diff --git a/card_game/__pycache__/battlefield.cpython-312.pyc b/card_game/__pycache__/battlefield.cpython-312.pyc index 7f9e9ab..4ef0b95 100644 Binary files a/card_game/__pycache__/battlefield.cpython-312.pyc and b/card_game/__pycache__/battlefield.cpython-312.pyc differ diff --git a/card_game/__pycache__/card.cpython-312.pyc b/card_game/__pycache__/card.cpython-312.pyc index 9ab4b0d..0f6307b 100644 Binary files a/card_game/__pycache__/card.cpython-312.pyc and b/card_game/__pycache__/card.cpython-312.pyc differ diff --git a/card_game/__pycache__/config.cpython-312.pyc b/card_game/__pycache__/config.cpython-312.pyc index 17799a9..7067ebf 100644 Binary files a/card_game/__pycache__/config.cpython-312.pyc and b/card_game/__pycache__/config.cpython-312.pyc differ diff --git a/card_game/__pycache__/ui.cpython-312.pyc b/card_game/__pycache__/ui.cpython-312.pyc index b23266e..f4a5550 100644 Binary files a/card_game/__pycache__/ui.cpython-312.pyc and b/card_game/__pycache__/ui.cpython-312.pyc differ diff --git a/card_game/battlefield.py b/card_game/battlefield.py index 2e16a46..18ebd8f 100644 --- a/card_game/battlefield.py +++ b/card_game/battlefield.py @@ -106,8 +106,7 @@ class Battlefield: if owner and owner.faction_id == "qin": owner.provisions += 1 - if "no_retaliation" not in attacker.abilities: - if not (attacker.is_ranged() and attacker.zone == "support"): + if "no_retaliation" not in attacker.abilities and not attacker.is_ranged(): retal = defender.get_effective_defense() if defender.is_alive() else 0 if retal > 0: attacker.take_damage(retal) diff --git a/card_game/card.py b/card_game/card.py index 95fc47c..4fc12f4 100644 --- a/card_game/card.py +++ b/card_game/card.py @@ -60,10 +60,10 @@ class Card: self.buffs = [(a, d, t - 1) for a, d, t in self.buffs if t > 1] def can_move_and_attack(self): - return "charge" in self.abilities + return self.unit_type == "cavalry" or "charge" in self.abilities def is_ranged(self): - return "ranged" in self.abilities + return self.unit_type == "archer" or "ranged" in self.abilities def get_keywords(self): result = [] diff --git a/card_game/config.py b/card_game/config.py index 766ce5d..7d3e3ba 100644 --- a/card_game/config.py +++ b/card_game/config.py @@ -108,7 +108,7 @@ RARITY_LIMITS = { } # --- Unit Types --- -UNIT_TYPES = ["infantry", "cavalry", "chariot", "archer", "siege"] +UNIT_TYPES = ["infantry", "cavalry", "archer"] # ============================================================ # CARD DATABASE @@ -142,7 +142,7 @@ CARD_DATABASE = { "defense": 2, "max_hp": 2, "description": "弓手·可从营地射击", - "abilities": ["ranged"], + "abilities": [], "rarity": "common", }, "qin_bubing": { @@ -172,7 +172,7 @@ CARD_DATABASE = { "defense": 2, "max_hp": 2, "description": "骑兵·冲锋", - "abilities": ["charge"], + "abilities": [], "rarity": "common", }, "qin_gongcheng": { @@ -180,14 +180,14 @@ CARD_DATABASE = { "name": "攻城弩", "faction": "qin", "type": "unit", - "unit_type": "siege", + "unit_type": "archer", "cost": 5, "op_cost": 2, "attack": 3, "defense": 1, "max_hp": 3, "description": "攻城·对都城双倍伤害", - "abilities": ["siege", "ranged"], + "abilities": ["siege"], "rarity": "rare", }, "qin_shangyang": { @@ -250,7 +250,7 @@ CARD_DATABASE = { "defense": 2, "max_hp": 3, "description": "弓手·可从营地射击", - "abilities": ["ranged"], + "abilities": [], "rarity": "common", }, "qin_ruiqi": { @@ -265,7 +265,7 @@ CARD_DATABASE = { "defense": 2, "max_hp": 2, "description": "骑兵·冲锋", - "abilities": ["charge"], + "abilities": [], "rarity": "common", }, "qin_fangzhen": { @@ -339,7 +339,7 @@ CARD_DATABASE = { "defense": 2, "max_hp": 2, "description": "弓手·可从营地射击", - "abilities": ["ranged"], + "abilities": [], "rarity": "common", }, "qi_tianqi": { @@ -347,7 +347,7 @@ CARD_DATABASE = { "name": "天齐战车", "faction": "qi", "type": "unit", - "unit_type": "chariot", + "unit_type": "infantry", "cost": 5, "op_cost": 2, "attack": 4, @@ -417,7 +417,7 @@ CARD_DATABASE = { "defense": 2, "max_hp": 2, "description": "弓手·可从营地射击", - "abilities": ["ranged"], + "abilities": [], "rarity": "common", }, "qi_shangdui": { @@ -506,7 +506,7 @@ CARD_DATABASE = { "defense": 3, "max_hp": 3, "description": "弓手·可从营地射击", - "abilities": ["ranged"], + "abilities": [], "rarity": "common", }, "chu_zhancha": { @@ -514,7 +514,7 @@ CARD_DATABASE = { "name": "楚战车", "faction": "chu", "type": "unit", - "unit_type": "chariot", + "unit_type": "infantry", "cost": 5, "op_cost": 2, "attack": 4, @@ -584,7 +584,7 @@ CARD_DATABASE = { "defense": 2, "max_hp": 2, "description": "骑兵·冲锋", - "abilities": ["charge"], + "abilities": [], "rarity": "common", }, "chu_nushou": { @@ -599,7 +599,7 @@ CARD_DATABASE = { "defense": 2, "max_hp": 2, "description": "弓手·可从营地射击", - "abilities": ["ranged"], + "abilities": [], "rarity": "common", }, "chu_wuzhu2": { @@ -643,7 +643,7 @@ CARD_DATABASE = { "defense": 1, "max_hp": 2, "description": "骑兵·行动费用-1", - "abilities": ["charge"], + "abilities": [], "rarity": "common", }, "yan_cike": { @@ -688,7 +688,7 @@ CARD_DATABASE = { "defense": 2, "max_hp": 2, "description": "弓手·可从营地射击", - "abilities": ["ranged"], + "abilities": [], "rarity": "common", }, "yan_jingke": { @@ -766,7 +766,7 @@ CARD_DATABASE = { "defense": 1, "max_hp": 2, "description": "骑兵·冲锋·行动费用-1", - "abilities": ["charge"], + "abilities": [], "rarity": "common", }, "yan_chihou": { @@ -822,7 +822,7 @@ CARD_DATABASE = { "defense": 3, "max_hp": 3, "description": "弓手·可从营地射击", - "abilities": ["ranged"], + "abilities": [], "rarity": "common", }, "han_shushi": { @@ -867,7 +867,7 @@ CARD_DATABASE = { "defense": 2, "max_hp": 3, "description": "骑兵·冲锋", - "abilities": ["charge"], + "abilities": [], "rarity": "common", }, "han_weiwei": { @@ -930,7 +930,7 @@ CARD_DATABASE = { "defense": 3, "max_hp": 3, "description": "弓手·可从营地射击", - "abilities": ["ranged"], + "abilities": [], "rarity": "common", }, "han_tiejiang": { @@ -989,7 +989,7 @@ CARD_DATABASE = { "defense": 2, "max_hp": 2, "description": "骑兵·冲锋", - "abilities": ["charge"], + "abilities": [], "rarity": "common", }, "zhao_tieqi": { @@ -1004,7 +1004,7 @@ CARD_DATABASE = { "defense": 3, "max_hp": 4, "description": "骑兵·无视报复", - "abilities": ["charge", "no_retaliation"], + "abilities": ["no_retaliation"], "rarity": "rare", }, "zhao_bubing": { @@ -1034,7 +1034,7 @@ CARD_DATABASE = { "defense": 2, "max_hp": 2, "description": "弓手·可从营地射击", - "abilities": ["ranged"], + "abilities": [], "rarity": "common", }, "zhao_qixi": { @@ -1097,7 +1097,7 @@ CARD_DATABASE = { "defense": 2, "max_hp": 3, "description": "骑兵·冲锋", - "abilities": ["charge"], + "abilities": [], "rarity": "common", }, "zhao_gongshou2": { @@ -1112,7 +1112,7 @@ CARD_DATABASE = { "defense": 2, "max_hp": 2, "description": "弓手·可从营地射击", - "abilities": ["ranged"], + "abilities": [], "rarity": "common", }, "zhao_qiangbing": { @@ -1186,7 +1186,7 @@ CARD_DATABASE = { "defense": 2, "max_hp": 2, "description": "弓手·可从营地射击", - "abilities": ["ranged"], + "abilities": [], "rarity": "common", }, "wei_qibing": { @@ -1201,7 +1201,7 @@ CARD_DATABASE = { "defense": 2, "max_hp": 3, "description": "骑兵·冲锋", - "abilities": ["charge"], + "abilities": [], "rarity": "common", }, "wei_zhengjun": { @@ -1279,7 +1279,7 @@ CARD_DATABASE = { "defense": 3, "max_hp": 3, "description": "弓手·可从营地射击", - "abilities": ["ranged"], + "abilities": [], "rarity": "common", }, "wei_zhancha": { @@ -1287,7 +1287,7 @@ CARD_DATABASE = { "name": "魏战车", "faction": "wei", "type": "unit", - "unit_type": "chariot", + "unit_type": "infantry", "cost": 5, "op_cost": 2, "attack": 4, @@ -1414,7 +1414,7 @@ CARD_DATABASE = { "defense": 2, "max_hp": 2, "description": "骑兵·冲锋", - "abilities": ["charge"], + "abilities": [], "rarity": "rare", }, "ally_song_yishang": { @@ -1474,7 +1474,7 @@ CARD_DATABASE = { "defense": 3, "max_hp": 3, "description": "弓手·可从营地射击", - "abilities": ["ranged"], + "abilities": [], "rarity": "common", }, "ally_wu_wuzixu": { @@ -1714,7 +1714,7 @@ CARD_DATABASE = { "defense": 2, "max_hp": 2, "description": "弓手·可从营地射击", - "abilities": ["ranged"], + "abilities": [], "rarity": "common", }, "ally_cai_qingtong": { diff --git a/card_game/ui.py b/card_game/ui.py index 7e78d04..410a0d7 100644 --- a/card_game/ui.py +++ b/card_game/ui.py @@ -257,8 +257,8 @@ class UI: # Line 2: type + stats if card_data["type"] == "unit": - icon = {"infantry": "步", "cavalry": "骑", "chariot": "车", - "archer": "弓", "siege": "攻"}.get(card_data.get("unit_type"), "?") + icon = {"infantry": "步", "cavalry": "骑", + "archer": "弓"}.get(card_data.get("unit_type"), "?") stats = f"{icon} 攻{card_data['attack']} 防{card_data['defense']} 血{card_data['max_hp']}" else: stats = f"谋略: {card_data['description'][:12]}" @@ -297,8 +297,8 @@ class UI: self.screen.blit(cs, (x + small_w - cs.get_width() - 4, y + 3)) if card_data["type"] == "unit": - icon = {"infantry": "步", "cavalry": "骑", "chariot": "车", - "archer": "弓", "siege": "攻"}.get(card_data.get("unit_type"), "?") + icon = {"infantry": "步", "cavalry": "骑", + "archer": "弓"}.get(card_data.get("unit_type"), "?") stats = f"{icon} 攻{card_data['attack']} 防{card_data['defense']} 血{card_data['max_hp']}" else: stats = f"谋略: {card_data['description'][:12]}" @@ -492,8 +492,8 @@ class UI: self.screen.blit(name_surf, (x + w // 2 - name_surf.get_width() // 2, y + 3)) # Unit type icon - icon_char = {"infantry": "步", "cavalry": "骑", "chariot": "车", - "archer": "弓", "siege": "攻"}.get(unit.unit_type, "?") + icon_char = {"infantry": "步", "cavalry": "骑", + "archer": "弓"}.get(unit.unit_type, "?") self.screen.blit(self.font_sm.render(icon_char, True, TENG_HUANG), (x + 3, y + 3)) # Operation cost @@ -564,8 +564,8 @@ class UI: self.screen.blit(name_surf, (x + w // 2 - name_surf.get_width() // 2, y + 28)) if card.card_type == "unit": - icon = {"infantry": "步", "cavalry": "骑", "chariot": "车", - "archer": "弓", "siege": "攻"}.get(card.unit_type, "?") + icon = {"infantry": "步", "cavalry": "骑", + "archer": "弓"}.get(card.unit_type, "?") self.screen.blit(self.font_sm.render(icon, True, TENG_HUANG), (x + 3, y + h - 40)) self.screen.blit(self.font_md.render(str(card.attack), True, (200, 80, 60)), (x + 5, y + h - 22)) self.screen.blit(self.font_md.render(str(card.defense), True, (60, 80, 160)), (x + w - 15, y + h - 22))