forked from External/mage
* Dragonlord Silumgar - Added some additional information about the controlled target to hame log and permanent info.
This commit is contained in:
parent
65f4c9d4b2
commit
fe7dbcb5c2
1 changed files with 45 additions and 7 deletions
|
|
@ -33,14 +33,21 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.condition.common.SourceOnBattlefieldControlUnchangedCondition;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.keyword.DeathtouchAbility;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreatureOrPlaneswalker;
|
||||
import mage.util.CardUtil;
|
||||
import mage.util.GameLog;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -59,17 +66,15 @@ public class DragonlordSilumgar extends CardImpl {
|
|||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
|
||||
// Deathtouch
|
||||
this.addAbility(DeathtouchAbility.getInstance());
|
||||
|
||||
|
||||
// When Dragonlord Silumgar enters the battlefield, gain control of target creature or planeswalker for as long as you control Dragonlord Silumgar.
|
||||
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(new GainControlTargetEffect(Duration.Custom), new SourceOnBattlefieldControlUnchangedCondition(), null);
|
||||
effect.setText("gain control of target creature or planeswalker for as long as you control {this}");
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(effect, false);
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new DragonlordSilumgarEffect(), false);
|
||||
ability.addTarget(new TargetCreatureOrPlaneswalker());
|
||||
this.addAbility(ability);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public DragonlordSilumgar(final DragonlordSilumgar card) {
|
||||
|
|
@ -81,3 +86,36 @@ public class DragonlordSilumgar extends CardImpl {
|
|||
return new DragonlordSilumgar(this);
|
||||
}
|
||||
}
|
||||
|
||||
class DragonlordSilumgarEffect extends OneShotEffect {
|
||||
|
||||
public DragonlordSilumgarEffect() {
|
||||
super(Outcome.GainControl);
|
||||
this.staticText = "gain control of target creature or planeswalker for as long as you control {this}";
|
||||
}
|
||||
|
||||
public DragonlordSilumgarEffect(final DragonlordSilumgarEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DragonlordSilumgarEffect copy() {
|
||||
return new DragonlordSilumgarEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (controller != null && sourcePermanent != null && target != null
|
||||
&& controller.getId().equals(sourcePermanent.getControllerId())) {
|
||||
game.addEffect(new ConditionalContinuousEffect(new GainControlTargetEffect(Duration.Custom), new SourceOnBattlefieldControlUnchangedCondition(), null), source);
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(sourcePermanent.getLogName() + ": " + controller.getLogName() + " gained control of " + target.getLogName());
|
||||
}
|
||||
sourcePermanent.addInfo("gained control of", CardUtil.addToolTipMarkTags("Gained control of: " + GameLog.getColoredObjectIdNameForTooltip(target)), game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue