Fix bugs around the evolution of statistics
This commit is contained in:
parent
9c03091c9b
commit
70bce561ba
46
README.md
46
README.md
|
@ -2,8 +2,50 @@
|
|||
|
||||
## Presentation
|
||||
|
||||
This game is a redesign of [CalcCity](https://www.planet-casio.com/Fr/programmes/programme1062-1-calccity-v3-menno-jeux-add-ins.html), a management game like Sim's City.
|
||||
Ce jeu est une refonte de [CalcCity](https://www.planet-casio.com/Fr/programmes/programme1062-1-calccity-v3-menno-jeux-add-ins.html), un jeu de gestion inspiré de Sims' City.
|
||||
|
||||
## License
|
||||
|
||||
All rights reserved.
|
||||
Tout droits réservés.
|
||||
|
||||
## Contrôles
|
||||
|
||||
[REPLAY] : se déplacer
|
||||
[F1] et [F2] : menus de construction des bâtiments
|
||||
[F4] : taxes et subventions
|
||||
[F5] : statistiques
|
||||
[F6] : options diverse
|
||||
[+] et [-] : zoomer / dézoomer sur la carte
|
||||
[SHIFT] : valider
|
||||
[ALPHA] : revenir en arrière
|
||||
|
||||
### Construction
|
||||
|
||||
Vous serez amener à constuire une ville, pour cela selectionnez un des deux menus de construction puis le bâtiment qui vous intéresse via [REPLAY] puis [SHIFT]. Le cadre autour du curseur vous indique où le bâtiment va se positionner. Certains bâtiments agencés en carrés permettent de construire un bâtiment plus grand et plus efficace.
|
||||
|
||||
Vous pouvez détruire un bâtiment en "construisant" de la terre dessus.
|
||||
|
||||
### Taxes et subventions
|
||||
|
||||
Votre ville à besoin de son état ! Les pompiers, les services de santés et les policiers ont besoin de subventions pour fonctionner correctement. Baisser les subventions vous expose à un risque plus ou moins grand de catastrophe.
|
||||
|
||||
À l'inverse les taxes vous permettent de faire monter vos revenus annuels, attention, booster les taxes peut aussi décourager les investissements dans votre ville et ainsi conduire à une perte importante d'argent.
|
||||
|
||||
### Statistiques
|
||||
|
||||
Vous permet de consulter les statistiques de votre ville. Les stats sont classées par catégories.
|
||||
|
||||
### Options
|
||||
|
||||
Le jeu est muni de quelques options.
|
||||
- les animations : eau, warnings divers peuvent être (dé)activés
|
||||
- les catastrophes : marre de voir votre ville détruite par un tremblement de terre ou autre évènements ? Vous pouvez les enlever !
|
||||
- la vitesse du jeu : régule l'allure à laquelle le temps passe (mois / années dans le jeu)
|
||||
- quitter le jeu : sauvegarde et quitte
|
||||
- reprendre la partie : continue la partie
|
||||
|
||||
## Conseils divers
|
||||
|
||||
Vous ne pouvez pas perdre, d'abord parce qu'il n'y pas de but à proprement parler, ensuite parce que si vous arrivez à 0$ de trésorerie à la fin de l'année, votre caisse sera renflouée de 1000$. C'est peu mais suffisant pour détruire les bâtiments qui coûte le plus cher et ainsi repartir d'un bon pied.
|
||||
|
||||
Ne négligez rien. Et le plus important : enjoy~ !
|
||||
|
|
82
src/core.c
82
src/core.c
|
@ -112,47 +112,47 @@ void next_step(struct calccity *calccity, struct map *map)
|
|||
end_year(calccity);
|
||||
calccity->month = 1;
|
||||
calccity->year ++;
|
||||
}
|
||||
|
||||
if (calccity->disaster)
|
||||
{
|
||||
int random_event = rand() % 10000;
|
||||
// Firehazard
|
||||
if (calccity->stat[7] > 500 && random_event == 0)
|
||||
if (calccity->disaster)
|
||||
{
|
||||
display_message("UN INCENDIE A RAVAGE VOTRE VILLE.");
|
||||
disaster(calccity, map, calccity->stat[7]);
|
||||
update_stat(calccity, map);
|
||||
}
|
||||
|
||||
// Nuclear disaster
|
||||
if (calccity->stat[8] >= 1 && random_event == 1)
|
||||
{
|
||||
display_message("UN ACCIDENT NUCLEAIRE A RAVAGE VOTRE VILLE.");
|
||||
disaster(calccity, map, calccity->stat[8] * 100);
|
||||
update_stat(calccity, map);
|
||||
}
|
||||
|
||||
// Earthquake
|
||||
if (random_event == 2)
|
||||
{
|
||||
display_message("UN TREMBLEMENT DE TERRE A RAVAGE VOTRE VILLE.");
|
||||
disaster(calccity, map, rand() % 10);
|
||||
update_stat(calccity, map);
|
||||
}
|
||||
|
||||
// Treasure
|
||||
if (calccity->misc[0] > 1000 && random_event == 3)
|
||||
{
|
||||
if (rand() % 2)
|
||||
int random_event = rand() % 10000;
|
||||
// Firehazard
|
||||
if (calccity->stat[7] > 1000 && random_event == 0)
|
||||
{
|
||||
display_message("DES INVESTISSEMENT AUDACIEUX VOUS ONT RAPPORTES 1000$ !");
|
||||
calccity->misc[0] += 1000;
|
||||
display_message("UN INCENDIE A RAVAGE VOTRE VILLE.");
|
||||
disaster(calccity, map, calccity->stat[7]);
|
||||
update_stat(calccity, map);
|
||||
}
|
||||
else
|
||||
|
||||
// Nuclear disaster
|
||||
if (calccity->stat[8] >= 1 && random_event == 1)
|
||||
{
|
||||
display_message("DES INVESTISSEMENT FOIREUX VOUS ONT FAIT PERDRE 1000$.");
|
||||
calccity->misc[0] -= 1000;
|
||||
display_message("UN ACCIDENT NUCLEAIRE A RAVAGE VOTRE VILLE.");
|
||||
disaster(calccity, map, calccity->stat[8] * 100);
|
||||
update_stat(calccity, map);
|
||||
}
|
||||
|
||||
// Earthquake
|
||||
if (random_event == 2)
|
||||
{
|
||||
display_message("UN TREMBLEMENT DE TERRE A RAVAGE VOTRE VILLE.");
|
||||
disaster(calccity, map, rand() % 10);
|
||||
update_stat(calccity, map);
|
||||
}
|
||||
|
||||
// Treasure
|
||||
if (calccity->misc[0] > 1000 && random_event == 3)
|
||||
{
|
||||
if (rand() % 2)
|
||||
{
|
||||
display_message("DES INVESTISSEMENT AUDACIEUX VOUS ONT RAPPORTES 1000$ !");
|
||||
calccity->misc[0] += 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
display_message("DES INVESTISSEMENT FOIREUX VOUS ONT FAIT PERDRE 1000$.");
|
||||
calccity->misc[0] -= 1000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -488,22 +488,22 @@ void update_stat(struct calccity *calccity, struct map *map)
|
|||
|
||||
// FUNDS : health
|
||||
case 1:
|
||||
calccity->stat[i] += floor(building.stat[i] * (calccity->funds[3] / 100));
|
||||
calccity->stat[i] += floor(building.stat[i] * ((float)calccity->funds[3] / 100));
|
||||
break;
|
||||
|
||||
// FUNDS : crime
|
||||
case 6:
|
||||
calccity->stat[i] += floor(building.stat[i] * (calccity->funds[0] / 100));
|
||||
calccity->stat[i] += floor(building.stat[i] * ((float)calccity->funds[0] / 100));
|
||||
break;
|
||||
|
||||
// FUNDS : firehazard
|
||||
case 7:
|
||||
calccity->stat[i] += floor(building.stat[i] * (calccity->funds[1] / 100));
|
||||
calccity->stat[i] += floor(building.stat[i] * ((float)calccity->funds[1] / 100));
|
||||
break;
|
||||
|
||||
// FUNDS : education
|
||||
case 2:
|
||||
calccity->stat[i] += floor(building.stat[i] * (calccity->funds[2] / 100));
|
||||
calccity->stat[i] += floor(building.stat[i] * ((float)calccity->funds[2] / 100));
|
||||
break;
|
||||
|
||||
// special calculation of the annual cost
|
||||
|
@ -779,7 +779,7 @@ void disaster(struct calccity *calccity, struct map *map, const int destruction_
|
|||
{
|
||||
for (int x = 0; x < 50; x ++)
|
||||
{
|
||||
if (map->id[y][x] > 1 && rand() % destruction_rate <= destruction_rate / 4)
|
||||
if (map->id[y][x] > 1 && rand() % destruction_rate <= destruction_rate / 10)
|
||||
{
|
||||
map->id[y][x] = 0;
|
||||
map->data[y][x] = 125 + rand() % 2;
|
||||
|
|
|
@ -98,7 +98,7 @@ void display_around(struct calccity *calccity, struct camera *camera, const int
|
|||
|
||||
// Date in the top-left corner and treasure
|
||||
char up_data[25];
|
||||
sprintf(up_data, "%d-%d | %d$", calccity->month, calccity->year, calccity->misc[0]);
|
||||
sprintf(up_data, "%d-%d %d$", calccity->month, calccity->year, calccity->misc[0]);
|
||||
int width;
|
||||
dsize(up_data, NULL, &width, NULL);
|
||||
drect(4, 1, 5 + width, 6, C_WHITE);
|
||||
|
|
Loading…
Reference in New Issue