mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 09:48:02 +00:00
Fix AssignGroup skipping triggers
This commit is contained in:
@@ -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))) {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user