changed MagicReturnExiledUntilThisLeavesPlay to accept a new controller parameter. added Day of the Dragons
parent
f8ad4cfccf
commit
6da724dd73
|
@ -15675,3 +15675,14 @@ cost={3}{W}{W}{W}
|
|||
pt=6/6
|
||||
ability=flying
|
||||
timing=main
|
||||
|
||||
>Day of the Dragons
|
||||
url=http://magiccards.info/sc/en/31.html
|
||||
image=http://magiccards.info/scans/en/sc/31.jpg
|
||||
value=4
|
||||
rarity=R
|
||||
type=Enchantment
|
||||
color=u
|
||||
converted=7
|
||||
cost={4}{U}{U}{U}
|
||||
timing=enchantment
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
package magic.card;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import magic.data.TokenCardDefinitions;
|
||||
import magic.model.MagicCardList;
|
||||
import magic.model.MagicGame;
|
||||
import magic.model.MagicLocationType;
|
||||
import magic.model.MagicPlayer;
|
||||
import magic.model.MagicPermanent;
|
||||
import magic.model.MagicType;
|
||||
import magic.model.action.MagicExileUntilThisLeavesPlayAction;
|
||||
import magic.model.action.MagicPlayTokenAction;
|
||||
import magic.model.action.MagicReturnExiledUntilThisLeavesPlayAction;
|
||||
import magic.model.action.MagicSacrificeAction;
|
||||
import magic.model.event.MagicEvent;
|
||||
import magic.model.target.MagicTarget;
|
||||
import magic.model.target.MagicTargetFilter;
|
||||
import magic.model.trigger.MagicWhenComesIntoPlayTrigger;
|
||||
import magic.model.trigger.MagicWhenLeavesPlayTrigger;
|
||||
|
||||
public class Day_of_the_Dragons {
|
||||
public static final MagicWhenComesIntoPlayTrigger T1 = new MagicWhenComesIntoPlayTrigger() {
|
||||
@Override
|
||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicPlayer player) {
|
||||
final int amount = player.getNrOfPermanentsWithType(MagicType.Creature,game);
|
||||
return new MagicEvent(
|
||||
permanent,
|
||||
player,
|
||||
new Object[]{player,permanent,amount},
|
||||
this,
|
||||
"Exile all creatures you control. Then put that many 5/5 " +
|
||||
"red Dragon creature tokens with flying onto the battlefield.");
|
||||
}
|
||||
@Override
|
||||
public void executeEvent(
|
||||
final MagicGame game,
|
||||
final MagicEvent event,
|
||||
final Object data[],
|
||||
final Object[] choiceResults) {
|
||||
final Collection<MagicTarget> targets =
|
||||
game.filterTargets((MagicPlayer)data[0],MagicTargetFilter.TARGET_CREATURE_YOU_CONTROL);
|
||||
for (final MagicTarget target : targets) {
|
||||
game.doAction(new MagicExileUntilThisLeavesPlayAction(
|
||||
(MagicPermanent)data[1],
|
||||
(MagicPermanent)target));
|
||||
}
|
||||
int amount = (Integer)data[2];
|
||||
for (;amount>0;amount--) {
|
||||
game.doAction(new MagicPlayTokenAction(
|
||||
(MagicPlayer)data[0],
|
||||
TokenCardDefinitions.getInstance().getTokenDefinition("Dragon5")));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public static final MagicWhenLeavesPlayTrigger T2 = new MagicWhenLeavesPlayTrigger() {
|
||||
@Override
|
||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicPermanent data) {
|
||||
if (permanent == data &&
|
||||
!permanent.getExiledCards().isEmpty()) {
|
||||
final MagicCardList clist = new MagicCardList(permanent.getExiledCards());
|
||||
return new MagicEvent(
|
||||
permanent,
|
||||
permanent.getController(),
|
||||
new Object[]{permanent.getController(),permanent},
|
||||
this,
|
||||
clist.size() > 1 ?
|
||||
"Sacrifice all Dragons. Return exiled cards to the battlefield." :
|
||||
"Sacrifice all Dragons. Return " + clist.get(0) + " to the battlefield.");
|
||||
}
|
||||
return MagicEvent.NONE;
|
||||
}
|
||||
@Override
|
||||
public void executeEvent(
|
||||
final MagicGame game,
|
||||
final MagicEvent event,
|
||||
final Object data[],
|
||||
final Object[] choiceResults) {
|
||||
final Collection<MagicTarget> targets =
|
||||
game.filterTargets((MagicPlayer)data[0],MagicTargetFilter.TARGET_DRAGON_YOU_CONTROL);
|
||||
for (final MagicTarget target : targets) {
|
||||
game.doAction(new MagicSacrificeAction((MagicPermanent)target));
|
||||
}
|
||||
final MagicPermanent permanent = (MagicPermanent)data[1];
|
||||
game.doAction(new MagicReturnExiledUntilThisLeavesPlayAction(
|
||||
permanent,
|
||||
MagicLocationType.Play,
|
||||
(MagicPlayer)data[0]));
|
||||
}
|
||||
};
|
||||
}
|
|
@ -6,6 +6,7 @@ import magic.model.MagicGame;
|
|||
import magic.model.MagicLocationType;
|
||||
import magic.model.MagicPayedCost;
|
||||
import magic.model.MagicPermanent;
|
||||
import magic.model.MagicPlayer;
|
||||
import magic.model.event.MagicReturnAuraEvent;
|
||||
import magic.model.stack.MagicCardOnStack;
|
||||
|
||||
|
@ -13,11 +14,24 @@ public class MagicReturnExiledUntilThisLeavesPlayAction extends MagicAction {
|
|||
|
||||
private final MagicPermanent source;
|
||||
private final MagicLocationType location;
|
||||
final MagicPlayer controller;
|
||||
private MagicCardList exiledList;
|
||||
|
||||
public MagicReturnExiledUntilThisLeavesPlayAction(final MagicPermanent source,final MagicLocationType location) {
|
||||
public MagicReturnExiledUntilThisLeavesPlayAction(
|
||||
final MagicPermanent source,
|
||||
final MagicLocationType location,
|
||||
final MagicPlayer controller) {
|
||||
this.source = source;
|
||||
this.location = location;
|
||||
this.controller = controller;
|
||||
}
|
||||
|
||||
public MagicReturnExiledUntilThisLeavesPlayAction(
|
||||
final MagicPermanent source,
|
||||
final MagicLocationType location) {
|
||||
this.source = source;
|
||||
this.location = location;
|
||||
this.controller = MagicPlayer.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,7 +46,11 @@ public class MagicReturnExiledUntilThisLeavesPlayAction extends MagicAction {
|
|||
final MagicCardOnStack cardOnStack = new MagicCardOnStack(card,MagicPayedCost.NO_COST);
|
||||
game.addEvent(new MagicReturnAuraEvent(cardOnStack));
|
||||
} else {
|
||||
game.doAction(new MagicPlayCardAction(card,card.getOwner(),MagicPlayCardAction.NONE));
|
||||
final Boolean newOwner = controller != MagicPlayer.NONE;
|
||||
game.doAction(new MagicPlayCardAction(
|
||||
card,
|
||||
newOwner ? controller : card.getOwner(),
|
||||
MagicPlayCardAction.NONE));
|
||||
}
|
||||
} else {
|
||||
game.doAction(new MagicMoveCardAction(card,MagicLocationType.Exile,location));
|
||||
|
|
Loading…
Reference in New Issue