mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 13:32:06 -08:00
[RTR] reworked Nivmagus Elemental and added test
This commit is contained in:
parent
cd4b93a71a
commit
2daf1945e7
3 changed files with 124 additions and 84 deletions
|
|
@ -1,63 +0,0 @@
|
|||
|
||||
package mage.abilities.costs.common;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetSpell;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class ExileFromStackCost extends CostImpl {
|
||||
|
||||
public ExileFromStackCost(TargetSpell target) {
|
||||
this.addTarget(target);
|
||||
this.text = "Exile " + target.getTargetName();
|
||||
}
|
||||
|
||||
public ExileFromStackCost(ExileFromStackCost cost) {
|
||||
super(cost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
if (targets.choose(Outcome.Exile, controllerId, source.getSourceId(), game)) {
|
||||
Player player = game.getPlayer(controllerId);
|
||||
for (UUID targetId : targets.get(0).getTargets()) {
|
||||
Spell spellToExile = game.getStack().getSpell(targetId);
|
||||
if (spellToExile == null) {
|
||||
return false;
|
||||
}
|
||||
String spellName = spellToExile.getName();
|
||||
if (spellToExile.isCopy()) {
|
||||
game.getStack().remove(spellToExile, game);
|
||||
} else {
|
||||
spellToExile.moveToExile(null, "", ability, game);
|
||||
}
|
||||
paid = true;
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(player.getLogName() + " exiles " + spellName + " (as costs)");
|
||||
}
|
||||
}
|
||||
}
|
||||
return paid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) {
|
||||
return targets.canChoose(source.getSourceId(), controllerId, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExileFromStackCost copy() {
|
||||
return new ExileFromStackCost(this);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue