removed all monetary/manufacturing calculation

This commit is contained in:
karan committed 2025-06-01 18:37:00 +05:30
1 parent ca77a071ae
commit 157158fee3
1 file changed
+5 -261
+5 -261
View File
@@ -994,8 +994,6 @@ class Banking(commands.Cog):
single_city: bool = False,
include_spies: bool = False,
) -> dict:
max_commerce = 100
base_com = 0
hos_dis_red = 2.5
alu_mod = 1
mun_mod = 1
@@ -1003,11 +1001,9 @@ class Banking(commands.Cog):
manu_poll_mod = 1
farm_poll_mod = 0.5
subw_poll_red = 45
rss_upkeep_mod = 1
ste_mod = 1
rec_poll = 70
pol_cri_red = 2.5
food_land_mod = 500
uranium_mod = 1
rss_upkeep = 0
civil_upkeep = 0
@@ -1037,20 +1033,12 @@ class Banking(commands.Cog):
mun_mod = 1.34
if nation.emergency_gasoline_reserve == True:
gas_mod = 2
if nation.mass_irrigation == True:
food_land_mod = 400
if nation.international_trade_center == True:
max_commerce = 115
if nation.telecommunications_satellite == True:
max_commerce = 125
base_com = 2
if nation.recycling_initiative == True:
rec_poll = 75
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:
hos_dis_red = 3.5
if nation.specialized_police_training_program == True:
@@ -1107,7 +1095,7 @@ class Banking(commands.Cog):
for level in range(2):
if unpowered_infra > 0:
unpowered_infra -= 1000
uranium -= 1.2
uranium -= 2.4
for oil_plant in range(city.oil_power):
power_upkeep += 1800
pollution += 6
@@ -1123,60 +1111,24 @@ class Banking(commands.Cog):
unpowered_infra -= 100
coal -= 1.2
rss_upkeep += 400 * city.coal_mine * rss_upkeep_mod
pollution += 12 * city.coal_mine
pollution += (12 * city.coal_mine) + (12 * city.oil_well) + (20 * city.uranium_mine) + (12 * city.lead_mine)
+ (12 * city.iron_mine) + (12 * city.bauxite_mine) + (2 * city.farm * farm_poll_mod)
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 += 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 += 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 += (
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
@@ -1184,14 +1136,6 @@ class Banking(commands.Cog):
* (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
@@ -1205,14 +1149,6 @@ class Banking(commands.Cog):
* (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
@@ -1220,14 +1156,6 @@ class Banking(commands.Cog):
* (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
@@ -1235,24 +1163,6 @@ class Banking(commands.Cog):
* (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
police_stations = city.police_station
hospitals = city.hospital
pollution += city.police_station
pollution += city.hospital * 4
@@ -1265,121 +1175,10 @@ class Banking(commands.Cog):
if pollution < 0:
pollution = 0
city.pollution = pollution
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
if commerce > max_commerce:
commerce = max_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
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
if disease_rate > 100:
disease_rate = 100
elif disease_rate < 0:
disease_rate = 0
city.disease_rate = disease_rate
disease_deaths = base_pop * (disease_rate / 100)
if disease_deaths < 0:
disease_deaths = 0
if isinstance(city.date, str):
city_date = datetime.datetime.strptime(city.date, "%Y-%m-%d")
else:
city_date = city.date
city_age = (datetime.datetime.utcnow() - city_date).days
if city_age == 0:
city_age = 1
population = (base_pop - disease_deaths - crime_deaths) * (
1 + math.log(city_age) / 15
)
nationpop += population
money_income += (((commerce / 50) * 0.725) + 0.725) * population
alliance_treasures = 0
nation_treasure_bonus = 1
for treasure in treasures:
if treasure.nation == None:
continue
if treasure.nation.id == nation.id:
nation_treasure_bonus += treasure.bonus / 100
if nation.alliance_id:
if treasure.nation.alliance_id == nation.alliance_id:
alliance_treasures += 1
if alliance_treasures > 0:
nation_treasure_bonus += math.sqrt(alliance_treasures * 4) / 100
if nation_treasure_bonus > 1:
treasure_text = f"\n\nTreasure Bonus: ${round(money_income * (nation_treasure_bonus - 1)):,}"
if not single_city:
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
new_player_text = f"\n\nNew Player Bonus: ${round((new_player_bonus - 1) * money_income):,}"
if nation.domestic_policy == "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:
if war["turnsleft"] > 0:
at_war = True
if include_spies:
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
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
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
if nation.domestic_policy == "Imperialism":
mil_cost = 0.95
policy_bonus_text = (
f"\n\nImperialism Bonus: ${round(military_upkeep * 0.05):,}"
)
if food < 0:
starve_exp_text = f"\n\nPossible Starvation Penalty: ${round(money_income * policy_bonus * new_player_bonus * 0.33):,}*"
starve_money_text = f" (${round(money_income * policy_bonus * new_player_bonus * 0.67 + color_bonus - power_upkeep - rss_upkeep - military_upkeep * mil_cost - civil_upkeep):,}*)"
@@ -1394,71 +1193,20 @@ class Banking(commands.Cog):
rev_obj = nation.cities[0]
else:
rev_obj = {}
rev_obj["monetary_net_num"] = round(
money_income * policy_bonus * new_player_bonus * nation_treasure_bonus
+ color_bonus
- power_upkeep
- rss_upkeep
- military_upkeep * mil_cost
- civil_upkeep
+ coal * prices["coal"]
+ oil * prices["oil"]
+ uranium * prices["uranium"]
+ lead * prices["lead"]
+ iron * prices["iron"]
+ bauxite * prices["bauxite"]
+ gasoline * prices["gasoline"]
+ munitions * prices["munitions"]
+ steel * prices["steel"]
+ aluminum * prices["aluminum"]
+ food * prices["food"]
)
rev_obj["net_cash_num"] = round(
money_income * policy_bonus * new_player_bonus * nation_treasure_bonus
+ color_bonus
- power_upkeep
- rss_upkeep
- military_upkeep * mil_cost
- civil_upkeep
)
rev_obj["food"] = food
if single_city and not build:
rev_obj["money"] = rev_obj["net_cash_num"]
rev_obj["net income"] = rev_obj["monetary_net_num"]
rev_obj["aluminum"] = aluminum
rev_obj["bauxite"] = bauxite
rev_obj["coal"] = coal
rev_obj["gasoline"] = gasoline
rev_obj["iron"] = iron
rev_obj["lead"] = lead
rev_obj["munitions"] = munitions
rev_obj["oil"] = oil
rev_obj["steel"] = steel
rev_obj["uranium"] = uranium
rev_obj["disease_rate"] = disease_rate
rev_obj["crime_rate"] = crime_rate
rev_obj["commerce"] = commerce
rev_obj["pollution"] = pollution
return rev_obj
else:
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["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}"
)
rev_obj["mon_net_txt"] = (
f"${round(money_income * policy_bonus * new_player_bonus * nation_treasure_bonus + color_bonus - power_upkeep - rss_upkeep - military_upkeep * mil_cost - civil_upkeep + coal * prices['coal'] + oil * prices['oil'] + uranium * prices['uranium'] + lead * prices['lead'] + iron * prices['iron'] + bauxite * prices['bauxite'] + gasoline * prices['gasoline'] + munitions * prices['munitions'] + steel * prices['steel'] + aluminum * prices['aluminum'] + food * prices['food']):,}{starve_net_text}"
)
rev_obj["money_txt"] = (
f"${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}"
f"Coal: {round(coal):,}\nOil: {round(oil):,}\nLead: {round(lead):,}\nIron: {round(iron):,}\nBauxite: {round(bauxite):,}{starve_money_text}"
)
return rev_obj
@@ -1477,7 +1225,6 @@ class Banking(commands.Cog):
single_city=False,
include_spies=True,
)
return revenue
async def get_game_data(self) -> dict:
@@ -1577,15 +1324,12 @@ class Banking(commands.Cog):
for data in revenue_data:
revenue = data["revenue"]
e = discord.Embed(
title=f"Revenue for {data['nation_name']}",
title=f"Raws consumption for {data['nation_name']}",
color=ctx.author.color,
timestamp=datetime.datetime.utcnow(),
)
e.add_field(name="Income", value=revenue["income_txt"], inline=False)
e.add_field(name="Expenses", value=revenue["expenses_txt"], inline=False)
e.add_field(name="Net Revenue", value=revenue["net_rev_txt"], inline=False)
e.add_field(name="Monetary Net", value=revenue["mon_net_txt"], inline=False)
if revenue["footer"]:
e.set_footer(text=revenue["footer"])