Card Effect Commons ‐ Give Effects - DCGO2/DCGO-Card-Scripts GitHub Wiki

Give Custom Effect

These functions give a custom effect to a specific permanent or a blanket effect to a player.

public static void AddEffectToPermanent(Permanent targetPermanent, EffectDuration effectDuration, CardSource card, ICardEffect cardEffect, EffectTiming timing)
public static void AddEffectToPlayer(EffectDuration effectDuration, CardSource card, ICardEffect cardEffect, EffectTiming timing, Func<EffectTiming, ICardEffect> getCardEffect = null)
  • AddEffectToPermanent (Gives effect to specified permanent)
  • targetPermanent - permanent selected to gain effect
  • effectDuration - an enum value indicating the duration the effect should maintain
  • card - reference to the card this effect came from
  • cardEffect - reference to the specific effect this given effect is granted from
  • timing - the timing of the given effect
  • AddEffectToPlayer(Gives effect to specified player)
  • effectDuration - an enum value indicating the duration the effect should maintain
  • card - used to target the owner of the card
  • cardEffect - reference to the specific effect this given effect is granted from
  • timing - the timing of the given effect
  • getCardEffect - customizable specifics on what the effect does, OPTIONAL

Give Effect To Player

Some commonly used effects to give to a player:

public static IEnumerator GainCanNotReturnToDeckPlayerEffect(
Func<Permanent, bool> permanentCondition,
Func<ICardEffect, bool> cardEffectCondition,
EffectDuration effectDuration,
ICardEffect activateClass,
string effectName)
  • permanentCondition - conditions that need met for permanent to gain the effect
  • cardEffectCondition - conditions for the effect used against the permanent
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
  • effectName - name for the effect (used in log UI)
public static IEnumerator GainCanNotAttackPlayerEffect(
Func<Permanent, bool> attackerCondition, 
Func<Permanent, bool> defenderCondition, 
EffectDuration effectDuration, 
ICardEffect activateClass, 
string effectName)
  • attackerCondition - conditions that need to be met for attacking permanent
  • defenderCondition - conditions that need to be met for the defending permanent
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
  • effectName - name for the effect (used in log UI)
public static IEnumerator GainCanNotBeDeletedPlayerEffect(
Func<Permanent, bool> permanentCondition, 
Func<Permanent, Permanent, Permanent, CardSource, bool> canNotBeDestroyedByBattleCondition, 
EffectDuration effectDuration, 
ICardEffect activateClass, 
string effectName)
  • permanentCondition - conditions that need met for permanent to gain the effect
  • canNotBeDestroyedByBattleCondition - conditions for the battle determining if the permanent can be deleted
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
  • effectName - name for the effect (used in log UI)
public static IEnumerator GainCanNotBlockPlayerEffect(
Func<Permanent, bool> attackerCondition,
Func<Permanent, bool> defenderCondition,
EffectDuration effectDuration,
ICardEffect activateClass,
string effectName)
  • attackerCondition - conditions for the attacking permanent
  • defenderCondition - conditions for the defending permanent
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
  • effectName - name for the effect (used in log UI)
public static IEnumerator GainCanNotReturnToHandPlayerEffect(
Func<Permanent, bool> permanentCondition, 
Func<ICardEffect, bool> cardEffectCondition, 
EffectDuration effectDuration, 
ICardEffect activateClass, 
string effectName)
  • permanentCondition - conditions that need met for permanent to gain the effect
  • cardEffectCondition - conditions for the effect used against the permanent
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
  • effectName - name for the effect (used in log UI)
public static IEnumerator GainCanNotSuspendPlayerEffect(
Func<Permanent, bool> permanentCondition, 
EffectDuration effectDuration, 
ICardEffect activateClass, 
bool isOnlyActivePhase, 
string effectName)
  • permanentCondition - conditions that need met for permanent to gain the effect
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
  • isOnlyActivePhase - whether or not it only works in the Active Phase
  • effectName - name for the effect (used in log UI)
public static IEnumerator GainCanNotUnsuspendPlayerEffect(
Func<Permanent, bool> permanentCondition, 
EffectDuration effectDuration, 
ICardEffect activateClass, 
bool isOnlyActivePhase, 
string effectName)
  • permanentCondition - conditions that need met for permanent to gain the effect
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
  • isOnlyActivePhase - whether or not it only works in the Active Phase
  • effectName - name for the effect (used in log UI)
public static IEnumerator ChangeSecurityDigimonCardDPPlayerEffect(
Func<CardSource, bool> cardCondition, 
int changeValue, 
EffectDuration effectDuration, 
ICardEffect activateClass)
  • cardCondition - conditions that need met for security card to be DP reduced
  • changeValue - amount of DP to change
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
public static Func<EffectTiming, ICardEffect> ChangeDigivolutionCostPlayerEffect(
Func<Permanent, bool> permanentCondition,
Func<CardSource, bool> cardCondition,
Func<SelectCardEffect.Root, bool> rootCondition,
int changeValue,
bool setFixedCost,
ICardEffect activateClass)
  • permanentCondition - conditions that need met for permanent to digivolve on
  • cardCondition - conditions that need met for card to digivolve into
  • rootCondition - conditions that need met for the root location of the digivolution (hand, trash, deck)
  • changeValue - cost of digivolution
  • setFixedCost - is digivolution cost fixed
  • activateClass - reference to the effect that gave it this function
public static IEnumerator ChangeDigimonDPPlayerEffect(
Func<Permanent, bool> permanentCondition, 
int changeValue, 
EffectDuration effectDuration, 
ICardEffect activateClass)
  • permanentCondition - conditions that need met for permanent change DP
  • changeValue - value of DP change
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
public static IEnumerator ChangePlayCostPlayerEffect(
Func<Permanent, bool> permanentCondition,
int changeValue,
bool setFixedCost,
EffectDuration effectDuration,
ICardEffect activateClass)
  • permanentCondition - conditions that need met for permanent change DP
  • changeValue - value of play cost change
  • setFixedCost - is cost fixed
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
public static IEnumerator ChangeDigimonSAttackPlayerEffect(
Func<Permanent, bool> permanentCondition, 
int changeValue, 
EffectDuration effectDuration, 
ICardEffect activateClass)
  • permanentCondition - conditions that need met for permanent change Security Attack
  • changeValue - value of security attack change
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
public static IEnumerator InvertDigimonSAttackPlayerEffect(
Func<Permanent, bool> permanentCondition,
int changeValue,
EffectDuration effectDuration,
ICardEffect activateClass)
  • permanentCondition - conditions that need met for permanent change Security Attack
  • changeValue - value of security attack invert change
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
public static Func<EffectTiming, ICardEffect> GainIgnoreDigivolutionRequirementPlayerEffect(
Func<Permanent, bool> permanentCondition, 
Func<CardSource, bool> cardCondition, 
bool ignoreDigivolutionRequirement, 
int digivolutionCost, 
ICardEffect activateClass)
  • permanentCondition - conditions that need met for permanent to digivolve on
  • cardCondition - conditions that need met for card to digivolve into
  • ignoreDigivolutionRequirement - should digivolution requirements be ignored
  • digivolutionCost - cost of digivolution
  • activateClass - reference to the effect that gave it this function
public static IEnumerator GainImmuneFromDPMinusPlayerEffect(
Func<Permanent, bool> permanentCondition, 
Func<ICardEffect, bool> cardEffectCondition, 
EffectDuration effectDuration, 
ICardEffect activateClass, 
string effectName)
  • permanentCondition - conditions that need met for permanent to gain effect
  • cardCondition - conditions that need met for card to gain effect
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
  • effectName - name for the effect (used in log UI)

Give Effect To Permanent

Some commonly used effects to give to a specific Permanent (stack):

public static IEnumerator GainCanNotReturnToDeck(
Permanent targetPermanent, 
Func<ICardEffect, bool> cardEffectCondition, 
EffectDuration effectDuration, 
ICardEffect activateClass, 
string effectName)
  • targetPermanent - reference to the affected permanent
  • cardEffectCondition - conditions for the effect used against the permanent
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
  • effectName - name for the effect (used in log UI)
public static IEnumerator GainCanNotAttack(
Permanent targetPermanent,
Func<Permanent, bool> defenderCondition,
EffectDuration effectDuration,
ICardEffect activateClass,
string effectName)
  • targetPermanent - reference to the affected permanent
  • defenderCondition - conditions that need to be met for the defending permanent
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
  • effectName - name for the effect (used in log UI)
public static IEnumerator GainCanNotBeAttacked(
Permanent targetPermanent,
Func<Permanent, bool> attackerCondition,
EffectDuration effectDuration,
ICardEffect activateClass,
string effectName)
  • targetPermanent - reference to the affected permanent
  • attackerCondition - conditions that need to be met for the attacking permanent
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
  • effectName - name for the effect (used in log UI)
public static IEnumerator GainCanNotBeBlocked(
Permanent targetPermanent,
Func<Permanent, bool> defenderCondition,
EffectDuration effectDuration,
ICardEffect activateClass,
string effectName)
  • targetPermanent - reference to the affected permanent
  • defenderCondition - conditions for the defending permanent
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
  • effectName - name for the effect (used in log UI)
public static IEnumerator GainCanNotBeDeletedByBattle(
Permanent targetPermanent, 
Func<Permanent, Permanent, Permanent, CardSource, bool> canNotBeDestroyedByBattleCondition, 
EffectDuration effectDuration, 
ICardEffect activateClass, 
string effectName)
  • targetPermanent - reference to the affected permanent
  • canNotBeDestroyedByBattleCondition - conditions for the battle determining if the permanent can be deleted
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
  • effectName - name for the effect (used in log UI)
public static IEnumerator GainCanNotBeDeletedByEffect(
Permanent targetPermanent, 
Func<ICardEffect, bool> cardEffectCondition, 
EffectDuration effectDuration, 
ICardEffect activateClass, 
string effectName)
  • targetPermanent - reference to the affected permanent
  • canNotBeDestroyedByBattleCondition - conditions for the battle determining if the permanent can be deleted
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
  • effectName - name for the effect (used in log UI)
public static IEnumerator GainCanNotBlock(
Permanent targetPermanent, 
Func<Permanent, bool> attackerCondition, 
EffectDuration effectDuration, 
ICardEffect activateClass, 
string effectName)
  • targetPermanent - reference to the affected permanent
  • attackerCondition - conditions for the attacking permanent
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
  • effectName - name for the effect (used in log UI)
public static IEnumerator GainCanNotReturnToHand(
Permanent targetPermanent, 
Func<ICardEffect, bool> cardEffectCondition, 
EffectDuration effectDuration, 
ICardEffect activateClass, 
string effectName)
  • targetPermanent - reference to the affected permanent
  • cardEffectCondition - conditions for the effect used against the permanent
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
  • effectName - name for the effect (used in log UI)
public static IEnumerator GainCantUnsuspendNextActivePhase(
Permanent targetPermanent, 
ICardEffect activateClass)
  • targetPermanent - reference to the affected permanent
  • activateClass - reference to the effect that gave it this function
public static IEnumerator GainCantUnsuspendUntilOpponentTurnEnd(
Permanent targetPermanent, 
ICardEffect activateClass)
  • targetPermanent - reference to the affected permanent
  • activateClass - reference to the effect that gave it this function
public static IEnumerator GainCanNotUnsuspend(
Permanent targetPermanent, 
EffectDuration effectDuration, 
ICardEffect activateClass, 
Func<bool> condition, 
string effectName)
  • targetPermanent - reference to the affected permanent
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
  • condition - conditions to be met in order to not unsuspend
  • effectName - name for the effect (used in log UI)
public static IEnumerator ChangeDigimonDP(
Permanent targetPermanent, 
int changeValue, 
EffectDuration effectDuration, 
ICardEffect activateClass)
  • targetPermanent - reference to the affected permanent
  • changeValue - value of DP change
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
public static IEnumerator ChangeDigimonLinkMax(
Permanent targetPermanent, 
int changeValue, 
EffectDuration effectDuration, 
ICardEffect activateClass)
  • targetPermanent - reference to the affected permanent
  • changeValue - value of link max change
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
public static IEnumerator ChangeBaseDigimonDP(
Permanent targetPermanent, 
int changeValue, 
EffectDuration effectDuration, 
ICardEffect activateClass)
  • targetPermanent - reference to the affected permanent
  • changeValue - value of DP change
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
public static IEnumerator ChangeDigimonSAttack(
Permanent targetPermanent,  
int changeValue, 
EffectDuration effectDuration, 
ICardEffect activateClass)
  • targetPermanent - reference to the affected permanent
  • changeValue - value of security attack change
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
public static IEnumerator InverteDigimonSAttack(
Permanent targetPermanent,  
int changeValue,
EffectDuration effectDuration,
ICardEffect activateClass)
  • targetPermanent - reference to the affected permanent
  • changeValue - value of security attack invert change
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
public static IEnumerator GainImmuneFromDPMinus(
Permanent targetPermanent,  
Func<ICardEffect, bool> cardEffectCondition, 
EffectDuration effectDuration, 
ICardEffect activateClass, 
string effectName)
  • targetPermanent - reference to the affected permanent
  • cardEffectCondition- conditions that need met for the card effect used
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
  • effectName - name for the effect (used in log UI)
public static IEnumerator BecomeDigimonThatCantDigivolve(
Permanent targetPermanent, 
int DP, 
EffectDuration effectDuration, 
ICardEffect activateClass)
  • targetPermanent - reference to the affected permanent
  • DP - Base DP of newly created Digimon
  • effectDuration - enum indicating how long the effect lasts
  • activateClass - reference to the effect that gave it this function
⚠️ **GitHub.com Fallback** ⚠️