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

@@ -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

@@ -121,7 +121,6 @@ public class CostGainLife extends CostPart {
return true;
}
public <T> T accept(ICostVisitor<T> visitor) {
return visitor.visit(this);
}

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

@@ -42,7 +42,6 @@ public class CostTap extends CostPart {
@Override
public boolean isUndoable() { return true; }
@Override
public boolean isReusable() { return true; }

View File

@@ -49,7 +49,6 @@ public class CostUntap extends CostPart {
@Override
public boolean isRenewable() { return true; }
/*
* (non-Javadoc)
*

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

@@ -227,7 +227,6 @@ public class Untap extends Phase {
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

@@ -85,5 +85,4 @@ 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

@@ -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