Player Action and Instruction
from dgisim import PlayerAction, Instruction
PlayerActionis any action that can be taken by a player in the game.Instructionis the additional information added in player actions to specify how an action should be performed.
- class PlayerAction
- class Instruction(*, dice: 'ActualDice')
- dice: ActualDice
dice to be paid.
- class CardAction(*, card: type[Card], instruction: Instruction)
Bases:
GameActionUsed to play a card.
- instruction: Instruction
detailed instruction on how the card should be used.
- class CardsSelectAction(*, selected_cards: 'Cards')
Bases:
PlayerAction
- class CharacterSelectAction(*, char_id: 'int')
Bases:
PlayerAction
- class DeathSwapAction(*, char_id: int)
Bases:
GameActionUsed when active character is defeated and requires swapping.
- class DiceOnlyInstruction(*, dice: ActualDice)
Bases:
InstructionAn instruction that only contains dice.
- class DiceSelectAction(*, selected_dice: 'ActualDice')
Bases:
PlayerAction- selected_dice: ActualDice
dice selected.
- class ElementalTuningAction(*, card: type[Card], dice_elem: Element)
Bases:
GameActionUsed tune an elemental die.
- class EndRoundAction
Bases:
PlayerAction
- class GameAction
Bases:
PlayerActionA superclass for actions that are mainly performed in action phase.
- class SkillAction(*, skill: CharacterSkill, instruction: DiceOnlyInstruction)
Bases:
GameActionUsed to cast the skill of the active character.
- instruction: DiceOnlyInstruction
instruction on which dice to be paid for the skill.
- skill: CharacterSkill
type of skill to cast (by the active character).
- class SourceTargetInstruction(*, dice: ActualDice, source: StaticTarget, target: StaticTarget)
Bases:
InstructionAn instruction that can choose two targets.
- source: StaticTarget
source target.
- target: StaticTarget
target target.
- class StaticTargetInstruction(*, dice: ActualDice, target: StaticTarget)
Bases:
InstructionAn instruction that can choose a single target.
- target: StaticTarget
the target selected.
- class SwapAction(*, char_id: int, instruction: DiceOnlyInstruction)
Bases:
GameActionUsed when normal character swap is performed.
- instruction: DiceOnlyInstruction
instruction on which dice to be paid for the skill.
All classes above are frozen dataclass that is key_word only. This means in order to initialize any of these, you need to specify all key words:
from dgisim import ActualDice, CardAction, Element, Pid, StaticTarget, StaticTargetInstruction
from dgisim.card import SendOff
from dgisim.summon import OceanicMimicFrogSummon
# just an example of using SendOff on OceanicMimicFrog (summon)
card_action = CardAction(
card=SendOff,
instruction=StaticTargetInstruction(
dice=ActualDice({Element.ELECTRO: 1, Element.ANEMO: 1}),
target=StaticTarget.from_summon(Pid.P2, OceanicMimicFrogSummon),
),
)