mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
* Xantcha, Sleeper Agent - Fixed wording of the replacement effect (Oracle changes from 2019-09-27) and generalized the effect for 3 cards.
This commit is contained in:
parent
36b6f15808
commit
bd76e54e9d
4 changed files with 86 additions and 147 deletions
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import static mage.constants.Outcome.Benefit;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetOpponent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
* Use this effect only with EntersBattlefieldAbility like abilities
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class EntersBattlefieldUnderControlOfOpponentOfChoiceEffect extends OneShotEffect {
|
||||
|
||||
public EntersBattlefieldUnderControlOfOpponentOfChoiceEffect() {
|
||||
super(Benefit);
|
||||
staticText = "under the control of an opponent of your choice";
|
||||
}
|
||||
|
||||
private EntersBattlefieldUnderControlOfOpponentOfChoiceEffect(final EntersBattlefieldUnderControlOfOpponentOfChoiceEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntersBattlefieldUnderControlOfOpponentOfChoiceEffect copy() {
|
||||
return new EntersBattlefieldUnderControlOfOpponentOfChoiceEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
Target target = new TargetOpponent();
|
||||
target.setNotTarget(true);
|
||||
if (!controller.choose(Outcome.Benefit, target, source.getSourceId(), game)) {
|
||||
return false;
|
||||
}
|
||||
Player opponent = game.getPlayer(target.getFirstTarget());
|
||||
if (opponent == null) {
|
||||
return false;
|
||||
}
|
||||
Permanent permanent = game.getPermanentEntering(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
game.informPlayers(permanent.getLogName() + " enters the battlefield under the control of " + opponent.getLogName());
|
||||
}
|
||||
ContinuousEffect continuousEffect = new GainControlTargetEffect(
|
||||
Duration.Custom, true, opponent.getId()
|
||||
);
|
||||
continuousEffect.setTargetPointer(new FixedTarget(
|
||||
source.getSourceId(), source.getSourceObjectZoneChangeCounter()
|
||||
));
|
||||
game.addEffect(continuousEffect, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue