diff --git a/Plague.g1a b/Plague.g1a index 29520fe..48881a2 100644 Binary files a/Plague.g1a and b/Plague.g1a differ diff --git a/README.md b/README.md index fddbdf3..9b68803 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,3 @@ -# Plague inc - -## Présentation - -### Description du jeu - Plague inc est un jeu de stratégie où le but est de réduire l'humanité à néant… Simple ? Non ! Il vous faudra manipuler avec dextérité et prudence un virus pour anéantir des humains qui ne sont pas super collaboratifs… Pire, ces petits rigolos veulent sauver leurs peaux et recherchent activement un remède à ce mystérieux virus inconnu ! ### Licence @@ -12,39 +6,37 @@ La totalité du projet est soumise à la licence GNU General Public Licence v3.0 ## Contrôles -Lancez le jeu, et pressez n'importe quelle touche pour passer l'écran principal. Une fois sur l'écran représentant la Terre, plusieurs choix s'offrent à vous : +Lancez le jeu, et pressez n'importe quelle touche pour passer l'écran principal. Une fois sur l'écran représentant la Terre, plusieurs choix s'offrent à vous : - [OPTN] permet d'afficher / cacher la barre en dessous du monde qui vous affiche vos points ADN et la barre de recherche des humains. - - [VARS] permet de passer au gros du jeu : les mutations. Ce menu vous affiche vos points ADN, mais aussi les mutations sélectionnées ainsi que vos point de contagion, de sévérité, et de létalité. Dans ce menu, vous pouvez modifier tout cela. - - [x^2] permet d'accéder au menu statistique qui vous affiche les stats sur les humains. La barre symbolise le pourcentage de la popuation totale : donc la somme de toute les barre doit donné une seule barre entière. + - [VARS] permet de passer au gros du jeu : les mutations. Ce menu vous affiche vos points ADN, mais aussi les mutations sélectionnées ainsi que vos points de contagion, de sévérité, et de létalité. Dans ce menu, vous pouvez modifier tout cela. + - [x^2] permet d'accéder au menu statistique qui vous affiche les stats sur les humains. La barre symbolise le pourcentage de la population totale : donc la somme de toutes les barres doit donner une seule barre entière. -De manière générale, si vous êtes perdu, [EXIT] vous ramènera toujours sur la mappemonde, ou au menu précédent. +Dans les menus déplacez-vous grâce aux touches fléchées, validez avec [SHIFT] et annulez avec [ALPHA]. -Dans le menu des mutations, vous pouvez modifier vos caractéristiques via les touches F1 à F6 comme suit : - - [F1] sert à changer les symptômes de votre maladie - - [F3] sert à changer les capacités d'adaptation de votre maladie - - [F5] sert à modifier les moyens de transmission de votre maladie - - [F6] sert à revenir au menu principal avec la mappemonde +Pour quitter le jeu, allez sur la mappemonde et pressez [EXIT]. ## Mutations -Dans ce jeu, vous aurez le choix entre plusieurs mutations pour faire le plus de dégât possible parmis les humains ! Comme dans le jeu d'origine, celles-ci sont divisées en 3 catégories : Symptômes, Capacités, et Transmissions. +Dans ce jeu, vous aurez le choix entre plusieurs mutations pour faire le plus de dégât possible parmi les humains ! Comme dans le jeu d'origine, celles-ci sont divisées en 3 catégories : Symptômes, Capacités, et Transmissions. Toutes les mutations ont plusieurs spécificités : - Contagion qui détermine la proportion de personnes infectées - - Sévérité touche la recherche, on peut la comprendre de la manière suivante : si la sévérité est élevée, la maladie est grave, elle entraine par conséquent une recherche active de la part des Humains. - - Létalité détermine le taux de mortalité parmi les infectés… Une létalité élevée fera de votre maladie une veritable machine à tuer, mais cela vous dévoile au grand jour et accèlere la recherche ! + - Sévérité touche la recherche, on peut la comprendre de la manière suivante : si la sévérité est élevée, la maladie est grave, elle entraine par conséquent une recherche active de la part des Humains. La sévérité vous permet également de gagner des points ADN plus rapidement. + - Létalité détermine le taux de mortalité parmi les infectés… Une létalité élevée fera de votre maladie une véritable machine à tuer, mais cela vous dévoile au grand jour et accélère la recherche ! - le coût en points ADN. Dans le menu de mutation vous avez les statistiques de la mutation sélectionnée. Et entre parenthèses vous avez les modifications effectives. Le nombre entre parenthèses vous indique donc le nombre de points de contagion, sévérité, létalité, vous allez gagner (ou perdre si le nombre est négatif) si vous faites muter votre maladie. + ### Symptômes de la maladie Comme son nom l'indique, votre maladie aussi puissante soit-elle n'est pas invisible : elle présente certains symptômes qui ont leurs spécificités. Bien entendu, les symptômes présentés dans ce jeu font partie du jeu d'origine et leurs spécificités en sont proches. ### Capacités spéciales -En mutant, votre maladie peut acquérir des capacités. Ces capacités lui permettent de mieux apréhender un milieu ou une situation, ainsi la capacité *Résistance au froid* donne un suplément de vigueur à votre virus dans les pays froid. Cela se traduit par une augmentation plus ou moins forte de la contagion dans ces régions du monde… +En mutant, votre maladie peut acquérir des capacités. Ces capacités lui permettent de mieux appréhender un milieu ou une situation, ainsi la capacité *Résistance au froid* donne un supplément de vigueur à votre virus dans les pays froids. Cela se traduit par une augmentation plus ou moins forte de la contagion dans ces régions du monde… ### Moyens de transmissions -Votre maladie aura tout le loisir de changer ses moyens de transmission ! Plus ou moins efficaces ceux-ci permettent à votre maladie d'accéder à des caractérestiques intéressantes qui lui permettront de coloniser le monde entier ! \ No newline at end of file +Votre maladie aura tout le loisir de changer ses moyens de transmission ! Plus ou moins efficaces ceux-ci permettent à votre maladie d'accéder à des caractéristiques intéressantes qui lui permettront de coloniser le monde entier ! + diff --git a/assets-fx/bground.png b/assets-fx/bground.png index 16eac62..fa6f7c3 100644 Binary files a/assets-fx/bground.png and b/assets-fx/bground.png differ diff --git a/src/core.c b/src/core.c index a476971..a9bb46b 100644 --- a/src/core.c +++ b/src/core.c @@ -30,6 +30,9 @@ void next_frame(struct game *current_game) } if (current_game->planes[i]->x == current_game->planes[i]->dest_x && current_game->planes[i]->y == current_game->planes[i]->dest_y) { + // Infect the airport + if (current_game->planes[i]->is_infected) current_game->grid.data[current_game->planes[i]->x + current_game->planes[i]->y * current_game->grid.width] = 1; + // Set the new destination current_game->planes[i]->dest_x = current_game->planes[i]->depa_x; current_game->planes[i]->dest_y = current_game->planes[i]->depa_y; @@ -42,6 +45,11 @@ void next_frame(struct game *current_game) int new_dir = (current_game->planes[i]->direction + 2) % 4; if (!new_dir) new_dir = 4; current_game->planes[i]->direction = new_dir; + + // Infect the plane + if (current_game->grid.data[current_game->planes[i]->x + current_game->planes[i]->y * current_game->grid.width] == 1 && current_game->mutations_selected[2] == 4) current_game->planes[i]->is_infected = 1; + + } } @@ -54,7 +62,8 @@ void next_frame(struct game *current_game) current_game->time = 0; // Update the game - if (current_game->dna <= 100) current_game->dna += 1 + floor(current_game->severity / 25); + current_game->dna = current_game->dna + 1 + floor(current_game->severity / 25); + if (current_game->dna > 30) current_game->dna = 30; if (current_game->research < current_game->limit) current_game->research += current_game->priority; epidemic_simulation(current_game); @@ -87,42 +96,40 @@ int get_inputs(const int background, int *mutation_menu) int key = rtc_key(); if (key == KEY_OPTN && (background == 1 || background == 2)) return (background % 2) + 1; - if (key == KEY_VARS) return 3; + if (key == KEY_VARS) + { + *mutation_menu = 1; + return 3; + } if (key == KEY_SQUARE) return 6; - if (key == KEY_EXIT) + if (key == KEY_ALPHA) { if (background == 5) return 3; if (background != 1 && background != 2) return 1; - if (background == 1 || background == 2) return -1; } + if (key == KEY_EXIT && (background == 1 || background == 2)) return -1; if (background == 3) { switch (key) { // Symptoms - case KEY_F1: - *mutation_menu = 1; - return 5; + case KEY_LEFT: + *mutation_menu = *mutation_menu - 1; + if (*mutation_menu <= 0) *mutation_menu = 4; break; // Abilities - case KEY_F3: - *mutation_menu = 2; - return 5; + case KEY_RIGHT: + *mutation_menu = *mutation_menu + 1; + if (*mutation_menu >= 5) *mutation_menu = 1; break; - // Transmission - case KEY_F5: - *mutation_menu = 3; - return 5; - break; - - // Return to the main menu - case KEY_F6: - *mutation_menu = 0; - return 1; + // Validation + case KEY_SHIFT: + if (*mutation_menu == 4) return 1; + else return 5; break; } } @@ -133,7 +140,7 @@ int get_inputs(const int background, int *mutation_menu) int rtc_key(void) { - int opt = GETKEY_DEFAULT & ~GETKEY_REP_ARROWS; + int opt = GETKEY_DEFAULT & ~GETKEY_MOD_SHIFT & ~GETKEY_MOD_ALPHA & ~GETKEY_REP_ARROWS; int timeout = 1; key_event_t ev = getkey_opt(opt, &timeout); diff --git a/src/core.h b/src/core.h index cd9427a..704bf20 100644 --- a/src/core.h +++ b/src/core.h @@ -40,7 +40,8 @@ struct game int mutations_bought[3][14]; // Research data - int research, limit, priority; + int research, limit; + float priority; // Humans stats : healthy, infected, dead, healed int humans[4]; @@ -70,6 +71,8 @@ struct plane // Coordinates of the plane's departure int depa_x, depa_y; + int is_infected; + }; //cursor : cursor information for mutations selection diff --git a/src/data.c b/src/data.c index 2aad3a3..4854748 100644 --- a/src/data.c +++ b/src/data.c @@ -4,20 +4,20 @@ // (contation, severity, lethality, DNA cost, change to cure requirement) const struct mutation symptoms_data[14] = { - {10, 10, 0, 2, 0, "NAUSEE"}, - {25, 10, 0, 10, 0, "VOMISSEMENT"}, - {20, 10, 0, 3, 0, "TOUX"}, - {15, 20, 0, 10, 0, "PNEUMONIE"}, - {10, 30, 20, 15, 25, "TUMEUR"}, - {25, 10, 0, 4, 0, "PLAIES"}, - {10, 10, 0, 10, 0, "LESIONS"}, - {30, 20, 20, 20, 30, "HEMORRAGIE"}, - {25, 15, 10, 17, 0, "INFECTION"}, - {25, 10, 20, 20, 0, "INFLAMMATION"}, - {10, 15, 20, 15, 0, "IMMUNITE"}, - { 0, 20, 0, 15, 120, "PARANOIA"}, - { 0, 15, 0, 20, 100, "FOLIE"}, - { 0, 30, 30, 30, 250, "ARRET TOTAL"}, + {10, 10, 0, 2, 0, "NAUSEE"}, + {15, 10, 0, 10, 0, "VOMISSEMENT"}, + {10, 5, 0, 3, 0, "TOUX"}, + {15, 20, 0, 10, 0, "PNEUMONIE"}, + {10, 30, 20, 15, 10, "TUMEUR"}, + {15, 10, 5, 4, 0, "PLAIES"}, + {10, 10, 10, 10, 0, "LESIONS"}, + {30, 20, 20, 20, 5, "HEMORRAGIE"}, + {25, 15, 10, 17, 0, "INFECTION"}, + {15, 10, 5, 5, 0, "INFLAMMATION"}, + {10, 15, 20, 15, 0, "IMMUNITE"}, + { 0, 20, 0, 15, 10, "PARANOIA"}, + { 0, 15, 15, 20, 10, "FOLIE"}, + { 0, 30, 30, 30, 20, "ARRET TOTAL"}, }; @@ -25,28 +25,28 @@ const struct mutation abilities_data[6] = { {15, 0, 0, 10, 0, "FROID"}, {15, 0, 0, 15, 0, "CHAUD"}, - { 0, 10, 4, 25, 20, "GENETIQUE"}, - {10, 40, 20, 30, 50, "MUTATION+"}, - {30, 0, 0, 30, 0, "ENVIRON"}, - { 0, 15, 30, 15, 30, "MEDICAMENT"}, + { 0, 10, 4, 25, 10, "GENETIQUE"}, + {10, 40, 20, 30, 20, "MUTATION+"}, + {30, 10, 0, 30, 0, "ENVIRON"}, + { 0, 15, 30, 15, 20, "MEDICAMENT"}, }; const struct mutation transmissions_data[13] = { - {5, 0, 0, 9, 0, "AIR 1"}, - {10, 0, 0, 15, 0, "AIR 2"}, - {20, 0, 0, 20, 0, "AIR 3"}, - {40, 0, 0, 30, 0, "AEROSOL"}, - {10, 0, 0, 9, 0, "EAU 1"}, - {20, 0, 0, 12, 0, "EAU 2"}, - {20, 0, 0, 10, 0, "ANIMAL 1"}, - {40, 0, 0, 16, 0, "ANIMAL 2"}, - {20, 0, 0, 12, 0, "OISEAU 1"}, - {40, 0, 0, 16, 0, "OISEAU 2"}, - {10, 0, 0, 8, 0, "SANG 1"}, - {20, 0, 0, 14, 0, "SANG 2"}, - {40, 0, 0, 20, 0, "SANG 3"}, + { 5, 0, 0, 9, 0, "AIR 1"}, + {10, 10, 0, 15, 0, "AIR 2"}, + {20, 10, 0, 20, 0, "AIR 3"}, + {40, 15, 0, 30, 0, "AEROSOL"}, + {10, 0, 0, 9, 0, "EAU 1"}, + {20, 10, 0, 12, 0, "EAU 2"}, + {20, 0, 0, 10, 0, "ANIMAL 1"}, + {40, 10, 0, 16, 0, "ANIMAL 2"}, + {20, 0, 0, 12, 0, "OISEAU 1"}, + {40, 10, 0, 16, 0, "OISEAU 2"}, + {10, 0, 0, 8, 0, "SANG 1"}, + {20, 10, 0, 14, 0, "SANG 2"}, + {40, 15, 0, 20, 0, "SANG 3"}, }; diff --git a/src/display_engine.c b/src/display_engine.c index 6459bf5..7d89692 100644 --- a/src/display_engine.c +++ b/src/display_engine.c @@ -12,7 +12,7 @@ void display_background(const int background) } -void display_foreground(const int background, const struct game *current_game) +void display_foreground(const int background, const struct game *current_game, const int mutation_menu) { extern const bopti_image_t img_mutations; extern const bopti_image_t img_planes; @@ -29,7 +29,7 @@ void display_foreground(const int background, const struct game *current_game) { for (int j = 0; j < current_game->grid.height; j ++) { - if (current_game->grid.data[i + j * current_game->grid.width] == 1 && world[j][i] != 0) dpixel(i, j, C_BLACK); + if ((current_game->grid.data[i + j * current_game->grid.width] == 1 || current_game->grid.data[i + j * current_game->grid.width] == 3) && world[j][i] != 0) dpixel(i, j, C_BLACK); } } @@ -47,7 +47,7 @@ void display_foreground(const int background, const struct game *current_game) { for (int j = 0; j < 48; j ++) { - if (current_game->grid.data[i + j * current_game->grid.width] == 1 && world[j][i] != 0) dpixel(i, j, C_BLACK); + if ((current_game->grid.data[i + j * current_game->grid.width] == 1 || current_game->grid.data[i + j * current_game->grid.width] == 3) && world[j][i] != 0) dpixel(i, j, C_BLACK); } } @@ -66,6 +66,8 @@ void display_foreground(const int background, const struct game *current_game) break; case 3: + drect(mutation_menu + 31 * (mutation_menu - 1), 0, mutation_menu + 31 * (mutation_menu), 7, C_INVERT); + dprint(102, 37, C_BLACK, "%d", current_game->dna); length = 67 * current_game->contagion / 100; @@ -80,9 +82,9 @@ void display_foreground(const int background, const struct game *current_game) dline(57, 60, 57 + length, 60, C_BLACK); dline(57, 61, 57 + length, 61, C_BLACK); - if (current_game->mutations_selected[0]) dsubimage(5, 15, &img_mutations, 0, 16 * (current_game->mutations_selected[0] - 1), 15, 15, 0); - if (current_game->mutations_selected[1]) dsubimage(35, 15, &img_mutations, 16, 16 * (current_game->mutations_selected[1] - 1), 15, 15, 0); - if (current_game->mutations_selected[2]) dsubimage(65, 15, &img_mutations, 32, 16 * (current_game->mutations_selected[2] - 1), 15, 15, 0); + if (current_game->mutations_selected[0]) dsubimage(7, 15, &img_mutations, 0, 16 * (current_game->mutations_selected[0] - 1), 15, 15, 0); + if (current_game->mutations_selected[1]) dsubimage(37, 15, &img_mutations, 16, 16 * (current_game->mutations_selected[1] - 1), 15, 15, 0); + if (current_game->mutations_selected[2]) dsubimage(67, 15, &img_mutations, 32, 16 * (current_game->mutations_selected[2] - 1), 15, 15, 0); break; case 6: diff --git a/src/display_engine.h b/src/display_engine.h index 916e4f8..20290cc 100644 --- a/src/display_engine.h +++ b/src/display_engine.h @@ -7,7 +7,7 @@ void display_background(const int background); // display_foreground : display the foreground, planes, statistics -void display_foreground(const int background, const struct game *current_game); +void display_foreground(const int background, const struct game *current_game, const int mutation_menu); // display_mutation : display the mutation selection screen void display_mutation(const int table[4][8], const struct cursor c, const int mutation_menu); diff --git a/src/epidemic_engine.c b/src/epidemic_engine.c index 3a2ffce..b504ed3 100644 --- a/src/epidemic_engine.c +++ b/src/epidemic_engine.c @@ -15,7 +15,7 @@ bool can_become_infected(const struct grid epidemic_grid, const int mutations_se extern const uint8_t world[64][128]; // In case of water, low or high temperature - if (world[j][i] == 0 && mutations_selected[2] != 3) return false; + if (world[j][i] == 0 && mutations_selected[2] != 3 && mutations_selected[2] != 4 && mutations_selected[2] != 6) return false; if (world[j][i] == 1 && mutations_selected[1] != 1 && mutations_selected[1] != 5) return false; if (world[j][i] == 3 && mutations_selected[1] != 2 && mutations_selected[1] != 5) return false; diff --git a/src/main.c b/src/main.c index a3d81e0..307b01a 100644 --- a/src/main.c +++ b/src/main.c @@ -1,6 +1,6 @@ /* Project name ......: Plague - Version ...........: 1.1 + Version ...........: 1.2 Last modification .: 4 June 2021 code and assets provided with licence : @@ -35,11 +35,11 @@ int main(void) title_screen(); // Game statistics - struct plane plane_1 = {22, 20, 2, 84, 20, 22, 20}; - struct plane plane_2 = {34, 20, 3, 34, 44, 34, 20}; - struct plane plane_3 = {68, 44, 1, 68, 20, 68, 44}; - struct plane plane_4 = {104, 20, 3, 104, 50, 104, 20}; - struct plane plane_5 = {68, 44, 4, 34, 44, 68, 44}; + struct plane plane_1 = {22, 20, 2, 84, 20, 22, 20, 0}; + struct plane plane_2 = {34, 20, 3, 34, 44, 34, 20, 0}; + struct plane plane_3 = {68, 44, 1, 68, 20, 68, 44, 0}; + struct plane plane_4 = {104, 20, 3, 104, 50, 104, 20, 0}; + struct plane plane_5 = {68, 44, 4, 34, 44, 68, 44, 0}; struct game current_game = @@ -146,7 +146,7 @@ void main_loop(struct game *current_game) // Update the screen dclear(C_WHITE); display_background(background); - display_foreground(background, current_game); + display_foreground(background, current_game, mutation_menu); dupdate(); // Compute the motion of planes, DNA points and infectious model diff --git a/src/mutation_engine.c b/src/mutation_engine.c index 1fa3c1d..658c14f 100644 --- a/src/mutation_engine.c +++ b/src/mutation_engine.c @@ -74,16 +74,16 @@ void mutation_select(struct game *current_game, const int mutation_menu) key = rtc_key(); // Manage input - if (key == KEY_EXIT) end = 1; - if (key == KEY_EXE && table[c.y][c.x] != 15 && table[c.y][c.x] != 0) + if (key == KEY_ALPHA) end = 1; + if (key == KEY_SHIFT && table[c.y][c.x] != 15 && table[c.y][c.x] != 0) { end = mutation_buy(current_game, c, mutation_menu, table); } - if (key == KEY_LEFT && c.x > 0) c.x --; - if (key == KEY_RIGHT && c.x < 7) c.x ++; - if (key == KEY_UP && c.y > 0) c.y --; - if (key == KEY_DOWN && c.y < 3) c.y ++; + if (key == KEY_LEFT && c.x > 0) c.x = (c.x - 1) % 8; + if (key == KEY_RIGHT && c.x < 7) c.x = (c.x + 1) % 8; + if (key == KEY_UP && c.y > 0) c.y = (c.y - 1) % 4; + if (key == KEY_DOWN && c.y < 3) c.y = (c.y + 1) % 4; } if (t >= 0) timer_stop(t); } @@ -99,11 +99,14 @@ int mutation_buy(struct game *current_game, const struct cursor c, const int mut while (1) { display_mutation_buy(c, mutation_menu, table, button_selected, current_game); - key = getkey().key; + + int opt = GETKEY_DEFAULT & ~GETKEY_MOD_SHIFT & ~GETKEY_MOD_ALPHA & ~GETKEY_REP_ARROWS; + key_event_t ev = getkey_opt(opt, NULL); + key = ev.key; if (key == KEY_DOWN || key == KEY_UP) button_selected = (button_selected + 1) % 2; - if (key == KEY_EXIT) return 1; - if (key == KEY_EXE) + if (key == KEY_ALPHA) return 1; + if (key == KEY_SHIFT) { if (!button_selected) return 0; else @@ -122,6 +125,7 @@ int mutation_buy(struct game *current_game, const struct cursor c, const int mut // Update update_disease(current_game); + current_game->priority += ceil((mutation_data->severity + mutation_data->lethality)/10); const char *msg[5] = {"mutation", "achetee", "", "", ""}; message(msg); } @@ -138,7 +142,7 @@ int mutation_buy(struct game *current_game, const struct cursor c, const int mut } } - return 1; + return 0; } } return 0; @@ -158,7 +162,6 @@ void update_disease(struct game *current_game) // research parameters current_game->limit = RESEARCH_LIMIT + symptom->changement + ability->changement + transmission->changement; - current_game->priority = floor((current_game->severity + current_game->lethality) / 40); }