This commit is contained in:
karan committed 2025-05-25 22:02:04 +05:30
1 parent 073dec2be0
commit b7f4abc454
1 file changed
+125 -125
+125 -125
View File
@@ -1024,33 +1024,33 @@ class Banking(commands.Cog):
footer = ""
if nation['iron_works'] == True:
if nation.iron_works == True:
ste_mod = 1.36
if nation['bauxite_works'] == True:
if nation.bauxite_works == True:
alu_mod = 1.36
if nation['arms_stockpile'] == True:
if nation.arms_stockpile == True:
mun_mod = 1.34
if nation['emergency_gasoline_reserve'] == True:
if nation.emergency_gasoline_reserve == True:
gas_mod = 2
if nation['mass_irrigation'] == True:
if nation.mass_irrigation == True:
food_land_mod = 400
if nation['international_trade_center'] == True:
if nation.international_trade_center == True:
max_commerce = 115
if nation['telecommunications_satellite'] == True:
if nation.telecommunications_satellite == True:
max_commerce = 125
base_com = 2
if nation['recycling_initiative'] == True:
if nation.recycling_initiative == True:
rec_poll = 75
if nation['green_technologies'] == True:
if nation.green_technologies == True:
manu_poll_mod = 0.75
farm_poll_mod = 0.5
subw_poll_red = 70
rss_upkeep_mod = 0.9
if nation['clinical_research_center'] == True:
if nation.clinical_research_center == True:
hos_dis_red = 3.5
if nation['specialized_police_training_program'] == True:
if nation.specialized_police_training_program == True:
hos_dis_red = 3.5
if nation['uranium_enrichment_program'] == True:
if nation.uranium_enrichment_program == True:
uranium_mod = 2
coal = 0
@@ -1073,40 +1073,40 @@ class Banking(commands.Cog):
return
land = 0
for city in nation.cities:
land += city['land']
land += city.land
city = {}
for key, value in build.items():
city[key[4:]] = int(value)
city['infrastructure'] = city.pop('a_needed')
city['land'] = round(land/nation['num_cities'])
city['powered'] = True
city['date'] = nation.cities[math.ceil(nation['num_cities']/2)]['date']
city.infrastructure = city.pop('a_needed')
city.land = round(land/nation.num_cities)
city.powered = True
city.date = nation.cities[math.ceil(nation.num_cities/2)]['date']
nation.cities = [city]
#print(city)
for city in nation.cities:
total_infra += city['infrastructure']
base_pop = city['infrastructure'] * 100
total_infra += city.infrastructure
base_pop = city.infrastructure * 100
pollution = 0
unpowered_infra = city['infrastructure']
for wind_plant in range(city['wind_power']): #can add something about wasted slots
unpowered_infra = city.infrastructure
for wind_plant in range(city.wind_power): #can add something about wasted slots
if unpowered_infra > 0:
unpowered_infra -= 250
power_upkeep += 42
for nucl_plant in range(city['nuclear_power']):
for nucl_plant in range(city.nuclear_power):
power_upkeep += 10500
for level in range(2):
if unpowered_infra > 0:
unpowered_infra -= 1000
uranium -= 1.2
for oil_plant in range(city['oil_power']):
for oil_plant in range(city.oil_power):
power_upkeep += 1800
pollution += 6
for level in range(5):
if unpowered_infra > 0:
unpowered_infra -= 100
oil -= 1.2
for coal_plant in range(city['coal_power']):
for coal_plant in range(city.coal_power):
power_upkeep += 1200
pollution += 8
for level in range(5):
@@ -1114,117 +1114,117 @@ class Banking(commands.Cog):
unpowered_infra -= 100
coal -= 1.2
rss_upkeep += 400 * city['coal_mine'] * rss_upkeep_mod
pollution += 12 * city['coal_mine']
coal += 3 * city['coal_mine'] * (1 + ((0.5 * (city['coal_mine'] - 1)) / (10 - 1)))
rss_upkeep += 400 * city.coal_mine * rss_upkeep_mod
pollution += 12 * city.coal_mine
coal += 3 * city.coal_mine * (1 + ((0.5 * (city.coal_mine - 1)) / (10 - 1)))
rss_upkeep += 600 * city['oil_well'] * rss_upkeep_mod
pollution += 12 * city['oil_well']
oil += 3 * city['oil_well'] * (1 + ((0.5 * (city['oil_well'] - 1)) / (10 - 1)))
rss_upkeep += 600 * city.oil_well * rss_upkeep_mod
pollution += 12 * city.oil_well
oil += 3 * city.oil_well * (1 + ((0.5 * (city.oil_well - 1)) / (10 - 1)))
rss_upkeep += 5000 * city['uranium_mine'] * rss_upkeep_mod
pollution += 20 * city['uranium_mine']
uranium += 3 * city['uranium_mine'] * (1 + ((0.5 * (city['uranium_mine'] - 1)) / (5 - 1))) * uranium_mod
rss_upkeep += 5000 * city.uranium_mine * rss_upkeep_mod
pollution += 20 * city.uranium_mine
uranium += 3 * city.uranium_mine * (1 + ((0.5 * (city.uranium_mine - 1)) / (5 - 1))) * uranium_mod
rss_upkeep += 1500 * city['lead_mine'] * rss_upkeep_mod
pollution += 12 * city['lead_mine']
lead += 3 * city['lead_mine'] * (1 + ((0.5 * (city['lead_mine'] - 1)) / (10 - 1)))
rss_upkeep += 1500 * city.lead_mine * rss_upkeep_mod
pollution += 12 * city.lead_mine
lead += 3 * city.lead_mine * (1 + ((0.5 * (city.lead_mine - 1)) / (10 - 1)))
rss_upkeep += 1600 * city['iron_mine'] * rss_upkeep_mod
pollution += 12 * city['iron_mine']
iron += 3 * city['iron_mine'] * (1 + ((0.5 * (city['iron_mine'] - 1)) / (10 - 1)))
rss_upkeep += 1600 * city.iron_mine * rss_upkeep_mod
pollution += 12 * city.iron_mine
iron += 3 * city.iron_mine * (1 + ((0.5 * (city.iron_mine - 1)) / (10 - 1)))
rss_upkeep += 1600 * city['bauxite_mine'] * rss_upkeep_mod
pollution += 12 * city['bauxite_mine']
bauxite += 3 * city['bauxite_mine'] * (1 + ((0.5 * (city['bauxite_mine'] - 1)) / (10 - 1)))
rss_upkeep += 1600 * city.bauxite_mine * rss_upkeep_mod
pollution += 12 * city.bauxite_mine
bauxite += 3 * city.bauxite_mine * (1 + ((0.5 * (city.bauxite_mine - 1)) / (10 - 1)))
rss_upkeep += 300 * city['farm'] * rss_upkeep_mod ## seasonal modifiers and radiation
pollution += 2 * city['farm'] * farm_poll_mod
food_prod = city['land']/food_land_mod * city['farm'] * (1 + ((0.5 * (city['farm'] - 1)) / (20 - 1))) * seasonal_mod[nation['continent']] * radiation[nation['continent']] * 12
rss_upkeep += 300 * city.farm * rss_upkeep_mod ## seasonal modifiers and radiation
pollution += 2 * city.farm * farm_poll_mod
food_prod = city.land/food_land_mod * city.farm * (1 + ((0.5 * (city.farm - 1)) / (20 - 1))) * seasonal_mod[nation.continent] * radiation[nation.continent] * 12
if food_prod < 0:
food += 0
else:
food += food_prod
commerce = base_com
if city['powered']:
rss_upkeep += 4000 * city['oil_refinery'] * rss_upkeep_mod
pollution += 32 * city['oil_refinery'] * manu_poll_mod
oil -= 3 * city['oil_refinery'] * (1 + ((0.5 * (city['oil_refinery'] - 1)) / (5 - 1))) * gas_mod
gasoline += 6 * city['oil_refinery'] * (1 + ((0.5 * (city['oil_refinery'] - 1)) / (5 - 1))) * gas_mod
if city.powered:
rss_upkeep += 4000 * city.oil_refinery * rss_upkeep_mod
pollution += 32 * city.oil_refinery * manu_poll_mod
oil -= 3 * city.oil_refinery * (1 + ((0.5 * (city.oil_refinery - 1)) / (5 - 1))) * gas_mod
gasoline += 6 * city.oil_refinery * (1 + ((0.5 * (city.oil_refinery - 1)) / (5 - 1))) * gas_mod
rss_upkeep += 4000 * city['steel_mill'] * rss_upkeep_mod
pollution += 40 * city['steel_mill'] * manu_poll_mod
iron -= 3 * city['steel_mill'] * (1 + ((0.5 * (city['steel_mill'] - 1)) / (5 - 1))) * ste_mod
coal -= 3 * city['steel_mill'] * (1 + ((0.5 * (city['steel_mill'] - 1)) / (5 - 1))) * ste_mod
steel += 9 * city['steel_mill'] * (1 + ((0.5 * (city['steel_mill'] - 1)) / (5 - 1))) * ste_mod
rss_upkeep += 4000 * city.steel_mill * rss_upkeep_mod
pollution += 40 * city.steel_mill * manu_poll_mod
iron -= 3 * city.steel_mill * (1 + ((0.5 * (city.steel_mill - 1)) / (5 - 1))) * ste_mod
coal -= 3 * city.steel_mill * (1 + ((0.5 * (city.steel_mill - 1)) / (5 - 1))) * ste_mod
steel += 9 * city.steel_mill * (1 + ((0.5 * (city.steel_mill - 1)) / (5 - 1))) * ste_mod
rss_upkeep += 2500 * city['aluminum_refinery'] * rss_upkeep_mod
pollution += 40 * city['aluminum_refinery'] * manu_poll_mod
bauxite -= 3 * city['aluminum_refinery'] * (1 + ((0.5 * (city['aluminum_refinery'] - 1)) / (5 - 1))) * alu_mod
aluminum += 9 * city['aluminum_refinery'] * (1 + ((0.5 * (city['aluminum_refinery'] - 1)) / (5 - 1))) * alu_mod
rss_upkeep += 2500 * city.aluminum_refinery * rss_upkeep_mod
pollution += 40 * city.aluminum_refinery * manu_poll_mod
bauxite -= 3 * city.aluminum_refinery * (1 + ((0.5 * (city.aluminum_refinery - 1)) / (5 - 1))) * alu_mod
aluminum += 9 * city.aluminum_refinery * (1 + ((0.5 * (city.aluminum_refinery - 1)) / (5 - 1))) * alu_mod
rss_upkeep += 3500 * city['munitions_factory'] * rss_upkeep_mod
pollution += 32 * city['munitions_factory'] * manu_poll_mod
lead -= 6 * city['munitions_factory'] * (1 + ((0.5 * (city['munitions_factory'] - 1)) / (5 - 1))) * mun_mod
munitions += 18 * city['munitions_factory'] * (1 + ((0.5 * (city['munitions_factory'] - 1)) / (5 - 1))) * mun_mod
rss_upkeep += 3500 * city.munitions_factory * rss_upkeep_mod
pollution += 32 * city.munitions_factory * manu_poll_mod
lead -= 6 * city.munitions_factory * (1 + ((0.5 * (city.munitions_factory - 1)) / (5 - 1))) * mun_mod
munitions += 18 * city.munitions_factory * (1 + ((0.5 * (city.munitions_factory - 1)) / (5 - 1))) * mun_mod
civil_upkeep += city['police_station'] * 750
civil_upkeep += city['hospital'] * 1000
civil_upkeep += city['recycling_center'] * 2500
civil_upkeep += city['subway'] * 3250
civil_upkeep += city['supermarket'] * 600
civil_upkeep += city['bank'] * 1800
civil_upkeep += city['shopping_mall'] * 5400
civil_upkeep += city['stadium'] * 12150
civil_upkeep += city.police_station * 750
civil_upkeep += city.hospital * 1000
civil_upkeep += city.recycling_center * 2500
civil_upkeep += city.subway * 3250
civil_upkeep += city.supermarket * 600
civil_upkeep += city.bank * 1800
civil_upkeep += city.shopping_mall * 5400
civil_upkeep += city.stadium * 12150
police_stations = city['police_station']
hospitals = city['hospital']
police_stations = city.police_station
hospitals = city.hospital
pollution += city['police_station']
pollution += city['hospital'] * 4
pollution -= city['recycling_center'] * rec_poll
pollution -= city['subway'] * subw_poll_red
pollution += city['shopping_mall'] * 2
pollution += city['stadium'] * 5
pollution += city.police_station
pollution += city.hospital * 4
pollution -= city.recycling_center * rec_poll
pollution -= city.subway * subw_poll_red
pollution += city.shopping_mall * 2
pollution += city.stadium * 5
city['real_pollution'] = pollution
city.real_pollution = pollution
if pollution < 0:
pollution = 0
city['pollution'] = pollution
city.pollution = pollution
commerce += city['subway'] * 8
commerce += city['supermarket'] * 3
commerce += city['bank'] * 5
commerce += city['shopping_mall'] * 9
commerce += city['stadium'] * 12
commerce += city.subway * 8
commerce += city.supermarket * 3
commerce += city.bank * 5
commerce += city.shopping_mall * 9
commerce += city.stadium * 12
city['real_commerce'] = commerce
city.real_commerce = commerce
if commerce > max_commerce:
commerce = max_commerce
city['commerce'] = commerce
city.commerce = commerce
else:
police_stations = 0
hospitals = 0
crime_rate = ((103 - commerce)**2 + (city['infrastructure'] * 100))/(111111) - police_stations * pol_cri_red
city['real_crime_rate'] = crime_rate
crime_rate = ((103 - commerce)**2 + (city.infrastructure * 100))/(111111) - police_stations * pol_cri_red
city.real_crime_rate = crime_rate
if crime_rate < 0:
crime_rate = 0
city['crime_rate'] = crime_rate
crime_deaths = ((crime_rate) / 10) * (100 * city['infrastructure']) - 25
disease_rate = (((((base_pop / city['land'])**2) * 0.01) - 25)/100) + (base_pop/100000) + pollution * 0.05 - hospitals * hos_dis_red
city['real_disease_rate'] = disease_rate
city.crime_rate = crime_rate
crime_deaths = ((crime_rate) / 10) * (100 * city.infrastructure) - 25
disease_rate = (((((base_pop / city.land)**2) * 0.01) - 25)/100) + (base_pop/100000) + pollution * 0.05 - hospitals * hos_dis_red
city.real_disease_rate = disease_rate
if disease_rate > 100:
disease_rate = 100
elif disease_rate < 0:
disease_rate = 0
city['disease_rate'] = disease_rate
city.disease_rate = disease_rate
disease_deaths = base_pop * (disease_rate/100)
if disease_deaths < 0:
disease_deaths = 0
city_age = (datetime.datetime.utcnow() - datetime.datetime.strptime(city['date'], "%Y-%m-%d")).days
city_age = (datetime.datetime.utcnow() - datetime.datetime.strptime(city.date, "%Y-%m-%d")).days
if city_age == 0:
city_age = 1
population = ((base_pop - disease_deaths - crime_deaths) * (1 + math.log(city_age)/15))
@@ -1236,10 +1236,10 @@ class Banking(commands.Cog):
for treasure in treasures:
if treasure['nation'] == None:
continue
if treasure['nation']['id'] == nation['id']:
if treasure['nation']['id'] == nation.id:
nation_treasure_bonus += treasure['bonus'] / 100
if nation['alliance']:
if treasure['nation']['alliance_id'] == nation['alliance_id']:
if nation.alliance:
if treasure['nation']['alliance_id'] == nation.alliance_id:
alliance_treasures += 1
if alliance_treasures > 0:
nation_treasure_bonus += math.sqrt(alliance_treasures * 4) / 100
@@ -1247,47 +1247,47 @@ class Banking(commands.Cog):
treasure_text = f"\n\nTreasure Bonus: ${round(money_income * (nation_treasure_bonus - 1)):,}"
if not single_city:
color_bonus = colors[nation['color']]
color_bonus = colors[nation.color]
color_text = f"\n\nColor Trade Bloc Bonus: ${round(color_bonus):,}"
food -= nationpop / 1000
if nation['num_cities'] < 11:
new_player_bonus = 2.1 - 0.1 * nation['num_cities']
if nation.num_cities < 11:
new_player_bonus = 2.1 - 0.1 * nation.num_cities
new_player_text = f"\n\nNew Player Bonus: ${round((new_player_bonus - 1) * money_income):,}"
if nation['dompolicy'] == "Open Markets":
if nation.dompolicy == "Open Markets":
policy_bonus = 1.01
policy_bonus_text = f"\n\nOpen Markets Bonus: ${round(money_income * 0.01):,}"
at_war = False
if not single_city:
for war in nation['wars']:
for war in nation.wars:
if war['turnsleft'] > 0:
at_war = True
if include_spies:
military_upkeep += nation['spies'] * 2400
military_upkeep += nation.spies * 2400
if not at_war:
military_upkeep += nation['soldiers'] * 1.25
food -= nation['soldiers'] / 750
military_upkeep += nation['tanks'] * 50
military_upkeep += nation['aircraft'] * 500
military_upkeep += nation['ships'] * 3750
military_upkeep += nation['missiles'] * 21000
military_upkeep += nation['nukes'] * 31500
military_upkeep += nation.soldiers * 1.25
food -= nation.soldiers / 750
military_upkeep += nation.tanks * 50
military_upkeep += nation.aircraft * 500
military_upkeep += nation.ships * 3750
military_upkeep += nation.missiles * 21000
military_upkeep += nation.nukes * 31500
else:
military_upkeep += nation['soldiers'] * 1.88
food -= nation['soldiers'] / 500
military_upkeep += nation['tanks'] * 75
military_upkeep += nation['aircraft'] * 750
military_upkeep += nation['ships'] * 5625
military_upkeep += nation['missiles'] * 35000
military_upkeep += nation['nukes'] * 52500
military_upkeep += nation.soldiers * 1.88
food -= nation.soldiers / 500
military_upkeep += nation.tanks * 75
military_upkeep += nation.aircraft * 750
military_upkeep += nation.ships * 5625
military_upkeep += nation.missiles * 35000
military_upkeep += nation.nukes * 52500
else:
military_upkeep += int(city['barracks']) * 3000 * 1.25
military_upkeep += int(city['factory']) * 250 * 50
military_upkeep += int(city['hangar']) * 15 * 500
military_upkeep += int(city['drydock']) * 5 * 3750
military_upkeep += int(city.barracks) * 3000 * 1.25
military_upkeep += int(city.factory) * 250 * 50
military_upkeep += int(city.hangar) * 15 * 500
military_upkeep += int(city.drydock) * 5 * 3750
if nation['dompolicy'] == "Imperialism":
if nation.dompolicy == "Imperialism":
mil_cost = 0.95
policy_bonus_text = f"\n\nImperialism Bonus: ${round(military_upkeep * 0.05):,}"
if food < 0:
@@ -1327,7 +1327,7 @@ class Banking(commands.Cog):
rev_obj['nation'] = nation
rev_obj['footer'] = footer
rev_obj['max_infra'] = max_infra
rev_obj['avg_infra'] = round(total_infra / nation['num_cities'])
rev_obj['avg_infra'] = round(total_infra / nation.num_cities)
rev_obj['income_txt']=f"National Tax Revenue: ${round(money_income):,}{color_text}{new_player_text}{policy_bonus_text}{treasure_text}"
rev_obj['expenses_txt']=f"Power Plant Upkeep: ${round(power_upkeep):,}\n\nResource Prod. Upkeep: ${round(rss_upkeep):,}\n\nMilitary Upkeep: ${round(military_upkeep * mil_cost):,}\n\nCity Improvement Upkeep: ${round(civil_upkeep):,}{starve_exp_text}"
rev_obj['net_rev_txt']=f"Coal: {round(coal):,}\nOil: {round(oil):,}\nUranium: {round(uranium):,}\nLead: {round(lead):,}\nIron: {round(iron):,}\nBauxite: {round(bauxite):,}\nGasoline: {round(gasoline):,}\nMunitions: {round(munitions):,}\nSteel: {round(steel):,}\nAluminum: {round(aluminum):,}\nFood: {round(food):,}\nMoney: ${round(money_income * policy_bonus * new_player_bonus * nation_treasure_bonus + color_bonus - power_upkeep - rss_upkeep - military_upkeep * mil_cost - civil_upkeep):,}{starve_money_text}"