适配巡猎武器

This commit is contained in:
qwerdvd 2023-05-28 20:18:12 +08:00
parent f4141646d7
commit c2f026a9b5
4 changed files with 301 additions and 105 deletions

View File

@ -12,7 +12,6 @@ class Seele(BaseAvatar):
def __init__(self, char: Dict, skills: List):
super().__init__(char=char, skills=skills)
self.Buff = BaseAvatarBuff(char=char, skills=skills)
self.eidolon_attribute = {}
self.extra_ability_attribute = {}
self.eidolons()

View File

@ -36,9 +36,11 @@ class BaseAvatarBuff:
class BaseAvatar:
Skill: BaseSkills
Buff: BaseAvatarBuff
def __init__(self, char: Dict, skills: List):
self.Skill = BaseSkills(char=char, skills=skills)
self.Buff = BaseAvatarBuff(char=char, skills=skills)
self.avatar_id = char['id']
self.avatar_level = char['level']
self.avatar_rank = char['rank']

View File

@ -32,23 +32,18 @@
]
},
"唯有沉默": {
"enable": true,
"trigger": {
"enemyCount": 2
},
"step": null,
"attrChange": {
"21003": {
"Param": {
"CriticalChance": [
0.12,
0.15,
0.18,
0.21,
0.24
0.12000000011175871,
0.1500000001396984,
0.18000000016763806,
0.21000000019557774,
0.24000000022351742
]
}
},
"如泥酣眠": {
"23012": {
"enable": false
},
"24001": {
@ -76,106 +71,86 @@
0.1600000001490116
]
},
"春水初生": {
"enable": true,
"trigger": {
"initBattle": true
},
"attrChange": {
"21024": {
"Param": {
"SpeedAddedRatio": [
0.08,
0.09,
0.1,
0.11,
0.12
]
},
"Dmg": [
0.12,
0.15,
0.18,
0.21,
0.24
]
},
"点个关注吧!": {
"enable": true,
"trigger": {
"fullSP": true
},
"A_finalDmg": [
0.24,
0.3,
0.36,
0.42,
0.48
0.0800000000745058,
0.09000000008381903,
0.10000000009313226,
0.11000000010244548,
0.12000000011175871
],
"E_finalDmg": [
0.24,
0.3,
0.36,
0.42,
0.48
]
},
"相抗": {
"enable": true,
"trigger": {
"eliminateEnemy": true
},
"attrChange": {
"SpeedAddedRatio": [
0.1,
0.12,
0.14,
0.16,
0.18
"AllDamageAddedRatio": [
0.12000000011175871,
0.1500000001396984,
0.18000000016763806,
0.21000000019557774,
0.24000000022351742
]
}
},
"离弦": {
"enable": true,
"trigger": {
"eliminateEnemy": true
},
"attrChange": {
"SpeedAddedRatio": [
0.24,
0.3,
0.36,
0.42,
0.48
"21017": {
"Param": {
"a_dmg": [
0.24000000022351742,
0.3000000002793968,
0.3600000003352761,
0.4200000003911555,
0.48000000044703484
],
"e_dmg": [
0.24000000022351742,
0.3000000002793968,
0.3600000003352761,
0.4200000003911555,
0.48000000044703484
]
}
},
"论剑": {
"enable": true,
"trigger": {
"focusEnemy": true
},
"Dmg": [
0.08,
0.1,
0.12,
0.14,
0.16
"20014": {
"Param": {
"SpeedAddedRatio": [
0.10000000009313226,
0.12000000011175871,
0.14000000013038516,
0.1600000001490116,
0.18000000016763806
]
}
},
"重返幽冥": {
"20007": {
"Param": {
"AttackAddedRatio": [
0.24000000022351742,
0.3000000002793968,
0.3600000003352761,
0.4200000003911555,
0.48000000044703484
]
}
},
"21010": {
"Param": {
"AllDamageAddedRatio": [
0.0800000000745058,
0.10000000009313226,
0.12000000011175871,
0.14000000013038516,
0.1600000001490116
]
}
},
"21031": {
"enable": false
},
"锋镝": {
"enable": true,
"trigger": {
"initBattle": true
},
"attrChange": {
"20000": {
"Param": {
"CriticalChance": [
0.12,
0.15,
0.18,
0.21,
0.24
0.12000000011175871,
0.1500000001396984,
0.18000000016763806,
0.21000000019557774,
0.24000000022351742
]
}
}

View File

@ -14,6 +14,196 @@ with open(path / 'Excel' / 'weapon_effect.json', 'r', encoding='utf-8') as f:
mp.dps = 14
class Arrows(BaseWeapon):
def __init__(self, weapon: Dict):
super().__init__(weapon)
async def check(self):
# 装备者消灭敌方目标
return True
async def weapon_ability(self, base_attr: Dict, attribute_bonus: Dict):
if await self.check():
critical_chance_base = attribute_bonus.get('CriticalChance', 0)
attribute_bonus['CriticalChance'] = critical_chance_base + mp.mpf(
weapon_effect['20000']['Param']['CriticalChance'][
self.weapon_rank - 1
]
)
return attribute_bonus
class ReturntoDarkness(BaseWeapon):
def __init__(self, weapon: Dict):
super().__init__(weapon)
async def check(self):
# 装备者消灭敌方目标
return True
async def weapon_ability(self, base_attr: Dict, attribute_bonus: Dict):
if await self.check():
pass
return attribute_bonus
class Swordplay(BaseWeapon):
def __init__(self, weapon: Dict):
super().__init__(weapon)
async def check(self):
# 装备者消灭敌方目标
return True
async def weapon_ability(self, base_attr: Dict, attribute_bonus: Dict):
if await self.check():
all_damage_added_ratio = attribute_bonus.get(
'AllDamageAddedRatio', 0
)
attribute_bonus[
'AllDamageAddedRatio'
] = all_damage_added_ratio + mp.mpf(
weapon_effect['21010']['Param']['AllDamageAddedRatio'][
self.weapon_rank - 1
]
)
return attribute_bonus
class DartingArrow(BaseWeapon):
def __init__(self, weapon: Dict):
super().__init__(weapon)
async def check(self):
# 装备者消灭敌方目标
return True
async def weapon_ability(self, base_attr: Dict, attribute_bonus: Dict):
if await self.check():
attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0)
attribute_bonus['AttackAddedRatio'] = attack_added_ratio + mp.mpf(
weapon_effect['20007']['Param']['AttackAddedRatio'][
self.weapon_rank - 1
]
)
return attribute_bonus
class Adversarial(BaseWeapon):
def __init__(self, weapon: Dict):
super().__init__(weapon)
async def check(self):
# 装备者消灭敌方目标
return True
async def weapon_ability(self, base_attr: Dict, attribute_bonus: Dict):
if await self.check():
speed_added_ratio = attribute_bonus.get('SpeedAddedRatio', 0)
attribute_bonus['SpeedAddedRatio'] = speed_added_ratio + mp.mpf(
weapon_effect['20014']['Param']['SpeedAddedRatio'][
self.weapon_rank - 1
]
)
return attribute_bonus
class SubscribeforMore(BaseWeapon):
def __init__(self, weapon: Dict):
super().__init__(weapon)
async def check(self):
# 装备者的当前能量值等于其能量上限
return True
async def weapon_ability(self, base_attr: Dict, attribute_bonus: Dict):
if await self.check():
normal_dmg_add = attribute_bonus.get('NormalDmgAdd', 0)
attribute_bonus['NormalDmgAdd'] = normal_dmg_add + (
mp.mpf(
weapon_effect['21017']['Param']['a_dmg'][
self.weapon_rank - 1
]
)
* 2
)
bp_skill_dmg_add = attribute_bonus.get('BPSkillDmgAdd', 0)
attribute_bonus['BPSkillDmgAdd'] = bp_skill_dmg_add + (
mp.mpf(
weapon_effect['21017']['Param']['e_dmg'][
self.weapon_rank - 1
]
)
* 2
)
return attribute_bonus
class RiverFlowsinSpring(BaseWeapon):
def __init__(self, weapon: Dict):
super().__init__(weapon)
async def check(self):
# 进入战斗后使装备者速度提高8%造成的伤害提高12%。
# 当装备者受到伤害后该效果失效,下个回合结束时该效果恢复。
return True
async def weapon_ability(self, base_attr: Dict, attribute_bonus: Dict):
if await self.check():
speed_added_ratio = attribute_bonus.get('SpeedAddedRatio', 0)
attribute_bonus['SpeedAddedRatio'] = speed_added_ratio + mp.mpf(
weapon_effect['21024']['Param']['SpeedAddedRatio'][
self.weapon_rank - 1
]
)
all_damage_added_ratio = attribute_bonus.get(
'AllDamageAddedRatio', 0
)
attribute_bonus[
'AllDamageAddedRatio'
] = all_damage_added_ratio + mp.mpf(
weapon_effect['21024']['Param']['AllDamageAddedRatio'][
self.weapon_rank - 1
]
)
return attribute_bonus
class SleepLiketheDead(BaseWeapon):
def __init__(self, weapon: Dict):
super().__init__(weapon)
async def check(self):
# 当装备者的普攻或战技伤害未造成暴击时使自身暴击率提高36%持续1回合。
# 该效果每3回合可以触发1次。
return True
async def weapon_ability(self, base_attr: Dict, attribute_bonus: Dict):
if await self.check():
return attribute_bonus
class OnlySilenceRemains(BaseWeapon):
def __init__(self, weapon: Dict):
super().__init__(weapon)
async def check(self):
# 当场上的敌方目标数量小于等于2时
return True
async def weapon_ability(self, base_attr: Dict, attribute_bonus: Dict):
if await self.check():
critical_chance_base = attribute_bonus.get('CriticalChanceBase', 0)
attribute_bonus[
'CriticalChanceBase'
] = critical_chance_base + mp.mpf(
weapon_effect['21003']['Param']['CriticalChance'][
self.weapon_rank - 1
]
)
return attribute_bonus
class IntheNight(BaseWeapon):
def __init__(self, weapon: Dict):
super().__init__(weapon)
@ -87,8 +277,24 @@ class HuntWeapon:
def __new__(cls, weapon: Dict):
if weapon['id'] == 24001:
return CruisingintheStellarSea(weapon)
if weapon['id'] == 23001:
elif weapon['id'] == 23001:
return IntheNight(weapon)
elif weapon['id'] == 21003:
return OnlySilenceRemains(weapon)
elif weapon['id'] == 21024:
return RiverFlowsinSpring(weapon)
elif weapon['id'] == 20014:
return Adversarial(weapon)
elif weapon['id'] == 20007:
return DartingArrow(weapon)
elif weapon['id'] == 21010:
return Swordplay(weapon)
elif weapon['id'] == 21031:
return ReturntoDarkness(weapon)
elif weapon['id'] == 20000:
return Arrows(weapon)
else:
raise ValueError(f'未知武器id: {weapon["id"]}')
async def check_ability(self):
pass
@ -96,5 +302,19 @@ class HuntWeapon:
class Weapon:
def __new__(cls, weapon: Dict):
if weapon['id'] == 24001 or weapon['id'] == 23001:
if weapon['id'] in [
23001,
21003,
23012,
24001,
21024,
21017,
20014,
20007,
21010,
21031,
20000,
]:
return HuntWeapon(weapon)
else:
raise ValueError(f'不支持的武器种类: {weapon["id"]}')