home *** CD-ROM | disk | FTP | other *** search
- //Mark Sobota
- //Mike Engle
- //economic.bhs
- //boom script
- //general boom, good for - Aztec, Inca, Mongols, Romans, Russians, Spanish
-
-
- labels {
- BLOCK_ON_THIS = 1,
- DONT_BLOCK_ON_THIS,
- SCRIPT_DONE,
- }
-
- include "aibestbuildlibrary.bhs"
-
- int ai economic (int who, ref int step, int boom_vs_rush, int num_loops)
- {
- if ((num_cities(who) < 1)&&(num_type_with_queued(who, "Citizen") < 1)) return SCRIPT_DONE;
-
- my_capital = find_city_with_num(who, 1);
-
- if (was_city_attacked(who, "", -1)||was_city_raided(who, "", -1)) {
- if ((num_type_with_queued(who, "Barracks") < 1)&&(have_tech(who, "The Art of War"))) {
- if (place_building_with_cost(who, "Barracks", my_capital) > 0) return SCRIPT_DONE;
- else return BLOCK_ON_THIS;
- }
- else return SCRIPT_DONE;
- }
-
- int return_value = BLOCK_ON_THIS;
- static int prev_step0 = 0;
- static int prev_step1 = 0;
- static int prev_step2 = 0;
- static int prev_step3 = 0;
- static int prev_step4 = 0;
- static int prev_step5 = 0;
- static int prev_step6 = 0;
- static int prev_step7 = 0;
- static int needed_citizens0 = 0;
- static int needed_citizens1 = 0;
- static int needed_citizens2 = 0;
- static int needed_citizens3 = 0;
- static int needed_citizens4 = 0;
- static int needed_citizens5 = 0;
- static int needed_citizens6 = 0;
- static int needed_citizens7 = 0;
- static int timer_started0 = 0;
- static int timer_started1 = 0;
- static int timer_started2 = 0;
- static int timer_started3 = 0;
- static int timer_started4 = 0;
- static int timer_started5 = 0;
- static int timer_started6 = 0;
- static int timer_started7 = 0;
- static int fishermen_total0 = 0;
- static int fishermen_total1 = 0;
- static int fishermen_total2 = 0;
- static int fishermen_total3 = 0;
- static int fishermen_total4 = 0;
- static int fishermen_total5 = 0;
- static int fishermen_total6 = 0;
- static int fishermen_total7 = 0;
- int old_step;
- who_nation = find_nation(who); //get player nation
- static int needed_techs = get_techs_per_age(who);
- int player_age = age(who);
- static int wood_camp = 0;
- static int wood_camp_1 = 0;
- static int max_woodcutters = 0;
- int needed_citizens = 0;
- static int build_merchant = 0;
- int timer_started = 0;
- int j = 0;
- int merchant_build_true = 1;
- int scholar_build_true = 1;
- int build_true = 1;
- int new_city = 0;
- int citizen_id = 0;
- int caravan_lim = num_cities(who) * (num_cities(who) - 1) / 2;
- int fishermen_cap = 4;
- int fishermen_total = 0;
- int large_conquest_start = 0;
-
- int sea_map = 0;
-
- ///ghetto array///
- switch (who-1) {
- case 0:
- old_step = prev_step0;
- needed_citizens = needed_citizens0;
- timer_started = timer_started0;
- fishermen_total = fishermen_total0;
- break;
- case 1:
- old_step = prev_step1;
- needed_citizens = needed_citizens1;
- timer_started = timer_started1;
- fishermen_total = fishermen_total1;
- break;
- case 2:
- old_step = prev_step2;
- needed_citizens = needed_citizens2;
- timer_started = timer_started2;
- fishermen_total = fishermen_total2;
- break;
- case 3:
- old_step = prev_step3;
- needed_citizens = needed_citizens3;
- timer_started = timer_started3;
- fishermen_total = fishermen_total3;
- break;
- case 4:
- old_step = prev_step4;
- needed_citizens = needed_citizens4;
- timer_started = timer_started4;
- fishermen_total = fishermen_total4;
- break;
- case 5:
- old_step = prev_step5;
- needed_citizens = needed_citizens5;
- timer_started = timer_started5;
- fishermen_total = fishermen_total5;
- break;
- case 6:
- old_step = prev_step6;
- needed_citizens = needed_citizens6;
- timer_started = timer_started6;
- fishermen_total = fishermen_total6;
- break;
- case 7:
- old_step = prev_step7;
- needed_citizens = needed_citizens7;
- timer_started = timer_started7;
- fishermen_total = fishermen_total7;
- break;
- default:
- old_step = 0;
- needed_citizens = 0;
- break;
- }
-
- ////water mapstyles at the moment: Atlantic Sea Power, Nile Delta, British Isles, Warring States, New World, East Indies
- //// Colonial Powers, Mediterranean
- ////Great Lakes?, African Watering Hole?, East Meets West?, Australian Outback?
- if ((get_mapstyle() == "Atlantic Sea Power")||(get_mapstyle() == "Nile Delta")||(get_mapstyle() == "British Isles")||(get_mapstyle() == "Warring States")||(get_mapstyle() == "New World")||(get_mapstyle() == "East Indies")) {
- sea_map = 1;
- }
- else if ((get_mapstyle() == "Colonial Powers")||(get_mapstyle() == "Mediterranean")) {
- sea_map = 1;
- }
- else sea_map = 0;
-
- my_second_city = find_city_with_num(who, 2);
- my_third_city = find_city_with_num(who, 3);
-
- if (is_conquest_scenario()) {
- size = get_starting_town_size(who);
- if (step == 1) {
- if (size == 0) step = 1; //nomad
- else if (size == 1) step = 2;
- else if (size == 2) {
- if (sea_map > 0) step = 6; //sea boom
- else if ((who_nation == "Greeks")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 7;
- else if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 7;
- else step = 6; //standard
- }
- else large_conquest_start = 1;
- }
- else if (size > 2) large_conquest_start = 1;
- }
- if (large_conquest_start > 0) {
- if ((age(who) > 0)&&(age(who) < 5)) {
- //build 2 farms, university, mine, 2nd woodcutter, research military 1, build barracks, build stable, 2 heavy, 2 light, 1 archer
- switch (step) {
- case 1:
- if(!have_tech(who, "The Art of War")) {
- if (research_tech_with_cost(who, "The Art of War") > 0) step++;
- }
- else step++;
- return BLOCK_ON_THIS;
- break;
- case 2:
- train_unit_with_cost(who, 5, "Citizen");
- if (have_tech(who, "The Art of War")) step+=2;
- else step++;
- return BLOCK_ON_THIS;
- break;
- case 3:
- if (num_type_with_queued(who, "Barracks") < 1) {
- if (num_cities(who) == 1) place_building_upgrade_with_cost(who, "Barracks", my_capital);
- else if (num_cities(who) == 2) place_building_upgrade_with_cost(who, "Barracks", my_second_city);
- else if (num_cities(who) == 3) place_building_upgrade_with_cost(who, "Barracks", my_third_city);
- }
- if (num_type_with_queued(who, "Stable") < 1) {
- if (num_cities(who) == 1) place_building_upgrade_with_cost(who, "Stable", my_capital);
- else if (num_cities(who) == 2) place_building_upgrade_with_cost(who, "Stable", my_second_city);
- else if (num_cities(who) == 3) place_building_upgrade_with_cost(who, "Stable", my_third_city);
- }
- if ((num_type_with_queued(who, "Barracks") > 0)&&(num_type_with_queued(who, "Stable") > 0)) step++;
- return BLOCK_ON_THIS;
- break;
- case 4:
- if (num_type_with_queued(who, "Tower") < num_cities(who)) {
- if (num_cities(who) == 1) place_building_upgrade_with_cost(who, "Tower", my_capital);
- else if (num_cities(who) == 2) {
- place_building_upgrade_with_cost(who, "Tower", my_second_city);
- place_building_upgrade_with_cost(who, "Tower", my_capital);
- }
- else if (num_cities(who) == 3) {
- place_building_upgrade_with_cost(who, "Tower", my_third_city);
- place_building_upgrade_with_cost(who, "Tower", my_second_city);
- place_building_upgrade_with_cost(who, "Tower", my_capital);
- }
- }
- else if (num_type(who, "Market") < 1) return SCRIPT_DONE;
- if (num_type_with_queued(who, "Tower") > num_cities(who)-1) return SCRIPT_DONE;
- return BLOCK_ON_THIS;
- break;
- default:
- return SCRIPT_DONE;
- }
- }
- else if (age(who) > 4) {
- switch (step) {
- case 1:
- if(!have_tech(who, "The Art of War")) {
- if (research_tech_with_cost(who, "The Art of War") > 0) step++;
- }
- else step++;
- return BLOCK_ON_THIS;
- break;
- case 2:
- train_unit_with_cost(who, 5, "Citizen");
- if (have_tech(who, "The Art of War")) step+=2;
- else step++;
- return BLOCK_ON_THIS;
- break;
- case 3:
- if (num_type_with_queued(who, "Barracks") < 1) {
- if (num_cities(who) == 1) place_building_upgrade_with_cost(who, "Barracks", my_capital);
- else if (num_cities(who) == 2) place_building_upgrade_with_cost(who, "Barracks", my_second_city);
- else if (num_cities(who) == 3) place_building_upgrade_with_cost(who, "Barracks", my_third_city);
- }
- if (num_type_with_queued(who, "Auto Plant") < 1) {
- if (num_cities(who) == 1) place_building_upgrade_with_cost(who, "Auto Plant", my_capital);
- else if (num_cities(who) == 2) place_building_upgrade_with_cost(who, "Auto Plant", my_second_city);
- else if (num_cities(who) == 3) place_building_upgrade_with_cost(who, "Auto Plant", my_third_city);
- }
- if ((num_type_with_queued(who, "Barracks") > 0)&&(num_type_with_queued(who, "Auto Plant") > 0)) step++;
- return BLOCK_ON_THIS;
- break;
- case 4:
- if (num_type_with_queued(who, "Stockade") < num_cities(who)) {
- if (num_cities(who) == 1) place_building_upgrade_with_cost(who, "Tower", my_capital);
- else if (num_cities(who) == 2) {
- place_building_upgrade_with_cost(who, "Tower", my_second_city);
- place_building_upgrade_with_cost(who, "Tower", my_capital);
- }
- else if (num_cities(who) == 3) {
- place_building_upgrade_with_cost(who, "Tower", my_third_city);
- place_building_upgrade_with_cost(who, "Tower", my_second_city);
- place_building_upgrade_with_cost(who, "Tower", my_capital);
- }
- }
- else if (num_type(who, "Market") < 1) return SCRIPT_DONE;
- if (num_type_with_queued(who, "Tower") > num_cities(who)-1) return SCRIPT_DONE;
- return BLOCK_ON_THIS;
- break;
- default:
- return SCRIPT_DONE;
- }
- }
- }
-
- if (step == 1) {
- if (get_starting_resources(who) > 4 || num_cities(who) > 1) {
- return SCRIPT_DONE;
- }
- size = get_starting_town_size(who);
- if (size == 0) step = 1; //nomad
- else if (size == 1) step = 2;
- else if (size >= 2) {
- if (sea_map > 0) step = 6; //sea boom
- else if ((who_nation == "Greeks")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 7;
- else if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 7;
- else step = 6; //standard
- }
- else return SCRIPT_DONE;
- }
-
- train_unit_with_need(who, needed_citizens, "Citizen");
-
- ////builds needed number of caravans and merchants
- if (num_type(who, "Market") >= 1) {
- if (num_type_with_queued(who, "Caravan") < caravan_lim) {
- train_unit_with_cost(who, 1, "Caravan");
- }
- if (at_least_type(who, 100, "Wealth")) {
- for (j = num_type_with_queued(who, "Merchant"); ((j < 3)&&(j < num_rare_resources_seen(who))); j++) {
- if (train_unit_with_cost(who, 1, "Merchant") < 1) break;
- }
- }
- }
-
- //checks pop limit
- if (population(who) >= 23 && (!have_tech(who, "The Art of War"))) {
- research_tech_with_cost(who, "The Art of War");
- }
-
- //spend all gold on scholars
- //at_least_type(const int &who, const int &num, const String &type)
- if ((num_type(who, "University") > 0)&&((num_type(who, "Market") > 0)||(num_type(who, "Dock") > 0))) {
- if (at_least_type(who, 130, "Wealth")) {
- train_unit_with_cost(who, 1, "Scholar");
- }
- }
-
- //builds fish herders after dock is built
- if ((fishermen_total < fishermen_cap)&&(num_type(who, "Dock") > 0)&&(at_least_type(who, 100, "Timber"))) {
- if (train_unit_with_cost(who, 1, "Fishermen") > 0) fishermen_total++;
- }
-
- //builds tower after military I is researched
- if ((have_tech(who, "The Art of War"))&&(num_type_with_queued(who, "Tower") < 1)) {
- if (num_cities(who) > 1) {
- place_building_with_cost(who, "Tower", my_second_city);
- }
- else {
- place_building_with_cost(who, "Tower", my_capital);
- }
- }
-
- if ((num_type(who, "Tower") > 0)&&(!have_tech(who, "Allegiance"))&&(age(who) > 0)&&(have_tech(who, "Mathematics"))) {
- research_tech_with_cost(who, "Allegiance");
- }
-
- ////check to see if script is hanging
- if ((step == old_step)&&(timer_started < 1)) {
- set_timer(who, 300);
- timer_started = 1;
- }
-
- if (step != old_step) {
- stop_timer(who);
- timer_started = 0;
- }
-
- if (timer_expired(who)) {
- return SCRIPT_DONE;
- }
-
- for (i = 0; i < num_loops; i++) {
-
- if (old_step != step) old_step = step;
-
- switch (step) {
- ////Nomad Setup Procedure/////
- case 1: //place City (nomad)
- old_step = 0;
- if (num_type_with_queued(who, "Small City") < 1) place_city_with_cost(who);
- if (find_inactive_build(who, "Small City")) {
- new_city = find_inactive_build(who, "Small City");
- if (building_started(who, new_city)) step++;
- }
- return_value = BLOCK_ON_THIS;
- break;
- case 2: //place Woodcutter's Camp at capital
- old_step = 0;
- new_city = find_inactive_build(who, "Small City");
- if (new_city > 0) {
- for (j = 0; j < num_type(who, "Citizen"); j++) {
- citizen_id = find_unit(who, "Citizen");
- citizen_repair_order(who, citizen_id, new_city);
- }
- }
- if (place_building_with_cost(who, "Woodcutter's Camp", my_capital) > 0) step++;
- else if ((my_capital > -1) && (can_pay_cost(who, "Woodcutter's Camp") > 0)) return SCRIPT_DONE;
- return_value = BLOCK_ON_THIS;
- break;
- case 3: //place 3 farms at capital
- old_step = 0;
- for (j = num_type_with_queued(who, "Farm"); j < 3; j++) {
- if (place_building_with_cost(who, "Farm", my_capital) < 1) break;
- }
- if (num_type_with_queued(who, "Farm") == 3) step++;
- return_value = BLOCK_ON_THIS;
- break;
- case 4: //build up to 5 peasants
- needed_citizens = 5;
- train_unit_with_need(who, needed_citizens, "Citizen");
- if ((who_nation == "Greeks")&&(get_is_no_nation_powers() < 1)) {
- if (num_type_with_queued(who, "University") > 0) step++;
- else if (place_building_with_cost(who, "University", my_capital) > 0) step++;
- }
- else step++;
- return_value = BLOCK_ON_THIS;
- break;
- case 5: //build a library
- old_step = 0;
- if (place_building_with_cost(who, "Library", my_capital) > 0) {
- if ((who_nation == "Greeks")&&(get_is_no_nation_powers() < 1)) step = 7;
- else if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 7;
- else {
- if(at_least_type(who, 75, "Wealth") < 1) step = 7;
- else step++;
- }
- }
- return_value = BLOCK_ON_THIS;
- break;
- ////End Nomad Setup Procedure/////
- case 6: //Science I
- old_step = 0;
- if (!have_tech(who, "Written Word")) {
- if (research_tech_with_cost(who, "Written Word") > 0) {
- if ((who_nation == "Greeks")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 18;
- else step++;
- }
- else {
- if(at_least_type(who, 75, "Wealth") < 1) step++;
- }
- }
- else if ((who_nation == "Greeks")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 18;
- else step++;
- return_value = BLOCK_ON_THIS;
- break;
- case 7: //Civic I
- if (num_cities(who) > 1) return SCRIPT_DONE;
- else if (have_tech(who, "City State")) step++;
- else if (research_tech_with_cost(who, "City State")) step++;
- return_value = BLOCK_ON_THIS;
- break;
- case 8: //Build 4 Citizens -> Timber.
- needed_citizens = 9;
- train_unit_with_need(who, needed_citizens, "Citizens");
- step++;
- return_value = BLOCK_ON_THIS;
- break;
- case 9: //Build a Farm with a Woodcutter.
- if (place_farm(who) >= 0) step++;
- return_value = BLOCK_ON_THIS;
- break;
- case 10: //Build City #2 with a Woodcutter.
- if (have_tech(who, "City State")) {
- if (num_cities(who) < 2) {
- if (city_placement(who) > 0) {
- if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 10;
- else step++;
- }
- }
- else {
- if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) {
- if (num_cities(who) < 3) {
- if (city_placement(who) > 0) step++;
- }
- else step++;
- }
- else step++;
- }
- }
- return_value = BLOCK_ON_THIS;
- break;
- case 11: //Build 2 Citizens -> Timber.
- needed_citizens = 11;
- train_unit_with_need(who, needed_citizens, "Citizens");
- step++;
- return_value = BLOCK_ON_THIS;
- break;
- case 12: //Build a Farm with a Woodcutter.
- if (place_farm(who) >= 0) {
- if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 14;
- else step++;
- }
- return_value = BLOCK_ON_THIS;
- break;
- case 13: //Build Woodcutter #2
- if (place_woodcutter(who) >= 0) {
- if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 17;
- else step++;
- }
- return_value = BLOCK_ON_THIS;
- break;
- case 14: //Commerce I
- if (research_tech_with_cost(who, "Barter") > 0) {
- if (sea_map > 0) step = 35;//build a dock
- else if ((who_nation == "Greeks")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 17;
- else if ((who_nation == "Koreans")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step+=2;
- else if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 13;
- else step++;
- }
- return_value = BLOCK_ON_THIS;
- break;
- case 15: //Build Market #1 (then immediately build a Caravan)
- if (num_city_buildings(who, my_capital, "Market", 1) < 1) {
- if (have_tech(who, "Barter")) {
- if (place_building_with_cost(who, "Market", my_capital) > 0) {
- if (sea_map > 0) step = 18;
- else if ((who_nation == "Greeks")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 23;
- else if ((who_nation == "Koreans")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step+=2;
- else if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 18;
- else step++;
- }
- }
- }
- else {
- if (sea_map > 0) step = 18;
- else if ((who_nation == "Greeks")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 23;
- else if ((who_nation == "Koreans")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step+=2;
- else if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 18;
- else step++;
- }
- return_value = BLOCK_ON_THIS;
- break;
- case 16: //Build 3 Citizens -> Timber.
- needed_citizens = 14;
- train_unit_with_need(who, needed_citizens, "Citizens");
- if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 15;
- else step++;
- return_value = BLOCK_ON_THIS;
- break;
- case 17: //construct 2 Farms.
- //got 5 already
- old_step = 0;
- if ((who_nation == "British")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) {
- needed_citizens = 23;
- if (num_type_with_queued(who, "Farm") < 10) {
- if (place_farm(who) > 0) old_step = 0;
- }
- else step = 28;
- }
- else if (num_type_with_queued(who, "Farm") < 7) place_farm(who);
- else {
- if (sea_map > 0) step = 23;
- else if ((who_nation == "Greeks")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 20;
- else if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 16;
- else step++;
- }
- return_value = BLOCK_ON_THIS;
- break;
- case 18: //Classical Age
- if ((is_conquest_scenario())&&(age(who) > 0)) {
- if (sea_map > 0) step = 24;
- else if ((who_nation == "Greeks")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 29;
- else if ((who_nation == "Egyptians")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step+=2;
- else if ((who_nation == "Inca")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step+=2;
- else if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 20;
- else step++;
- }
- else if (needed_techs <= 3) {
- if (age(who) > 0) return SCRIPT_DONE;
- else if (research_tech_with_cost(who, "Classical Age") > 0) {
- if (sea_map > 0) step = 24;
- else if ((who_nation == "Greeks")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 29;
- else if ((who_nation == "Egyptians")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step+=2;
- else if ((who_nation == "Inca")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step+=2;
- else if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 20;
- else step++;
- }
- }
- else return SCRIPT_DONE;
- return_value = BLOCK_ON_THIS;
- break;
- case 19: //Market #2
- if (num_city_buildings(who, my_second_city, "Market", 1) < 1) {
- if (have_tech(who, "Barter")) {
- if (place_building_with_cost(who, "Market", my_second_city) > 0) {
- if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 21;
- else step++;
- }
- }
- }
- else if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 21;
- else step++;
- return_value = BLOCK_ON_THIS;
- break;
- case 20: //Build 2 universities and spend all Wealth on Scholars.
- if (have_tech(who, "Classical Age")||((who_nation == "Greeks")&&(get_is_no_nation_powers() < 1))) {
- if (num_city_buildings(who, my_second_city, "University", 1) < 1) {
- if (place_building_with_cost(who, "University", my_second_city) == 0) return SCRIPT_DONE;
- old_step = 0;
- }
- else if (num_city_buildings(who, my_capital, "University", 1) < 1) {
- if (place_building_with_cost(who, "University", my_capital) == 0) return SCRIPT_DONE;
- old_step = 0;
- }
- else {
- if (sea_map > 0) step = 30;
- else if ((who_nation == "Greeks")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 15;
- else if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 32;
- else step++;
- }
- }
- else if (researching_tech(who, "Classical Age") > 0) old_step = 0;
- return_value = BLOCK_ON_THIS;
- break;
- case 21: //Build Mine #1.
- if (place_mine(who) >= 0) {
- if ((who_nation == "British")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 29;
- else if ((who_nation == "Greeks")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 32;
- else if ((who_nation == "Inca")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) {
- //build two more mines
- old_step = 0;
- if (num_type_with_queued(who, "Mine") < 3) place_mine(who);
- else step++;
- if (can_pay_cost(who, "Mine") > 0) step++;
- }
- else step++;
- }
- return_value = BLOCK_ON_THIS;
- break;
- case 22: //Build 9 Citizens
- old_step = 0;
- if ((who_nation == "Inca")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) needed_citizens = 27;
- else needed_citizens = 23;
- train_unit_with_need(who, needed_citizens, "Citizens");
- if (sea_map > 0) step = 32;
- else if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 33;
- else step++;
- return_value = BLOCK_ON_THIS;
- break;
- case 23: //Commerce II
- old_step = 0;
- if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) needed_citizens = 18;
- if(!have_tech(who, "Coinage")) {
- if (research_tech_with_cost(who, "Coinage") > 0) {
- if (sea_map > 0) step = 15;
- else if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 25;
- else step++;
- }
- }
- else {
- if (sea_map > 0) step = 15;
- else if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 25;
- else step++;
- }
- return_value = BLOCK_ON_THIS;
- break;
- case 24: //Military I
- if (!have_tech(who, "The Art of War")) {
- if (research_tech_with_cost(who, "The Art of War")) {
- if (sea_map > 0) step = 29;
- else if ((who_nation == "British")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 31;
- else if ((who_nation == "Greeks")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) {
- needed_citizens = 20;
- step++;
- }
- else if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 34;
- else step++;
- }
- }
- else {
- if (sea_map > 0) step = 29;
- else if ((who_nation == "British")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 31;
- else if ((who_nation == "Greeks")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) {
- needed_citizens = 20;
- step++;
- }
- else if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 34;
- else step++;
- }
- return_value = BLOCK_ON_THIS;
- break;
- case 25: //Build 2 Farms (Build 4 if Egyptian)
- //got 7 already
- if ((who_nation == "Egyptians")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) {
- if (num_type_with_queued(who, "Farm") < 11) {
- if (place_farm(who) > 0) old_step = 0;
- }
- else step++;
- }
- else {
- if (num_type_with_queued(who, "Farm") < 9) {
- if (place_farm(who) > 0) old_step = 0;
- }
- else if ((who_nation == "Greeks")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 6;
- else if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 24;
- else step++;
- }
- return_value = BLOCK_ON_THIS;
- break;
- case 26: ///Build Granary at City #1.
- if (num_city_buildings(who, my_capital, "Granary", 1) < 1) {
- if (place_building_with_cost(who, "Granary", my_capital) > 0) {
- if ((who_nation == "British")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) return SCRIPT_DONE;
- else step++;
- }
- }
- else {
- if ((who_nation == "British")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) return SCRIPT_DONE;
- else step++;
- }
- return_value = BLOCK_ON_THIS;
- break;
- case 27: //Build 5 Citizens -> Metal/Timber
- needed_citizens = 28;
- train_unit_with_need(who, needed_citizens, "Citizens");
- step++;
- return_value = BLOCK_ON_THIS;
- break;
- case 28: //Science II
- if (!have_tech(who, "Mathematics")) {
- if (research_tech_with_cost(who, "Mathematics") > 0) {
- if ((who_nation == "British")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 24;
- else step++;
- }
- }
- return_value = BLOCK_ON_THIS;
- break;
- case 29: //Civic II
- if (!have_tech(who, "Empire")) {
- if (research_tech_with_cost(who, "Empire") > 0) {
- if (sea_map > 0) step = 20;
- else step++;
- }
- }
- return_value = BLOCK_ON_THIS;
- break;
- case 30: //Build City #3.
- if (have_tech(who, "Empire")) {
- if ((num_cities(who) < 3)||((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(num_cities(who) < 4)&&(sea_map > 0))) {
- if (city_placement(who) > 0) {
- if (sea_map > 0) {
- if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(num_type_with_queued(who, "Small City") < 4)) step = 30;
- else step = 21;
- }
- else if ((who_nation == "British")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 26;
- else if ((who_nation == "Greeks")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 21;
- else step++;
- }
- }
- else {
- if (sea_map > 0) step = 21;
- else if ((who_nation == "British")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 26;
- else if ((who_nation == "Greeks")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 21;
- else step++;
- }
- }
- return_value = BLOCK_ON_THIS;
- break;
- case 31: //barracks
- if (place_building_with_cost(who, "Barracks", my_second_city) > 0) {
- if ((who_nation == "British")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 18;
- else if ((who_nation == "Greeks")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) return SCRIPT_DONE;
- else if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) return SCRIPT_DONE;
- else step++;
- }
- return_value = BLOCK_ON_THIS;
- break;
- case 32: //Build University #3
- if (num_cities(who) > 2) {
- if (num_city_buildings(who, my_third_city, "University", 1) < 1) {
- if (place_building_with_cost(who, "University", my_third_city) > 0) {
- if (sea_map > 0) return SCRIPT_DONE;
- else if ((who_nation == "Greeks")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 31;
- else if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 23;
- else step++;
- }
- }
- }
- return_value = BLOCK_ON_THIS;
- break;
- case 33: //Build Market #3 (This will be Market #2 for Egyptians)
- if (num_city_buildings(who, my_third_city, "Market", 1) < 1) {
- if (have_tech(who, "Barter")) {
- if (place_building_with_cost(who, "Market", my_third_city) > 0) {
- if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 31;
- else step++;
- }
- }
- }
- else if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 31;
- else step++;
- return_value = BLOCK_ON_THIS;
- break;
- case 34: //Build Woodcutter's Camp #3 (unless more than 6 open slots already exist,in which case build more citizens)
- if (place_woodcutter(who) >= 0) {
- if ((who_nation == "Mongols")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 36;
- else if ((who_nation == "Bantu")&&(get_is_no_nation_powers() < 1)&&(sea_map < 1)) step = 19;
- else return SCRIPT_DONE;
- }
- return_value = BLOCK_ON_THIS;
- break;
- case 35:
- //dock step
- if (place_dock(who) > 0) step = 16;
- else if (can_pay_cost(who, "Dock") > 0) return SCRIPT_DONE;
- return_value = BLOCK_ON_THIS;
- break;
- case 36:
- //Mongolians step
- if (num_type_with_queued(who, "Stable") < 2) {
- if (num_cities(who) == 1) place_building_with_cost(who, "Stable", my_capital);
- else if (num_cities(who) == 2) place_building_with_cost(who, "Stable", my_second_city);
- else if (num_cities(who) == 3) place_building_with_cost(who, "Stable", my_third_city);
- else return SCRIPT_DONE;
- }
- else return SCRIPT_DONE;
- return_value = BLOCK_ON_THIS;
- break;
- default:
- return_value = SCRIPT_DONE;
- break;
- }
- }
- ///ghetto array///
- switch (who-1) {
- case 0:
- prev_step0 = old_step;
- needed_citizens0 = needed_citizens;
- timer_started0 = timer_started;
- fishermen_total0 = fishermen_total;
- break;
- case 1:
- prev_step1 = old_step;
- needed_citizens1 = needed_citizens;
- timer_started1 = timer_started;
- fishermen_total1 = fishermen_total;
- break;
- case 2:
- prev_step2 = old_step;
- needed_citizens2 = needed_citizens;
- timer_started2 = timer_started;
- fishermen_total2 = fishermen_total;
- break;
- case 3:
- prev_step3 = old_step;
- needed_citizens3 = needed_citizens;
- timer_started3 = timer_started;
- fishermen_total3 = fishermen_total;
- break;
- case 4:
- prev_step4 = old_step;
- needed_citizens4 = needed_citizens;
- timer_started4 = timer_started;
- fishermen_total4 = fishermen_total;
- break;
- case 5:
- prev_step5 = old_step;
- needed_citizens5 = needed_citizens;
- timer_started5 = timer_started;
- fishermen_total5 = fishermen_total;
- break;
- case 6:
- prev_step6 = old_step;
- needed_citizens6 = needed_citizens;
- timer_started6 = timer_started;
- fishermen_total6 = fishermen_total;
- break;
- case 7:
- prev_step7 = old_step;
- needed_citizens7 = needed_citizens;
- timer_started7 = timer_started;
- fishermen_total7 = fishermen_total;
- break;
- default:
- old_step = 0;
- needed_citizens = 0;
- break;
- }
- return return_value;
- }