Abilities
Last updated
Last updated
Abilities can be found in the Resources/Abilities folder. They can be assigned to cards or characters to give them special power. The engine is also made in a way to make it easy to code your own abilities.
Determines WHEN the ability will be resolved.
Ongoing: Always active as long as this card is in play. (Ongoing only works with a limited number of effects such as status and stat bonus). Ongoing abilities bonus are recalculated any time there is a state change. These would only work if the ability is attached to something that stays in play such as a power card or character.
On Play: Resolved when the card is played from your hand.
On Play Other: Resolved when this card is already in play (power card or character) and another card is played. Usually this type of trigger will have some trigger conditions.
On Drawn: Resolved when the card is drawn into your hand.
Start/End of Turn: Resolved once every turn, during your turn.
On Death: When the character with this ability dies.
On Damaged: When the character with this ability is damaged.
Ability won't trigger unless all the trigger conditions are met. For example, you could have an "OnPlay" ability that only triggers if the player has less than 10 health, or a Start of Turn ability that triggers only if you have 5 cards on the board..
There are many conditions already available in the Resources/Condition folder, but you can also code your own. (See the scripts section).
Determines WHO is affected by the ability?
There are 3 different categories of possible target:
Cards
Characters
Board Slots
And different targets you can choose form:
Card Self: The card with this ability
Character Self: The character who played the card
All Characters: All characters currently in the battle.
All Cards Hand: All cards in all character's hand.
All Cards All Piles: All existing cards, in hand, deck, discard or power area. You will usually want to use some target conditions to filter only the deck or discard or other.
All Slots: All slots on the board, whether they are empty or occupied. Usually used for summon abilities.
All Card Data: All existing card data in the game (scriptable objects), this is usually used to instantiate new cards (like discover effect), since it doesn't represent an existing card in the game, but only the data of the card.
Play Target: When playing a spell, you will be asked to drag the spell directly on top of a target when playing it. Use only for spells.
Ability Triggerer: The card that caused the ability to be triggered. This is usually the same than the caster (self) but for some Triggers it is not. For example, OnPlayOther has a different triggerer than the caster.
Select Target: Player will be asked to click on a target character of his choice on the board.
Card Selector: A menu will open to let the player select a card as target. This is useful for abilities that let you retrieve a card from your discard or deck. Choice of cards can be refined with target condition.
Choice Selector: A menu will open to let the player choose between a few different abilities. If you use this, place the choice abilities under chain_abilities array.
This is really useful to target multiple cards (but not all) or to limit the choices of the player. For example, if you want an ability that says "All wolves gain +1 attack", the Target would be "All Characters", and the target condition "Is Wolf".
Another example would be a skill that let you take an adventurer spell from your discard. The Target would be "Card Selector", and the target conditions would be "Is Adventurer" and "Is Spell" (You also need to add "Is Ally" and "Is In Discard" with the card selector, otherwise it will show cards in your deck and your opponent deck/discard).
Target filters are a bit more complex and slightly less performant than conditions, since they involve manipulating arrays instead of just a bool check. But they are a lot more flexible when you want to target multiple targets with a more global condition instead of a condition that is only checked on each individual target.
For example targets filters could be used to target X number of random targets on the board, or to target the card with the highest hp, cards that have duplicates, etc.. This is done by targeting AllCharacters and then adding a filter that will use all board cards as source and only add the new targets into the destination array. Filters also work with AllCards and AllSlots.
More info on this will be added to the Scripts section.
Determines WHAT will happen to the targets when the ability is resolved.
Several effects are already available in the Resources/Effects folder. If an effect has a parameter and you want to use it with different values, you can simply duplicate one effect with Ctrl-D.
Effects can also be coded easily like conditions, by creating your own scripts. See the scripts section to know how to code your own effects.
A value and duration can be passed to each effect.
Some more complex abilities could have multiple effects, each with different targets and conditions, but that are all triggered by the same thing. To simplify the creation of these more complex abilities, you can instead create multiple abilities, and only the first one will have a trigger. Set the trigger to None on the other ones. And only attach the first ability on your card.
Then, on that first ability, add the other abilities into the chain_abilities array. This means those abilities will be triggered immediately after the first one, whenever it is triggered.
This array is also used when using the Choice Selector.