Card Effects - DCGO2/DCGO-Card-Scripts GitHub Wiki

Organization

There is 1 script per card, these scripts are named the card ID (ex. BT20-001 = BT20_001). These are organized into folders of the Set Number (ex. BT20). Then placed into corresponding color folders. These colors are based on the left most color of a given card in the case of multi-colored cards.

Default Script

Here is an example of a default script, it contains the basics of what you will need (in most cases). Below we will break down each section of the code and what it means.

using System.Collections;
using System.Collections.Generic;

namespace DCGO.CardEffects
{
    public class #SCRIPTNAME# : CEntity_Effect
    {
        public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
        {
            List<ICardEffect> cardEffects = new List<ICardEffect>();

            if (timing == EffectTiming.None)
            {
                ActivateClass activateClass = new ActivateClass();
                activateClass.SetUpICardEffect("", CanUseCondition, card);
                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
                cardEffects.Add(activateClass);

                string EffectDiscription()
                {
                    return "";
                }

                bool CanUseCondition(Hashtable hashtable)
                {
                    return true;
                }

                bool CanActivateCondition(Hashtable hashtable)
                {
                    return true;
                }

                IEnumerator ActivateCoroutine(Hashtable hashtable)
                {
                    yield return null;
                }
            }

            return cardEffects;
        }
    }
}

Usings

using System.Collections;
using System.Collections.Generic;

These are used to incorporate other namespaces within the code, you will generally use only these, though using System may be added for MathF calls.

Namespace

This is the default namespace for card effects, for any new script you need to also add the set ID so it should look like this:

namespace DCGO.CardEffects.BT20
{

}

Class Name

The class name should always be named after the card ID replacing #SCRIPTNAME# with (ex. BT20_001). CEntity_Effect is the base class for effects, you should NEVER need to edit this. public class #SCRIPTNAME# : CEntity_Effect

Card Effects Method

The only method in these classes return a list of effects for the card.

public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
{

}

Effect

These timing if statements indicate a unique effect on the card, this includes effects with multiple timings as they should be created as their own effects (Thanks Venusmon). See EffectTiming for more details.

if (timing == EffectTiming.None)
{

}

Card Effect Classes

Classes used when creating a new effect. There are several more used by other pre existing classes, but we are only going to cover the ones you may actually use here. The Activate Class is the most commonly used class

  • SetUpICardEffect initializes the effect for use, parameters are as follows
  • String: Effect Name - short hand name for effect
  • Func: CanUseCondition - Bool return method for determining if the effect can trigger
  • CardSource: Card - reference to this cards CardSource Class

Activate Class

Most commonly used effect class. Indicates and activated effect.

public void SetUpActivateClass(Func<Hashtable, bool> canActivateCondition, Func<Hashtable, IEnumerator> activateCoroutine, int maxCountPerTurn, bool isOptional, string effectDiscription)
  • SetUpActivateClass initializes the effect, parameters are as follows
  • Func: CanActivateCondition - Bool return method for determining if the effect can activate
  • IEnumerator: ActivateCoroutine - IEnumerator for what the actual effect does
  • Int: MaxPerTurnCount - how many times per turn this effect can activate usually -1 or 1
  • Bool: isOptional - determines if effect is optional, will present user with "do you want to use X effect" popup
  • String: Effect Description - String returned method outlining the full text for the effect

Add Skill Class

Adds a skill/effect to target.

public void SetUpAddSkillClass(Func<CardSource, bool> cardSourceCondition, Func<CardSource, List<ICardEffect>, EffectTiming, List<ICardEffect>> getEffects)
  • SetUpAddSkillClass initializes the effect, parameters are as follows
  • cardSourceCondition - Bool return method for determining if the card meets certain conditions
  • getEffects - returns List for what the actual added skill does

Can Not Affected Class

Adds specified immunity to target.

public void SetUpCanNotAffectedClass(Func<CardSource, bool> CardCondition, Func<ICardEffect, bool> SkillCondition)
  • SetUpCanNotAffectedClass initializes the effect, parameters are as follows
  • CardCondition- Bool return method for determining if the card meets certain conditions
  • SkillCondition- Bool return method for determining if the effect meets certain conditions

Can Not Be Removed Class

Determines if card can be removed.

public void SetUpCanNotBeRemovedClass(Func<Permanent, bool> permanentCondition)
  • SetUpCanNotBeRemovedClass initializes the effect, parameters are as follows
  • permanentCondition - Bool return method for determining if the permanent meets certain conditions

Can Not Digivolve Class

Determines if card can Digivolve.

public void SetUpCanNotEvolveClass(Func<Permanent, bool> permanentCondition, Func<CardSource, bool> cardCondition)
  • SetUpCanNotEvolveClass initializes the effect, parameters are as follows
  • permanentCondition - Bool return method for determining if the permanent meets certain conditions
  • cardCondition - Bool return method for determining if the card meets certain conditions

Can Not Move Class

Determines if card can move to/from breeding.

public void SetUpCanNotMoveClass(Func<CardSource, bool> cardCondition, Func<ICardEffect, bool> cardEffectCondition)
  • SetUpCanNotMoveClass initializes the effect, parameters are as follows
  • cardCondition - Bool return method for determining if the card meets certain conditions
  • cardEffectCondition - Bool return method for determining if the ICardEffect meets certain conditions

Can Not Play Class

Determines if card can be played.

public void SetUpCanNotPlayClass(Func<CardSource, bool> cardCondition)
  • SetUpCanNotPlayClass initializes the effect, parameters are as follows
  • cardCondition - Bool return method for determining if the card meets certain conditions

Can Not Put Field Class

Determines if card can be put onto field.

public void SetUpCanNotPutFieldClass(Func<CardSource, bool> cardCondition, Func<ICardEffect, bool> cardEffectCondition)
  • SetUpCanNotPutFieldClass initializes the effect, parameters are as follows
  • cardCondition - Bool return method for determining if the card meets certain conditions
  • cardEffectCondition - Bool return method for determining if the ICardEffect meets certain conditions

Can Not Reduce Cost Class

Determines if card can reduce its cost.

public void SetUpCannotReduceCostClass(Func<Player, bool> playerCondition, Func<List<Permanent>, bool> targetPermanentsCondition, Func<CardSource, bool> cardCondition)
  • SetUpCannotReduceCostClass initializes the effect, parameters are as follows
  • playerCondition - Bool return method for determining if the player meets certain conditions
  • targetPermanentsCondition - Bool return method for determining if the List meets certain conditions
  • cardCondition - Bool return method for determining if the card meets certain conditions

Can Not Suspend Class

Determines if card can suspend.

public void SetUpCanNotSuspendClass(Func<Permanent, bool> PermanentCondition)
  • SetUpCanNotSuspendClass initializes the effect, parameters are as follows
  • PermanentCondition - Bool return method for determining if the permanent meets certain conditions

Can Not Switch Attack Target Class

Determines if card can change attack targets.

public void SetUpCanNotSwitchAttackTargetClass(Func<Permanent, bool> PermanentCondition)
  • SetUpCanNotSwitchAttackTargetClass initializes the effect, parameters are as follows
  • PermanentCondition - Bool return method for determining if the permanent meets certain conditions

Change Base Card Color Class

Determines if card changed it base color.

public void SetUpChangeBaseCardColorClass(Func<CardSource, List<CardColor>, List<CardColor>> ChangeBaseCardColors)
  • SetUpChangeBaseCardColorClass initializes the effect, parameters are as follows
  • ChangeBaseCardColors - List return method for determining what colors to change to based on certain conditions

Change Base Card Names Class

Determines if card changed it base names.

public void SetUpChangeBaseCardNamesClass(Func<CardSource, List<string>, List<string>> changeBaseCardNames)
  • SetUpChangeBaseCardNamesClass initializes the effect, parameters are as follows
  • changeBaseCardNames- List return method for determining what names to change to based on certain conditions

Change Card Colors Class

Determines if card changed it color.

public void SetUpChangeCardColorClass(Func<CardSource, List<CardColor>, List<CardColor>> ChangeCardColors)
  • SetUpChangeCardColorClass initializes the effect, parameters are as follows
  • ChangeCardColors - List return method for determining what colors to change to based on certain conditions

Change Card Names Class

Determines if card changed it names.

public void SetUpChangeCardNamesClass(Func<CardSource, List<string>, List<string>> changeCardNames)
  • SetUpChangeCardNamesClass initializes the effect, parameters are as follows
  • changeCardNames - List return method for determining what names to change to based on certain conditions

Change Card Names For Digi Xros Class

Determines if card changed it names specifically for digi xrossing.

public void SetUpChangeCardNamesForDigiXrosClass(Func<CardSource, List<string>, List<string>> changeCardNames)
  • SetUpChangeCardNamesForDigiXrosClass initializes the effect, parameters are as follows
  • changeCardNames - List return method for determining what names to change to based on certain conditions

Change Cost Class

Determines if card changed it cost.

public void SetUpChangeCostClass(Func<CardSource, int, SelectCardEffect.Root, List<Permanent>, int> changeCostFunc, Func<CardSource, bool> cardSourceCondition, Func<SelectCardEffect.Root, bool> rootCondition, Func<bool> isUpDown, Func<bool> isCheckAvailability, Func<bool> isChangePayingCost)
  • SetUpChangeCostClass initializes the effect, parameters are as follows
  • changeCostFunc - List return method for determining what names to change to based on certain conditions
  • cardSourceCondition - Bool return method for determining if the card meets certain conditions
  • rootCondition - Bool return method for determining if the root meets certain conditions
  • isUpDown - Bool method for determining if the cost is reduced/added based on certain conditions
  • isCheckAvailability - Bool method for determining if the reduction can occur
  • isChangePayingCost - Bool method for determining if the cost should be changed

Change DP Delete Effect Max DP Class

Determines if an effect can delete additional DP.

public void SetUpChangeDPDeleteEffectMaxDPClass(Func<int, ICardEffect, int> changeMaxDP)
  • SetUpChangeDPDeleteEffectMaxDPClass initializes the effect, parameters are as follows
  • changeMaxDP - Int return method for determining what max DP is changed to based on certain conditions

Change Permanent Level Class

Determines if an permanent can change its level.

public void SetUpChangePermanentLevelClass(Func<Permanent, int, int> GetLevel)
  • SetUpChangePermanentLevelClass initializes the effect, parameters are as follows
  • GetLevel - Int return method for determining what level permanent is changed to based on certain conditions

Change Security Attack Class

Determines if an card changes its security attack count.

public void SetUpChangeSAttackClass(Func<Permanent, int, int> changeSAttackFunc, Func<Permanent, bool> permanentCondition, Func<CalculateOrder> isUpDown)
  • SetUpChangeSAttackClass initializes the effect, parameters are as follows
  • changeSAttackFunc - Int return method for determining what security attack is changed to based on certain conditions
  • permanentCondition- Bool return method for determining if a permanent meets certain conditions
  • isUpDown - Bool method for determining if the count is reduced/increased based on certain conditions

Disable Effect Class

Determines if an effect is disabled.

public void SetUpDisableEffectClass(Func<ICardEffect, bool> DisableCondition)
  • SetUpDisableEffectClass initializes the effect, parameters are as follows
  • DisableCondition- Bool return method for determining if an effect meets certain conditions

Ignore Color Condition Class

Determines if a card can ignore color requirements.

public void SetUpIgnoreColorConditionClass(Func<CardSource, bool> cardCondition)
  • SetUpIgnoreColorConditionClass initializes the effect, parameters are as follows
  • cardCondition - Bool return method for determining if an card meets certain conditions

Immune De-Digivolve Class

Determines if a card is immune to de-digivolve.

public void SetUpImmuneFromDeDigivolveClass(Func<Permanent, bool> PermanentCondition)
  • SetUpImmuneFromDeDigivolveClass initializes the effect, parameters are as follows
  • PermanentCondition - Bool return method for determining if an permanent meets certain conditions

Treat As Digimon Class

Determines if a card is treated as a digimon.

public void SetUpTreatAsDigimonClass(Func<Permanent, bool> permanentCondition)
  • SetUpTreatAsDigimonClass initializes the effect, parameters are as follows
  • permanentCondition- Bool return method for determining if an permanent meets certain conditions
⚠️ **GitHub.com Fallback** ⚠️