Ward only works on Permanents

This commit is contained in:
tool4EvEr
2021-11-02 19:07:31 +01:00
parent 94defab3ce
commit 4ab76d94db
25 changed files with 31 additions and 49 deletions

View File

@@ -746,7 +746,7 @@ public class AiController {
// one is warded and can't be paid for.
if (sa.usesTargeting()) {
for (Card tgt : sa.getTargets().getTargetCards()) {
if (tgt.hasKeyword(Keyword.WARD) && tgt.getController().isOpponentOf(sa.getHostCard().getController())) {
if (tgt.hasKeyword(Keyword.WARD) && tgt.isInPlay() && tgt.getController().isOpponentOf(sa.getHostCard().getController())) {
int amount = 0;
Cost wardCost = ComputerUtilCard.getTotalWardCost(tgt);
if (wardCost.hasManaCost()) {

View File

@@ -592,7 +592,7 @@ public class ComputerUtilCost {
// Ward - will be accounted for when rechecking a targeted ability
if (sa.usesTargeting()) {
for (Card tgt : sa.getTargets().getTargetCards()) {
if (tgt.hasKeyword(Keyword.WARD) && tgt.getController().isOpponentOf(sa.getHostCard().getController())) {
if (tgt.hasKeyword(Keyword.WARD) && tgt.isInPlay() && tgt.getController().isOpponentOf(sa.getHostCard().getController())) {
Cost wardCost = ComputerUtilCard.getTotalWardCost(tgt);
if (wardCost.hasManaCost()) {
extraManaNeeded += wardCost.getTotalMana().getCMC();

View File

@@ -36,7 +36,7 @@ public final class GameObjectPredicates {
return new Predicate<GameObject>() {
@Override
public boolean apply(final GameObject c) {
return (c != null) && c.isValid(restrictions, sourceController, source, spellAbility);
return c != null && c.isValid(restrictions, sourceController, source, spellAbility);
}
};
}

View File

@@ -2,7 +2,7 @@ package forge.game.cost;
import forge.game.player.Player;
public abstract class CostDecisionMakerBase implements ICostVisitor<PaymentDecision> {
public abstract class CostDecisionMakerBase implements ICostVisitor<PaymentDecision> {
protected final Player player;
public CostDecisionMakerBase(Player player0) {

View File

@@ -226,8 +226,7 @@ public class CostDiscard extends CostPartWithList {
protected void handleChangeZoneTrigger(Player payer, SpellAbility ability, CardCollectionView targetCards) {
super.handleChangeZoneTrigger(payer, ability, targetCards);
if (!targetCards.isEmpty())
{
if (!targetCards.isEmpty()) {
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
runParams.put(AbilityKey.Player, payer);
runParams.put(AbilityKey.Cards, new CardCollection(targetCards));

View File

@@ -84,7 +84,6 @@ public class CostExert extends CostPartWithList {
public final boolean canPay(final SpellAbility ability, final Player payer) {
final Card source = ability.getHostCard();
if (!this.payCostFromSource()) {
boolean needsAnnoucement = ability.hasParam("Announce") && this.getType().contains(ability.getParam("Announce"));
@@ -94,7 +93,6 @@ public class CostExert extends CostPartWithList {
return needsAnnoucement || (amount == null) || (typeList.size() >= amount);
}
return true;

View File

@@ -120,5 +120,5 @@ public class CostExileFromStack extends CostPart {
public <T> T accept(ICostVisitor<T> visitor) {
return visitor.visit(this);
}
}

View File

@@ -63,7 +63,7 @@ public class CostGainLife extends CostPart {
sb.append("Have an opponent gain ").append(this.getAmount()).append(" life");
return sb.toString();
}
public List<Player> getPotentialTargets(final Player payer, final Card source) {
List<Player> res = new ArrayList<>();
for (Player p : payer.getGame().getPlayers()) {
@@ -121,7 +121,6 @@ public class CostGainLife extends CostPart {
return true;
}
public <T> T accept(ICostVisitor<T> visitor) {
return visitor.visit(this);
}

View File

@@ -57,7 +57,7 @@ public class CostPayment extends ManaConversionMatrix {
public final SpellAbility getAbility() {
return this.ability;
}
/**
* <p>
* Constructor for Cost_Payment.

View File

@@ -151,7 +151,6 @@ public class CostPutCounter extends CostPartWithList {
return !typeList.isEmpty();
}
}
/*
@@ -204,7 +203,6 @@ public class CostPutCounter extends CostPartWithList {
tempTable.triggerCountersPutAll(ability.getHostCard().getGame());
}
/* (non-Javadoc)
* @see forge.game.cost.CostPartWithList#resetLists()
*/

View File

@@ -38,17 +38,16 @@ public class CostTap extends CostPart {
}
public int paymentOrder() { return -1; }
@Override
public boolean isUndoable() { return true; }
@Override
public boolean isReusable() { return true; }
@Override
public boolean isRenewable() { return true; }
@Override
public final String toString() {
return "{T}";
@@ -70,7 +69,7 @@ public class CostTap extends CostPart {
ability.getHostCard().tap(true);
return true;
}
public <T> T accept(ICostVisitor<T> visitor) {
return visitor.visit(this);
}

View File

@@ -78,7 +78,7 @@ public class CostTapType extends CostPartWithList {
@Override
public boolean isRenewable() { return true; }
/*
* (non-Javadoc)
*
@@ -131,7 +131,7 @@ public class CostTapType extends CostPartWithList {
String type = this.getType();
boolean sameType = false;
if (type.contains(".sharesCreatureTypeWith")) {
sameType = true;
type = TextUtil.fastReplace(type, ".sharesCreatureTypeWith", "");

View File

@@ -45,11 +45,10 @@ public class CostUntap extends CostPart {
@Override
public boolean isUndoable() { return true; }
@Override
public boolean isRenewable() { return true; }
/*
* (non-Javadoc)
*
@@ -88,7 +87,7 @@ public class CostUntap extends CostPart {
ability.getHostCard().untap(true);
return true;
}
public <T> T accept(ICostVisitor<T> visitor) {
return visitor.visit(this);
}

View File

@@ -38,7 +38,7 @@ public class PaymentDecision {
this.counterTable = counterTable;
}
private PaymentDecision(Card chosen) {
private PaymentDecision(Card chosen) {
this(null, null, null, null, null);
cards.add(chosen);
}
@@ -81,7 +81,7 @@ public class PaymentDecision {
*/
@Override
public String toString() {
return TextUtil.concatWithSpace("Payment Decision:", TextUtil.addSuffix(String.valueOf(c),","), cards.toString());
return TextUtil.concatWithSpace("Payment Decision:", TextUtil.addSuffix(String.valueOf(c),","), cards.toString());
}
public static PaymentDecision type(String choice) {

View File

@@ -45,7 +45,6 @@ public class Mana {
return result;
}
@Override
public boolean equals(Object other) {
if (!(other instanceof Mana)) {
@@ -89,12 +88,10 @@ public class Mana {
return this.manaAbility != null && (!manaAbility.getManaRestrictions().isEmpty() || !manaAbility.getExtraManaRestriction().isEmpty());
}
public final boolean addsNoCounterMagic(SpellAbility saBeingPaid) {
return this.manaAbility != null && manaAbility.cannotCounterPaidWith(saBeingPaid);
}
public final boolean addsCounters(SpellAbility saBeingPaid) {
return this.manaAbility != null && manaAbility.addsCounters(saBeingPaid);
}

View File

@@ -154,8 +154,7 @@ public class ManaCostBeingPaid {
for (ManaCostShard shard : manaCost) {
if (shard == ManaCostShard.X) {
cntX++;
}
else {
} else {
increaseShard(shard, 1, false);
}
}
@@ -588,8 +587,7 @@ public class ManaCostBeingPaid {
for (ManaCostShard shard : extra) {
if (shard == ManaCostShard.X) {
cntX++;
}
else {
} else {
increaseShard(shard, 1, false);
}
}

View File

@@ -119,4 +119,4 @@ public class ExtraTurn {
this.cantSetSchemesInMotion = noSchemes;
}
} //end class Untap
}

View File

@@ -226,8 +226,7 @@ public class Untap extends Phase {
// even if they are not creatures
for (final Card c : game.getCardsInGame()) {
c.removeExertedBy(player);
}
}
} // end doUntap
private static void optionalUntap(final Card c) {
@@ -261,7 +260,7 @@ public class Untap extends Phase {
@Override
public boolean apply(final Card c) {
return ((c.isPhasedOut() && c.isDirectlyPhasedOut()) || c.hasKeyword(Keyword.PHASING));
return (c.isPhasedOut() && c.isDirectlyPhasedOut()) || c.hasKeyword(Keyword.PHASING);
}
});

View File

@@ -63,7 +63,6 @@ public final class PlayerPredicates {
return Predicates.not(isCardInPlay(cardName));
}
public static final Predicate<Player> hasCounters() {
return new Predicate<Player>() {
@Override

View File

@@ -350,7 +350,6 @@ public class AbilityManaPart implements java.io.Serializable {
}
}
if (sa.getHostCard() != null) {
if (sa.getHostCard().isValid(restriction, this.getSourceCard().getController(), this.getSourceCard(), null)) {
return true;
@@ -583,7 +582,6 @@ public class AbilityManaPart implements java.io.Serializable {
public Card getSourceCard() {
return sourceCard;
}
public void setSourceCard(final Card host) {
sourceCard = host;
}

View File

@@ -682,7 +682,7 @@ public final class StaticAbilityContinuous {
// set P/T
if (layer == StaticAbilityLayer.SETPT) {
if ((setPower != null) || (setToughness != null)) {
if (setPower != null || setToughness != null) {
// non CharacteristicDefining
if (setP.startsWith("Affected")) {
setPower = AbilityUtils.calculateAmount(affectedCard, setP, stAb, true);
@@ -709,7 +709,7 @@ public final class StaticAbilityContinuous {
// add keywords
// TODO regular keywords currently don't try to use keyword multiplier
// (Although nothing uses it at this time)
if ((addKeywords != null) || (removeKeywords != null) || removeAllAbilities) {
if (addKeywords != null || removeKeywords != null || removeAllAbilities) {
List<String> newKeywords = null;
if (addKeywords != null) {
newKeywords = Lists.newArrayList(addKeywords);

View File

@@ -84,6 +84,5 @@ public abstract class Expressions {
}
return " ? ";
}
} // end class AllZoneUtil
}

View File

@@ -132,9 +132,9 @@ public class FCheckBoxTree extends JTree {
this.selectedChildrenCount = selectedChildrenCount;
this.enabledChildrenCount = enabledChildrenCount;
}
public boolean hasChildren() { return this.numberOfChildren > 0;}
public boolean allChildrenSelected(){ return this.numberOfChildren == this.selectedChildrenCount; };
public boolean allChildrenEnabled(){ return this.enabledChildrenCount == this.numberOfChildren; };
public boolean hasChildren() { return this.numberOfChildren > 0; }
public boolean allChildrenSelected() { return this.numberOfChildren == this.selectedChildrenCount; }
public boolean allChildrenEnabled() { return this.enabledChildrenCount == this.numberOfChildren; }
}
// == Fields of the FCheckboxTree class ==

View File

@@ -3,7 +3,7 @@ ManaCost:3 U
Types:Enchantment
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigToken | TriggerDescription$ When CARDNAME enters the battlefield, create two 1/1 blue Merfolk creature tokens with hexproof.
SVar:TrigToken:DB$ Token | TokenAmount$ 2 | LegacyImage$ u 1 1 merfolk hexproof rix | TokenScript$ u_1_1_merfolk_hexproof | TokenOwner$ You
A:AB$ Pump | Cost$ 3 U | ValidTgts$ Merfolk | TgtPrompt$ Select target Merfolk | KW$ HIDDEN Unblockable | SpellDescription$ Target Merfolk can't be blocked this turn.
A:AB$ Pump | Cost$ 3 U | ValidTgts$ Merfolk | TgtPrompt$ Select target Merfolk | KW$ HIDDEN Unblockable | SpellDescription$ Target Merfolk can't be blocked this turn.
DeckHints:Type$Merfolk
SVar:Picture:http://www.wizards.com/global/images/magic/general/aquatic_incursion.jpg
Oracle:When Aquatic Incursion enters the battlefield, create two 1/1 blue Merfolk creature tokens with hexproof. (They can't be the targets of spells or abilities your opponents control.)\n{3}{U}: Target Merfolk can't be blocked this turn.

View File

@@ -2,7 +2,7 @@ Name:Awe for the Guilds
ManaCost:2 R
Types:Sorcery
A:SP$ Effect | Cost$ 2 R | Name$ Awe for the Guilds Effect | StaticAbilities$ KWPump | AILogic$ Evasion | SpellDescription$ Monocolored creatures can't block this turn.
SVar:KWPump:Mode$ Continuous | EffectZone$ Command | AffectedZone$ Battlefield | Affected$ Creature.MonoColor| AddHiddenKeyword$ CARDNAME can't block. | Description$ Monocolored creatures can't block this turn.
SVar:KWPump:Mode$ Continuous | EffectZone$ Command | AffectedZone$ Battlefield | Affected$ Creature.MonoColor | AddHiddenKeyword$ CARDNAME can't block. | Description$ Monocolored creatures can't block this turn.
SVar:PlayMain1:TRUE
AI:RemoveDeck:All
SVar:Picture:http://www.wizards.com/global/images/magic/general/awe_for_the_guilds.jpg