mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Clean up
This commit is contained in:
@@ -5,7 +5,6 @@ import com.google.common.collect.Iterables;
|
||||
import forge.ai.*;
|
||||
import forge.card.CardStateName;
|
||||
import forge.card.CardTypeView;
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.game.Game;
|
||||
import forge.game.GameType;
|
||||
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.
|
||||
if (cards.size() < 3)
|
||||
return false;
|
||||
ManaCost mana = sa.getPayCosts().getTotalMana();
|
||||
if (mana.countX() > 0) {
|
||||
if (sa.costHasManaX()) {
|
||||
int amount = ComputerUtilCost.getMaxXValue(sa, ai, sa.isTrigger());
|
||||
if (amount < ComputerUtilCard.getBestAI(cards).getCMC())
|
||||
return false;
|
||||
@@ -160,7 +158,7 @@ public class PlayAi extends SpellAbilityAi {
|
||||
if (sa.hasParam("WithoutManaCost")) {
|
||||
// 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.getPayCosts().getTotalMana().countX() > 0) {
|
||||
if (spell.costHasManaX()) {
|
||||
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).
|
||||
// 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.
|
||||
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
|
||||
return false;
|
||||
}
|
||||
return spell.isTargetNumberValid();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -672,7 +672,7 @@ public abstract class CardTraitBase extends GameObject implements IHasCardView,
|
||||
} else if (descriptiveKeys.contains(key)) {
|
||||
// change descriptions differently
|
||||
newValue = AbilityUtils.applyTextChangeEffects(value, true, colorMap, typeMap);
|
||||
}else if (this.getHostCard().hasSVar(value)) {
|
||||
} else if (this.getHostCard().hasSVar(value)) {
|
||||
// don't change literal SVar names!
|
||||
continue;
|
||||
} else {
|
||||
|
||||
@@ -2596,7 +2596,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
|
||||
String currentName = host.getName();
|
||||
String desc1 = TextUtil.fastReplace(stAb.toString(), "CARDNAME", currentName);
|
||||
String desc = TextUtil.fastReplace(desc1,"NICKNAME", currentName.split(" ")[0].replace(",", ""));
|
||||
String desc = TextUtil.fastReplace(desc1, "NICKNAME", currentName.split(" ")[0].replace(",", ""));
|
||||
if (host.getEffectSource() != null) {
|
||||
desc = TextUtil.fastReplace(desc, "EFFECTSOURCE", host.getEffectSource().getName());
|
||||
}
|
||||
|
||||
@@ -118,6 +118,10 @@ public class CardState extends GameObject implements IHasSVars {
|
||||
return name + " (" + view.getState() + ")";
|
||||
}
|
||||
|
||||
public CardTypeView getTypeWithChanges() {
|
||||
return getType().getTypeWithChanges(card.getChangedCardTypes());
|
||||
}
|
||||
|
||||
public final CardTypeView getType() {
|
||||
return type;
|
||||
}
|
||||
@@ -466,12 +470,7 @@ public class CardState extends GameObject implements IHasSVars {
|
||||
return getReplacementEffects().contains(re);
|
||||
}
|
||||
public final boolean hasReplacementEffect(final int id) {
|
||||
for (final ReplacementEffect r : getReplacementEffects()) {
|
||||
if (id == r.getId()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return getReplacementEffect(id) != null;
|
||||
}
|
||||
|
||||
public final ReplacementEffect getReplacementEffect(final int id) {
|
||||
@@ -657,11 +656,6 @@ public class CardState extends GameObject implements IHasSVars {
|
||||
public String getSetCode() {
|
||||
return setCode;
|
||||
}
|
||||
|
||||
public CardTypeView getTypeWithChanges() {
|
||||
return getType().getTypeWithChanges(card.getChangedCardTypes());
|
||||
}
|
||||
|
||||
public void setSetCode(String setCode0) {
|
||||
setCode = setCode0;
|
||||
view.updateSetCode(this);
|
||||
|
||||
@@ -958,4 +958,4 @@ public class SpellAbilityVariables implements Cloneable {
|
||||
public void setClassLevelOperator(String op) {
|
||||
classLevelOperator = op;
|
||||
}
|
||||
} // end class SpellAbilityVariables
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class SpellPermanent extends SpellApiBased {
|
||||
this.setStackDescription("");
|
||||
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"));
|
||||
}
|
||||
} // Spell_Permanent()
|
||||
|
||||
@@ -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.
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
|
||||
@@ -3,7 +3,7 @@ ManaCost:1 R
|
||||
Types:Instant
|
||||
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: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: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.
|
||||
|
||||
@@ -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.
|
||||
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: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:STAffinity:Mode$ Continuous | EffectZone$ Command | AffectedZone$ Stack | AddKeyword$ Affinity:Artifact | Affected$ Artifact.CastSa Spell.MayPlaySource
|
||||
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$ Card.CastSa Spell.MayPlaySource
|
||||
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
|
||||
SVar:HasAttackEffect:TRUE
|
||||
DeckNeeds:Type$Artifact
|
||||
|
||||
@@ -6,6 +6,6 @@ T:Mode$ AttackersDeclared | AttackedTarget$ Opponent | Execute$ TrigTreasure | T
|
||||
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.
|
||||
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
|
||||
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.
|
||||
|
||||
@@ -3,7 +3,7 @@ ManaCost:2 R G
|
||||
Types:Legendary Creature Minotaur Warrior
|
||||
PT:5/5
|
||||
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
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user