|
| 1 | +## Triggers and Order of Operations |
| 2 | +This article is for modders looking for specific information on the order triggers are called in various contexts. |
| 3 | +The information presented here is fairly technical and dry, and assumes you have an understanding of how Inscryption's code works. |
| 4 | + |
| 5 | +Triggers are listed in the order they are called, with the first entry being the first trigger called and the last entry being the last trigger called. |
| 6 | + |
| 7 | +Custom triggers start with the letter 'I' and are implemented via interfaces, and the rest are vanilla triggers. |
| 8 | + |
| 9 | +## Card Damage |
| 10 | +Handled by `PlayableCard.TakeDamage`, `ShieldManager.TriggerBreakShield`, and `ShieldManager.BreakShield`. |
| 11 | + |
| 12 | +Cards with shields only call the first four triggers listed. |
| 13 | + |
| 14 | +|Trigger|Additional information| |
| 15 | +|:-|:-| |
| 16 | +|IModifyDamageTaken|Sets the damage amount to the returned value| |
| 17 | +|IPreTakeDamage|Called before shields are checked| |
| 18 | +|IShieldPreventedDamage|Only called when a card has a shield| |
| 19 | +|IShieldPreventedDamageInHand|Only called when a card has a shield <br><br> Called on cards in the player's hand| |
| 20 | +|OnTakeDamage|Called for cards without shields| |
| 21 | +|OtherCardDealtDamage|Called after `PlayableCard.Die`| |
| 22 | +|IOnOtherCardDealtDamageInHand|Called on card's in the player's hand| |
| 23 | + |
| 24 | +## Card Death |
| 25 | +Handled by `PlayableCard.Die`. |
| 26 | + |
| 27 | +|Trigger|Additional information| |
| 28 | +|:-|:-| |
| 29 | +|OnPreDeathAnimation|| |
| 30 | +|OnOtherCardPreDeath|| |
| 31 | +|IOnOtherCardPreDeathInHand|Called on cards in the player's hand| |
| 32 | +|OnOtherCardDie|| |
| 33 | +|IOnOtherCardDieInHand|Called on cards in the player's hand| |
| 34 | + |
| 35 | +## Card Drawing |
| 36 | +Handled by `PlayerHand.AddCardToHand`. |
| 37 | + |
| 38 | +|Trigger|Additional information| |
| 39 | +|:-|:-| |
| 40 | +|OnDrawn|Called before a card is added to `cardsInHand`| |
| 41 | +|OnOtherCardDrawn|Called before a card is added to `cardsInHand`| |
| 42 | +|IOnAddedToHand|Called after a card is added to `cardsInHand`| |
| 43 | +|IOtherCardAddedToHand|Called after a card is added to `cardsInHand`| |
| 44 | + |
| 45 | +## Card Playing |
| 46 | +Handled by `BoardManager.TransitionAndResolveCreatedCard`, `BoardManager.ResolveCardOnBoard`, and `BoardManager.AssignCardToSlot`. |
| 47 | + |
| 48 | +|Trigger|Additional information| |
| 49 | +|:-|:-| |
| 50 | +|OnOtherCardAssignedToSlot|| |
| 51 | +|IOnCardAssignedToSlotContext|Provides information on new and old slot| |
| 52 | +|IOnOtherCardAssignedToSlotInHand|Called on cards in the player's hand| |
| 53 | +|IOnCardAssignedToSlotNoResolve|Only called if assigned card was already resolved| |
| 54 | +|OnResolveOnBoard|Called when a card is played from the hand or queue| |
| 55 | +|OnOtherCardResolve|Called when a card is played from the hand or queue| |
| 56 | +|IOnOtherCardResolveInHand|Called on cards in the player's hand <br><br> Called when a card is played from the hand or queue| |
| 57 | + |
| 58 | +## Combat Phase |
| 59 | +Handled by `CombatPhaseManager.DoCombatPhase`, `CombatPhaseManager.SlotAttackSequence`, and `CombatPhaseManager.SlotAttackSlot`. |
| 60 | + |
| 61 | +`SlotAttackSequence` is called for every attacking card, then `SlotAttackSlot` is called for every time a card attacks. |
| 62 | + |
| 63 | +|Trigger|Additional information| |
| 64 | +|:-|:-| |
| 65 | +|IOnBellRun|Called before `DoCombatPhase`| |
| 66 | +|IOnPreSlotAttackSequence|Called before `SlotAttackSequence`| |
| 67 | +|IGetAttackingSlots|Adds return value to current list of attacking slots, can modify current list within the method| |
| 68 | +|ISetupAttackSequence|Replaces current list of targeted slots with return value<br><br>Called with priority `ReplacesDefaultOpposingSlot`| |
| 69 | +|IGetOpposingSlots|Adds return value to current list of targeted slots, can modify current list within the method| |
| 70 | +|ISetupAttackSequence|Replaces current list of targeted slots with return value<br><br>Called with priority `Normal`| |
| 71 | +|ISetupAttackSequence|Replaces current list of targeted slots with return value<br><br>Called with priority `BringsBackOpposingSlot`| |
| 72 | +|ISetupAttackSequence|Replaces current list of targeted slots with return value<br><br>Called with priority `PostAdditionModification`| |
| 73 | +|OnSlotTargetedForAttack|| |
| 74 | +|IModifyDirectDamage|Called only if direct damage is being dealt<br><br>Sets the damage being dealt to the returned value| |
| 75 | +|OnDealDamageDirectly|| |
| 76 | +|IOnCardDealtDamageDirectly|Called for every card on the board| |
| 77 | +|OnCardGettingAttacked|Called only if a card is being attacked| |
| 78 | +|IPostCardGettingAttacked|| |
| 79 | +|IOnPostSingularSlotAttackSlot|Called after `SlotAttackSlot`| |
| 80 | +|OnAttackEnded|Called after all cards have finished attacking| |
| 81 | +|IOnPostSlotAttackSequence|Called after `SlotAttackSequence`| |
| 82 | + |
| 83 | +## Consumable Items |
| 84 | +Handled by `ConsumableItemSlot.ConsumeItem` and each ConsumableItem's `ActivateSequence`. |
| 85 | + |
| 86 | +|Trigger|Additional information| |
| 87 | +|:-|:-| |
| 88 | +|IItemCanBeUsed|Can stop items from being used| |
| 89 | +|IOnItemPreventedFromUse|Called if `IItemCanBeUsed` stopped an item from being used| |
| 90 | +|IOnPreItemUsed|Called before `ConsumeItem` and `ActivateSequence`| |
| 91 | +|IOnPostItemUsed|Called after `ConsumeItem` and `ActivateSequence`| |
| 92 | + |
| 93 | +## Passive Stat Buffs |
| 94 | +Handled by `PlayableCard.GetPassiveAttackBuffs` and `PlayableCard.GetPassiveHealthBuffs`. |
| 95 | + |
| 96 | +These patches are called every frame. |
| 97 | + |
| 98 | +|Trigger|Additional information| |
| 99 | +|:-|:-| |
| 100 | +|IOnCardPassiveAttackBuffs|Sets attack buff to returned value| |
| 101 | +|IPassiveAttackBuffs|Adds to attack buff with returned value| |
| 102 | + |
| 103 | +|Trigger|Additional information| |
| 104 | +|:-|:-| |
| 105 | +|IOnCardPassiveHealthBuffs|Sets health buff to returned value| |
| 106 | +|IPassiveHealthBuffs|Adds to health buff with returned value| |
| 107 | + |
| 108 | +## Scale Damage |
| 109 | +Handled by `LifeManager.ShowDamageSequence`. |
| 110 | + |
| 111 | +|Trigger|Additional information| |
| 112 | +|:-|:-| |
| 113 | +|IOnPreScalesChangedRef|Modifies the damage being dealt and weights being added to the physical scale| |
| 114 | +|IOnPreScalesChanged|Called before `ShowDamageSequence`| |
| 115 | +|IOnPostScalesChanged|Called after `ShowDamageSequence`| |
| 116 | + |
| 117 | +## Turn Sequence |
| 118 | +Handled by `TurnManager.GameSequence`, `TurnManager.PlayerTurn`, `TurnManager.OpponentTurn`, `TurnManager.DoUpkeepPhase`. |
| 119 | + |
| 120 | +Triggers for the opponent's turn are not called if their turn is skipped. |
| 121 | + |
| 122 | +|Trigger|Additional information| |
| 123 | +|:-|:-| |
| 124 | +|OnUpkeep|| |
| 125 | +|IOnUpkeepInHand|Called on cards in the player's hand| |
| 126 | +|OnTurnEnd|Called after `DoCombatPhase`| |
| 127 | +|IOnTurnEndInQueue|Called on cards in the opponent's queue| |
| 128 | +|IOnTurnEndInHand|Called on cards in the player's hand| |
0 commit comments