Skip to content

Commit

Permalink
feat: implement raiden shogun
Browse files Browse the repository at this point in the history
  • Loading branch information
zyr17 committed Sep 7, 2023
1 parent 436230b commit cf63dfd
Show file tree
Hide file tree
Showing 3 changed files with 242 additions and 8 deletions.
7 changes: 4 additions & 3 deletions server/charactor/electro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
from .electro_hypostasis import (
ElectroHypostasis, AbsorbingPrism, ChainsOfWardingThunder
)
from .raiden_shogun import RaidenShogun, EyeOfStormyJudgment, WishesUnnumbered


ElectroCharactors = Fischl | Keqing | ElectroHypostasis
SummonsOfElectroCharactors = Oz | ChainsOfWardingThunder
ElectroCharactors = Fischl | Keqing | ElectroHypostasis | RaidenShogun
SummonsOfElectroCharactors = Oz | ChainsOfWardingThunder | EyeOfStormyJudgment
ElectroCharactorTalents = (
StellarPredator | ThunderingPenance | AbsorbingPrism
StellarPredator | ThunderingPenance | AbsorbingPrism | WishesUnnumbered
# special card for Keqing, treated as a talent card.
| LightningStiletto
)
179 changes: 179 additions & 0 deletions server/charactor/electro/raiden_shogun.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
from typing import Any, List, Literal

from ...modifiable_values import DamageIncreaseValue

from ...event import GameStartEventArguments

from ...summon.base import AttackerSummonBase

from ...action import Actions, ChargeAction, CreateObjectAction
from ...struct import Cost

from ...consts import (
DamageElementalType, DamageType, DieColor, ElementType, FactionType,
ObjectPositionType, SkillType, WeaponType
)
from ..charactor_base import (
ElementalBurstBase, ElementalSkillBase, PhysicalNormalAttackBase,
PassiveSkillBase, CharactorBase, SkillBase, SkillTalent
)


# Summons


class EyeOfStormyJudgment(AttackerSummonBase):
name: Literal['Eye of Stormy Judgment'] = 'Eye of Stormy Judgment'
desc: str = (
'End Phase: Deal 1 Electro DMG. '
"When this Summon is on the field: Your characters' Elemental Bursts "
'deal +1 DMG.'
)
version: Literal['3.7'] = '3.7'
usage: int = 3
max_usage: int = 3
damage_elemental_type: DamageElementalType = DamageElementalType.ELECTRO
damage: int = 1

def value_modifier_DAMAGE_INCREASE(
self, value: DamageIncreaseValue, match: Any,
mode: Literal['TEST', 'REAL']
) -> DamageIncreaseValue:
assert mode == 'REAL'
if value.position.player_idx != self.position.player_idx:
# not self, not modify
return value
if value.position.area != ObjectPositionType.SKILL:
# not skill, not modify
return value
if value.damage_type != DamageType.DAMAGE:
# not damage, not modify
return value
skill: SkillBase = match.get_object(value.position)
if skill.skill_type != SkillType.ELEMENTAL_BURST:
# not burst, not modify
return value
# add damage
value.damage += 1
return value


# Skills


class TranscendenceBalefulOmen(ElementalSkillBase):
name: Literal[
'Transcendence: Baleful Omen'] = 'Transcendence: Baleful Omen'
desc: str = '''Summons 1 Eye of Stormy Judgment'''
damage: int = 0
damage_type: DamageElementalType = DamageElementalType.PIERCING
cost: Cost = Cost(
elemental_dice_color = DieColor.ELECTRO,
elemental_dice_number = 3
)

def get_actions(self, match: Any) -> List[Actions]:
"""
create object
"""
return [
self.charge_self(1),
self.create_summon('Eye of Stormy Judgment')
]


class SecretArtMusouShinsetsu(ElementalBurstBase):
name: Literal[
'Secret Art: Musou Shinsetsu'] = 'Secret Art: Musou Shinsetsu'
desc: str = (
'Deals 3 Electro DMG. All of your other characters gain 2 Energy.'
)
damage: int = 3
damage_type: DamageElementalType = DamageElementalType.ELECTRO
cost: Cost = Cost(
elemental_dice_color = DieColor.ELECTRO,
elemental_dice_number = 4,
charge = 2
)

def get_actions(self, match: Any) -> List[Actions]:
ret = super().get_actions(match)
table = match.player_tables[self.position.player_idx]
for cid, charactor in enumerate(table.charactors):
if charactor.is_alive and cid != self.position.charactor_idx:
ret.append(ChargeAction(
player_idx = self.position.player_idx,
charactor_idx = cid,
charge = 2,
))
return ret


class ChakraDesiderata(PassiveSkillBase):
name: Literal['Chakra Desiderata'] = 'Chakra Desiderata'
desc: str = (
'(Passive) When the battle begins, this character gains '
'Chakra Desiderata.'
)

def event_handler_GAME_START(
self, event: GameStartEventArguments, match: Any
) -> List[CreateObjectAction]:
"""
When game begin, gain stealth
"""
return [self.create_charactor_status(self.name)]


# Talents


class WishesUnnumbered(SkillTalent):
name: Literal['Wishes Unnumbered']
desc: str = (
'Combat Action: When your active character is Raiden Shogun, '
'equip this card. After Raiden Shogun equips this card, immediately '
'use Secret Art: Musou Shinsetsu once. When your Raiden Shogun, who '
'has this card equipped, uses Secret Art: Musou Shinsetsu, it will '
'deal +1 additional DMG for every point of Resolve consumed.'
)
version: Literal['3.7'] = '3.7'
charactor_name: Literal['Raiden Shogun'] = 'Raiden Shogun'
cost: Cost = Cost(
elemental_dice_color = DieColor.ELECTRO,
elemental_dice_number = 4,
charge = 2
)
skill: SecretArtMusouShinsetsu = SecretArtMusouShinsetsu()


# charactor base


class RaidenShogun(CharactorBase):
name: Literal['Raiden Shogun']
version: Literal['3.7'] = '3.7'
desc: str = '''"Plane of Euthymia" Raiden Shogun'''
element: ElementType = ElementType.ELECTRO
max_hp: int = 10
max_charge: int = 2
skills: List[
PhysicalNormalAttackBase | TranscendenceBalefulOmen
| SecretArtMusouShinsetsu | ChakraDesiderata
] = []
faction: List[FactionType] = [
FactionType.INAZUMA
]
weapon_type: WeaponType = WeaponType.POLEARM
talent: WishesUnnumbered | None = None

def _init_skills(self) -> None:
self.skills = [
PhysicalNormalAttackBase(
name = 'Origin',
cost = PhysicalNormalAttackBase.get_cost(self.element),
),
TranscendenceBalefulOmen(),
SecretArtMusouShinsetsu(),
ChakraDesiderata(),
]
64 changes: 59 additions & 5 deletions server/status/charactor_status/electro_charactors.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@

from ...struct import Cost

from ...action import MakeDamageAction, RemoveObjectAction
from ...action import Actions, MakeDamageAction, RemoveObjectAction

from ...event import MakeDamageEventArguments
from ...event import MakeDamageEventArguments, SkillEndEventArguments

from ...consts import DamageElementalType, DamageType
from ...consts import (
DamageElementalType, DamageType, ObjectPositionType, SkillType
)

from ...modifiable_values import DamageIncreaseValue, DamageValue
from .base import (
ElementalInfusionCharactorStatus, PrepareCharactorStatus,
RoundCharactorStatus, UsageCharactorStatus
RoundCharactorStatus, UsageCharactorStatus, CharactorStatusBase
)


Expand Down Expand Up @@ -145,7 +147,59 @@ class RockPaperScissorsComboPaper(PrepareCharactorStatus):
] = 'Rock-Paper-Scissors Combo: Paper'


class ChakraDesiderata(CharactorStatusBase):
name: Literal['Chakra Desiderata'] = 'Chakra Desiderata'
desc: str = (
'After your other characters use Elemental Bursts: Gain 1 Resolve. '
'(Max 3) '
'When the character to which this is attached uses Secret Art: Musou '
'Shinsetsu: Consume all Resolve and deal +1 DMG per Resolve.'
)
version: Literal['3.7'] = '3.7'
usage: int = 0
max_usage: int = 3

def event_handler_SKILL_END(
self, event: SkillEndEventArguments, match: Any
) -> List[Actions]:
"""
When other charactor using elemental burst, gain resolve.
"""
if not self.position.check_position_valid(
event.action.position, match, player_idx_same = True,
charactor_idx_same = False, target_area = ObjectPositionType.SKILL,
):
# not other ally use elemental burst, do nothing
return []
if event.action.skill_type == SkillType.ELEMENTAL_BURST:
# is burst
self.usage = min(self.usage + 1, self.max_usage)
return []

def value_modifier_DAMAGE_INCREASE(
self, value: DamageIncreaseValue, match: Any,
mode: Literal['TEST', 'REAL']
) -> DamageIncreaseValue:
"""
When self using elemental burst, increase damage by usage.
"""
if not value.is_corresponding_charactor_use_damage_skill(
self.position, match, SkillType.ELEMENTAL_BURST
):
# not self use burst, do nothing
return value
# increase damage
value.damage += self.usage
charactor = match.player_tables[self.position.player_idx].charactors[
self.position.charactor_idx]
if charactor.talent is not None:
# has talent, double increase damage
value.damage += self.usage
self.usage = 0
return value


ElectroCharactorStatus = (
ElectroInfusionKeqing | RockPaperScissorsComboScissors
| RockPaperScissorsComboPaper | ElectroCrystalCore
| RockPaperScissorsComboPaper | ElectroCrystalCore | ChakraDesiderata
)

0 comments on commit cf63dfd

Please sign in to comment.