*Separated targeted cards to pump from untargeted cards to pump. Fixes the example where a black creature with Prot White doesn't get pumped when Wojek Siren targets another black creature. I will attempt to insert this basic structure into the other AFs that Radiance cards can use.

This commit is contained in:
Hellfish
2011-09-21 07:49:37 +00:00
parent 33c7b0666b
commit 676e60cfa7

View File

@@ -696,8 +696,8 @@ public class AbilityFactory_Pump {
* @param sa a {@link forge.card.spellability.SpellAbility} object. * @param sa a {@link forge.card.spellability.SpellAbility} object.
*/ */
private void pumpResolve(SpellAbility sa) { private void pumpResolve(SpellAbility sa) {
Player activator = sa.getActivatingPlayer();
ArrayList<Card> tgtCards; ArrayList<Card> tgtCards;
ArrayList<Card> untargetedCards = new ArrayList<Card>();
Target tgt = AF.getAbTgt(); Target tgt = AF.getAbTgt();
if (tgt != null) if (tgt != null)
tgtCards = tgt.getTargetCards(); tgtCards = tgt.getTargetCards();
@@ -706,7 +706,7 @@ public class AbilityFactory_Pump {
if(params.containsKey("Radiance")) { if(params.containsKey("Radiance")) {
for(Card c : CardUtil.getRadiance(hostCard, tgtCards.get(0), params.get("ValidTgts").split(","))) { for(Card c : CardUtil.getRadiance(hostCard, tgtCards.get(0), params.get("ValidTgts").split(","))) {
tgtCards.add(c); untargetedCards.add(c);
} }
} }
@@ -722,15 +722,29 @@ public class AbilityFactory_Pump {
if (tgt != null && !CardFactoryUtil.canTarget(AF.getHostCard(), tgtC)) if (tgt != null && !CardFactoryUtil.canTarget(AF.getHostCard(), tgtC))
continue; continue;
applyPump(sa,tgtC);
}
for(int i=0;i<untargetedCards.size();i++) {
final Card tgtC = untargetedCards.get(i);
if(!AllZoneUtil.isCardInPlay(tgtC))
continue;
applyPump(sa,tgtC);
}
}//pumpResolve()
private void applyPump(final SpellAbility sa,final Card applyTo) {
final int a = getNumAttack(sa); final int a = getNumAttack(sa);
final int d = getNumDefense(sa); final int d = getNumDefense(sa);
tgtC.addTempAttackBoost(a); applyTo.addTempAttackBoost(a);
tgtC.addTempDefenseBoost(d); applyTo.addTempDefenseBoost(d);
for (int i = 0; i < Keywords.size(); i++) { for (int i = 0; i < Keywords.size(); i++) {
if (!Keywords.get(i).equals("none")) if (!Keywords.get(i).equals("none"))
tgtC.addExtrinsicKeyword(Keywords.get(i)); applyTo.addExtrinsicKeyword(Keywords.get(i));
} }
if (!params.containsKey("Permanent")) { if (!params.containsKey("Permanent")) {
@@ -739,14 +753,14 @@ public class AbilityFactory_Pump {
private static final long serialVersionUID = -42244224L; private static final long serialVersionUID = -42244224L;
public void execute() { public void execute() {
if (AllZoneUtil.isCardInPlay(tgtC)) { if (AllZoneUtil.isCardInPlay(applyTo)) {
tgtC.addTempAttackBoost(-1 * a); applyTo.addTempAttackBoost(-1 * a);
tgtC.addTempDefenseBoost(-1 * d); applyTo.addTempDefenseBoost(-1 * d);
if (Keywords.size() > 0) { if (Keywords.size() > 0) {
for (int i = 0; i < Keywords.size(); i++) { for (int i = 0; i < Keywords.size(); i++) {
if (!Keywords.get(i).equals("none")) if (!Keywords.get(i).equals("none"))
tgtC.removeExtrinsicKeyword(Keywords.get(i)); applyTo.removeExtrinsicKeyword(Keywords.get(i));
} }
} }
@@ -754,11 +768,10 @@ public class AbilityFactory_Pump {
} }
}; };
if (params.containsKey("UntilEndOfCombat")) AllZone.getEndOfCombat().addUntil(untilEOT); if (params.containsKey("UntilEndOfCombat")) AllZone.getEndOfCombat().addUntil(untilEOT);
else if(params.containsKey("UntilYourNextUpkeep")) AllZone.getUpkeep().addUntil(activator, untilEOT); else if(params.containsKey("UntilYourNextUpkeep")) AllZone.getUpkeep().addUntil(sa.getActivatingPlayer(), untilEOT);
else AllZone.getEndOfTurn().addUntil(untilEOT); else AllZone.getEndOfTurn().addUntil(untilEOT);
} }
} }
}//pumpResolve()
///////////////////////////////////// /////////////////////////////////////