forked from External/mage
Fixed a problem with casting split cards from non hand zone. Added some generic cast from non hand zone effects and started replacing card specific effects by the generic ones (fixes #5356 and fixes #4493).
This commit is contained in:
parent
c097ec053f
commit
c41c6e1fe9
25 changed files with 304 additions and 476 deletions
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
|
@ -9,9 +8,9 @@ import mage.MageObjectReference;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
|
||||
import mage.abilities.effects.AsThoughEffectImpl;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect;
|
||||
import mage.abilities.effects.common.combat.CantBlockTargetEffect;
|
||||
import mage.cards.*;
|
||||
import mage.constants.*;
|
||||
|
|
@ -20,7 +19,6 @@ import mage.filter.common.FilterInstantOrSorceryCard;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.players.Library;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetCard;
|
||||
|
|
@ -177,12 +175,13 @@ class ChandraPyromasterEffect2 extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (controller != null && sourceObject != null && controller.getLibrary().hasCards()) {
|
||||
Library library = controller.getLibrary();
|
||||
Card card = library.getFromTop(game);
|
||||
if (controller != null && sourceObject != null) {
|
||||
Card card = controller.getLibrary().getFromTop(game);
|
||||
if (card != null) {
|
||||
controller.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getIdName() + " <this card may be played the turn it was exiled>", source.getSourceId(), game, Zone.LIBRARY, true);
|
||||
game.addEffect(new ChandraPyromasterPlayEffect(new MageObjectReference(card, game)), source);
|
||||
controller.moveCards(card, Zone.EXILED, source, game);
|
||||
ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.EndOfTurn);
|
||||
effect.setTargetPointer(new FixedTarget(card, game));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -190,45 +189,6 @@ class ChandraPyromasterEffect2 extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
class ChandraPyromasterPlayEffect extends AsThoughEffectImpl {
|
||||
|
||||
private final MageObjectReference objectReference;
|
||||
|
||||
public ChandraPyromasterPlayEffect(MageObjectReference objectReference) {
|
||||
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
|
||||
this.objectReference = objectReference;
|
||||
staticText = "you may play that card until end of turn";
|
||||
}
|
||||
|
||||
public ChandraPyromasterPlayEffect(final ChandraPyromasterPlayEffect effect) {
|
||||
super(effect);
|
||||
this.objectReference = effect.objectReference;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChandraPyromasterPlayEffect copy() {
|
||||
return new ChandraPyromasterPlayEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||
if (objectReference.refersTo(objectId, game) && affectedControllerId.equals(source.getControllerId())) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
return true;
|
||||
} else {
|
||||
discard();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class ChandraPyromasterEffect3 extends OneShotEffect {
|
||||
|
||||
public ChandraPyromasterEffect3() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue