游戏可以运行
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -106,8 +106,7 @@ class Battlefield:
|
|||||||
if owner and owner.faction_id == "qin":
|
if owner and owner.faction_id == "qin":
|
||||||
owner.provisions += 1
|
owner.provisions += 1
|
||||||
|
|
||||||
if "no_retaliation" not in attacker.abilities:
|
if "no_retaliation" not in attacker.abilities and not attacker.is_ranged():
|
||||||
if not (attacker.is_ranged() and attacker.zone == "support"):
|
|
||||||
retal = defender.get_effective_defense() if defender.is_alive() else 0
|
retal = defender.get_effective_defense() if defender.is_alive() else 0
|
||||||
if retal > 0:
|
if retal > 0:
|
||||||
attacker.take_damage(retal)
|
attacker.take_damage(retal)
|
||||||
|
|||||||
@@ -60,10 +60,10 @@ class Card:
|
|||||||
self.buffs = [(a, d, t - 1) for a, d, t in self.buffs if t > 1]
|
self.buffs = [(a, d, t - 1) for a, d, t in self.buffs if t > 1]
|
||||||
|
|
||||||
def can_move_and_attack(self):
|
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):
|
def is_ranged(self):
|
||||||
return "ranged" in self.abilities
|
return self.unit_type == "archer" or "ranged" in self.abilities
|
||||||
|
|
||||||
def get_keywords(self):
|
def get_keywords(self):
|
||||||
result = []
|
result = []
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ RARITY_LIMITS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# --- Unit Types ---
|
# --- Unit Types ---
|
||||||
UNIT_TYPES = ["infantry", "cavalry", "chariot", "archer", "siege"]
|
UNIT_TYPES = ["infantry", "cavalry", "archer"]
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
# CARD DATABASE
|
# CARD DATABASE
|
||||||
@@ -142,7 +142,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 2,
|
"defense": 2,
|
||||||
"max_hp": 2,
|
"max_hp": 2,
|
||||||
"description": "弓手·可从营地射击",
|
"description": "弓手·可从营地射击",
|
||||||
"abilities": ["ranged"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"qin_bubing": {
|
"qin_bubing": {
|
||||||
@@ -172,7 +172,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 2,
|
"defense": 2,
|
||||||
"max_hp": 2,
|
"max_hp": 2,
|
||||||
"description": "骑兵·冲锋",
|
"description": "骑兵·冲锋",
|
||||||
"abilities": ["charge"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"qin_gongcheng": {
|
"qin_gongcheng": {
|
||||||
@@ -180,14 +180,14 @@ CARD_DATABASE = {
|
|||||||
"name": "攻城弩",
|
"name": "攻城弩",
|
||||||
"faction": "qin",
|
"faction": "qin",
|
||||||
"type": "unit",
|
"type": "unit",
|
||||||
"unit_type": "siege",
|
"unit_type": "archer",
|
||||||
"cost": 5,
|
"cost": 5,
|
||||||
"op_cost": 2,
|
"op_cost": 2,
|
||||||
"attack": 3,
|
"attack": 3,
|
||||||
"defense": 1,
|
"defense": 1,
|
||||||
"max_hp": 3,
|
"max_hp": 3,
|
||||||
"description": "攻城·对都城双倍伤害",
|
"description": "攻城·对都城双倍伤害",
|
||||||
"abilities": ["siege", "ranged"],
|
"abilities": ["siege"],
|
||||||
"rarity": "rare",
|
"rarity": "rare",
|
||||||
},
|
},
|
||||||
"qin_shangyang": {
|
"qin_shangyang": {
|
||||||
@@ -250,7 +250,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 2,
|
"defense": 2,
|
||||||
"max_hp": 3,
|
"max_hp": 3,
|
||||||
"description": "弓手·可从营地射击",
|
"description": "弓手·可从营地射击",
|
||||||
"abilities": ["ranged"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"qin_ruiqi": {
|
"qin_ruiqi": {
|
||||||
@@ -265,7 +265,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 2,
|
"defense": 2,
|
||||||
"max_hp": 2,
|
"max_hp": 2,
|
||||||
"description": "骑兵·冲锋",
|
"description": "骑兵·冲锋",
|
||||||
"abilities": ["charge"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"qin_fangzhen": {
|
"qin_fangzhen": {
|
||||||
@@ -339,7 +339,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 2,
|
"defense": 2,
|
||||||
"max_hp": 2,
|
"max_hp": 2,
|
||||||
"description": "弓手·可从营地射击",
|
"description": "弓手·可从营地射击",
|
||||||
"abilities": ["ranged"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"qi_tianqi": {
|
"qi_tianqi": {
|
||||||
@@ -347,7 +347,7 @@ CARD_DATABASE = {
|
|||||||
"name": "天齐战车",
|
"name": "天齐战车",
|
||||||
"faction": "qi",
|
"faction": "qi",
|
||||||
"type": "unit",
|
"type": "unit",
|
||||||
"unit_type": "chariot",
|
"unit_type": "infantry",
|
||||||
"cost": 5,
|
"cost": 5,
|
||||||
"op_cost": 2,
|
"op_cost": 2,
|
||||||
"attack": 4,
|
"attack": 4,
|
||||||
@@ -417,7 +417,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 2,
|
"defense": 2,
|
||||||
"max_hp": 2,
|
"max_hp": 2,
|
||||||
"description": "弓手·可从营地射击",
|
"description": "弓手·可从营地射击",
|
||||||
"abilities": ["ranged"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"qi_shangdui": {
|
"qi_shangdui": {
|
||||||
@@ -506,7 +506,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 3,
|
"defense": 3,
|
||||||
"max_hp": 3,
|
"max_hp": 3,
|
||||||
"description": "弓手·可从营地射击",
|
"description": "弓手·可从营地射击",
|
||||||
"abilities": ["ranged"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"chu_zhancha": {
|
"chu_zhancha": {
|
||||||
@@ -514,7 +514,7 @@ CARD_DATABASE = {
|
|||||||
"name": "楚战车",
|
"name": "楚战车",
|
||||||
"faction": "chu",
|
"faction": "chu",
|
||||||
"type": "unit",
|
"type": "unit",
|
||||||
"unit_type": "chariot",
|
"unit_type": "infantry",
|
||||||
"cost": 5,
|
"cost": 5,
|
||||||
"op_cost": 2,
|
"op_cost": 2,
|
||||||
"attack": 4,
|
"attack": 4,
|
||||||
@@ -584,7 +584,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 2,
|
"defense": 2,
|
||||||
"max_hp": 2,
|
"max_hp": 2,
|
||||||
"description": "骑兵·冲锋",
|
"description": "骑兵·冲锋",
|
||||||
"abilities": ["charge"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"chu_nushou": {
|
"chu_nushou": {
|
||||||
@@ -599,7 +599,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 2,
|
"defense": 2,
|
||||||
"max_hp": 2,
|
"max_hp": 2,
|
||||||
"description": "弓手·可从营地射击",
|
"description": "弓手·可从营地射击",
|
||||||
"abilities": ["ranged"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"chu_wuzhu2": {
|
"chu_wuzhu2": {
|
||||||
@@ -643,7 +643,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 1,
|
"defense": 1,
|
||||||
"max_hp": 2,
|
"max_hp": 2,
|
||||||
"description": "骑兵·行动费用-1",
|
"description": "骑兵·行动费用-1",
|
||||||
"abilities": ["charge"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"yan_cike": {
|
"yan_cike": {
|
||||||
@@ -688,7 +688,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 2,
|
"defense": 2,
|
||||||
"max_hp": 2,
|
"max_hp": 2,
|
||||||
"description": "弓手·可从营地射击",
|
"description": "弓手·可从营地射击",
|
||||||
"abilities": ["ranged"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"yan_jingke": {
|
"yan_jingke": {
|
||||||
@@ -766,7 +766,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 1,
|
"defense": 1,
|
||||||
"max_hp": 2,
|
"max_hp": 2,
|
||||||
"description": "骑兵·冲锋·行动费用-1",
|
"description": "骑兵·冲锋·行动费用-1",
|
||||||
"abilities": ["charge"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"yan_chihou": {
|
"yan_chihou": {
|
||||||
@@ -822,7 +822,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 3,
|
"defense": 3,
|
||||||
"max_hp": 3,
|
"max_hp": 3,
|
||||||
"description": "弓手·可从营地射击",
|
"description": "弓手·可从营地射击",
|
||||||
"abilities": ["ranged"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"han_shushi": {
|
"han_shushi": {
|
||||||
@@ -867,7 +867,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 2,
|
"defense": 2,
|
||||||
"max_hp": 3,
|
"max_hp": 3,
|
||||||
"description": "骑兵·冲锋",
|
"description": "骑兵·冲锋",
|
||||||
"abilities": ["charge"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"han_weiwei": {
|
"han_weiwei": {
|
||||||
@@ -930,7 +930,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 3,
|
"defense": 3,
|
||||||
"max_hp": 3,
|
"max_hp": 3,
|
||||||
"description": "弓手·可从营地射击",
|
"description": "弓手·可从营地射击",
|
||||||
"abilities": ["ranged"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"han_tiejiang": {
|
"han_tiejiang": {
|
||||||
@@ -989,7 +989,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 2,
|
"defense": 2,
|
||||||
"max_hp": 2,
|
"max_hp": 2,
|
||||||
"description": "骑兵·冲锋",
|
"description": "骑兵·冲锋",
|
||||||
"abilities": ["charge"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"zhao_tieqi": {
|
"zhao_tieqi": {
|
||||||
@@ -1004,7 +1004,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 3,
|
"defense": 3,
|
||||||
"max_hp": 4,
|
"max_hp": 4,
|
||||||
"description": "骑兵·无视报复",
|
"description": "骑兵·无视报复",
|
||||||
"abilities": ["charge", "no_retaliation"],
|
"abilities": ["no_retaliation"],
|
||||||
"rarity": "rare",
|
"rarity": "rare",
|
||||||
},
|
},
|
||||||
"zhao_bubing": {
|
"zhao_bubing": {
|
||||||
@@ -1034,7 +1034,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 2,
|
"defense": 2,
|
||||||
"max_hp": 2,
|
"max_hp": 2,
|
||||||
"description": "弓手·可从营地射击",
|
"description": "弓手·可从营地射击",
|
||||||
"abilities": ["ranged"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"zhao_qixi": {
|
"zhao_qixi": {
|
||||||
@@ -1097,7 +1097,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 2,
|
"defense": 2,
|
||||||
"max_hp": 3,
|
"max_hp": 3,
|
||||||
"description": "骑兵·冲锋",
|
"description": "骑兵·冲锋",
|
||||||
"abilities": ["charge"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"zhao_gongshou2": {
|
"zhao_gongshou2": {
|
||||||
@@ -1112,7 +1112,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 2,
|
"defense": 2,
|
||||||
"max_hp": 2,
|
"max_hp": 2,
|
||||||
"description": "弓手·可从营地射击",
|
"description": "弓手·可从营地射击",
|
||||||
"abilities": ["ranged"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"zhao_qiangbing": {
|
"zhao_qiangbing": {
|
||||||
@@ -1186,7 +1186,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 2,
|
"defense": 2,
|
||||||
"max_hp": 2,
|
"max_hp": 2,
|
||||||
"description": "弓手·可从营地射击",
|
"description": "弓手·可从营地射击",
|
||||||
"abilities": ["ranged"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"wei_qibing": {
|
"wei_qibing": {
|
||||||
@@ -1201,7 +1201,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 2,
|
"defense": 2,
|
||||||
"max_hp": 3,
|
"max_hp": 3,
|
||||||
"description": "骑兵·冲锋",
|
"description": "骑兵·冲锋",
|
||||||
"abilities": ["charge"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"wei_zhengjun": {
|
"wei_zhengjun": {
|
||||||
@@ -1279,7 +1279,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 3,
|
"defense": 3,
|
||||||
"max_hp": 3,
|
"max_hp": 3,
|
||||||
"description": "弓手·可从营地射击",
|
"description": "弓手·可从营地射击",
|
||||||
"abilities": ["ranged"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"wei_zhancha": {
|
"wei_zhancha": {
|
||||||
@@ -1287,7 +1287,7 @@ CARD_DATABASE = {
|
|||||||
"name": "魏战车",
|
"name": "魏战车",
|
||||||
"faction": "wei",
|
"faction": "wei",
|
||||||
"type": "unit",
|
"type": "unit",
|
||||||
"unit_type": "chariot",
|
"unit_type": "infantry",
|
||||||
"cost": 5,
|
"cost": 5,
|
||||||
"op_cost": 2,
|
"op_cost": 2,
|
||||||
"attack": 4,
|
"attack": 4,
|
||||||
@@ -1414,7 +1414,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 2,
|
"defense": 2,
|
||||||
"max_hp": 2,
|
"max_hp": 2,
|
||||||
"description": "骑兵·冲锋",
|
"description": "骑兵·冲锋",
|
||||||
"abilities": ["charge"],
|
"abilities": [],
|
||||||
"rarity": "rare",
|
"rarity": "rare",
|
||||||
},
|
},
|
||||||
"ally_song_yishang": {
|
"ally_song_yishang": {
|
||||||
@@ -1474,7 +1474,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 3,
|
"defense": 3,
|
||||||
"max_hp": 3,
|
"max_hp": 3,
|
||||||
"description": "弓手·可从营地射击",
|
"description": "弓手·可从营地射击",
|
||||||
"abilities": ["ranged"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"ally_wu_wuzixu": {
|
"ally_wu_wuzixu": {
|
||||||
@@ -1714,7 +1714,7 @@ CARD_DATABASE = {
|
|||||||
"defense": 2,
|
"defense": 2,
|
||||||
"max_hp": 2,
|
"max_hp": 2,
|
||||||
"description": "弓手·可从营地射击",
|
"description": "弓手·可从营地射击",
|
||||||
"abilities": ["ranged"],
|
"abilities": [],
|
||||||
"rarity": "common",
|
"rarity": "common",
|
||||||
},
|
},
|
||||||
"ally_cai_qingtong": {
|
"ally_cai_qingtong": {
|
||||||
|
|||||||
@@ -257,8 +257,8 @@ class UI:
|
|||||||
|
|
||||||
# Line 2: type + stats
|
# Line 2: type + stats
|
||||||
if card_data["type"] == "unit":
|
if card_data["type"] == "unit":
|
||||||
icon = {"infantry": "步", "cavalry": "骑", "chariot": "车",
|
icon = {"infantry": "步", "cavalry": "骑",
|
||||||
"archer": "弓", "siege": "攻"}.get(card_data.get("unit_type"), "?")
|
"archer": "弓"}.get(card_data.get("unit_type"), "?")
|
||||||
stats = f"{icon} 攻{card_data['attack']} 防{card_data['defense']} 血{card_data['max_hp']}"
|
stats = f"{icon} 攻{card_data['attack']} 防{card_data['defense']} 血{card_data['max_hp']}"
|
||||||
else:
|
else:
|
||||||
stats = f"谋略: {card_data['description'][:12]}"
|
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))
|
self.screen.blit(cs, (x + small_w - cs.get_width() - 4, y + 3))
|
||||||
|
|
||||||
if card_data["type"] == "unit":
|
if card_data["type"] == "unit":
|
||||||
icon = {"infantry": "步", "cavalry": "骑", "chariot": "车",
|
icon = {"infantry": "步", "cavalry": "骑",
|
||||||
"archer": "弓", "siege": "攻"}.get(card_data.get("unit_type"), "?")
|
"archer": "弓"}.get(card_data.get("unit_type"), "?")
|
||||||
stats = f"{icon} 攻{card_data['attack']} 防{card_data['defense']} 血{card_data['max_hp']}"
|
stats = f"{icon} 攻{card_data['attack']} 防{card_data['defense']} 血{card_data['max_hp']}"
|
||||||
else:
|
else:
|
||||||
stats = f"谋略: {card_data['description'][:12]}"
|
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))
|
self.screen.blit(name_surf, (x + w // 2 - name_surf.get_width() // 2, y + 3))
|
||||||
|
|
||||||
# Unit type icon
|
# Unit type icon
|
||||||
icon_char = {"infantry": "步", "cavalry": "骑", "chariot": "车",
|
icon_char = {"infantry": "步", "cavalry": "骑",
|
||||||
"archer": "弓", "siege": "攻"}.get(unit.unit_type, "?")
|
"archer": "弓"}.get(unit.unit_type, "?")
|
||||||
self.screen.blit(self.font_sm.render(icon_char, True, TENG_HUANG), (x + 3, y + 3))
|
self.screen.blit(self.font_sm.render(icon_char, True, TENG_HUANG), (x + 3, y + 3))
|
||||||
|
|
||||||
# Operation cost
|
# Operation cost
|
||||||
@@ -564,8 +564,8 @@ class UI:
|
|||||||
self.screen.blit(name_surf, (x + w // 2 - name_surf.get_width() // 2, y + 28))
|
self.screen.blit(name_surf, (x + w // 2 - name_surf.get_width() // 2, y + 28))
|
||||||
|
|
||||||
if card.card_type == "unit":
|
if card.card_type == "unit":
|
||||||
icon = {"infantry": "步", "cavalry": "骑", "chariot": "车",
|
icon = {"infantry": "步", "cavalry": "骑",
|
||||||
"archer": "弓", "siege": "攻"}.get(card.unit_type, "?")
|
"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_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.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))
|
self.screen.blit(self.font_md.render(str(card.defense), True, (60, 80, 160)), (x + w - 15, y + h - 22))
|
||||||
|
|||||||
Reference in New Issue
Block a user