diff --git a/Plague.g1a b/Plague.g1a index 48881a2..ea62317 100644 Binary files a/Plague.g1a and b/Plague.g1a differ diff --git a/README.md b/README.md index 9b68803..09ff5d9 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,22 @@ +# Plague + +## Généralités + +### Présentation + 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 ! +Vous commencez la partie en Asie Centrale. + ### Licence La totalité du projet est soumise à la licence GNU General Public Licence v3.0. +### To do list + + - Ajouter *in-game* des information sur chaque mutation + - Corriger le calcul avec les statistiques des humains + ## 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 : @@ -38,5 +51,4 @@ En mutant, votre maladie peut acquérir des capacités. Ces capacités lui perme ### 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éristiques intéressantes qui lui permettront de coloniser le monde entier ! - +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 ! \ No newline at end of file diff --git a/assets-fx/bground.png b/assets-fx/bground.png index fa6f7c3..83b496d 100644 Binary files a/assets-fx/bground.png and b/assets-fx/bground.png differ diff --git a/old assets/convert_world.py b/old assets/convert_world.py index 094f5d1..2764dfe 100644 --- a/old assets/convert_world.py +++ b/old assets/convert_world.py @@ -14,12 +14,11 @@ def show(): img = Image.open("world.png") data = np.array(img) - rslt = "" + count = 0 for index, line in enumerate(data): for pxl in line: - rslt += f"{analyse(index, pxl)}" - rslt += "\n" - print(rslt) + if analyse(index, pxl) == 0: count += 1 + print(count) def get_tabular(): @@ -35,5 +34,4 @@ def get_tabular(): rslt += "\n};" print(rslt) - -get_tabular() +show() diff --git a/src/core.c b/src/core.c index a9bb46b..8c0a73e 100644 --- a/src/core.c +++ b/src/core.c @@ -48,8 +48,6 @@ void next_frame(struct game *current_game) // 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; - - } } @@ -64,16 +62,12 @@ void next_frame(struct game *current_game) // Update the game 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; + current_game->research += current_game->priority; + if (current_game->research > current_game->limit) current_game->research = current_game->limit; + epidemic_simulation(current_game); // Check the end of the game - if (current_game->research >= current_game->limit) - { - const char *msg[5] = {"Vous avez", "perdu.", "", "", ""}; - message(msg); - current_game->research = 0; - } if (!current_game->humans[1]) { if (current_game->humans[0] != 0) diff --git a/src/core.h b/src/core.h index 704bf20..9332e3d 100644 --- a/src/core.h +++ b/src/core.h @@ -3,8 +3,6 @@ #include - - // Duration for internal clock (ms) #define ENGINE_TICK 50 #define CURSOR_TICK 150 @@ -16,6 +14,9 @@ // Number of planes on screen #define NB_PLANES 5 +// Number of non-infectable cases +#define BLANK_CASES 5382 + struct grid { // 64, 128 diff --git a/src/display_engine.c b/src/display_engine.c index 7d89692..6cc5fd6 100644 --- a/src/display_engine.c +++ b/src/display_engine.c @@ -90,7 +90,7 @@ void display_foreground(const int background, const struct game *current_game, c case 6: for (int i = 0; i < 4; i ++) { - length = 63 * current_game->humans[i] / (current_game->grid.width * current_game->grid.height); + length = 63 * current_game->humans[i] / ((current_game->grid.width * current_game->grid.height) - BLANK_CASES); dline(61, i*8 + 31, 61 + length, i*8 + 31, C_BLACK); dline(61, i*8 + 32, 61 + length, i*8 + 32, C_BLACK); } diff --git a/src/epidemic_engine.c b/src/epidemic_engine.c index b504ed3..26f8ad4 100644 --- a/src/epidemic_engine.c +++ b/src/epidemic_engine.c @@ -32,6 +32,8 @@ bool bernoulli(const int p) void epidemic_simulation(struct game *current_game) { + extern const uint8_t world[64][128]; + srand(current_game->total_time); // Create a copy of the epidemic grid @@ -54,8 +56,11 @@ void epidemic_simulation(struct game *current_game) if (can_become_infected(current_game->grid, current_game->mutations_selected, i, j) && bernoulli(current_game->contagion)) { current_grid[i + j * current_game->grid.width] = 1; - current_game->humans[0] --; - current_game->humans[1] ++; + if (world[j][i]) + { + current_game->humans[0] --; + current_game->humans[1] ++; + } } break; @@ -66,16 +71,22 @@ void epidemic_simulation(struct game *current_game) if (bernoulli(healed_rate)) { current_grid[i + j * current_game->grid.width] = 2; - current_game->humans[1] --; - current_game->humans[2] ++; + if (world[j][i]) + { + current_game->humans[1] --; + current_game->humans[2] ++; + } } // Become dead else if (bernoulli(current_game->lethality)) { current_grid[i + j * current_game->grid.width] = 3; - current_game->humans[1] --; - current_game->humans[3] ++; + if (world[j][i]) + { + current_game->humans[1] --; + current_game->humans[3] ++; + } } break; } diff --git a/src/main.c b/src/main.c index 307b01a..8adeb4b 100644 --- a/src/main.c +++ b/src/main.c @@ -1,6 +1,6 @@ /* Project name ......: Plague - Version ...........: 1.2 + Version ...........: 1.2.1 Last modification .: 4 June 2021 code and assets provided with licence : @@ -70,7 +70,7 @@ int main(void) current_game.grid.data = calloc(current_game.grid.width * current_game.grid.height, sizeof(uint8_t)); current_game.grid.data[95 + 20 * current_game.grid.width] = 1; - current_game.humans[0] = (current_game.grid.width * current_game.grid.height) - 1; + current_game.humans[0] = (current_game.grid.width * current_game.grid.height) - 1 - BLANK_CASES; read_save(¤t_game); @@ -130,7 +130,7 @@ static void title_screen(void) void main_loop(struct game *current_game) { - int background = 1, mutation_menu = 0; + int background = 1, mutation_menu = 4; int end = 0; static volatile int tick = 1; diff --git a/src/mutation_engine.c b/src/mutation_engine.c index 658c14f..d8eecf7 100644 --- a/src/mutation_engine.c +++ b/src/mutation_engine.c @@ -80,10 +80,13 @@ void mutation_select(struct game *current_game, const int mutation_menu) end = mutation_buy(current_game, c, mutation_menu, table); } - 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 (key == KEY_LEFT) c.x = c.x - 1; + if (key == KEY_RIGHT) c.x = (c.x + 1) % 8; + if (key == KEY_UP) c.y = c.y - 1; + if (key == KEY_DOWN) c.y = (c.y + 1) % 4; + + if (c.x < 0) c.x = 7; + if (c.y < 0) c.y = 3; } if (t >= 0) timer_stop(t); } @@ -125,7 +128,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); + current_game->priority += ceil((mutation_data->severity + mutation_data->lethality)/8); const char *msg[5] = {"mutation", "achetee", "", "", ""}; message(msg); } @@ -160,8 +163,10 @@ void update_disease(struct game *current_game) current_game->severity = symptom->severity + ability->severity + transmission->severity; current_game->lethality = symptom->lethality + ability->lethality + transmission->lethality; - // research parameters + // research parameter current_game->limit = RESEARCH_LIMIT + symptom->changement + ability->changement + transmission->changement; + if (current_game->research > current_game->limit) current_game->research = current_game->limit; + } diff --git a/src/mutation_engine.h b/src/mutation_engine.h index b8d22d1..f41a68b 100644 --- a/src/mutation_engine.h +++ b/src/mutation_engine.h @@ -5,7 +5,7 @@ #include "display_engine.h" // Basic limit research -#define RESEARCH_LIMIT 100 +#define RESEARCH_LIMIT 200 // mutation_table : contain the map of the mutation available struct mutation_table