Skip to content
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions forge-ai/src/main/java/forge/ai/SpellAbilityAi.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
* The three main methods are canPlayAI(), chkAIDrawback and doTriggerAINoCost.
*/
public abstract class SpellAbilityAi {
public static final String[] OPTIONAL_PARAMS = {
"AIActivateLast", "AIBidMax", "AICheckSVar", "AILifeThreshold", "AILogic",
"AIManaPref", "AIMaxTgtsCount", "AIPhyrexianPayment", "AIRespondsToOwnAbility",
"AISVarCompare", "AITgts", "AITgtsStrict", "AIXMax", "UnlessAI",
};

public Predicate<Card> CREATURE_OR_TAP_ABILITY = c -> {
if (c.isCreature()) {
Expand Down
10 changes: 10 additions & 0 deletions forge-game/src/main/java/forge/game/CardTraitBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@
*
*/
public abstract class CardTraitBase implements GameObject, IHasCardView, IHasSVars {
public static final String[] OPTIONAL_PARAMS = {
"Adamant", "Blessing", "Bloodthirst", "CheckDefinedPlayer", "CheckSVar",
"CheckSecondSVar", "ClassLevel", "DayTime", "DefinedPlayerCompare", "Delirium",
"Desert", "FatefulHour", "Hellbent", "Invert", "IsPresent", "IsPresent2",
"LifeAmount", "LifeTotal", "ManaNotSpent", "ManaSpent", "Metalcraft", "Monarch",
"PresentCompare", "PresentCompare2", "PresentDefined", "PresentPlayer",
"PresentPlayer2", "PresentZone", "PresentZone2", "Revolt", "SVarCompare",
"SecondSVarCompare", "Secondary", "Threshold", "WerewolfTransformCondition",
"WerewolfUntransformCondition",
};

/** The host card. */
protected Card hostCard;
Expand Down
11 changes: 11 additions & 0 deletions forge-game/src/main/java/forge/game/ability/AbilityFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@
* @version $Id$
*/
public final class AbilityFactory {
public static final String[] OPTIONAL_PARAMS = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd still like to see additionalAbilityKeys unioned here less manually

"BidSubAbility", "CantChooseSubAbility", "Choices", "ChooseNumberSubAbility",
"ChooseSubAbility", "ChosenPile", "Cost", "Execute", "FallbackAbility",
"FalseSubAbility", "GiftAbility", "GuessCorrect", "GuessWrong", "HeadsSubAbility",
"Highest", "LoseSubAbility", "Lowest", "MatchedAbility", "NonBasicSpell",
"NotLowest", "Origin", "OtherwiseSubAbility", "PreventionSubAbility",
"RegenerationAbility", "RepeatSubAbility", "ResultSubAbilities", "ReturnAbility",
"SpellDescription", "SubAbility", "TailsSubAbility", "TrueSubAbility",
"UnchosenPile", "UnmatchedAbility", "ValidTgts", "VoteSubAbility",
"VoteTiedAbility", "WinSubAbility",
};

public static final List<String> additionalAbilityKeys = Lists.newArrayList(
"WinSubAbility", "OtherwiseSubAbility", // Clash
Expand Down
7 changes: 7 additions & 0 deletions forge-game/src/main/java/forge/game/ability/AbilityUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@
import java.util.stream.IntStream;

public class AbilityUtils {
public static final String[] OPTIONAL_PARAMS = {
"AbilityCount", "AnnounceMax", "Destination", "ETB", "ForgetOtherTargets",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Destination is effect specific?

"IncludeAllComponentCards", "LockInText", "RememberCostMana", "RememberTargets",
"Triggered", "UnlessColor", "UnlessCost", "UnlessPayer", "UnlessResolveSubs",
"UnlessSwitched", "UnlessUpTo", "XMax", "XMin",
};

private final static ImmutableList<String> cmpList = ImmutableList.of("LT", "LE", "EQ", "GE", "GT", "NE");

// should the three getDefined functions be merged into one? Or better to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@
*/

public abstract class SpellAbilityEffect {
// Card-script parameters read by the framework, declared here so the set each class
// consumes is explicit and can be checked against the card scripts. Each framework class
// lists the shared (optional) base params it consumes; ability effects additionally
// declare REQUIRED_PARAMS (one-of groups) on top.
public static final String[] OPTIONAL_PARAMS = {
"AfterDescription", "Amount", "Announce", "AtEOTCondition", "AtEOTDesc",
"ConditionDescription", "Defined", "DefinedExiler", "Duration",
"ExiledWithEffectSource", "ForEach", "Forecast", "GiftDescription",
"IncludeAllComponentCards", "Named", "ReplaceDyingCondition", "ReplaceDyingDefined",
"ReplaceDyingExiledWith", "ReplaceDyingValid", "ReplaceDyingZone", "ReturnAbility",
"ReturnValid", "SpellDescription", "StackDescription", "StartingWith",
"ThisDefinedAndTgts",
};

public abstract void resolve(SpellAbility sa);

Expand Down
9 changes: 9 additions & 0 deletions forge-game/src/main/java/forge/game/cost/Cost.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@
* @version $Id$
*/
public class Cost implements Serializable {
public static final String[] OPTIONAL_PARAMS = {
"AffectedZone", "Amount", "Announce", "Collected", "CollectedCards", "Color",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would like to see the Hash* fields queried instead if possible

"Cost", "Exiled", "ExiledCards", "FirstForetell", "ForEachShard", "Foraged",
"ForagedCards", "IgnoreGeneric", "MinMana", "ModeCost", "OnlyFirstSpell",
"RaiseCost", "RaiseTo", "ReduceAmount", "ReduceCost", "Relative",
"SpellDescription", "TapCreaturesForMana", "Type", "UnlessValidTarget", "UpTo",
"ValidCard", "ValidSpell", "ValidTarget",
};

/**
* Serializables need a version ID.
*/
Expand Down
12 changes: 12 additions & 0 deletions forge-game/src/main/java/forge/game/spellability/SpellAbility.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@
* @version $Id$
*/
public abstract class SpellAbility extends CardTraitBase implements ISpellAbility, IIdentifiable, Comparable<SpellAbility> {
public static final String[] OPTIONAL_PARAMS = {
"AlternateCost", "Amount", "Announce", "Boast", "CantCopy", "CloakUp", "CostDesc",
"CumulativeUpkeep", "DisguiseUp", "DividedAsYouChoose", "Exhaust", "Hidden",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sometimes, like with CumulativeUpkeep they are only used internally as helper

so for this case if it'd show up in a script it'd actually be wrong

conceptually I'm not sure yet if we need a third category for params that are technically still implemented but very exotic/deprecated instead 🤔

"IsCurse", "ManaRestriction", "ManifestUp", "MaxTotalTargetCMC",
"MaxTotalTargetPower", "MorphUp", "Origin", "Planeswalker", "PowerUp",
"PrecostDesc", "SpellDescription", "TargetType", "TargetingPlayer",
"TargetingPlayerControls", "TargetsWithControllerProperty",
"TargetsWithDefinedController", "TargetsWithRelatedProperty",
"TargetsWithSharedCardType", "TargetsWithSharedTypes", "Unlock", "ValidAfterStack",
"WithoutManaCost", "XColor",
};

private static int maxId = 0;
private static int nextId() { return ++maxId; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,20 @@
* @since 1.0.15
*/
public class SpellAbilityCondition extends SpellAbilityVariables {
public static final String[] OPTIONAL_PARAMS = {
"Condition", "ConditionActivationLimit", "ConditionCheckSVar",
"ConditionChosenColor", "ConditionCompare", "ConditionCompare2", "ConditionDefined",
"ConditionDefined2", "ConditionFirstCombat", "ConditionGameTypes",
"ConditionLifeAmount", "ConditionLifeTotal", "ConditionManaNotSpent",
"ConditionManaSpent", "ConditionNoDifferentColors", "ConditionNotPresent",
"ConditionOpponentTurn", "ConditionOptionalPaid", "ConditionPhases",
"ConditionPlayerContains", "ConditionPlayerDefined", "ConditionPlayerTurn",
"ConditionPresent", "ConditionPresent2", "ConditionSVarCompare",
"ConditionSorcerySpeed", "ConditionTargetValidTargeting",
"ConditionTargetsSingleTarget", "ConditionZone", "OrConditionCheckSVar",
"OrOtherConditionSVarCompare",
};

// A class for handling SpellAbility Conditions. These restrictions include:
// Zone, Phase, OwnTurn, Speed (instant/sorcery), Amount per Turn, Player,
// Threshold, Metalcraft, LevelRange, etc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@
* @version $Id$
*/
public class SpellAbilityRestriction extends SpellAbilityVariables {
public static final String[] OPTIONAL_PARAMS = {
"Activation", "ActivationAfterBlockers", "ActivationFirstCombat",
"ActivationGameTypes", "ActivationLifeAmount", "ActivationLifeTotal",
"ActivationLimit", "ActivationPhases", "ActivationZone", "Activator",
"AdditionalActivationZone", "Affected", "CheckSVar", "ClassLevel",
"GameActivationLimit", "InstantSpeed", "IsPresent", "OpponentTurn", "PlayerTurn",
"PresentCompare", "PresentDefined", "PresentZone", "SVarCompare", "SorcerySpeed",
"ValidSA",
};

// A class for handling SpellAbility Restrictions. These restrictions include:
// Zone, Phase, OwnTurn, Speed (instant/sorcery), Amount per Turn, Player,
// Threshold, Metalcraft, LevelRange, etc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@
* @version $Id$
*/
public class TargetRestrictions {
public static final String[] OPTIONAL_PARAMS = {
"MaxTotalTargetCMC", "MaxTotalTargetPower", "RandomNumTargets", "TargetMax",
"TargetMin", "TargetUnique", "TargetValidTargeting", "TargetingPlayer",
"TargetsAtRandom", "TargetsForEachPlayer", "TargetsWithDifferentCMC",
"TargetsWithDifferentControllers", "TargetsWithDifferentNames",
"TargetsWithEqualToughness", "TargetsWithSameCardType", "TargetsWithSameController",
"TargetsWithSameCreatureType", "TargetsWithoutSameCreatureType", "TgtPrompt",
"TgtZone", "ValidTgts", "ValidTgtsDesc",
};

// Target has two things happening:
// Targeting restrictions (Creature, Min/Maxm etc) which are true for this
// What this Object is restricted to targeting
Expand Down
Loading
Loading