Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Mage.Sets/src/mage/cards/w/WarsToll.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import mage.game.permanent.Permanent;
import mage.players.Player;

import java.util.Map;
import java.util.Set;
import java.util.UUID;

/**
Expand Down Expand Up @@ -105,6 +107,14 @@ public boolean canAttackCheckAfter(int numberOfAttackers, Ability source, Game g
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);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package mage.abilities.effects;

import java.util.Map;
import java.util.Set;
import java.util.UUID;

import mage.abilities.Ability;
Expand Down Expand Up @@ -57,6 +59,10 @@ public boolean canAttackCheckAfter(int numberOfAttackers, Ability source, Game g
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
Expand Down
10 changes: 10 additions & 0 deletions Mage/src/main/java/mage/game/combat/Combat.java
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,16 @@ protected boolean checkAttackRestrictions(Player player, Game game) {
}
}
}
// Allow unconventional forced attacks (War's Toll) to record creatures as having been forced to attack.
Copy link
Member

@JayDi85 JayDi85 Apr 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Workaround looks strange. I’ll look at it. Maybe all that checkAfter must be renamed or use another logic (it’s strange to call one time requirement effects and multiple times restriction effects)
  2. Need tests.
  3. Miss clear of creaturesForcedToAttack on removing from attack? Human player can select and unselect creature from attack. Make sure it’s clear restrictions on removing from 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;
}
Expand Down