Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Magpie
2022-04-23 00:44:36 +02:00
3 changed files with 20 additions and 12 deletions

View File

@@ -1040,9 +1040,9 @@ public class PlayerControllerAi extends PlayerController {
if (sa.isCopied()) {
if (sa.isSpell()) {
if (!sa.getHostCard().isInZone(ZoneType.Stack)) {
sa.setHostCard(player.getGame().getAction().moveToStack(sa.getHostCard(), sa));
sa.setHostCard(getGame().getAction().moveToStack(sa.getHostCard(), sa));
} else {
player.getGame().getStackZone().add(sa.getHostCard());
getGame().getStackZone().add(sa.getHostCard());
}
}
@@ -1053,13 +1053,13 @@ public class PlayerControllerAi extends PlayerController {
*/
if (sa.isMayChooseNewTargets() && !sa.setupTargets()) {
if (sa.isSpell()) {
player.getGame().getAction().ceaseToExist(sa.getHostCard(), false);
getGame().getAction().ceaseToExist(sa.getHostCard(), false);
}
continue;
}
}
// need finally add the new spell to the stack
player.getGame().getStack().add(sa);
getGame().getStack().add(sa);
}
}
}

View File

@@ -957,7 +957,10 @@ public class GameAction {
if (c.isInZone(ZoneType.Stack)) {
c.getGame().getStack().remove(c);
}
c.getZone().remove(c);
// in some corner cases there's no zone yet (copied spell that failed targeting)
if (c.getZone() != null) {
c.getZone().remove(c);
}
// CR 603.6c other players LTB triggers should work
if (!skipTrig) {
@@ -971,13 +974,15 @@ public class GameAction {
if (lki == null) {
lki = CardUtil.getLKICopy(c);
}
if (game.getCombat() != null) {
game.getCombat().removeFromCombat(c);
game.getCombat().saveLKI(lki);
}
// again, make sure no triggers run from cards leaving controlled by loser
if (!lki.getController().equals(lki.getOwner())) {
game.getTriggerHandler().registerActiveLTBTrigger(lki);
if (lki.isInPlay()) {
if (game.getCombat() != null) {
game.getCombat().saveLKI(lki);
game.getCombat().removeFromCombat(c);
}
// again, make sure no triggers run from cards leaving controlled by loser
if (!lki.getController().equals(lki.getOwner())) {
game.getTriggerHandler().registerActiveLTBTrigger(lki);
}
}
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(c);
runParams.put(AbilityKey.CardLKI, lki);

View File

@@ -295,6 +295,9 @@ public class Combat {
// takes LKI into consideration, should use it at all times (though a single iteration over multimap seems faster)
public final AttackingBand getBandOfAttacker(final Card c) {
if (c == null) {
return null;
}
for (AttackingBand ab : attackedByBands.values()) {
if (ab.contains(c)) {
return ab;