游戏可以运行

This commit is contained in:
2026-05-24 08:10:22 +08:00
commit 035b2f7af9
28 changed files with 4222 additions and 0 deletions

20
card_game/factions.py Normal file
View File

@@ -0,0 +1,20 @@
"""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