- Fixed some more instances of using the host card of the AF instead of the source card of the SA.

This commit is contained in:
Sloth
2012-08-22 15:52:48 +00:00
parent aca015560e
commit fb848bcad9
2 changed files with 32 additions and 32 deletions

View File

@@ -269,7 +269,7 @@ public class AbilityFactoryGainControl {
if ((tgt != null) && !this.params.containsKey("Defined")) {
tgtCards = tgt.getTargetCards();
} else {
tgtCards = AbilityFactory.getDefinedCards(this.hostCard, this.params.get("Defined"), sa);
tgtCards = AbilityFactory.getDefinedCards(sa.getSourceCard(), this.params.get("Defined"), sa);
}
ArrayList<Player> newController = AbilityFactory.getDefinedPlayers(sa.getSourceCard(),
@@ -332,7 +332,7 @@ public class AbilityFactoryGainControl {
}
CardList list = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
list = list.getValidCards(tgt.getValidTgts(), this.hostCard.getController(), this.hostCard);
list = list.getValidCards(tgt.getValidTgts(), sa.getSourceCard().getController(), sa.getSourceCard());
// AI won't try to grab cards that are filtered out of AI decks on
// purpose
list = list.filter(new CardListFilter() {
@@ -424,7 +424,7 @@ public class AbilityFactoryGainControl {
} else if ((tgt != null) && !this.params.containsKey("Defined")) {
tgtCards.addAll(tgt.getTargetCards());
} else {
tgtCards.addAll(AbilityFactory.getDefinedCards(this.hostCard, this.params.get("Defined"), sa));
tgtCards.addAll(AbilityFactory.getDefinedCards(sa.getSourceCard(), this.params.get("Defined"), sa));
}
ArrayList<Player> controllers = new ArrayList<Player>();
@@ -441,7 +441,7 @@ public class AbilityFactoryGainControl {
if (sa.isSpell()) {
newController = sa.getActivatingPlayer();
} else {
newController = this.hostCard;
newController = sa.getSourceCard();
}
} else {
newController = controllers.get(0);
@@ -452,8 +452,8 @@ public class AbilityFactoryGainControl {
final Card tgtC = tgtCards.get(j);
final Player originalController = tgtC.getController();
if (!tgtC.equals(this.hostCard) && !this.hostCard.getGainControlTargets().contains(tgtC)) {
this.hostCard.addGainControlTarget(tgtC);
if (!tgtC.equals(sa.getSourceCard()) && !sa.getSourceCard().getGainControlTargets().contains(tgtC)) {
sa.getSourceCard().addGainControlTarget(tgtC);
}
if (AllZoneUtil.isCardInPlay(tgtC)) {
@@ -477,13 +477,13 @@ public class AbilityFactoryGainControl {
if (this.lose != null) {
if (this.lose.contains("LeavesPlay")) {
this.hostCard.addLeavesPlayCommand(this.getLoseControlCommand(tgtC, originalController, newController));
sa.getSourceCard().addLeavesPlayCommand(this.getLoseControlCommand(tgtC, originalController, newController));
}
if (this.lose.contains("Untap")) {
this.hostCard.addUntapCommand(this.getLoseControlCommand(tgtC, originalController, newController));
sa.getSourceCard().addUntapCommand(this.getLoseControlCommand(tgtC, originalController, newController));
}
if (this.lose.contains("LoseControl")) {
this.hostCard.addChangeControllerCommand(this.getLoseControlCommand(tgtC, originalController, newController));
sa.getSourceCard().addChangeControllerCommand(this.getLoseControlCommand(tgtC, originalController, newController));
}
if (this.lose.contains("EOT")) {
AllZone.getEndOfTurn().addAt(this.getLoseControlCommand(tgtC, originalController, newController));
@@ -492,18 +492,18 @@ public class AbilityFactoryGainControl {
if (this.destroyOn != null) {
if (this.destroyOn.contains("LeavesPlay")) {
this.hostCard.addLeavesPlayCommand(this.getDestroyCommand(tgtC));
sa.getSourceCard().addLeavesPlayCommand(this.getDestroyCommand(tgtC));
}
if (this.destroyOn.contains("Untap")) {
this.hostCard.addUntapCommand(this.getDestroyCommand(tgtC));
sa.getSourceCard().addUntapCommand(this.getDestroyCommand(tgtC));
}
if (this.destroyOn.contains("LoseControl")) {
this.hostCard.addChangeControllerCommand(this.getDestroyCommand(tgtC));
sa.getSourceCard().addChangeControllerCommand(this.getDestroyCommand(tgtC));
}
}
this.hostCard.clearGainControlReleaseCommands();
this.hostCard.addGainControlReleaseCommand(this.getLoseControlCommand(tgtC, originalController, newController));
sa.getSourceCard().clearGainControlReleaseCommands();
sa.getSourceCard().addGainControlReleaseCommand(this.getLoseControlCommand(tgtC, originalController, newController));
} // end foreach target
}
@@ -843,7 +843,7 @@ public class AbilityFactoryGainControl {
tgt.resetTargets();
CardList list = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
list = list.getValidCards(tgt.getValidTgts(), AllZone.getComputerPlayer(), this.hostCard);
list = list.getValidCards(tgt.getValidTgts(), AllZone.getComputerPlayer(), sa.getSourceCard());
// AI won't try to grab cards that are filtered out of AI decks on
// purpose
list = list.filter(new CardListFilter() {
@@ -858,7 +858,7 @@ public class AbilityFactoryGainControl {
object2 = AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("Defined"), sa).get(0);
} else if (tgt.getMinTargets(sa.getSourceCard(), sa) > 1) {
CardList list2 = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
list2 = list2.getValidCards(tgt.getValidTgts(), AllZone.getComputerPlayer(), this.hostCard);
list2 = list2.getValidCards(tgt.getValidTgts(), AllZone.getComputerPlayer(), sa.getSourceCard());
object2 = CardFactoryUtil.getWorstAI(list2);
tgt.addTarget(object2);
}

View File

@@ -260,7 +260,7 @@ public class AbilityFactoryPump {
* @return a int.
*/
private int getNumAttack(final SpellAbility sa) {
return AbilityFactory.calculateAmount(this.hostCard, this.numAttack, sa);
return AbilityFactory.calculateAmount(sa.getSourceCard(), this.numAttack, sa);
}
/**
@@ -273,7 +273,7 @@ public class AbilityFactoryPump {
* @return a int.
*/
private int getNumDefense(final SpellAbility sa) {
return AbilityFactory.calculateAmount(this.hostCard, this.numDefense, sa);
return AbilityFactory.calculateAmount(sa.getSourceCard(), this.numDefense, sa);
}
/**
@@ -753,19 +753,19 @@ public class AbilityFactoryPump {
private boolean pumpPlayAI(final SpellAbility sa) {
final Cost cost = sa.getPayCosts();
if (!CostUtil.checkLifeCost(cost, this.hostCard, 4)) {
if (!CostUtil.checkLifeCost(cost, sa.getSourceCard(), 4)) {
return false;
}
if (!CostUtil.checkDiscardCost(cost, this.hostCard)) {
if (!CostUtil.checkDiscardCost(cost, sa.getSourceCard())) {
return false;
}
if (!CostUtil.checkCreatureSacrificeCost(cost, this.hostCard)) {
if (!CostUtil.checkCreatureSacrificeCost(cost, sa.getSourceCard())) {
return false;
}
if (!CostUtil.checkRemoveCounterCost(cost, this.hostCard)) {
if (!CostUtil.checkRemoveCounterCost(cost, sa.getSourceCard())) {
return false;
}
@@ -1164,12 +1164,12 @@ public class AbilityFactoryPump {
}
if ((this.abilityFactory.getAbTgt() == null) || !this.abilityFactory.getAbTgt().doesTarget()) {
if (this.hostCard.isCreature()) {
if (!this.hostCard.hasKeyword("Indestructible")
&& ((this.hostCard.getNetDefense() + defense) <= this.hostCard.getDamage())) {
if (source.isCreature()) {
if (!source.hasKeyword("Indestructible")
&& ((source.getNetDefense() + defense) <= source.getDamage())) {
return false;
}
if ((this.hostCard.getNetDefense() + defense) <= 0) {
if ((source.getNetDefense() + defense) <= 0) {
return false;
}
}
@@ -1315,13 +1315,13 @@ public class AbilityFactoryPump {
}
if (pumpRemembered != null) {
for (final Object o : AbilityFactory.getDefinedObjects(this.hostCard, pumpRemembered, sa)) {
this.hostCard.addRemembered(o);
for (final Object o : AbilityFactory.getDefinedObjects(sa.getSourceCard(), pumpRemembered, sa)) {
sa.getSourceCard().addRemembered(o);
}
}
if (this.params.containsKey("Radiance")) {
for (final Card c : CardUtil.getRadiance(this.hostCard, tgtCards.get(0), this.params.get("ValidTgts")
for (final Card c : CardUtil.getRadiance(sa.getSourceCard(), tgtCards.get(0), this.params.get("ValidTgts")
.split(","))) {
untargetedCards.add(c);
}
@@ -1602,7 +1602,7 @@ public class AbilityFactoryPump {
private boolean pumpAllCanPlayAI(final SpellAbility sa) {
String valid = "";
final Random r = MyRandom.getRandom();
// final Card source = sa.getSourceCard();
final Card source = sa.getSourceCard();
this.params = this.abilityFactory.getMapParams();
final int power = this.getNumAttack(sa);
final int defense = this.getNumDefense(sa);
@@ -1616,9 +1616,9 @@ public class AbilityFactoryPump {
}
CardList comp = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
comp = comp.getValidCards(valid, this.hostCard.getController(), this.hostCard);
comp = comp.getValidCards(valid, source.getController(), source);
CardList human = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
human = human.getValidCards(valid, this.hostCard.getController(), this.hostCard);
human = human.getValidCards(valid, source.getController(), source);
final Target tgt = sa.getTarget();
if (tgt != null && sa.canTarget(AllZone.getHumanPlayer()) && params.containsKey("IsCurse")) {