src / enemies.py
"""
敌人类型系统 - 20种子类型实现
"""
import random
from typing import List, Dict, Optional, Tuple
class Enemy:
"""敌人基类"""
def __init__(self, enemy_type: str, subtype: str, hp_range: Tuple[int, int],
morale: int, weapons: List[Dict], armor: str, behavior: str,
drop_table: List[Dict], negotiation_base: float):
self.type = enemy_type
self.subtype = subtype
self.hp = random.randint(*hp_range)
self.max_hp = self.hp
self.base_morale = morale
self.morale = morale
self.weapons = weapons
self.armor = armor
self.behavior = behavior
self.drop_table = drop_table
self.negotiation_base = negotiation_base
self.cover = None
self.position = (0, 0)
self.alive = True
self.surrendered = False
self.fled = False
self.id = f"{enemy_type}_{subtype}_{random.randint(1000, 9999)}"
self.name = f"{subtype}"
# 战斗系统字段(Combat 类访问)
self.ap = 3 # 行动点(每回合重置)
self.state = "normal"
def ai_behavior(self, combat_state: Dict) -> str:
"""AI行为决策,返回动作建议"""
if not self.alive:
return 'none'
# 基础行为逻辑
if self.hp < self.max_hp * 0.3 and self.morale < 40:
return 'flee'
if self.morale < 20:
return 'surrender'
# 根据行为模式决定
if self.behavior == 'aggressive':
return 'shoot'
elif self.behavior == 'defensive':
return 'cover'
elif self.behavior == 'tactical':
return 'aim'
elif self.behavior == 'cowardly':
if self.hp < self.max_hp * 0.5:
return 'flee'
return 'shoot'
else:
return 'shoot'
def drop_loot(self) -> List[Dict]:
"""掉落物品"""
if self.alive and not self.surrendered:
return []
loot = []
for item in self.drop_table:
if random.random() < item.get('chance', 1.0):
loot.append({
'name': item['name'],
'quantity': random.randint(item.get('min', 1), item.get('max', 1)),
'type': item.get('type', 'item')
})
return loot
def surrender_check(self, current_morale: int) -> bool:
"""检查是否投降"""
if current_morale < 10:
self.surrendered = True
return True
elif current_morale < 30:
if random.random() < 0.4:
self.surrendered = True
return True
return False
def flee_check(self, current_morale: int) -> bool:
"""检查是否逃跑"""
if 30 <= current_morale < 50:
if random.random() < 0.3:
self.fled = True
return True
return False
def take_damage(self, damage: int, body_part: str = 'torso'):
"""受到伤害"""
# 部位修正
modifiers = {'head': 2.0, 'torso': 1.0, 'limbs': 0.5}
mod = modifiers.get(body_part, 1.0)
actual_damage = int(damage * mod)
self.hp -= actual_damage
if self.hp <= 0:
self.hp = 0
self.alive = False
# 士气影响
morale_penalty = max(5, actual_damage // 2)
self.morale = max(0, self.morale - morale_penalty)
return actual_damage
# ==================== 流民(3种) ====================
class PeasantRefugee(Enemy):
"""农民难民"""
def __init__(self):
super().__init__(
enemy_type='流民',
subtype='PeasantRefugee',
hp_range=(30, 40),
morale=35,
weapons=[
{'name': '锄头', 'damage': 5, 'accuracy': 0.5},
{'name': '镰刀', 'damage': 6, 'accuracy': 0.55},
{'name': '54手枪', 'damage': 15, 'accuracy': 0.6, 'chance': 0.2}
],
armor='padded_coat',
behavior='cowardly',
drop_table=[
{'name': '粗粮', 'min': 1, 'max': 3, 'chance': 0.7, 'type': 'food'},
{'name': '农具', 'min': 1, 'max': 1, 'chance': 0.5, 'type': 'tool'}
],
negotiation_base=0.60
)
class WorkerRefugee(Enemy):
"""工人难民"""
def __init__(self):
super().__init__(
enemy_type='流民',
subtype='WorkerRefugee',
hp_range=(40, 50),
morale=45,
weapons=[
{'name': '扳手', 'damage': 8, 'accuracy': 0.6},
{'name': '铁棍', 'damage': 10, 'accuracy': 0.65},
{'name': '56冲', 'damage': 20, 'accuracy': 0.7, 'chance': 0.15}
],
armor='coat',
behavior='defensive',
drop_table=[
{'name': '工具包', 'min': 1, 'max': 1, 'chance': 0.6, 'type': 'tool'},
{'name': '干粮', 'min': 2, 'max': 4, 'chance': 0.8, 'type': 'food'}
],
negotiation_base=0.45
)
class StudentRefugee(Enemy):
"""学生难民(可成队友)"""
def __init__(self):
super().__init__(
enemy_type='流民',
subtype='StudentRefugee',
hp_range=(25, 35),
morale=50,
weapons=[
{'name': '棍棒', 'damage': 4, 'accuracy': 0.5},
{'name': '54手枪', 'damage': 15, 'accuracy': 0.6, 'chance': 0.25}
],
armor='none',
behavior='tactical',
drop_table=[
{'name': '书籍', 'min': 1, 'max': 2, 'chance': 0.8, 'type': 'misc'},
{'name': '笔记本', 'min': 1, 'max': 1, 'chance': 0.6, 'type': 'misc'}
],
negotiation_base=0.55
)
def can_become_ally(self) -> bool:
"""可能成为队友"""
return self.surrendered and self.morale > 30
# ==================== 土匪(3种) ====================
class RebelBandit(Enemy):
"""造反派土匪(毛主席语录+20%谈判)"""
def __init__(self):
super().__init__(
enemy_type='土匪',
subtype='RebelBandit',
hp_range=(50, 60),
morale=55,
weapons=[
{'name': '56冲', 'damage': 20, 'accuracy': 0.7},
{'name': '54手枪', 'damage': 15, 'accuracy': 0.65},
{'name': '手榴弹', 'damage': 30, 'accuracy': 0.5, 'chance': 0.3}
],
armor='coat',
behavior='aggressive',
drop_table=[
{'name': '56冲子弹', 'min': 10, 'max': 30, 'chance': 0.8, 'type': 'ammo'},
{'name': '手榴弹', 'min': 1, 'max': 2, 'chance': 0.4, 'type': 'weapon'},
{'name': '毛主席语录', 'min': 1, 'max': 1, 'chance': 0.6, 'type': 'misc'}
],
negotiation_base=0.35
)
def negotiate_modifier(self, options: Dict) -> float:
if options.get('use_mao_quote'):
return 0.20
return 0.0
class ExConvictBandit(Enemy):
"""劳改犯土匪(死战不降)"""
def __init__(self):
super().__init__(
enemy_type='土匪',
subtype='ExConvictBandit',
hp_range=(60, 70),
morale=60,
weapons=[
{'name': '56冲', 'damage': 20, 'accuracy': 0.7},
{'name': '猎枪', 'damage': 25, 'accuracy': 0.6},
{'name': '匕首', 'damage': 10, 'accuracy': 0.75}
],
armor='vest',
behavior='aggressive',
drop_table=[
{'name': '56冲子弹', 'min': 15, 'max': 40, 'chance': 0.9, 'type': 'ammo'},
{'name': '猎枪弹药', 'min': 5, 'max': 15, 'chance': 0.6, 'type': 'ammo'},
{'name': '现金', 'min': 50, 'max': 200, 'chance': 0.5, 'type': 'money'}
],
negotiation_base=0.25
)
def surrender_check(self, current_morale: int) -> bool:
"""死战不降"""
return False
class OpportunistBandit(Enemy):
"""投机分子土匪(利诱+30%)"""
def __init__(self):
super().__init__(
enemy_type='土匪',
subtype='OpportunistBandit',
hp_range=(50, 60),
morale=50,
weapons=[
{'name': '56冲', 'damage': 20, 'accuracy': 0.7},
{'name': '猎枪', 'damage': 25, 'accuracy': 0.6},
{'name': '手榴弹', 'damage': 30, 'accuracy': 0.5, 'chance': 0.25}
],
armor='coat',
behavior='tactical',
drop_table=[
{'name': '56冲子弹', 'min': 10, 'max': 25, 'chance': 0.7, 'type': 'ammo'},
{'name': '贵重物品', 'min': 1, 'max': 3, 'chance': 0.5, 'type': 'valuable'},
{'name': '现金', 'min': 100, 'max': 500, 'chance': 0.6, 'type': 'money'}
],
negotiation_base=0.40
)
def negotiate_modifier(self, options: Dict) -> float:
if options.get('action') == 'bribe':
return 0.30
return 0.0
class PLARouted(Enemy):
"""解放军溃军(士气低+20%信任-50)"""
def __init__(self):
super().__init__(
enemy_type='解放军残部',
subtype='PLARouted',
hp_range=(40, 60),
morale=30,
weapons=[
{'name': '56半', 'damage': 25, 'accuracy': 0.6},
{'name': '刺刀', 'damage': 12, 'accuracy': 0.65}
],
armor='coat',
behavior='defensive',
drop_table=[
{'name': '56半', 'min': 1, 'max': 1, 'chance': 0.4, 'type': 'weapon'},
{'name': '7.62mm子弹', 'min': 10, 'max': 30, 'chance': 0.7, 'type': 'ammo'}
],
negotiation_base=0.40
)
class PLACavalry(Enemy):
"""解放军骑兵(友军,战术AI+马刀冲锋)"""
def __init__(self):
super().__init__(
enemy_type='解放军骑兵',
subtype='PLACavalry',
hp_range=(70, 85),
morale=90,
weapons=[
{'name': '56半', 'damage': 25, 'accuracy': 0.75},
{'name': '马刀', 'damage': 18, 'accuracy': 0.70},
{'name': '56冲', 'damage': 20, 'accuracy': 0.75, 'chance': 0.2}
],
armor='vest',
behavior='tactical',
drop_table=[],
negotiation_base=0.70
)
self.is_ally = True
self.is_cavalry = True
def ai_behavior(self, combat_state: Dict) -> str:
"""骑兵AI行为决策"""
return 'shoot'
# ==================== 苏军残部(4种) ====================
class SovietInfantry(Enemy):
"""苏军步兵(俄语Lv2+30%信任+20)"""
def __init__(self):
super().__init__(
enemy_type='苏军残部',
subtype='SovietInfantry',
hp_range=(70, 80),
morale=70,
weapons=[
{'name': 'AK74', 'damage': 22, 'accuracy': 0.75},
{'name': '马卡洛夫', 'damage': 12, 'accuracy': 0.65},
{'name': '手榴弹', 'damage': 30, 'accuracy': 0.55, 'chance': 0.4}
],
armor='vest',
behavior='tactical',
drop_table=[
{'name': 'AK74', 'min': 1, 'max': 1, 'chance': 0.7, 'type': 'weapon'},
{'name': '7.62mm子弹', 'min': 20, 'max': 60, 'chance': 0.9, 'type': 'ammo'},
{'name': '苏军地图', 'min': 1, 'max': 1, 'chance': 0.3, 'type': 'intel'},
{'name': '伏特加', 'min': 1, 'max': 2, 'chance': 0.5, 'type': 'consumable'}
],
negotiation_base=0.30
)
def language_bonus(self, player_russian_level: int) -> float:
if player_russian_level >= 2:
return 0.30
return 0.0
class SovietCrew(Enemy):
"""苏军车组(BTR车体)"""
def __init__(self):
super().__init__(
enemy_type='苏军残部',
subtype='SovietCrew',
hp_range=(80, 100),
morale=75,
weapons=[
{'name': 'BTR机关枪', 'damage': 35, 'accuracy': 0.7},
{'name': 'AK74', 'damage': 22, 'accuracy': 0.75},
{'name': 'RPG-7', 'damage': 80, 'accuracy': 0.6, 'chance': 0.3}
],
armor='vest',
behavior='defensive',
drop_table=[
{'name': 'BTR载具', 'min': 1, 'max': 1, 'chance': 0.5, 'type': 'vehicle'},
{'name': '14.5mm弹药', 'min': 50, 'max': 150, 'chance': 0.8, 'type': 'ammo'},
{'name': 'RPG-7火箭弹', 'min': 2, 'max': 5, 'chance': 0.4, 'type': 'ammo'}
],
negotiation_base=0.25
)
class SovietSniper(Enemy):
"""苏军狙击手(一击HP-30)"""
def __init__(self):
super().__init__(
enemy_type='苏军残部',
subtype='SovietSniper',
hp_range=(60, 60),
morale=80,
weapons=[
{'name': 'SVD', 'damage': 30, 'accuracy': 0.85},
{'name': '马卡洛夫', 'damage': 12, 'accuracy': 0.65}
],
armor='coat',
behavior='tactical',
drop_table=[
{'name': 'SVD狙击枪', 'min': 1, 'max': 1, 'chance': 0.8, 'type': 'weapon'},
{'name': '7.62x54mm子弹', 'min': 10, 'max': 30, 'chance': 0.9, 'type': 'ammo'},
{'name': '狙击镜', 'min': 1, 'max': 1, 'chance': 0.6, 'type': 'equipment'}
],
negotiation_base=0.15
)
def special_attack(self, target) -> Tuple[int, str]:
"""特殊狙击攻击"""
if random.random() < 0.4:
return 30, '头部狙杀'
return 0, '未命中'
class SovietOfficer(Enemy):
"""苏军军官(击杀后其他苏军溃散,获地图)"""
def __init__(self):
super().__init__(
enemy_type='苏军残部',
subtype='SovietOfficer',
hp_range=(80, 100),
morale=85,
weapons=[
{'name': 'AK74', 'damage': 22, 'accuracy': 0.75},
{'name': '马卡洛夫', 'damage': 12, 'accuracy': 0.7},
{'name': '指挥刀', 'damage': 15, 'accuracy': 0.7}
],
armor='vest',
behavior='tactical',
drop_table=[
{'name': '苏军作战地图', 'min': 1, 'max': 1, 'chance': 1.0, 'type': 'intel'},
{'name': '军官证', 'min': 1, 'max': 1, 'chance': 0.8, 'type': 'document'},
{'name': 'AK74', 'min': 1, 'max': 1, 'chance': 0.7, 'type': 'weapon'},
{'name': '望远镜', 'min': 1, 'max': 1, 'chance': 0.5, 'type': 'equipment'}
],
negotiation_base=0.20
)
def on_death_effect(self, combat_state: Dict) -> List[str]:
"""死亡效果:其他苏军溃散"""
effects = []
for enemy in combat_state.get('enemies', []):
if enemy.type == '苏军残部' and enemy.alive:
enemy.morale = max(0, enemy.morale - 30)
effects.append(f'{enemy.name}因军官阵亡而溃散')
return effects
class SovietParatrooper(Enemy):
"""苏军空降兵(敌对,RPG+AK74组合)"""
def __init__(self):
super().__init__(
enemy_type='苏军残部',
subtype='SovietParatrooper',
hp_range=(75, 90),
morale=85,
armor='vest',
behavior='tactical',
weapons=[
{'name': 'AK74', 'damage': 22, 'accuracy': 0.75},
{'name': 'RPG-7', 'damage': 80, 'accuracy': 0.55, 'chance': 0.25},
{'name': '手榴弹', 'damage': 30, 'accuracy': 0.50, 'chance': 0.3}
],
drop_table=[
{'name': 'AK74', 'min': 1, 'max': 1, 'chance': 0.8, 'type': 'weapon'},
{'name': '5.45mm弹药', 'min': 10, 'max': 25, 'chance': 0.9, 'type': 'ammo'},
{'name': '俄语词汇本', 'min': 1, 'max': 1, 'chance': 0.6, 'type': 'intel'}
],
negotiation_base=0.20
)
self.is_airborne = True
# ==================== 解放军残部(3种) ====================
class PLARegular(Enemy):
"""解放军正规军(军官证+30%,凌暮雪黑五类-30%)"""
def __init__(self):
super().__init__(
enemy_type='解放军残部',
subtype='PLARegular',
hp_range=(80, 100),
morale=85,
weapons=[
{'name': '56半', 'damage': 25, 'accuracy': 0.8},
{'name': '56冲', 'damage': 20, 'accuracy': 0.75},
{'name': '54手枪', 'damage': 15, 'accuracy': 0.65},
{'name': 'RPG-7', 'damage': 80, 'accuracy': 0.6, 'chance': 0.2}
],
armor='vest',
behavior='tactical',
drop_table=[
{'name': '56半', 'min': 1, 'max': 1, 'chance': 0.6, 'type': 'weapon'},
{'name': '56冲', 'min': 1, 'max': 1, 'chance': 0.4, 'type': 'weapon'},
{'name': '7.62mm子弹', 'min': 20, 'max': 50, 'chance': 0.9, 'type': 'ammo'},
{'name': '军用物资', 'min': 2, 'max': 5, 'chance': 0.7, 'type': 'supply'}
],
negotiation_base=0.60
)
def identity_modifier(self, player_identity: str) -> float:
if player_identity == 'officer_certificate':
return 0.30
elif player_identity == 'black_five' and hasattr(player_identity, 'lingmuxue'):
return -0.30
return 0.0
class PLAMilitia(Enemy):
"""解放军民兵"""
def __init__(self):
super().__init__(
enemy_type='解放军残部',
subtype='PLAMilitia',
hp_range=(60, 80),
morale=65,
weapons=[
{'name': '56半', 'damage': 25, 'accuracy': 0.75},
{'name': '猎枪', 'damage': 20, 'accuracy': 0.6},
{'name': '手榴弹', 'damage': 30, 'accuracy': 0.5, 'chance': 0.3}
],
armor='coat',
behavior='defensive',
drop_table=[
{'name': '56半', 'min': 1, 'max': 1, 'chance': 0.5, 'type': 'weapon'},
{'name': '猎枪', 'min': 1, 'max': 1, 'chance': 0.4, 'type': 'weapon'},
{'name': '手榴弹', 'min': 1, 'max': 3, 'chance': 0.5, 'type': 'weapon'}
],
negotiation_base=0.50
)
class PLARouted(Enemy):
"""解放军溃兵(可救赎加入)"""
def __init__(self):
super().__init__(
enemy_type='解放军残部',
subtype='PLA routed',
hp_range=(70, 90),
morale=40,
weapons=[
{'name': '56冲', 'damage': 20, 'accuracy': 0.7},
{'name': '54手枪', 'damage': 15, 'accuracy': 0.65},
{'name': '手榴弹', 'damage': 30, 'accuracy': 0.5, 'chance': 0.25}
],
armor='coat',
behavior='cowardly',
drop_table=[
{'name': '56冲', 'min': 1, 'max': 1, 'chance': 0.6, 'type': 'weapon'},
{'name': '军用口粮', 'min': 2, 'max': 4, 'chance': 0.8, 'type': 'food'},
{'name': '急救包', 'min': 1, 'max': 2, 'chance': 0.5, 'type': 'medical'}
],
negotiation_base=0.35
)
def can_join_player(self) -> bool:
"""可被救赎加入"""
return self.surrendered and self.morale > 25
# ==================== 特务(3种) ====================
class KGB(Enemy):
"""克格勃"""
def __init__(self):
super().__init__(
enemy_type='特务',
subtype='KGB',
hp_range=(70, 80),
morale=70,
weapons=[
{'name': '马卡洛夫', 'damage': 12, 'accuracy': 0.7},
{'name': '消音手枪', 'damage': 18, 'accuracy': 0.75},
{'name': '匕首', 'damage': 10, 'accuracy': 0.8},
{'name': '毒药', 'damage': 50, 'accuracy': 0.4, 'chance': 0.2}
],
armor='vest',
behavior='tactical',
drop_table=[
{'name': '消音手枪', 'min': 1, 'max': 1, 'chance': 0.6, 'type': 'weapon'},
{'name': '间谍证件', 'min': 1, 'max': 1, 'chance': 0.7, 'type': 'document'},
{'name': '密码本', 'min': 1, 'max': 1, 'chance': 0.5, 'type': 'intel'},
{'name': '毒药', 'min': 1, 'max': 3, 'chance': 0.4, 'type': 'special'}
],
negotiation_base=0.15
)
class CIA(Enemy):
"""中情局"""
def __init__(self):
super().__init__(
enemy_type='特务',
subtype='CIA',
hp_range=(60, 70),
morale=60,
weapons=[
{'name': '消音手枪', 'damage': 18, 'accuracy': 0.75},
{'name': '匕首', 'damage': 10, 'accuracy': 0.8},
{'name': '毒药', 'damage': 50, 'accuracy': 0.4, 'chance': 0.25}
],
armor='coat',
behavior='tactical',
drop_table=[
{'name': '消音手枪', 'min': 1, 'max': 1, 'chance': 0.7, 'type': 'weapon'},
{'name': '美元', 'min': 100, 'max': 500, 'chance': 0.6, 'type': 'money'},
{'name': 'CIA证件', 'min': 1, 'max': 1, 'chance': 0.5, 'type': 'document'}
],
negotiation_base=0.10
)
class KMT(Enemy):
"""国民党特务"""
def __init__(self):
super().__init__(
enemy_type='特务',
subtype='KMT',
hp_range=(60, 70),
morale=65,
weapons=[
{'name': '消音手枪', 'damage': 18, 'accuracy': 0.75},
{'name': '匕首', 'damage': 10, 'accuracy': 0.8},
{'name': '毒药', 'damage': 50, 'accuracy': 0.4, 'chance': 0.2}
],
armor='coat',
behavior='tactical',
drop_table=[
{'name': '消音手枪', 'min': 1, 'max': 1, 'chance': 0.6, 'type': 'weapon'},
{'name': '金条', 'min': 1, 'max': 3, 'chance': 0.5, 'type': 'valuable'},
{'name': '国民党证件', 'min': 1, 'max': 1, 'chance': 0.6, 'type': 'document'}
],
negotiation_base=0.12
)
# ==================== 野兽(4种) ====================
class WolfPack(Enemy):
"""狼群(夜晚出没,火光可驱赶)"""
def __init__(self, pack_size: int = None):
size = pack_size or random.randint(3, 5)
super().__init__(
enemy_type='野兽',
subtype='WolfPack',
hp_range=(20, 30),
morale=999,
weapons=[
{'name': '咬伤', 'damage': 5, 'accuracy': 0.7}
],
armor='none',
behavior='aggressive',
drop_table=[
{'name': '狼皮', 'min': 1, 'max': 1, 'chance': 0.8, 'type': 'material'},
{'name': '狼肉', 'min': 2, 'max': 5, 'chance': 0.9, 'type': 'food'}
],
negotiation_base=0.0
)
self.pack_size = size
self.count = size
def is_night(self) -> bool:
"""是否夜晚出没"""
# 简化判断,实际应从游戏时间获取
return True
def can_be_repelled(self, has_fire: bool) -> bool:
"""是否可被火光驱赶"""
if has_fire:
return random.random() < 0.6
return False
class Roe(Enemy):
"""狍子(无攻击,猎物)"""
def __init__(self, count: int = None):
num = count or random.randint(1, 3)
super().__init__(
enemy_type='野兽',
subtype='Roe',
hp_range=(15, 20),
morale=999,
weapons=[],
armor='none',
behavior='cowardly',
drop_table=[
{'name': '狍子肉', 'min': 3, 'max': 8, 'chance': 1.0, 'type': 'food'},
{'name': '狍子皮', 'min': 1, 'max': 1, 'chance': 0.9, 'type': 'material'}
],
negotiation_base=0.0
)
self.count = num
def ai_behavior(self, combat_state: Dict) -> str:
"""总是逃跑"""
return 'flee'
class Bear(Enemy):
"""熊(独行受惊攻击,致命威胁)"""
def __init__(self):
super().__init__(
enemy_type='野兽',
subtype='Bear',
hp_range=(80, 100),
morale=999,
weapons=[
{'name': '拍击', 'damage': 15, 'accuracy': 0.65}
],
armor='coat',
behavior='aggressive',
drop_table=[
{'name': '熊掌', 'min': 1, 'max': 2, 'chance': 0.7, 'type': 'valuable'},
{'name': '熊皮', 'min': 1, 'max': 1, 'chance': 0.8, 'type': 'material'},
{'name': '熊胆', 'min': 1, 'max': 1, 'chance': 0.5, 'type': 'valuable'}
],
negotiation_base=0.0
)
class WildBoar(Enemy):
"""野猪(群居受惊攻击)"""
def __init__(self, group_size: int = None):
size = group_size or random.randint(3, 5)
super().__init__(
enemy_type='野兽',
subtype='WildBoar',
hp_range=(50, 70),
morale=999,
weapons=[
{'name': '冲撞', 'damage': 10, 'accuracy': 0.6}
],
armor='coat',
behavior='aggressive',
drop_table=[
{'name': '野猪肉', 'min': 5, 'max': 15, 'chance': 1.0, 'type': 'food'},
{'name': '野猪獠牙', 'min': 1, 'max': 2, 'chance': 0.6, 'type': 'material'}
],
negotiation_base=0.0
)
self.group_size = size
self.count = size
# ==================== 韩国特种部队(平壤分支) ====================
class KoreanSpecialForces(Enemy):
"""韩国特种部队(高威胁,可能绑架凌暮雪)"""
def __init__(self):
super().__init__(
enemy_type='韩国特种部队',
subtype='KoreanSpecialForces',
hp_range=(80, 100),
morale=90,
weapons=[
{'name': 'K2步枪', 'damage': 28, 'accuracy': 0.80},
{'name': 'K7冲锋枪', 'damage': 22, 'accuracy': 0.75},
{'name': '手榴弹', 'damage': 35, 'accuracy': 0.55, 'chance': 0.4}
],
armor='vest',
behavior='aggressive',
drop_table=[
{'name': 'K2步枪', 'min': 1, 'max': 1, 'chance': 0.6, 'type': 'weapon'},
{'name': '5.56mm弹药', 'min': 30, 'max': 60, 'chance': 0.9, 'type': 'ammo'},
{'name': '战术地图', 'min': 1, 'max': 1, 'chance': 0.5, 'type': 'intel'}
],
negotiation_base=0.10 # 几乎不可能谈判
)
# ==================== 工厂函数 ====================
ENEMY_CLASSES = {
'PeasantRefugee': PeasantRefugee,
'WorkerRefugee': WorkerRefugee,
'StudentRefugee': StudentRefugee,
'RebelBandit': RebelBandit,
'ExConvictBandit': ExConvictBandit,
'OpportunistBandit': OpportunistBandit,
'SovietInfantry': SovietInfantry,
'SovietCrew': SovietCrew,
'SovietSniper': SovietSniper,
'SovietOfficer': SovietOfficer,
'SovietParatrooper': SovietParatrooper,
'PLARegular': PLARegular,
'PLAMilitia': PLAMilitia,
'PLARouted': PLARouted,
'PLACavalry': PLACavalry,
'KGB': KGB,
'CIA': CIA,
'KMT': KMT,
'WolfPack': WolfPack,
'Roe': Roe,
'Bear': Bear,
'WildBoar': WildBoar,
}
def create_enemy(enemy_subtype: str, **kwargs) -> Enemy:
"""创建敌人实例"""
if enemy_subtype in ENEMY_CLASSES:
return ENEMY_CLASSES[enemy_subtype](**kwargs)
raise ValueError(f"未知敌人类型: {enemy_subtype}")
def get_all_enemy_types() -> List[str]:
"""获取所有敌人类型列表"""
return list(ENEMY_CLASSES.keys())