Skip to content

Commit e80c6e8

Browse files
authored
Clean up some default amounts (Card-Forge#9345)
1 parent a6c5e79 commit e80c6e8

File tree

2,247 files changed

+2375
-2378
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,247 files changed

+2375
-2378
lines changed

docs/Card-scripting-API/Card-scripting-API.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ PT:2/2
1111
Oracle:
1212
```
1313

14-
* The name of this card is Vanilla Creature.
15-
* It's casting cost is {2}{G}.
16-
* It has the types Creature and Beast.
17-
* It has a Power-Toughness of 2/2.
18-
* It will not display any additional text in the card's template.
14+
* The name of this card is Vanilla Creature.
15+
* It's casting cost is {2}{G}.
16+
* It has the types Creature and Beast.
17+
* It has a Power-Toughness of 2/2.
18+
* It will not display any additional text in the card's template.
1919

20-
If a card has two faces, use AlternateMode:{CardStateName} in the front face and separate both by a new line with the text "ALTERNATE".
20+
If a card has two faces, use AlternateMode:{CardStateName} in the front face and separate both by a new line with the text `ALTERNATE`.
2121

22-
There are a few other properties that will appear in many cards. These are
22+
There are a few other properties that will appear in many cards. These can all be used across different faces - with `AI` and related `Deck`-variants being the exception:
2323

2424
| Property | Description
2525
| - | -

forge-ai/src/main/java/forge/ai/AiController.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -907,10 +907,9 @@ public AiPlayDecision canPlaySa(SpellAbility sa) {
907907
final Card card = sa.getHostCard();
908908

909909
// Trying to play a card that has Buyback without a Buyback cost, look for possible additional considerations
910-
if (getBoolProperty(AiProps.TRY_TO_PRESERVE_BUYBACK_SPELLS)) {
911-
if (card.hasKeyword(Keyword.BUYBACK) && !sa.isBuyback() && !canPlaySpellWithoutBuyback(card, sa)) {
912-
return AiPlayDecision.NeedsToPlayCriteriaNotMet;
913-
}
910+
if (getBoolProperty(AiProps.TRY_TO_PRESERVE_BUYBACK_SPELLS) && card.hasKeyword(Keyword.BUYBACK)
911+
&& !sa.isBuyback() && !canPlaySpellWithoutBuyback(card, sa)) {
912+
return AiPlayDecision.NeedsToPlayCriteriaNotMet;
914913
}
915914

916915
// TODO before suspending some spells try to predict if relevant targets can be expected

forge-ai/src/main/java/forge/ai/SpellAbilityAi.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public final AiAbilityDecision canPlayWithSubs(final Player aiPlayer, final Spel
5656
* Handles the AI decision to play a "main" SpellAbility
5757
*/
5858
protected AiAbilityDecision canPlay(final Player ai, final SpellAbility sa) {
59+
// TODO this is redundant when reached from canPlayAndPayForFace
5960
if (sa.getRestrictions() != null && !sa.getRestrictions().canPlay(sa.getHostCard(), sa)) {
6061
return new AiAbilityDecision(0, AiPlayDecision.CantPlaySa);
6162
}

forge-core/src/main/java/forge/card/CardRules.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -897,8 +897,7 @@ public boolean hasStartOfKeyword(final String k) {
897897
}
898898
public boolean hasStartOfKeyword(final String k, ICardFace cf) {
899899
for (final String inst : cf.getKeywords()) {
900-
final String[] parts = inst.split(":");
901-
if ((parts[0]).equalsIgnoreCase(k)) {
900+
if (inst.startsWith(k)) {
902901
return true;
903902
}
904903
}

forge-game/src/main/java/forge/game/GameActionUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ public static List<OptionalCostValue> getOptionalCostValues(final SpellAbility s
405405
final Game game = source.getGame();
406406
boolean lkicheck = false;
407407

408-
Card newHost = ((Spell)sa).getAlternateHost(source);
408+
Card newHost = sa.getAlternateHost(source);
409409
if (newHost != null) {
410410
source = newHost;
411411
lkicheck = true;

forge-game/src/main/java/forge/game/card/CardFactoryUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,7 +1457,7 @@ public static void addTriggerAbility(final KeywordInterface inst, final Card car
14571457
sbTrig.append("Living Weapon (").append(inst.getReminderText()).append(")");
14581458

14591459
final StringBuilder sbGerm = new StringBuilder();
1460-
sbGerm.append("DB$ Token | TokenAmount$ 1 | TokenScript$ b_0_0_phyrexian_germ | TokenOwner$ You | RememberTokens$ True");
1460+
sbGerm.append("DB$ Token | TokenScript$ b_0_0_phyrexian_germ | TokenOwner$ You | RememberTokens$ True");
14611461

14621462
final SpellAbility saGerm = AbilityFactory.getAbility(sbGerm.toString(), card);
14631463

@@ -3983,7 +3983,7 @@ else if ("Artifact".equals(t))
39833983
+ " | Secondary$ True | Description$ " + sb.toString() + " (" + inst.getReminderText() + ")";
39843984
String trig = "Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self" +
39853985
" | Execute$ TrigDraw | Secondary$ True | TriggerDescription$ When this creature dies, draw a card.";
3986-
String ab = "DB$ Draw | NumCards$ 1";
3986+
String ab = "DB$ Draw";
39873987

39883988
StaticAbility st = StaticAbility.create(effect, state.getCard(), state, intrinsic);
39893989

forge-game/src/main/java/forge/game/cost/CostExile.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,19 @@ else if (type.contains("FromTopGrave")) {
223223
list = CardLists.getValidCards(list, type.split(";"), payer, source, ability);
224224
}
225225

226-
int amount = this.getAbilityAmount(ability);
226+
if (nTypes > -1 && AbilityUtils.countCardTypesFromList(list, false) < nTypes) {
227+
return false;
228+
}
227229

228-
if (nTypes > -1) {
229-
if (AbilityUtils.countCardTypesFromList(list, false) < nTypes) return false;
230+
if (totalCMC || totalCMCgreater) {
231+
if (totalM.equals("X") && ability.getXManaCostPaid() == null) { // X hasn't yet been decided, let it pass
232+
return true;
233+
}
234+
int i = AbilityUtils.calculateAmount(source, totalM, ability);
235+
return totalCMCgreater ? CardLists.getTotalCMC(list) >= i : CardLists.cmcCanSumTo(i, list);
230236
}
237+
238+
int amount = this.getAbilityAmount(ability);
231239

232240
if (sharedType) { // will need more logic if cost ever wants more than 2 that share a type
233241
if (list.size() < amount) return false;
@@ -242,14 +250,6 @@ else if (type.contains("FromTopGrave")) {
242250
return false;
243251
}
244252

245-
if (totalCMC || totalCMCgreater) {
246-
if (totalM.equals("X") && ability.getXManaCostPaid() == null) { // X hasn't yet been decided, let it pass
247-
return true;
248-
}
249-
int i = AbilityUtils.calculateAmount(source, totalM, ability);
250-
return totalCMCgreater ? CardLists.getTotalCMC(list) >= i : CardLists.cmcCanSumTo(i, list);
251-
}
252-
253253
// for Craft: do not count the source card twice (it will be sacrificed)
254254
if (ability.isCraft()) {
255255
CostExile firstExileCost = ability.getPayCosts().getCostPartByType(CostExile.class);

forge-gui/res/cardsfolder/a/a_killer_among_us.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ SVar:TrigToken:DB$ Token | TokenScript$ w_1_1_human,u_1_1_merfolk,r_1_1_goblin |
66
SVar:DBChooseType:DB$ ChooseType | Type$ Creature | ValidTypes$ Human,Merfolk,Goblin | Secretly$ True
77
A:AB$ PutCounter | Cost$ Sac<1/CARDNAME> RevealChosen<Type/creature type> | ValidTgts$ Creature.token+attacking | TgtPrompt$ Select target attacking creature token | AITgts$ Creature.token+attacking+ChosenType | Defined$ Targeted.ChosenType | CounterType$ P1P1 | CounterNum$ 3 | SubAbility$ DBPump | StackDescription$ REP target attacking creature token_{c:Targeted} | SpellDescription$ If target attacking creature token is the chosen type, put three +1/+1 counters on it
88
SVar:DBPump:DB$ Pump | Defined$ Targeted.ChosenType | KW$ Deathtouch | StackDescription$ SpellDescription | SpellDescription$ and it gains deathtouch until end of turn.
9-
DeckHas:Ability$Token|Sacrifice & Type$Human|Merfolk|Goblin & Color$White|Blue|Red
9+
DeckHas:Ability$Token|Sacrifice
1010
Oracle:When A Killer Among Us enters, create a 1/1 white Human creature token, a 1/1 blue Merfolk creature token, and a 1/1 red Goblin creature token. Then secretly choose Human, Merfolk, or Goblin.\nSacrifice A Killer Among Us, Reveal the chosen creature type: If target attacking creature token is the chosen type, put three +1/+1 counters on it and it gains deathtouch until end of turn.

forge-gui/res/cardsfolder/a/abby_merciless_soldier.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ SVar:X:Count$CastTotalManaSpent
99
R:Event$ Moved | ValidCard$ Card.Self | Destination$ Battlefield | ReplaceWith$ DBChooseOpp | Layer$ Control | Description$ NICKNAME enters under the control of an opponent of your choice.
1010
SVar:DBChooseOpp:DB$ ChoosePlayer | Defined$ You | Choices$ Player.Opponent | ChoiceTitle$ Choose an opponent to give control to | AILogic$ Curse | SubAbility$ MoveToPlay
1111
SVar:MoveToPlay:DB$ ChangeZone | Hidden$ True | Origin$ All | Destination$ Battlefield | Defined$ ReplacedCard | GainControl$ ChosenPlayer
12-
DeckHas:Ability$Token & Type$Zombie|Fungus
12+
DeckHas:Ability$Token
1313
Oracle:When you cast this spell, create a number of 1/1 black Fungus Zombie creature tokens named Cordyceps Infected equal to the amount of mana spent to cast it.\nAbby enters under the control of an opponent of your choice.\nPartner—Survivors (You can have two commanders if both have this ability.)

forge-gui/res/cardsfolder/a/abstruse_interference.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ManaCost:2 U
33
Types:Instant
44
K:Devoid
55
A:SP$ Counter | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ 1 | SubAbility$ DBToken | SpellDescription$ Counter target spell unless its controller pays {1}.
6-
SVar:DBToken:DB$ Token | TokenAmount$ 1 | TokenScript$ c_1_1_eldrazi_scion_sac | TokenOwner$ You | SpellDescription$ You create a 1/1 colorless Eldrazi Scion creature token. It has "Sacrifice this creature: Add {C}." ({C} represents colorless mana.)
6+
SVar:DBToken:DB$ Token | TokenScript$ c_1_1_eldrazi_scion_sac | TokenOwner$ You | SpellDescription$ You create a 1/1 colorless Eldrazi Scion creature token. It has "Sacrifice this creature: Add {C}." ({C} represents colorless mana.)
77
DeckHas:Ability$Mana.Colorless|Token
88
DeckHints:Type$Eldrazi
99
Oracle:Devoid (This card has no color.)\nCounter target spell unless its controller pays {1}. You create a 1/1 colorless Eldrazi Scion creature token. It has "Sacrifice this creature: Add {C}." ({C} represents colorless mana.)

0 commit comments

Comments
 (0)