mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08:00
Fixed Dark Impostor not properly gaining abilities (fixes #4938)
This commit is contained in:
parent
01fb64367e
commit
1720b17ebe
3 changed files with 47 additions and 11 deletions
|
|
@ -29,14 +29,15 @@ package mage.cards.d;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.ActivatedAbility;
|
import mage.abilities.ActivatedAbility;
|
||||||
|
import mage.abilities.Mode;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.abilities.effects.common.ExileTargetEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.ImprintTargetEffect;
|
|
||||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
|
@ -55,17 +56,15 @@ import mage.target.common.TargetCreaturePermanent;
|
||||||
public class DarkImpostor extends CardImpl {
|
public class DarkImpostor extends CardImpl {
|
||||||
|
|
||||||
public DarkImpostor(UUID ownerId, CardSetInfo setInfo) {
|
public DarkImpostor(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}");
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
|
||||||
this.subtype.add(SubType.VAMPIRE);
|
this.subtype.add(SubType.VAMPIRE);
|
||||||
this.subtype.add(SubType.ASSASSIN);
|
this.subtype.add(SubType.ASSASSIN);
|
||||||
|
|
||||||
this.power = new MageInt(2);
|
this.power = new MageInt(2);
|
||||||
this.toughness = new MageInt(2);
|
this.toughness = new MageInt(2);
|
||||||
|
|
||||||
// {4}{B}{B}: Exile target creature and put a +1/+1 counter on Dark Impostor.\
|
// {4}{B}{B}: Exile target creature and put a +1/+1 counter on Dark Impostor.
|
||||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ImprintTargetEffect(), new ManaCostsImpl("{4}{B}{B}"));
|
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DarkImpostorExileTargetEffect(), new ManaCostsImpl("{4}{B}{B}"));
|
||||||
ability.addEffect(new ExileTargetEffect(null, this.getIdName()));
|
|
||||||
ability.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance()));
|
|
||||||
ability.addTarget(new TargetCreaturePermanent());
|
ability.addTarget(new TargetCreaturePermanent());
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
|
|
||||||
|
|
@ -83,6 +82,40 @@ public class DarkImpostor extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class DarkImpostorExileTargetEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
public DarkImpostorExileTargetEffect() {
|
||||||
|
super(Outcome.Exile);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DarkImpostorExileTargetEffect(final DarkImpostorExileTargetEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DarkImpostorExileTargetEffect copy() {
|
||||||
|
return new DarkImpostorExileTargetEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Permanent permanent = game.getPermanentOrLKIBattlefield(source.getFirstTarget());
|
||||||
|
MageObject sourceObject = source.getSourceObject(game);
|
||||||
|
if (permanent != null) {
|
||||||
|
permanent.moveToExile(null, null, source.getSourceId(), game);
|
||||||
|
if (sourceObject instanceof Permanent) {
|
||||||
|
((Permanent) sourceObject).imprint(permanent.getId(), game);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new AddCountersSourceEffect(CounterType.P1P1.createInstance()).apply(game, source);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getText(Mode mode) {
|
||||||
|
return "exile target creature and put a +1/+1 counter on {this}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class DarkImpostorContinuousEffect extends ContinuousEffectImpl {
|
class DarkImpostorContinuousEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
public DarkImpostorContinuousEffect() {
|
public DarkImpostorContinuousEffect() {
|
||||||
|
|
@ -103,7 +136,7 @@ class DarkImpostorContinuousEffect extends ContinuousEffectImpl {
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
for (Ability ability : card.getAbilities()) {
|
for (Ability ability : card.getAbilities()) {
|
||||||
if (ability instanceof ActivatedAbility) {
|
if (ability instanceof ActivatedAbility) {
|
||||||
perm.addAbility(ability, source.getSourceId(), game);
|
perm.addAbility(ability.copy(), source.getSourceId(), game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.ActivatedAbility;
|
import mage.abilities.ActivatedAbility;
|
||||||
import mage.abilities.ActivatedAbilityImpl;
|
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
|
@ -169,9 +168,9 @@ class MairsilThePretenderGainAbilitiesEffect extends ContinuousEffectImpl {
|
||||||
if (filter.match(card, game) && Objects.equals(card.getOwnerId(), perm.getControllerId())) {
|
if (filter.match(card, game) && Objects.equals(card.getOwnerId(), perm.getControllerId())) {
|
||||||
for (Ability ability : card.getAbilities()) {
|
for (Ability ability : card.getAbilities()) {
|
||||||
if (ability instanceof ActivatedAbility) {
|
if (ability instanceof ActivatedAbility) {
|
||||||
ActivatedAbilityImpl copyAbility = (ActivatedAbilityImpl) ability.copy();
|
ActivatedAbility copyAbility = (ActivatedAbility) ability.copy();
|
||||||
copyAbility.setMaxActivationsPerTurn(1);
|
copyAbility.setMaxActivationsPerTurn(1);
|
||||||
perm.addAbility(copyAbility, card.getId(), game);
|
perm.addAbility(copyAbility, source.getSourceId(), game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,4 +67,8 @@ public interface ActivatedAbility extends Ability {
|
||||||
void setCheckPlayableMode();
|
void setCheckPlayableMode();
|
||||||
|
|
||||||
boolean isCheckPlayableMode();
|
boolean isCheckPlayableMode();
|
||||||
|
|
||||||
|
void setMaxActivationsPerTurn(int maxActivationsPerTurn);
|
||||||
|
|
||||||
|
int getMaxActivationsPerTurn(Game game);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue