[NEO] Implemented Mechtitan Core

This commit is contained in:
Evan Kranzler 2022-02-08 18:38:40 -05:00
parent 33ba01e093
commit b100890cdf
5 changed files with 264 additions and 30 deletions

View file

@ -2,20 +2,23 @@
package mage.abilities.costs.common;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetControlledPermanent;
import mage.util.CardUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
*
* @author emerald000
*/
public class ExileTargetCost extends CostImpl {
@ -26,35 +29,43 @@ public class ExileTargetCost extends CostImpl {
this.addTarget(target);
this.text = "Exile " + target.getTargetName();
}
public ExileTargetCost(TargetControlledPermanent target, boolean noText) {
this.addTarget(target);
}
public ExileTargetCost(ExileTargetCost cost) {
super(cost);
for (Permanent permanent: cost.permanents) {
for (Permanent permanent : cost.permanents) {
this.permanents.add(permanent.copy());
}
}
@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)) {
for (UUID targetId: targets.get(0).getTargets()) {
Permanent permanent = game.getPermanent(targetId);
if (permanent == null) {
return false;
}
permanents.add(permanent.copy());
// 117.11. The actions performed when paying a cost may be modified by effects.
// Even if they are, meaning the actions that are performed don't match the actions
// that are called for, the cost has still been paid.
// so return state here is not important because the user indended to exile the target anyway
game.getPlayer(ability.getControllerId()).moveCardToExileWithInfo(permanent, null, null, source, game, Zone.BATTLEFIELD, true);
}
paid = true;
Player player = game.getPlayer(ability.getControllerId());
if (player == null || !targets.choose(Outcome.Exile, controllerId, source.getSourceId(), game)) {
return paid;
}
Cards cards = new CardsImpl();
for (UUID targetId : targets.get(0).getTargets()) {
Permanent permanent = game.getPermanent(targetId);
if (permanent == null) {
return false;
}
cards.add(permanent);
permanents.add(permanent.copy());
// 117.11. The actions performed when paying a cost may be modified by effects.
// Even if they are, meaning the actions that are performed don't match the actions
// that are called for, the cost has still been paid.
// so return state here is not important because the user indended to exile the target anyway
}
player.moveCardsToExile(
cards.getCards(game), source, game, false,
CardUtil.getExileZoneId(game, source),
CardUtil.getSourceName(game, source)
);
paid = true;
return paid;
}
@ -71,5 +82,4 @@ public class ExileTargetCost extends CostImpl {
public List<Permanent> getPermanents() {
return permanents;
}
}