mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
- Fixed #6751
This commit is contained in:
parent
b01a1ac3aa
commit
fa5cf8b412
1 changed files with 18 additions and 11 deletions
|
@ -1,11 +1,11 @@
|
|||
package mage.cards.l;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DiesSourceTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CreateTokenTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
|
@ -14,7 +14,6 @@ import mage.constants.SubType;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.token.SquirrelToken;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.ManaUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -32,7 +31,8 @@ public final class LiegeOfTheHollows extends CardImpl {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// When Liege of the Hollows dies, each player may pay any amount of mana.
|
||||
// Then each player creates a number of 1/1 green Squirrel creature tokens equal to the amount of mana they paid this way.
|
||||
// Then each player creates a number of 1/1 green Squirrel creature tokens
|
||||
// equal to the amount of mana they paid this way.
|
||||
this.addAbility(new DiesSourceTriggeredAbility(new LiegeOfTheHollowsEffect()));
|
||||
}
|
||||
|
||||
|
@ -66,18 +66,25 @@ class LiegeOfTheHollowsEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Map<UUID, Integer> paidMana = new HashMap<>();
|
||||
if (controller != null) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
int numSquirrels = ManaUtil.playerPaysXGenericMana(false, "Liege of the Hollows", player, source, game);
|
||||
if (numSquirrels > 0) {
|
||||
Effect effect = new CreateTokenTargetEffect(new SquirrelToken(), numSquirrels);
|
||||
effect.setTargetPointer(new FixedTarget(playerId));
|
||||
effect.apply(game, source);
|
||||
paidMana.put(player.getId(), ManaUtil.playerPaysXGenericMana(false,
|
||||
"Liege of the Hollows", player, source, game));
|
||||
}
|
||||
}
|
||||
// create tokens
|
||||
SquirrelToken token = new SquirrelToken();
|
||||
for (Map.Entry<UUID, Integer> entry
|
||||
: paidMana.entrySet()) {
|
||||
Player player = game.getPlayer(entry.getKey());
|
||||
if (player != null) {
|
||||
token.putOntoBattlefield(entry.getValue(), game, source.getSourceId(), player.getId());
|
||||
}
|
||||
}
|
||||
game.getState().processAction(game);
|
||||
|
||||
// prevent undo
|
||||
controller.resetStoredBookmark(game);
|
||||
|
|
Loading…
Reference in a new issue