Fix AssignGroup skipping triggers

This commit is contained in:
TRT
2021-09-29 11:26:42 +02:00
parent 9a7fe7c4f0
commit cc2cb8cdd1
5 changed files with 12 additions and 9 deletions

View File

@@ -165,7 +165,7 @@ public class GameAction {
// need to check before it enters
if (c.isAura() && !c.isAttachedToEntity() && toBattlefield && (zoneFrom == null || !zoneFrom.is(ZoneType.Stack))) {
boolean found = false;
if (Iterables.any(game.getPlayers(),PlayerPredicates.canBeAttached(c))) {
if (Iterables.any(game.getPlayers(), PlayerPredicates.canBeAttached(c))) {
found = true;
}
if (Iterables.any((CardCollectionView) params.get(AbilityKey.LastStateBattlefield), CardPredicates.canBeAttached(c))) {

View File

@@ -53,7 +53,7 @@ public class AssignGroupEffect extends SpellAbilityEffect {
final String title = Localizer.getInstance().getMessage("lblChooseAbilityForObject", g.toString());
Map<String, Object> params = Maps.newHashMap();
params.put("Affected", g);
result.put(chooser.getController().chooseSingleSpellForEffect(abilities, sa, title, params), g);
}
@@ -61,14 +61,17 @@ public class AssignGroupEffect extends SpellAbilityEffect {
for (SpellAbility s : abilities) {
// is that in Player order?
Collection<GameObject> l = result.get(s);
// no player assigned for this choice
if (l.isEmpty()) continue;
host.addRemembered(l);
AbilityUtils.resolve(s);
host.removeRemembered(l);
// this will refresh continuous abilities for players and permanents.
game.getAction().checkStaticAbilities();
game.getTriggerHandler().resetActiveTriggers(false);
game.getTriggerHandler().resetActiveTriggers();
}
}

View File

@@ -88,7 +88,7 @@ public class SacrificeEffect extends SpellAbilityEffect {
}
// Expand Sacrifice keyword here depending on what we need out of it.
final String num = sa.hasParam("Amount") ? sa.getParam("Amount") : "1";
final String num = sa.getParamOrDefault("Amount", "1");
final int amount = AbilityUtils.calculateAmount(card, num, sa);
final List<Player> tgts = getTargetPlayers(sa);
final boolean devour = sa.hasParam("Devour");
@@ -126,7 +126,7 @@ public class SacrificeEffect extends SpellAbilityEffect {
CardCollectionView choosenToSacrifice = null;
for (final Player p : tgts) {
CardCollectionView battlefield = p.getCardsIn(ZoneType.Battlefield);
if (sacEachValid) { // Sacrifice maximum permanents in any combination of types specified by SacValid
if (sacEachValid) { // Sacrifice maximum permanents in any combination of types specified by SacValid
String [] validArray = valid.split(" & ");
String [] msgArray = msg.split(" & ");
List<CardCollection> validTargetsList = new ArrayList<>(validArray.length);

View File

@@ -81,11 +81,11 @@ public class CombatUtil {
public static boolean validateAttackers(final Combat combat) {
final AttackConstraints constraints = combat.getAttackConstraints();
final Pair<Map<Card, GameEntity>, Integer> bestAttack = constraints.getLegalAttackers();
final int myViolations = constraints.countViolations(combat.getAttackersAndDefenders());
if (myViolations == -1) {
return false;
}
final Pair<Map<Card, GameEntity>, Integer> bestAttack = constraints.getLegalAttackers();
return myViolations <= bestAttack.getRight().intValue();
}

View File

@@ -336,7 +336,7 @@ public class TriggerHandler {
}
public void resetTurnTriggerState() {
for(final Trigger t : activeTriggers) {
for (final Trigger t : activeTriggers) {
t.resetTurnState();
}
for (final Trigger t : delayedTriggers) {