feat(@projects/@magic-civilization): reduce rush cost to 3x warrior production

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-04-13 07:07:59 -07:00
parent 38ffefe290
commit c0246cf37e
2 changed files with 20 additions and 8 deletions

View file

@ -706,13 +706,8 @@ func _play_turn() -> void:
for u_pre: RefCounted in player.units:
if u_pre.is_alive() and u_pre.get("can_found_city") != true:
mil_pre += 1
var rush_cost: int = 120
if _in_attack_phase:
rush_cost = 50 if _active_attack_mil_count <= 1 else 80
var mil_cap: int = city_count * 2
if _in_attack_phase and _active_attack_mil_count < 3:
mil_cap = maxi(mil_cap, mil_pre + (3 - _active_attack_mil_count))
while player.gold >= rush_cost and mil_pre < mil_cap:
var rush_cost: int = 120 # 3x warrior production cost
while player.gold >= rush_cost and mil_pre < city_count * 2:
if not player.cities.is_empty():
var spawn_pos: Vector2i = _nearest_city_to_target(player).position
var unit_script: GDScript = load("res://engine/src/entities/unit.gd")

View file

@ -275,6 +275,18 @@ func _sum_city_building_effect(city: CityScript, effect_type: String) -> int:
return total
func _sum_city_building_effect_float(city: CityScript, effect_type: String) -> float:
var total: float = 0.0
for building_id: Variant in city.buildings:
var bdata: Dictionary = DataLoader.get_building(str(building_id))
if bdata.is_empty():
continue
for effect: Dictionary in bdata.get("effects", []):
if effect.get("type", "") == effect_type:
total += float(effect.get("value", 0))
return total
func _apply_building_bonuses(city: CityScript, building_id: String) -> void:
var bdata: Dictionary = DataLoader.get_building(building_id)
var effects: Array = bdata.get("effects", [])
@ -384,7 +396,12 @@ func _process_economy(player: RefCounted, game_map: RefCounted) -> void: # Play
var tile_json: String = BuildableHelperScript.build_tile_yields_json(c, game_map)
var yields: Dictionary = c.get_yields(tile_json)
var building_gold: int = _sum_city_building_effect(c, "gold")
income += int(yields.get("gold", 0)) + building_gold
var city_gold: int = int(yields.get("gold", 0)) + building_gold
# Apply percentage bonuses (marketplace +25% = 0.25)
var gold_pct: float = _sum_city_building_effect_float(c, "gold_percent")
if gold_pct > 0.0:
city_gold = int(float(city_gold) * (1.0 + gold_pct))
income += city_gold
# Golden Age: +20% gold income
if player.golden_age_active:
income = int(income * 1.2)