Fix phasing in attached when entity stopped existing

This commit is contained in:
TRT
2022-11-29 20:12:30 +01:00
parent 56963e6d07
commit f7fd335b10
6 changed files with 24 additions and 8 deletions

View File

@@ -261,10 +261,10 @@ public class AnimateAi extends SpellAbilityAi {
// something is used for animate into creature
if (types.isCreature()) {
final Game game = ai.getGame();
CardCollectionView list = CardLists.getTargetableCards(game.getCardsIn(ZoneType.Battlefield), sa);
CardCollection list = CardLists.getTargetableCards(game.getCardsIn(ZoneType.Battlefield), sa);
// Filter AI-specific targets if provided
list = ComputerUtil.filterAITgts(sa, ai, (CardCollection)list, false);
list = ComputerUtil.filterAITgts(sa, ai, list, false);
// list is empty, no possible targets
if (list.isEmpty() && !alwaysActivatePWAbility) {

View File

@@ -74,9 +74,11 @@ public class ChooseSourceAi extends SpellAbilityAi {
}
final Card threatSource = topStack.getHostCard();
List<? extends GameObject> objects = getTargets(topStack);
List<? extends GameObject> objects;
if (!topStack.usesTargeting() && topStack.hasParam("ValidPlayers") && !topStack.hasParam("Defined")) {
objects = AbilityUtils.getDefinedPlayers(threatSource, topStack.getParam("ValidPlayers"), topStack);
} else {
objects = getTargets(topStack);
}
if (!objects.contains(ai) || topStack.hasParam("NoPrevention")) {
@@ -201,7 +203,7 @@ public class ChooseSourceAi extends SpellAbilityAi {
private static List<GameObject> getTargets(final SpellAbility sa) {
return sa.usesTargeting() && (!sa.hasParam("Defined"))
? Lists.newArrayList(sa.getTargets())
? sa.getTargets()
: AbilityUtils.getDefinedObjects(sa.getHostCard(), sa.getParam("Defined"), sa);
}
}

View File

@@ -107,9 +107,8 @@ public class CountersRemoveAi extends SpellAbilityAi {
// remove counter with Time might use Exile Zone too
final TargetRestrictions tgt = sa.getTargetRestrictions();
CardCollection list = new CardCollection(game.getCardsIn(tgt.getZone()));
// need to targetable
list = CardLists.getTargetableCards(list, sa);
CardCollection list = CardLists.getTargetableCards(game.getCardsIn(tgt.getZone()), sa);
if (list.isEmpty()) {
return false;

View File

@@ -218,6 +218,7 @@ public class EffectAi extends SpellAbilityAi {
return FightAi.canFightAi(ai, sa, 0, 0);
} else if (logic.equals("Pump")) {
List<Card> options = CardUtil.getValidCardsToTarget(sa.getTargetRestrictions(), sa);
options = CardLists.filterControlledBy(options, ai);
if (sa.getPayCosts().hasTapCost()) {
options.remove(sa.getHostCard());
}