mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
- 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:
@@ -269,7 +269,7 @@ public class AbilityFactoryGainControl {
|
|||||||
if ((tgt != null) && !this.params.containsKey("Defined")) {
|
if ((tgt != null) && !this.params.containsKey("Defined")) {
|
||||||
tgtCards = tgt.getTargetCards();
|
tgtCards = tgt.getTargetCards();
|
||||||
} else {
|
} 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(),
|
ArrayList<Player> newController = AbilityFactory.getDefinedPlayers(sa.getSourceCard(),
|
||||||
@@ -332,7 +332,7 @@ public class AbilityFactoryGainControl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CardList list = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
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
|
// AI won't try to grab cards that are filtered out of AI decks on
|
||||||
// purpose
|
// purpose
|
||||||
list = list.filter(new CardListFilter() {
|
list = list.filter(new CardListFilter() {
|
||||||
@@ -424,7 +424,7 @@ public class AbilityFactoryGainControl {
|
|||||||
} else if ((tgt != null) && !this.params.containsKey("Defined")) {
|
} else if ((tgt != null) && !this.params.containsKey("Defined")) {
|
||||||
tgtCards.addAll(tgt.getTargetCards());
|
tgtCards.addAll(tgt.getTargetCards());
|
||||||
} else {
|
} 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>();
|
ArrayList<Player> controllers = new ArrayList<Player>();
|
||||||
@@ -441,7 +441,7 @@ public class AbilityFactoryGainControl {
|
|||||||
if (sa.isSpell()) {
|
if (sa.isSpell()) {
|
||||||
newController = sa.getActivatingPlayer();
|
newController = sa.getActivatingPlayer();
|
||||||
} else {
|
} else {
|
||||||
newController = this.hostCard;
|
newController = sa.getSourceCard();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
newController = controllers.get(0);
|
newController = controllers.get(0);
|
||||||
@@ -452,8 +452,8 @@ public class AbilityFactoryGainControl {
|
|||||||
final Card tgtC = tgtCards.get(j);
|
final Card tgtC = tgtCards.get(j);
|
||||||
final Player originalController = tgtC.getController();
|
final Player originalController = tgtC.getController();
|
||||||
|
|
||||||
if (!tgtC.equals(this.hostCard) && !this.hostCard.getGainControlTargets().contains(tgtC)) {
|
if (!tgtC.equals(sa.getSourceCard()) && !sa.getSourceCard().getGainControlTargets().contains(tgtC)) {
|
||||||
this.hostCard.addGainControlTarget(tgtC);
|
sa.getSourceCard().addGainControlTarget(tgtC);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AllZoneUtil.isCardInPlay(tgtC)) {
|
if (AllZoneUtil.isCardInPlay(tgtC)) {
|
||||||
@@ -477,13 +477,13 @@ public class AbilityFactoryGainControl {
|
|||||||
|
|
||||||
if (this.lose != null) {
|
if (this.lose != null) {
|
||||||
if (this.lose.contains("LeavesPlay")) {
|
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")) {
|
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")) {
|
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")) {
|
if (this.lose.contains("EOT")) {
|
||||||
AllZone.getEndOfTurn().addAt(this.getLoseControlCommand(tgtC, originalController, newController));
|
AllZone.getEndOfTurn().addAt(this.getLoseControlCommand(tgtC, originalController, newController));
|
||||||
@@ -492,18 +492,18 @@ public class AbilityFactoryGainControl {
|
|||||||
|
|
||||||
if (this.destroyOn != null) {
|
if (this.destroyOn != null) {
|
||||||
if (this.destroyOn.contains("LeavesPlay")) {
|
if (this.destroyOn.contains("LeavesPlay")) {
|
||||||
this.hostCard.addLeavesPlayCommand(this.getDestroyCommand(tgtC));
|
sa.getSourceCard().addLeavesPlayCommand(this.getDestroyCommand(tgtC));
|
||||||
}
|
}
|
||||||
if (this.destroyOn.contains("Untap")) {
|
if (this.destroyOn.contains("Untap")) {
|
||||||
this.hostCard.addUntapCommand(this.getDestroyCommand(tgtC));
|
sa.getSourceCard().addUntapCommand(this.getDestroyCommand(tgtC));
|
||||||
}
|
}
|
||||||
if (this.destroyOn.contains("LoseControl")) {
|
if (this.destroyOn.contains("LoseControl")) {
|
||||||
this.hostCard.addChangeControllerCommand(this.getDestroyCommand(tgtC));
|
sa.getSourceCard().addChangeControllerCommand(this.getDestroyCommand(tgtC));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.hostCard.clearGainControlReleaseCommands();
|
sa.getSourceCard().clearGainControlReleaseCommands();
|
||||||
this.hostCard.addGainControlReleaseCommand(this.getLoseControlCommand(tgtC, originalController, newController));
|
sa.getSourceCard().addGainControlReleaseCommand(this.getLoseControlCommand(tgtC, originalController, newController));
|
||||||
|
|
||||||
} // end foreach target
|
} // end foreach target
|
||||||
}
|
}
|
||||||
@@ -843,7 +843,7 @@ public class AbilityFactoryGainControl {
|
|||||||
tgt.resetTargets();
|
tgt.resetTargets();
|
||||||
|
|
||||||
CardList list = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
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
|
// AI won't try to grab cards that are filtered out of AI decks on
|
||||||
// purpose
|
// purpose
|
||||||
list = list.filter(new CardListFilter() {
|
list = list.filter(new CardListFilter() {
|
||||||
@@ -858,7 +858,7 @@ public class AbilityFactoryGainControl {
|
|||||||
object2 = AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("Defined"), sa).get(0);
|
object2 = AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("Defined"), sa).get(0);
|
||||||
} else if (tgt.getMinTargets(sa.getSourceCard(), sa) > 1) {
|
} else if (tgt.getMinTargets(sa.getSourceCard(), sa) > 1) {
|
||||||
CardList list2 = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
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);
|
object2 = CardFactoryUtil.getWorstAI(list2);
|
||||||
tgt.addTarget(object2);
|
tgt.addTarget(object2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ public class AbilityFactoryPump {
|
|||||||
* @return a int.
|
* @return a int.
|
||||||
*/
|
*/
|
||||||
private int getNumAttack(final SpellAbility sa) {
|
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.
|
* @return a int.
|
||||||
*/
|
*/
|
||||||
private int getNumDefense(final SpellAbility sa) {
|
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) {
|
private boolean pumpPlayAI(final SpellAbility sa) {
|
||||||
final Cost cost = sa.getPayCosts();
|
final Cost cost = sa.getPayCosts();
|
||||||
|
|
||||||
if (!CostUtil.checkLifeCost(cost, this.hostCard, 4)) {
|
if (!CostUtil.checkLifeCost(cost, sa.getSourceCard(), 4)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CostUtil.checkDiscardCost(cost, this.hostCard)) {
|
if (!CostUtil.checkDiscardCost(cost, sa.getSourceCard())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CostUtil.checkCreatureSacrificeCost(cost, this.hostCard)) {
|
if (!CostUtil.checkCreatureSacrificeCost(cost, sa.getSourceCard())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CostUtil.checkRemoveCounterCost(cost, this.hostCard)) {
|
if (!CostUtil.checkRemoveCounterCost(cost, sa.getSourceCard())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1164,12 +1164,12 @@ public class AbilityFactoryPump {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((this.abilityFactory.getAbTgt() == null) || !this.abilityFactory.getAbTgt().doesTarget()) {
|
if ((this.abilityFactory.getAbTgt() == null) || !this.abilityFactory.getAbTgt().doesTarget()) {
|
||||||
if (this.hostCard.isCreature()) {
|
if (source.isCreature()) {
|
||||||
if (!this.hostCard.hasKeyword("Indestructible")
|
if (!source.hasKeyword("Indestructible")
|
||||||
&& ((this.hostCard.getNetDefense() + defense) <= this.hostCard.getDamage())) {
|
&& ((source.getNetDefense() + defense) <= source.getDamage())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((this.hostCard.getNetDefense() + defense) <= 0) {
|
if ((source.getNetDefense() + defense) <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1315,13 +1315,13 @@ public class AbilityFactoryPump {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pumpRemembered != null) {
|
if (pumpRemembered != null) {
|
||||||
for (final Object o : AbilityFactory.getDefinedObjects(this.hostCard, pumpRemembered, sa)) {
|
for (final Object o : AbilityFactory.getDefinedObjects(sa.getSourceCard(), pumpRemembered, sa)) {
|
||||||
this.hostCard.addRemembered(o);
|
sa.getSourceCard().addRemembered(o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.params.containsKey("Radiance")) {
|
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(","))) {
|
.split(","))) {
|
||||||
untargetedCards.add(c);
|
untargetedCards.add(c);
|
||||||
}
|
}
|
||||||
@@ -1602,7 +1602,7 @@ public class AbilityFactoryPump {
|
|||||||
private boolean pumpAllCanPlayAI(final SpellAbility sa) {
|
private boolean pumpAllCanPlayAI(final SpellAbility sa) {
|
||||||
String valid = "";
|
String valid = "";
|
||||||
final Random r = MyRandom.getRandom();
|
final Random r = MyRandom.getRandom();
|
||||||
// final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
this.params = this.abilityFactory.getMapParams();
|
this.params = this.abilityFactory.getMapParams();
|
||||||
final int power = this.getNumAttack(sa);
|
final int power = this.getNumAttack(sa);
|
||||||
final int defense = this.getNumDefense(sa);
|
final int defense = this.getNumDefense(sa);
|
||||||
@@ -1616,9 +1616,9 @@ public class AbilityFactoryPump {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CardList comp = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
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);
|
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();
|
final Target tgt = sa.getTarget();
|
||||||
if (tgt != null && sa.canTarget(AllZone.getHumanPlayer()) && params.containsKey("IsCurse")) {
|
if (tgt != null && sa.canTarget(AllZone.getHumanPlayer()) && params.containsKey("IsCurse")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user