Base Game CardTriggerEffects - brandonandzeus/Trainworks2 GitHub Wiki

Base Game CardTriggerEffect subclasses

These effects generally apply Permanent upgrades to cards. There is a parameter to restrict the upgrades to a SingleBattle, however, it doesn't generally work across these effect classes. I will make note of which ones work and which don't. The usefulness in Trigger Effects comes from upgrading the Card that triggered the effect easily which you can't easily do with the CardEffects in the base game (would require a custom effect class)

NOTICE As of Trainworks 2.4.0 You don't need to use these. With CardEffectAddCardUpgradeToTargetCards or CardEffectAddCardUpgradeToTargetUnits and setting TargetMode to TargetModes.PlayedCard the effect will be the same as CardTriggerEffectBuffCharacterDamage, CardTriggerEffectBuffCharacterMaxHP, CardTriggerEffectBuffSpellDamage or CardTriggerUpgradEffect. Instead of PersistentMode, ParamBool for CardEffectAddCardUpgradeToTargetCards or CardEffectAddCardUpgradeToTargetUnits will make the upgrade permanent for the run if set to true.

Another note you can't mix and match the PersistenceMode across trigger effects. You can't have a card with a TriggerEffect that is SingleRun and another that is SingleBattle since all of the trigger effects modify the Permanent CardStateModifiers object (CardState.cardModifiers) (this is likely a bug).

And lastly, some of these are worse copies of the CardEffect of the same name those ones are unused.

I wouldn't bother with these if you are trying to apply a temporary upgrade to a card lasting a single battle. Generally for each of these CardTriggerEffects there's a CardEffect that does the same thing as a temporary effect. For instance all of the TriggerEffects that Buff a card or apply an upgrade can be done temporarily with CardEffectAddTempCardUpgradeToXXX. Those specific card effects will modify the temporary modifiers for a card which get reset at the end of battle.

As mentioned earlier combining Trigger effects with differing PersistenceModes set will clear the Permanent buffs along with the SingleBattle buffs. This isn't an issue if you had instead use CardEffects to apply the temporary upgrades to a card.

CardTriggerBuffEffect

This appears to be unused and has many bugs This effect appears to allow you to modify a CardEFfect (in CardData.Effects) when the card is played. The only modification that can be done is to ParamInt or ParamMinInt/ParamMaxInt.

The bug is that at the end of the battle, CardState.ResetEffects can potentially reorder the effects within a card if PersistenceMode is set to SingleBattle. That can be catastrophic if the card depends on replacement text for the description. The bug does not happen if the Card only has one effect.

Additionally, an even worse bug is possible if PersistenceMode is SingleRun. If the player exits and returns to a run, the changes made by this CardTriggerEffect will be lost. Modifications to a CardEffectState within a CardState during a run are not saved.

Note that the CardEffectBase subclass is completely reset when CardState.ResetEffects is called so if you have any lingering data within the class it will be reset with a new instance.

  • BuffEffectType: Type any CardEffect within CardData.Effects that match this class will be modified.
  • ParamInt: Amount to Adjust by.

CardTriggerEffectBuffCharacterDamage

This effect buffs attack damage to a card and its spawned monster. The buff can be temporary lasting a single battle or permanently.

  • ParamInt: Amount of attack damage to add (or subtract).

CardTriggerEffectBuffCharacterMaxHP

This effect buffs a monster's maxhp and applies the buff to the card. The buff can be temporary lasting a single battle or permanently.

  • ParamInt: Amount of MaxHP to add (or subtract).

CardTriggerEffectBuffSpellDamage

This effect applies a damage buff to a spell card. The only difference between this and BuffCharacterDamage is that it doesn't check for and apply the buff to a spawned monster.

  • ParamInt: Amount of spell damage to add (or subtract).

CardTriggerEffectDrawAdditionalNextTurn

This appears to be unused. Honestly, this effect shouldn't exist since a CardTriggerEffect can include normal CardEffects. You can just as easily use CardEffectDrawAdditionalNextTurn.

  • ParamInt: Number of cards to draw next turn.

CardTriggerEffectGainEnergyNextTurn

This appears to be unused Like CardTriggerEffectDrawAdditionalNextTurn, this effect is similar to the CardEffect of the same name, but with less functionality.

  • ParamInt: Amount of ember to gain next turn.

CardTriggerUpgradeEffect

This appears to have a bug This Trigger Effect is used by Lil' Fade's spikes upgrade path. Applies a CardUpgrade to a Card and if it is a Monster Card also applies the upgrade to all instances of the Monster that have been spawned by the card. [Bug] The Upgrade appears to be permanent regardless of the PersistenceMode. PersistenceMode.SingleBattle is ignored here as the upgrade is applied to the permanent CardStateModifiers (CardState.cardModifiers) which isn't cleared at the end of battle.

As a workaround, if you need to apply an upgrade that lasts a single battle then one of the CardEffectAddTempCardUpgradeToXXX can be used.

This Trigger effect is useful if you only need to upgrade the Card that triggered this effect, permanently.

  • ParamUpgrade: CardUpgrade to apply.