* Induced Amnesia - Fixed a bug that the exiled cards were not returned back to hand.

This commit is contained in:
LevelX2 2018-02-09 15:32:45 +01:00
parent 9b873d7aa4
commit 66533c490e
2 changed files with 11 additions and 11 deletions

View file

@ -132,7 +132,7 @@ class InducedAmnesiaReturnEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && sourcePermanent != null) { if (controller != null && sourcePermanent != null) {
UUID exileId = CardUtil.getCardExileZoneId(game, source); UUID exileId = CardUtil.getCardExileZoneId(game, source.getSourceId(), true);
int numberOfCards = 0; int numberOfCards = 0;
ExileZone exileZone = game.getExile().getExileZone(exileId); ExileZone exileZone = game.getExile().getExileZone(exileId);
if (exileZone != null) { if (exileZone != null) {

View file

@ -42,9 +42,9 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.AttachmentType; import mage.constants.AttachmentType;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.DamagedPlayerEvent; import mage.game.events.DamagedPlayerEvent;
@ -62,10 +62,9 @@ import mage.target.common.TargetCreaturePermanent;
public class PollenbrightWings extends CardImpl { public class PollenbrightWings extends CardImpl {
public PollenbrightWings(UUID ownerId, CardSetInfo setInfo) { public PollenbrightWings(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{4}{G}{W}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{G}{W}");
this.subtype.add(SubType.AURA); this.subtype.add(SubType.AURA);
// Enchant creature // Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent(); TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addTarget(auraTarget);
@ -73,7 +72,8 @@ public class PollenbrightWings extends CardImpl {
Ability ability = new EnchantAbility(auraTarget.getTargetName()); Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability); this.addAbility(ability);
// Enchanted creature has flying. // Enchanted creature has flying.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(FlyingAbility.getInstance(), AttachmentType.AURA, Duration.WhileOnBattlefield))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new GainAbilityAttachedEffect(FlyingAbility.getInstance(), AttachmentType.AURA, Duration.WhileOnBattlefield)));
// Whenever enchanted creature deals combat damage to a player, create that many 1/1 green Saproling creature tokens. // Whenever enchanted creature deals combat damage to a player, create that many 1/1 green Saproling creature tokens.
this.addAbility(new PollenbrightWingsAbility()); this.addAbility(new PollenbrightWingsAbility());
} }
@ -111,10 +111,10 @@ class PollenbrightWingsAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
Permanent p = game.getPermanent(event.getSourceId()); Permanent damageSource = game.getPermanent(event.getSourceId());
if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) { if (damageEvent.isCombatDamage() && damageSource != null && damageSource.getAttachments().contains(this.getSourceId())) {
game.getState().setValue(new StringBuilder("Damage_").append(getSourceId().toString()).toString(), new Integer(damageEvent.getAmount())); game.getState().setValue("Damage_" + getSourceId(), damageEvent.getAmount());
return true; return true;
} }
return false; return false;
@ -144,9 +144,9 @@ class PollenbrightWingsEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Integer damage = (Integer) game.getState().getValue(new StringBuilder("Damage_").append(source.getSourceId().toString()).toString()); Integer damage = (Integer) game.getState().getValue("Damage_" + source.getSourceId());
if (damage != null) { if (damage != null) {
return (new CreateTokenEffect(new SaprolingToken(), damage.intValue()).apply(game, source)); return (new CreateTokenEffect(new SaprolingToken(), damage).apply(game, source));
} }
return false; return false;
} }