mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Fix typechange Auras not attaching on reload (e.g. Minimus Containment)
This commit is contained in:
@@ -389,7 +389,7 @@ public class AiController {
|
||||
final List<SpellAbility> spellAbility = Lists.newArrayList();
|
||||
for (final Card c : l) {
|
||||
for (final SpellAbility sa : c.getNonManaAbilities()) {
|
||||
// Check if this AF is a Counterpsell
|
||||
// Check if this AF is a Counterspell
|
||||
if (sa.getApi() == ApiType.Counter) {
|
||||
spellAbility.add(sa);
|
||||
}
|
||||
|
||||
@@ -1307,7 +1307,7 @@ public class ComputerUtil {
|
||||
}
|
||||
if (abCost.hasTapCost() && source.hasSVar("AITapDown")) {
|
||||
return true;
|
||||
} else if (sa.hasParam("Planeswalker") && ai.getGame().getPhaseHandler().is(PhaseType.MAIN2)) {
|
||||
} else if (sa.isPwAbility() && ai.getGame().getPhaseHandler().is(PhaseType.MAIN2)) {
|
||||
for (final CostPart part : abCost.getCostParts()) {
|
||||
if (part instanceof CostPutCounter) {
|
||||
return true;
|
||||
@@ -2859,7 +2859,6 @@ public class ComputerUtil {
|
||||
public static boolean lifegainNegative(final Player player, final Card source) {
|
||||
return lifegainNegative(player, source, 1);
|
||||
}
|
||||
|
||||
public static boolean lifegainNegative(final Player player, final Card source, final int n) {
|
||||
if (!player.canGainLife()) {
|
||||
return false;
|
||||
|
||||
@@ -1236,7 +1236,7 @@ public abstract class GameState {
|
||||
// (will be overridden later, so the actual value shouldn't matter)
|
||||
|
||||
//FIXME it shouldn't be able to attach itself
|
||||
c.setEntityAttachedTo(c);
|
||||
c.setEntityAttachedTo(CardFactory.copyCard(c, true));
|
||||
}
|
||||
|
||||
if (cardsWithoutETBTrigs.contains(c)) {
|
||||
|
||||
@@ -252,7 +252,7 @@ public class AnimateAi extends SpellAbilityAi {
|
||||
private boolean animateTgtAI(final SpellAbility sa) {
|
||||
final Player ai = sa.getActivatingPlayer();
|
||||
final PhaseHandler ph = ai.getGame().getPhaseHandler();
|
||||
final boolean alwaysActivatePWAbility = sa.hasParam("Planeswalker")
|
||||
final boolean alwaysActivatePWAbility = sa.isPwAbility()
|
||||
&& sa.getPayCosts().hasSpecificCostType(CostPutCounter.class)
|
||||
&& sa.getTargetRestrictions() != null
|
||||
&& sa.getTargetRestrictions().getMinTargets(sa.getHostCard(), sa) == 0;
|
||||
|
||||
@@ -1130,7 +1130,7 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
||||
}
|
||||
}
|
||||
|
||||
boolean doWithoutTarget = sa.hasParam("Planeswalker") && sa.usesTargeting()
|
||||
boolean doWithoutTarget = sa.isPwAbility() && sa.usesTargeting()
|
||||
&& sa.getMinTargets() == 0
|
||||
&& sa.getPayCosts().hasSpecificCostType(CostPutCounter.class);
|
||||
|
||||
|
||||
@@ -64,7 +64,6 @@ public class CounterAi extends SpellAbilityAi {
|
||||
|
||||
final TargetRestrictions tgt = sa.getTargetRestrictions();
|
||||
if (tgt != null) {
|
||||
|
||||
final SpellAbility topSA = ComputerUtilAbility.getTopSpellAbilityOnStack(game, sa);
|
||||
if (!CardFactoryUtil.isCounterableBy(topSA.getHostCard(), sa) || topSA.getActivatingPlayer() == ai
|
||||
|| ai.getAllies().contains(topSA.getActivatingPlayer())) {
|
||||
@@ -317,7 +316,7 @@ public class CounterAi extends SpellAbilityAi {
|
||||
|
||||
Iterator<SpellAbilityStackInstance> it = game.getStack().iterator();
|
||||
SpellAbilityStackInstance si = null;
|
||||
while(it.hasNext()) {
|
||||
while (it.hasNext()) {
|
||||
si = it.next();
|
||||
tgtSA = si.getSpellAbility(true);
|
||||
if (!sa.canTargetSpellAbility(tgtSA)) {
|
||||
|
||||
@@ -501,7 +501,7 @@ public class CountersPutAi extends SpellAbilityAi {
|
||||
// Activate +Loyalty planeswalker abilities even if they have no target (e.g. Vivien of the Arkbow),
|
||||
// but try to do it in Main 2 then so that the AI has a chance to play creatures first.
|
||||
if (list.isEmpty()
|
||||
&& sa.hasParam("Planeswalker")
|
||||
&& sa.isPwAbility()
|
||||
&& sa.getPayCosts().hasOnlySpecificCostType(CostPutCounter.class)
|
||||
&& sa.isTargetNumberValid()
|
||||
&& sa.getTargets().size() == 0
|
||||
|
||||
@@ -53,7 +53,7 @@ public class MillAi extends SpellAbilityAi {
|
||||
} else if ("ExileAndPlayOrDealDamage".equals(sa.getParam("AILogic"))) {
|
||||
return (ph.is(PhaseType.MAIN1) || ph.is(PhaseType.MAIN2)) && ph.isPlayerTurn(ai); // Chandra, Torch of Defiance and similar
|
||||
}
|
||||
if (!sa.hasParam("Planeswalker")) { // Planeswalker abilities are only activated at sorcery speed
|
||||
if (!sa.isPwAbility()) { // Planeswalker abilities are only activated at sorcery speed
|
||||
if ("You".equals(sa.getParam("Defined")) && !(!SpellAbilityAi.isSorcerySpeed(sa) && ph.is(PhaseType.END_OF_TURN)
|
||||
&& ph.getNextTurn().equals(ai))) {
|
||||
return false; // only self-mill at opponent EOT
|
||||
|
||||
@@ -24,7 +24,6 @@ public class ScryAi extends SpellAbilityAi {
|
||||
*/
|
||||
@Override
|
||||
protected boolean doTriggerAINoCost(Player ai, SpellAbility sa, boolean mandatory) {
|
||||
|
||||
if (sa.usesTargeting()) { // It doesn't appear that Scry ever targets
|
||||
// ability is targeted
|
||||
sa.resetTargets();
|
||||
@@ -69,7 +68,7 @@ public class ScryAi extends SpellAbilityAi {
|
||||
// in the playerturn Scry should only be done in Main1 or in upkeep if able
|
||||
if (ph.isPlayerTurn(ai)) {
|
||||
if (SpellAbilityAi.isSorcerySpeed(sa)) {
|
||||
return ph.is(PhaseType.MAIN1) || sa.hasParam("Planeswalker");
|
||||
return ph.is(PhaseType.MAIN1) || sa.isPwAbility();
|
||||
} else {
|
||||
return ph.is(PhaseType.UPKEEP);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ public class SurveilAi extends SpellAbilityAi {
|
||||
*/
|
||||
@Override
|
||||
protected boolean doTriggerAINoCost(Player ai, SpellAbility sa, boolean mandatory) {
|
||||
|
||||
if (sa.usesTargeting()) { // TODO: It doesn't appear that Surveil ever targets, is this necessary?
|
||||
sa.resetTargets();
|
||||
sa.getTargets().add(ai);
|
||||
@@ -60,7 +59,7 @@ public class SurveilAi extends SpellAbilityAi {
|
||||
// in the player's turn Surveil should only be done in Main1 or in Upkeep if able
|
||||
if (ph.isPlayerTurn(ai)) {
|
||||
if (SpellAbilityAi.isSorcerySpeed(sa)) {
|
||||
return ph.is(PhaseType.MAIN1) || sa.hasParam("Planeswalker");
|
||||
return ph.is(PhaseType.MAIN1) || sa.isPwAbility();
|
||||
} else {
|
||||
return ph.is(PhaseType.UPKEEP);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class ImageUtil {
|
||||
|
||||
int artIdx = cp.getArtIndex() - 1;
|
||||
if (hasManyPictures) {
|
||||
if ( cntPictures <= artIdx ) // prevent overflow
|
||||
if (cntPictures <= artIdx) // prevent overflow
|
||||
artIdx = cntPictures == 0 ? 0 : artIdx % cntPictures;
|
||||
s.append(artIdx + 1);
|
||||
}
|
||||
@@ -91,8 +91,8 @@ public class ImageUtil {
|
||||
|
||||
public static String getNameToUse(PaperCard cp, boolean backFace) {
|
||||
final CardRules card = cp.getRules();
|
||||
if (backFace ) {
|
||||
if ( hasBackFacePicture(cp) )
|
||||
if (backFace) {
|
||||
if (hasBackFacePicture(cp))
|
||||
if (card.getOtherPart() != null) {
|
||||
return card.getOtherPart().getName();
|
||||
} else if (!card.getMeldWith().isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user