mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
Merge f1ab8a4296 into acc180d1d4
This commit is contained in:
commit
e1d5937b43
3 changed files with 26 additions and 0 deletions
|
|
@ -14,6 +14,8 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -105,6 +107,14 @@ class WarsTollAttackRestrictionEffect extends RestrictionEffect {
|
||||||
return true;
|
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
|
@Override
|
||||||
public WarsTollAttackRestrictionEffect copy() {
|
public WarsTollAttackRestrictionEffect copy() {
|
||||||
return new WarsTollAttackRestrictionEffect(this);
|
return new WarsTollAttackRestrictionEffect(this);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package mage.abilities.effects;
|
package mage.abilities.effects;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
|
@ -57,6 +59,10 @@ public abstract class RestrictionEffect extends ContinuousEffectImpl {
|
||||||
return true;
|
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 attacker can be empty for general checks
|
||||||
* @param blocker
|
* @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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue