mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 02:08:00 +00:00
Merge branch 'pir' into 'master'
Fix AssignGroup skipping triggers See merge request core-developers/forge!5469
This commit is contained in:
@@ -165,7 +165,7 @@ public class GameAction {
|
|||||||
// need to check before it enters
|
// need to check before it enters
|
||||||
if (c.isAura() && !c.isAttachedToEntity() && toBattlefield && (zoneFrom == null || !zoneFrom.is(ZoneType.Stack))) {
|
if (c.isAura() && !c.isAttachedToEntity() && toBattlefield && (zoneFrom == null || !zoneFrom.is(ZoneType.Stack))) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
if (Iterables.any(game.getPlayers(),PlayerPredicates.canBeAttached(c))) {
|
if (Iterables.any(game.getPlayers(), PlayerPredicates.canBeAttached(c))) {
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
if (Iterables.any((CardCollectionView) params.get(AbilityKey.LastStateBattlefield), CardPredicates.canBeAttached(c))) {
|
if (Iterables.any((CardCollectionView) params.get(AbilityKey.LastStateBattlefield), CardPredicates.canBeAttached(c))) {
|
||||||
|
|||||||
@@ -62,13 +62,16 @@ public class AssignGroupEffect extends SpellAbilityEffect {
|
|||||||
// is that in Player order?
|
// is that in Player order?
|
||||||
Collection<GameObject> l = result.get(s);
|
Collection<GameObject> l = result.get(s);
|
||||||
|
|
||||||
|
// no player assigned for this choice
|
||||||
|
if (l.isEmpty()) continue;
|
||||||
|
|
||||||
host.addRemembered(l);
|
host.addRemembered(l);
|
||||||
AbilityUtils.resolve(s);
|
AbilityUtils.resolve(s);
|
||||||
host.removeRemembered(l);
|
host.removeRemembered(l);
|
||||||
|
|
||||||
// this will refresh continuous abilities for players and permanents.
|
// this will refresh continuous abilities for players and permanents.
|
||||||
game.getAction().checkStaticAbilities();
|
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.
|
// 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 int amount = AbilityUtils.calculateAmount(card, num, sa);
|
||||||
final List<Player> tgts = getTargetPlayers(sa);
|
final List<Player> tgts = getTargetPlayers(sa);
|
||||||
final boolean devour = sa.hasParam("Devour");
|
final boolean devour = sa.hasParam("Devour");
|
||||||
@@ -126,7 +126,7 @@ public class SacrificeEffect extends SpellAbilityEffect {
|
|||||||
CardCollectionView choosenToSacrifice = null;
|
CardCollectionView choosenToSacrifice = null;
|
||||||
for (final Player p : tgts) {
|
for (final Player p : tgts) {
|
||||||
CardCollectionView battlefield = p.getCardsIn(ZoneType.Battlefield);
|
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 [] validArray = valid.split(" & ");
|
||||||
String [] msgArray = msg.split(" & ");
|
String [] msgArray = msg.split(" & ");
|
||||||
List<CardCollection> validTargetsList = new ArrayList<>(validArray.length);
|
List<CardCollection> validTargetsList = new ArrayList<>(validArray.length);
|
||||||
|
|||||||
@@ -81,11 +81,11 @@ public class CombatUtil {
|
|||||||
|
|
||||||
public static boolean validateAttackers(final Combat combat) {
|
public static boolean validateAttackers(final Combat combat) {
|
||||||
final AttackConstraints constraints = combat.getAttackConstraints();
|
final AttackConstraints constraints = combat.getAttackConstraints();
|
||||||
final Pair<Map<Card, GameEntity>, Integer> bestAttack = constraints.getLegalAttackers();
|
|
||||||
final int myViolations = constraints.countViolations(combat.getAttackersAndDefenders());
|
final int myViolations = constraints.countViolations(combat.getAttackersAndDefenders());
|
||||||
if (myViolations == -1) {
|
if (myViolations == -1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
final Pair<Map<Card, GameEntity>, Integer> bestAttack = constraints.getLegalAttackers();
|
||||||
return myViolations <= bestAttack.getRight().intValue();
|
return myViolations <= bestAttack.getRight().intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ public class TriggerHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void resetTurnTriggerState() {
|
public void resetTurnTriggerState() {
|
||||||
for(final Trigger t : activeTriggers) {
|
for (final Trigger t : activeTriggers) {
|
||||||
t.resetTurnState();
|
t.resetTurnState();
|
||||||
}
|
}
|
||||||
for (final Trigger t : delayedTriggers) {
|
for (final Trigger t : delayedTriggers) {
|
||||||
|
|||||||
Reference in New Issue
Block a user