///////////////////////////////// // // Plague / Epidemic Function // /////////////////////////////////// void_f Plague (int_t thePlayer){ int_t tmpPlayer; tmpPlayer = thePlayer; if(IsHumanPlayer(tmpPlayer)){ // put this line back in if you dont want to affect the AI message(1, 'testdata'); int_t CityCount; player[0] = tmpPlayer; CityCount = player[0].cities - 1; int_t PlaguedCityCounter; 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); // // Building that reduce plague chance are: // aqueduct, drug store, aqua-filter, hospital // // Start = 50/50 chance of plague in PlaguedCity // + aqueduct --> 40/60 chance // + drug store --> 30/70 chance // + hospital --> 20/80 chance // + aqua filter --> 10/90 chance // if(CityHasBuilding(PlaguedCity, BuildingDB(IMPROVE_AQUEDUCT))){ PPChance = PPChance - 10; } if(CityHasBuilding(PlaguedCity, BuildingDB(IMPROVE_DRUG_STORE))){ PPChance = PPChance - 10; } if(CityHasBuilding(PlaguedCity, BuildingDB(IMPROVE_HOSPITAL))){ PPChance = PPChance - 10; } if(CityHasBuilding(PlaguedCity, BuildingDB(IMPROVE_AQUA_FILTER))){ PPChance = PPChance - 10; } 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/2; int_t j; for(j = 0; j < tmpDead; j = j + 1){ Event:KillPop(PlaguedCity); } Event:AddHappyTimer(PlaguedCity, 3, -2, 14); // 3 turns of -2 happiness PlaguedCityCounter = PlaguedCityCounter + 1; } } player[0] = tmpPlayer; if(PlaguedCityCounter >= 1){ if(HasAdvance(tmpPlayer, ID_ADVANCE_MEDICINE)){ message(tmpPlayer, 'EpidemicHitYou'); if(tmpPlayer != human){ message(human, 'EpidemicHitOther'); } } else{ message(tmpPlayer, 'PlagueHitYou'); if(tmpPlayer != human){ message(human, 'PlagueHitOther'); } } } else{ message(tmpPlayer, 'PlagueDidntHitYou'); if(tmpPlayer != human){ message(human, 'PlagueDidntHitOther'); } } } // closing the IsHuman brackets } //----------------- // Plague messages //------------------- messagebox 'EpidemicHitYou' { Show(); Title(ID_EPIDEMIC); Text(ID_EPIDEMIC_YOU); //"An epidemic occurred in {PlaguedCityCounter} of your cities" } messagebox 'EpidemicHitOther' { Show(); Title(ID_EPIDEMIC); Text(ID_EPIDEMIC_OTHER); //"An epidemic occurred in {PlaguedCityCounter} of {player[0].name}'s cities" } messagebox 'PlagueHitYou' { Show(); Title(ID_PLAGUE_TITLE); Text(ID_PLAGUE_YOU); //"A plague struck in {PlaguedCityCounter} of your cities" } messagebox 'EpidemicHitOther' { Show(); Title(ID_PLAGUE_TITLE); Text(ID_PLAGUE_OTHER); //"A plague struck in {PlaguedCityCounter} of {player[0].name}'s cities" } messagebox 'PlagueDidntHitYou' { Show(); Title(ID_NO_PLAGUE); Text(ID_NO_PLAGUE_YOU); //"Medics across the empire averted a horrible medical catastrophe" } messagebox 'EpidemicDidntHitOther' { Show(); Title(ID_NO_PLAGUE); Text(ID_NO_PLAGUE_OTHER); //"Medics across the {player[0].name} empire averted a horrible medical catastrophe" } //--------------------- MESSAGE STRINGS ----------------- // //EPIDEMIC "EPIDEMIC!" //EPIDEMIC_YOU "An epidemic is sweeping the country, thousands are sick, in {PlaguedCityCounter} cities" //EPIDEMIC_OTHER "An epidemic occurred in {PlaguedCityCounter} of {player[0].name}'s cities" // //PLAGUE_TITLE "A plague has broken out!" //PLAGUE_YOU "A plague struck in {PlaguedCityCounter} of your cities" //PLAGUE_OTHER "A plague struck in {PlaguedCityCounter} of {player[0].name}'s cities" // //NO_PLAGUE "" //NO_PLAGUE_YOU "Quick-thinking medics across your empire averted a horrible medical catastrophe" //NO_PLAGUE_OTHER "Medics across the {tmpPlayer.name} empire averted a horrible medical catastrophe" // //---------------------------------------------------------- //============================= // DISASTER // HANDLER //================================ //----------------------------- // Disasters included are: // Plague, Earthquake, Volcano, Tsunami, //-------------------------------- HandleEvent(BeginTurn) 'EQ_RunEachTurn' post { int_t i; int_t j; int_t QuakeChance; int_t PlagueChance; city_t tmpCity; location_t nLoc; location_t mLoc; int_t tmpPlayer; tmpPlayer = player[0]; if(g.year >= 3){ // QuakeChance = random(19); PlagueChance = random(14); // DroughtChance = random(19); // VolcanoChance = random(19); // if(DroughtChance >= 16){ // Drought(player[0]); // } if(PlagueChance >= 1){ // change back to 12 or something Plague(tmpPlayer); } // if(PlagueChance >= 11 && DroughtCount >= 14){ // plague(player[0]); // } // if(QuakeChance >= 16){ // ditto to 16 // Quake_Event(); // message(1, 'startdata'); // } // if(VolcanoChance >= 1){ // VolcanoEvent(); // } // for(i = 1; i < NumPlayers; i = i + 1){ // EQ_Mess[i] = 0; // } } }