mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
Discord bug report: Firkraag doesn't trigger with War's Toll
This commit is contained in:
parent
d8b2d14bd2
commit
f1ab8a4296
3 changed files with 26 additions and 0 deletions
|
|
@ -14,6 +14,8 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
|
|
@ -105,6 +107,14 @@ class WarsTollAttackRestrictionEffect extends RestrictionEffect {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateForcedAttackersAfter(int numberAttackers, Permanent attackingCreature, Ability source, Game game, Map<UUID, Set<UUID>> creaturesForcedToAttack) {
|
||||
if (numberAttackers == 0) return true;
|
||||
Set<UUID> opponents = game.getOpponents(attackingCreature.getControllerId());
|
||||
creaturesForcedToAttack.put(attackingCreature.getId(), opponents);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarsTollAttackRestrictionEffect copy() {
|
||||
return new WarsTollAttackRestrictionEffect(this);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package mage.abilities.effects;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -57,6 +59,10 @@ public abstract class RestrictionEffect extends ContinuousEffectImpl {
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean updateForcedAttackersAfter(int numberAttackers, Permanent attackingCreature, Ability source, Game game, Map<UUID, Set<UUID>> creaturesForcedToAttack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param attacker can be empty for general checks
|
||||
* @param blocker
|
||||
|
|
|
|||
|
|
@ -644,6 +644,16 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
}
|
||||
}
|
||||
}
|
||||
// Allow unconventional forced attacks (War's Toll) to record creatures as having been forced to attack.
|
||||
for (UUID attackingCreatureId : this.getAttackers()) {
|
||||
Permanent attackingCreature = game.getPermanent(attackingCreatureId);
|
||||
for (Map.Entry<RestrictionEffect, Set<Ability>> entry : game.getContinuousEffects().getApplicableRestrictionEffects(attackingCreature, game).entrySet()) {
|
||||
RestrictionEffect effect = entry.getKey();
|
||||
for (Ability ability : entry.getValue()) {
|
||||
effect.updateForcedAttackersAfter(numberAttackers, attackingCreature, ability, game, creaturesForcedToAttack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue