 |
|  |
 |
|
Pedrunn
|
 |
of Natal, Brazil
Jul 2001 time: 02:16
|
|
The IW plague function uses.
code:
void_f Plague (int_t thePlayer){
int_t tmpPlayer;
tmpPlayer = thePlayer;
//if(IsHumanPlayer(tmpPlayer)){ // take this line out in if you do want to affect the AI
//message(1, 'startdata');
int_t CityCount;
player[0] = tmpPlayer;
CityCount = player[0].cities - 1;
PlaguedCityCounter = 0;
int_t i;
for(i = 0; i < CityCount; i = i + 1){
//message(1, 'testdata');
int_t PPChance;
PPChance = random(100);
city_t PlaguedCity;
GetCityByIndex(tmpPlayer, i, PlaguedCity);
if(PlaguedCity.population >= 5){
//
// Building that reduce plague chance are:
// Granary, Aqueduct, Food Silo, Sewer System, hospital
//
// Start = 50/50 chance of plague in PlaguedCity
//
if(CityHasBuilding(PlaguedCity, "IMPROVE_GRANARY")){
PPChance = PPChance - 5;
}
if(CityHasBuilding(PlaguedCity, "IMPROVE_AQUEDUCT")){
PPChance = PPChance - 5;
}
if(CityHasBuilding(PlaguedCity, "IMPROVE_FOOD_SILO")){
PPChance = PPChance - 5;
}
if(CityHasBuilding(PlaguedCity, "IMPROVE_DRUG_STORE")){
PPChance = PPChance - 5;
}
if(CityHasBuilding(PlaguedCity, "IMPROVE_HOSPITAL")){
PPChance = PPChance - 20;
}
if(PPChance >= 40){ // replace to 50 again for a base 50/50 chance of strike
city[0] = PlaguedCity;
int_t tmpDead;
tmpDead = city[0].population/5;
int_t j;
for(j = 0; j < tmpDead; j = j + 1){
Event:KillPop(PlaguedCity);
}
Event:AddHappyTimer(PlaguedCity, 1, -4, 14); // 3 turns of -6 happiness
AddEffect(PlaguedCity.location, "SPECEFFECT_BIO_TERROR", "SOUND_ID_BIO_TERROR");
PlaguedCityCounter = PlaguedCityCounter + 1;
}
}
}
player[0] = tmpPlayer;
if(PlaguedCityCounter >= 1){
if(HasAdvance(tmpPlayer, ID_ADVANCE_MEDICINE)){
message(tmpPlayer, 'EpidemicYou');
if(tmpPlayer != ND_human){
message(ND_human, 'EpidemicOther');
}
}
else{
message(tmpPlayer, 'PlagueHitYou');
}
}
else{
message(tmpPlayer, 'PlagueDidntHitYou');
}
// } // closing the IsHuman brackets
}
|
|
|  |
All times are GMT. The time now is 05:16. Apolyton Time is 00:16. |
top of page
|
| archivepost |
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|