Files
card/card_game/factions.py
2026-05-24 08:10:22 +08:00

21 lines
646 B
Python

"""Faction ability system: applies passive bonuses."""
def get_passive_bonus(faction_id, bonus_type):
"""Get passive bonus value for a faction."""
bonuses = {
"zhao": {"cavalry_attack": 1},
"wei": {"infantry_defense": 1},
}
return bonuses.get(faction_id, {}).get(bonus_type, 0)
def apply_faction_passive(unit, faction_id):
"""Apply faction passive to a unit at deploy time."""
if faction_id == "zhao" and unit.unit_type == "cavalry":
unit.attack += 1
elif faction_id == "wei" and unit.unit_type == "infantry":
unit.defense += 1
unit.max_hp += 1
unit.current_hp += 1