Skip to content

Commit

Permalink
feat: implement diluc
Browse files Browse the repository at this point in the history
  • Loading branch information
zyr17 committed Sep 14, 2023
1 parent 1d11024 commit 170c3eb
Show file tree
Hide file tree
Showing 3 changed files with 157 additions and 2 deletions.
4 changes: 3 additions & 1 deletion server/charactor/pyro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
from .xiangling import Xiangling, Guoba, Crossfire
from .yanfei import Yanfei, RightOfFinalInterpretation
from .hu_tao import HuTao, SanguineRouge
from .diluc import Diluc, FlowingFlame


PyroCharactors = (
FatuiPyroAgent | Klee | Bennett | Yoimiya | Xiangling | Yanfei | HuTao
| Diluc
)
SummonsOfPyroCharactors = Guoba | Guoba
PyroCharactorTalents = (
PaidinFull | PoundingSurprise | GrandExpectation | NaganoharaMeteorSwarm
| Crossfire | RightOfFinalInterpretation | SanguineRouge
| Crossfire | RightOfFinalInterpretation | SanguineRouge | FlowingFlame
)
144 changes: 144 additions & 0 deletions server/charactor/pyro/diluc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
from typing import Any, List, Literal

from ...modifiable_values import CostValue
from ...event import RoundPrepareEventArguments

from ...action import Actions
from ...struct import Cost

from ...consts import (
DamageElementalType, DieColor, ElementType, FactionType,
WeaponType
)
from ..charactor_base import (
ElementalBurstBase, ElementalSkillBase,
PhysicalNormalAttackBase, CharactorBase, SkillTalent
)
# Skills


class SearingOnslaught(ElementalSkillBase):
name: Literal['Searing Onslaught'] = 'Searing Onslaught'
desc: str = (
'Deals 3 Pyro DMG. For the third use of this Skill each Round, deals '
'+2 DMG.'
)
damage_type: DamageElementalType = DamageElementalType.PYRO
cost: Cost = Cost(
elemental_dice_color = DieColor.PYRO,
elemental_dice_number = 3
)

counter: int = 0

def event_handler_ROUND_PREPARE(
self, event: RoundPrepareEventArguments, match: Any
) -> List[Actions]:
"""
When in round prepare, reset counter
"""
self.counter = 0
return []

def value_modifier_COST(
self, value: CostValue, match: Any, mode: Literal['REAL', 'TEST']
) -> CostValue:
"""
If self equipped talent, reduce the second use cost by 1
"""
if self.counter != 1:
# not second use
return value
if not self.is_talent_equipped(match):
# no talent
return value
if not self.position.check_position_valid(
value.position, match, player_idx_same = True,
charactor_idx_same = True, area_same = True, id_same = True
):
# not this skill
return value
# decrease cost
value.cost.decrease_cost(DieColor.PYRO)
return value

def get_actions(self, match: Any) -> List[Actions]:
"""
if it is the third time to use, increase damage by 2
"""
self.counter += 1
if self.counter == 3:
self.damage = 5
ret = super().get_actions(match)
self.damage = 3
return ret


class Dawn(ElementalBurstBase):
name: Literal['Dawn'] = 'Dawn'
desc: str = '''Deals 8 Pyro DMG. This character gains Pyro Infusion.'''
damage: int = 8
damage_type: DamageElementalType = DamageElementalType.PYRO
cost: Cost = Cost(
elemental_dice_color = DieColor.PYRO,
elemental_dice_number = 4,
charge = 3
)

def get_actions(self, match: Any) -> List[Actions]:
return super().get_actions(match) + [
self.create_charactor_status(
'Pyro Elemental Infusion',
{ 'mark': 'Diluc' }
)
]


# Talents


class FlowingFlame(SkillTalent):
name: Literal['Flowing Flame']
desc: str = (
'Combat Action: When your active character is Diluc, equip this card. '
'After Diluc equips this card, immediately use Searing Onslaught '
'once. When your Diluc, who has this card equipped, uses Searing '
'Onslaught for the second time in one Round, spend 1 less Pyro Die.'
)
version: Literal['3.3'] = '3.3'
charactor_name: Literal['Diluc'] = 'Diluc'
cost: Cost = Cost(
elemental_dice_color = DieColor.PYRO,
elemental_dice_number = 3,
)
skill: SearingOnslaught = SearingOnslaught()


# charactor base


class Diluc(CharactorBase):
name: Literal['Diluc'] # Do not set default value for charactor name
version: Literal['3.3'] = '3.3'
desc: str = '''"Dark Side of Dawn" Diluc'''
element: ElementType = ElementType.PYRO
max_hp: int = 10
max_charge: int = 3
skills: List[
PhysicalNormalAttackBase | SearingOnslaught | Dawn
] = []
faction: List[FactionType] = [
FactionType.MONDSTADT
]
weapon_type: WeaponType = WeaponType.CLAYMORE
talent: FlowingFlame | None = None

def _init_skills(self) -> None:
self.skills = [
PhysicalNormalAttackBase(
name = 'Tempered Sword',
cost = PhysicalNormalAttackBase.get_cost(self.element),
),
SearingOnslaught(),
Dawn()
]
11 changes: 10 additions & 1 deletion server/status/charactor_status/pyro_charactors.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,16 @@ def event_handler_ROUND_END(
)]


class DilucInfusion(ElementalInfusionCharactorStatus,
RoundCharactorStatus):
name: Literal['Pyro Elemental Infusion'] = 'Pyro Elemental Infusion'
mark: Literal['Diluc'] = 'Diluc'
version: Literal['3.3'] = '3.3'
usage: int = 2
max_usage: int = 2


PyroCharactorStatus = (
Stealth | ExplosiveSpark | NiwabiEnshou | Brilliance | ScarletSeal
| ParamitaPapilio | BloodBlossom
| ParamitaPapilio | BloodBlossom | DilucInfusion
)

0 comments on commit 170c3eb

Please sign in to comment.