forked from External/mage
55 lines
1.7 KiB
Java
55 lines
1.7 KiB
Java
|
|
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.abilities.effects.ContinuousEffect;
|
|
import mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect;
|
|
import mage.game.Game;
|
|
import mage.game.events.GameEvent;
|
|
import mage.game.events.GameEvent.EventType;
|
|
import mage.game.permanent.Permanent;
|
|
import mage.players.Player;
|
|
import mage.target.targetpointer.FixedTarget;
|
|
|
|
/**
|
|
*
|
|
* @author emerald000
|
|
*/
|
|
public class ExertSourceCost extends CostImpl {
|
|
|
|
public ExertSourceCost() {
|
|
this.text = "Exert {this}";
|
|
}
|
|
|
|
public ExertSourceCost(ExertSourceCost cost) {
|
|
super(cost);
|
|
}
|
|
|
|
@Override
|
|
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
|
Player player = game.getPlayer(controllerId);
|
|
Permanent permanent = game.getPermanent(sourceId);
|
|
if (player != null && permanent != null) {
|
|
game.fireEvent(GameEvent.getEvent(EventType.BECOMES_EXERTED, permanent.getId(), permanent.getId(), permanent.getControllerId()));
|
|
ContinuousEffect effect = new DontUntapInControllersNextUntapStepTargetEffect("", permanent.getControllerId());
|
|
effect.setTargetPointer(new FixedTarget(permanent, game));
|
|
game.addEffect(effect, ability);
|
|
paid = true;
|
|
}
|
|
return paid;
|
|
}
|
|
|
|
@Override
|
|
public ExertSourceCost copy() {
|
|
return new ExertSourceCost(this);
|
|
}
|
|
}
|