This commit is contained in:
tool4EvEr
2023-02-12 12:32:36 +01:00
parent 71c14c00f0
commit 58fb2ba650
11 changed files with 19 additions and 27 deletions

View File

@@ -5,7 +5,6 @@ import com.google.common.collect.Iterables;
import forge.ai.*; import forge.ai.*;
import forge.card.CardStateName; import forge.card.CardStateName;
import forge.card.CardTypeView; import forge.card.CardTypeView;
import forge.card.mana.ManaCost;
import forge.game.Game; import forge.game.Game;
import forge.game.GameType; import forge.game.GameType;
import forge.game.ability.AbilityUtils; import forge.game.ability.AbilityUtils;
@@ -74,8 +73,7 @@ public class PlayAi extends SpellAbilityAi {
// Try to play only when there are more than three playable cards. // Try to play only when there are more than three playable cards.
if (cards.size() < 3) if (cards.size() < 3)
return false; return false;
ManaCost mana = sa.getPayCosts().getTotalMana(); if (sa.costHasManaX()) {
if (mana.countX() > 0) {
int amount = ComputerUtilCost.getMaxXValue(sa, ai, sa.isTrigger()); int amount = ComputerUtilCost.getMaxXValue(sa, ai, sa.isTrigger());
if (amount < ComputerUtilCard.getBestAI(cards).getCMC()) if (amount < ComputerUtilCard.getBestAI(cards).getCMC())
return false; return false;
@@ -160,7 +158,7 @@ public class PlayAi extends SpellAbilityAi {
if (sa.hasParam("WithoutManaCost")) { if (sa.hasParam("WithoutManaCost")) {
// Try to avoid casting instants and sorceries with X in their cost, since X will be assumed to be 0. // Try to avoid casting instants and sorceries with X in their cost, since X will be assumed to be 0.
if (!(spell instanceof SpellPermanent)) { if (!(spell instanceof SpellPermanent)) {
if (spell.getPayCosts().getTotalMana().countX() > 0) { if (spell.costHasManaX()) {
continue; continue;
} }
} }
@@ -180,11 +178,11 @@ public class PlayAi extends SpellAbilityAi {
// Before accepting, see if the spell has a valid number of targets (it should at this point). // Before accepting, see if the spell has a valid number of targets (it should at this point).
// Proceeding past this point if the spell is not correctly targeted will result // Proceeding past this point if the spell is not correctly targeted will result
// in "Failed to add to stack" error and the card disappearing from the game completely. // in "Failed to add to stack" error and the card disappearing from the game completely.
if (!sa.hasParam("WithoutManaCost") && !ComputerUtilCost.canPayCost(spell, ai, true)) { if (!spell.isTargetNumberValid() || !ComputerUtilCost.canPayCost(spell, ai, true)) {
// if we won't be able to pay the cost, don't choose the card // if we won't be able to pay the cost, don't choose the card
return false; return false;
} }
return spell.isTargetNumberValid(); return true;
} }
} }
return false; return false;

View File

@@ -118,6 +118,10 @@ public class CardState extends GameObject implements IHasSVars {
return name + " (" + view.getState() + ")"; return name + " (" + view.getState() + ")";
} }
public CardTypeView getTypeWithChanges() {
return getType().getTypeWithChanges(card.getChangedCardTypes());
}
public final CardTypeView getType() { public final CardTypeView getType() {
return type; return type;
} }
@@ -466,12 +470,7 @@ public class CardState extends GameObject implements IHasSVars {
return getReplacementEffects().contains(re); return getReplacementEffects().contains(re);
} }
public final boolean hasReplacementEffect(final int id) { public final boolean hasReplacementEffect(final int id) {
for (final ReplacementEffect r : getReplacementEffects()) { return getReplacementEffect(id) != null;
if (id == r.getId()) {
return true;
}
}
return false;
} }
public final ReplacementEffect getReplacementEffect(final int id) { public final ReplacementEffect getReplacementEffect(final int id) {
@@ -657,11 +656,6 @@ public class CardState extends GameObject implements IHasSVars {
public String getSetCode() { public String getSetCode() {
return setCode; return setCode;
} }
public CardTypeView getTypeWithChanges() {
return getType().getTypeWithChanges(card.getChangedCardTypes());
}
public void setSetCode(String setCode0) { public void setSetCode(String setCode0) {
setCode = setCode0; setCode = setCode0;
view.updateSetCode(this); view.updateSetCode(this);

View File

@@ -958,4 +958,4 @@ public class SpellAbilityVariables implements Cloneable {
public void setClassLevelOperator(String op) { public void setClassLevelOperator(String op) {
classLevelOperator = op; classLevelOperator = op;
} }
} // end class SpellAbilityVariables }

View File

@@ -61,7 +61,7 @@ public class SpellPermanent extends SpellApiBased {
this.setStackDescription(""); this.setStackDescription("");
this.setDescription(this.getStackDescription()); this.setDescription(this.getStackDescription());
if (this.getPayCosts().getTotalMana().countX() > 0 && StringUtils.isNotBlank(getHostCard().getSVar("X"))) { if (costHasManaX() && StringUtils.isNotBlank(getHostCard().getSVar("X"))) {
this.setSVar("X", this.getHostCard().getSVar("X")); this.setSVar("X", this.getHostCard().getSVar("X"));
} }
} // Spell_Permanent() } // Spell_Permanent()

View File

@@ -4,7 +4,7 @@ Types:Enchantment
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigSearch | OptionalDecider$ You | TriggerDescription$ When CARDNAME enters the battlefield, you may search your library and/or graveyard for a card named Ajani, Valiant Protector, reveal it, and put it into your hand. If you search your library this way, shuffle. T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigSearch | OptionalDecider$ You | TriggerDescription$ When CARDNAME enters the battlefield, you may search your library and/or graveyard for a card named Ajani, Valiant Protector, reveal it, and put it into your hand. If you search your library this way, shuffle.
SVar:TrigSearch:DB$ ChangeZone | Origin$ Library | OriginAlternative$ Graveyard | AlternativeMessage$ Would you like to search your library with this ability? If you do, your library will be shuffled. | Destination$ Hand | ChangeType$ Card.YouOwn+namedAjani; Valiant Protector | Optional$ True SVar:TrigSearch:DB$ ChangeZone | Origin$ Library | OriginAlternative$ Graveyard | AlternativeMessage$ Would you like to search your library with this ability? If you do, your library will be shuffled. | Destination$ Hand | ChangeType$ Card.YouOwn+namedAjani; Valiant Protector | Optional$ True
A:AB$ ChooseCard | Cost$ Sac<1/CARDNAME> | Choices$ Creature | Mandatory$ True | AILogic$ NeedsPrevention | SubAbility$ DBEffect | SpellDescription$ Prevent all combat damage a creature of your choice would deal this turn. A:AB$ ChooseCard | Cost$ Sac<1/CARDNAME> | Choices$ Creature | Mandatory$ True | AILogic$ NeedsPrevention | SubAbility$ DBEffect | SpellDescription$ Prevent all combat damage a creature of your choice would deal this turn.
SVar:DBEffect:DB$ Effect | ReplacementEffects$ RPreventNextFromSource | RememberObjects$ ChosenCard | SubAbility$ DBCleanup | ExileOnMoved$ Battlefield SVar:DBEffect:DB$ Effect | ReplacementEffects$ RPreventNextFromSource | RememberObjects$ ChosenCard | ExileOnMoved$ Battlefield
SVar:RPreventNextFromSource:Event$ DamageDone | IsCombat$ True | ValidSource$ Card.IsRemembered | Prevent$ True | Description$ Prevent all combat damage a creature of your choice would deal this turn. SVar:RPreventNextFromSource:Event$ DamageDone | IsCombat$ True | ValidSource$ Card.IsRemembered | Prevent$ True | Description$ Prevent all combat damage a creature of your choice would deal this turn.
DeckHints:Name$Ajani, Valiant Protector DeckHints:Name$Ajani, Valiant Protector
Oracle:When Ajani's Aid enters the battlefield, you may search your library and/or graveyard for a card named Ajani, Valiant Protector, reveal it, and put it into your hand. If you search your library this way, shuffle.\nSacrifice Ajani's Aid: Prevent all combat damage a creature of your choice would deal this turn. Oracle:When Ajani's Aid enters the battlefield, you may search your library and/or graveyard for a card named Ajani, Valiant Protector, reveal it, and put it into your hand. If you search your library this way, shuffle.\nSacrifice Ajani's Aid: Prevent all combat damage a creature of your choice would deal this turn.

View File

@@ -3,7 +3,7 @@ ManaCost:1 R
Types:Instant Types:Instant
A:SP$ Pump | ValidTgts$ Creature | NumAtt$ +3 | NumDef$ +1 | SubAbility$ DBExile | SpellDescription$ Target creature gets +3/+1 until end of turn. A:SP$ Pump | ValidTgts$ Creature | NumAtt$ +3 | NumDef$ +1 | SubAbility$ DBExile | SpellDescription$ Target creature gets +3/+1 until end of turn.
SVar:DBExile:DB$ Dig | DigNum$ 1 | ChangeNum$ All | DestinationZone$ Exile | RememberChanged$ True | SubAbility$ DBEffect | SpellDescription$ Until the end of your next turn, you may play that card. SVar:DBExile:DB$ Dig | DigNum$ 1 | ChangeNum$ All | DestinationZone$ Exile | RememberChanged$ True | SubAbility$ DBEffect | SpellDescription$ Until the end of your next turn, you may play that card.
SVar:DBEffect:DB$ Effect | RememberObjects$ RememberedCard | Duration$ UntilYourNextTurn | StaticAbilities$ Play | SubAbility$ DBCleanup | ForgetOnMoved$ Exile SVar:DBEffect:DB$ Effect | RememberObjects$ RememberedCard | Duration$ UntilTheEndOfYourNextTurn | StaticAbilities$ Play | SubAbility$ DBCleanup | ForgetOnMoved$ Exile
SVar:Play:Mode$ Continuous | MayPlay$ True | EffectZone$ Command | Affected$ Card.IsRemembered | AffectedZone$ Exile | Description$ You may play remembered card. SVar:Play:Mode$ Continuous | MayPlay$ True | EffectZone$ Command | Affected$ Card.IsRemembered | AffectedZone$ Exile | Description$ You may play remembered card.
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
Oracle:Target creature gets +3/+1 until end of turn.\nExile the top card of your library. Until the end of your next turn, you may play that card. Oracle:Target creature gets +3/+1 until end of turn.\nExile the top card of your library. Until the end of your next turn, you may play that card.

View File

@@ -8,8 +8,8 @@ K:Haste
T:Mode$ Attacks | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigExile | TriggerDescription$ Whenever CARDNAME attacks, exile the top five cards of your library. You may cast an artifact spell from among them this turn. If you do, it has affinity for artifacts. T:Mode$ Attacks | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigExile | TriggerDescription$ Whenever CARDNAME attacks, exile the top five cards of your library. You may cast an artifact spell from among them this turn. If you do, it has affinity for artifacts.
SVar:TrigExile:DB$ Dig | Defined$ You | DigNum$ 5 | ChangeNum$ All | DestinationZone$ Exile | RememberChanged$ True | SubAbility$ DBEffect SVar:TrigExile:DB$ Dig | Defined$ You | DigNum$ 5 | ChangeNum$ All | DestinationZone$ Exile | RememberChanged$ True | SubAbility$ DBEffect
SVar:DBEffect:DB$ Effect | StaticAbilities$ STPlay,STAffinity | RememberObjects$ Remembered | ForgetOnMoved$ Exile | SubAbility$ DBCleanup SVar:DBEffect:DB$ Effect | StaticAbilities$ STPlay,STAffinity | RememberObjects$ Remembered | ForgetOnMoved$ Exile | SubAbility$ DBCleanup
SVar:STPlay:Mode$ Continuous | EffectZone$ Command | AffectedZone$ Exile,Stack | Affected$ Artifact.IsRemembered+nonLand | MayPlay$ True | Description$ You may cast an artifact spell from among them this turn. If you do, it has affinity for artifacts. SVar:STPlay:Mode$ Continuous | EffectZone$ Command | AffectedZone$ Exile,Stack | Affected$ Card.IsRemembered+Artifact+nonLand | MayPlay$ True | MayPlayLimit$ 1 | Description$ You may cast an artifact spell from among them this turn. If you do, it has affinity for artifacts.
SVar:STAffinity:Mode$ Continuous | EffectZone$ Command | AffectedZone$ Stack | AddKeyword$ Affinity:Artifact | Affected$ Artifact.CastSa Spell.MayPlaySource SVar:STAffinity:Mode$ Continuous | EffectZone$ Command | AffectedZone$ Stack | AddKeyword$ Affinity:Artifact | Affected$ Card.CastSa Spell.MayPlaySource
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:HasAttackEffect:TRUE SVar:HasAttackEffect:TRUE
DeckNeeds:Type$Artifact DeckNeeds:Type$Artifact

View File

@@ -6,6 +6,6 @@ T:Mode$ AttackersDeclared | AttackedTarget$ Opponent | Execute$ TrigTreasure | T
SVar:TrigTreasure:DB$ Token | TokenScript$ c_a_treasure_sac | TokenOwner$ TriggeredAttackingPlayer SVar:TrigTreasure:DB$ Token | TokenScript$ c_a_treasure_sac | TokenOwner$ TriggeredAttackingPlayer
R:Event$ CreateToken | ActiveZones$ Battlefield | ValidPlayer$ You | ValidToken$ Treasure | ReplaceWith$ DBReplace | Description$ If you would create one or more Treasure tokens, instead create those tokens plus an additional Treasure token. R:Event$ CreateToken | ActiveZones$ Battlefield | ValidPlayer$ You | ValidToken$ Treasure | ReplaceWith$ DBReplace | Description$ If you would create one or more Treasure tokens, instead create those tokens plus an additional Treasure token.
SVar:DBReplace:DB$ ReplaceToken | Type$ AddToken | Amount$ 1 | ValidCard$ Treasure | TokenScript$ c_a_treasure_sac SVar:DBReplace:DB$ ReplaceToken | Type$ AddToken | Amount$ 1 | ValidCard$ Treasure | TokenScript$ c_a_treasure_sac
A:AB$ PutCounter | Cost$ Sac<5/Treasure> | CounterType$ P1P1 | CounterNum$ 5 | SpellDescription$ Put 5 +1/+1 counters on CARDNAME. A:AB$ PutCounter | Cost$ Sac<5/Treasure> | CounterType$ P1P1 | CounterNum$ 5 | SpellDescription$ Put five +1/+1 counters on NICKNAME.
DeckHas:Ability$Counters|Token|Sacrifice & Type$Artifact|Treasure DeckHas:Ability$Counters|Token|Sacrifice & Type$Artifact|Treasure
Oracle:Whenever a player attacks one or more of your opponents, that attacking player creates a Treasure token.\nIf you would create one or more Treasure tokens, instead create those tokens plus an additional Treasure token.\nSacrifice five Treasures: Put five +1/+1 counters on Jolene. Oracle:Whenever a player attacks one or more of your opponents, that attacking player creates a Treasure token.\nIf you would create one or more Treasure tokens, instead create those tokens plus an additional Treasure token.\nSacrifice five Treasures: Put five +1/+1 counters on Jolene.

View File

@@ -3,7 +3,7 @@ ManaCost:2 R G
Types:Legendary Creature Minotaur Warrior Types:Legendary Creature Minotaur Warrior
PT:5/5 PT:5/5
S:Mode$ MinMaxBlocker | ValidCard$ Card.Self | Max$ 1 | Description$ CARDNAME can't be blocked by more than one creature. S:Mode$ MinMaxBlocker | ValidCard$ Card.Self | Max$ 1 | Description$ CARDNAME can't be blocked by more than one creature.
T:Mode$ AttackersDeclared | AttackingPlayer$ Player.Opponent | Execute$ TrigGainControl | TriggerZones$ Battlefield | OptionalDecider$ You | IsPresent$ Card.Self+tapped | TriggerDescription$ Whenever an opponent attacks with one or more creatures, if CARDNAME is tapped, you may have that opponent gain control of CARDNAME until end of combat. If you do, choose a player or planeswalker that opponent is attacking. CARDNAME is attacking that player or planeswalker. T:Mode$ AttackersDeclared | AttackingPlayer$ Player.Opponent | Execute$ TrigGainControl | TriggerZones$ Battlefield | OptionalDecider$ You | IsPresent$ Card.Self+tapped | TriggerDescription$ Whenever an opponent attacks with one or more creatures, if NICKNAME is tapped, you may have that opponent gain control of NICKNAME until end of combat. If you do, choose a player or planeswalker that opponent is attacking. NICKNAME is attacking that player or planeswalker.
SVar:TrigGainControl:DB$ GainControl | Defined$ Self | NewController$ TriggeredAttackingPlayer | LoseControl$ EndOfCombat | Attacking$ Player.Defending | Chooser$ You | ChoosePlayerOrPlaneswalker$ True SVar:TrigGainControl:DB$ GainControl | Defined$ Self | NewController$ TriggeredAttackingPlayer | LoseControl$ EndOfCombat | Attacking$ Player.Defending | Chooser$ You | ChoosePlayerOrPlaneswalker$ True
AI:RemoveDeck:All AI:RemoveDeck:All
Oracle:Tahngarth, First Mate can't be blocked by more than one creature.\nWhenever an opponent attacks with one or more creatures, if Tahngarth is tapped, you may have that opponent gain control of Tahngarth until end of combat. If you do, choose a player or planeswalker that opponent is attacking. Tahngarth is attacking that player or planeswalker. Oracle:Tahngarth, First Mate can't be blocked by more than one creature.\nWhenever an opponent attacks with one or more creatures, if Tahngarth is tapped, you may have that opponent gain control of Tahngarth until end of combat. If you do, choose a player or planeswalker that opponent is attacking. Tahngarth is attacking that player or planeswalker.