move EVENT_ACTION after constructor
parent
37af0af2cd
commit
4298c5b19a
|
@ -8,6 +8,16 @@ import magic.model.choice.MagicDeclareAttackersResult;
|
|||
|
||||
public class MagicDeclareAttackersEvent extends MagicEvent {
|
||||
|
||||
public MagicDeclareAttackersEvent(final MagicPlayer player) {
|
||||
super(
|
||||
MagicEvent.NO_SOURCE,
|
||||
player,
|
||||
MagicDeclareAttackersChoice.getInstance(),
|
||||
EVENT_ACTION,
|
||||
""
|
||||
);
|
||||
}
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||
@Override
|
||||
public void executeEvent(
|
||||
|
@ -21,14 +31,4 @@ public class MagicDeclareAttackersEvent extends MagicEvent {
|
|||
game.logAttackers(player,result);
|
||||
}
|
||||
};
|
||||
|
||||
public MagicDeclareAttackersEvent(final MagicPlayer player) {
|
||||
super(
|
||||
MagicEvent.NO_SOURCE,
|
||||
player,
|
||||
MagicDeclareAttackersChoice.getInstance(),
|
||||
EVENT_ACTION,
|
||||
""
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,16 +8,6 @@ import magic.model.choice.MagicDeclareBlockersResult;
|
|||
|
||||
public class MagicDeclareBlockersEvent extends MagicEvent {
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||
@Override
|
||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object data[],final Object[] choiceResults) {
|
||||
final MagicPlayer player=event.getPlayer();
|
||||
final MagicDeclareBlockersResult result=(MagicDeclareBlockersResult)choiceResults[0];
|
||||
game.doAction(new MagicDeclareBlockersAction(player,result));
|
||||
game.logBlockers(player,result);
|
||||
}
|
||||
};
|
||||
|
||||
public MagicDeclareBlockersEvent(final MagicPlayer player) {
|
||||
super(
|
||||
MagicEvent.NO_SOURCE,
|
||||
|
@ -27,4 +17,14 @@ public class MagicDeclareBlockersEvent extends MagicEvent {
|
|||
""
|
||||
);
|
||||
}
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||
@Override
|
||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object data[],final Object[] choiceResults) {
|
||||
final MagicPlayer player=event.getPlayer();
|
||||
final MagicDeclareBlockersResult result=(MagicDeclareBlockersResult)choiceResults[0];
|
||||
game.doAction(new MagicDeclareBlockersAction(player,result));
|
||||
game.logBlockers(player,result);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -11,6 +11,16 @@ import magic.model.choice.MagicRandomCardChoice;
|
|||
|
||||
public class MagicDiscardEvent extends MagicEvent {
|
||||
|
||||
public MagicDiscardEvent(final MagicSource source,final MagicPlayer player,final int amount,final boolean random) {
|
||||
super(
|
||||
source,
|
||||
player,
|
||||
random ? new MagicRandomCardChoice(amount) : new MagicCardChoice(amount),
|
||||
EVENT_ACTION,
|
||||
"PN " + genDescription(player,amount)
|
||||
);
|
||||
}
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||
@Override
|
||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
||||
|
@ -22,16 +32,6 @@ public class MagicDiscardEvent extends MagicEvent {
|
|||
}
|
||||
};
|
||||
|
||||
public MagicDiscardEvent(final MagicSource source,final MagicPlayer player,final int amount,final boolean random) {
|
||||
super(
|
||||
source,
|
||||
player,
|
||||
random ? new MagicRandomCardChoice(amount) : new MagicCardChoice(amount),
|
||||
EVENT_ACTION,
|
||||
player.getName() + genDescription(player,amount)
|
||||
);
|
||||
}
|
||||
|
||||
private static final String genDescription(final MagicPlayer player,final int amount) {
|
||||
final int actualAmount = Math.min(amount,player.getHandSize());
|
||||
String description = "";
|
||||
|
|
|
@ -10,19 +10,16 @@ public class MagicDrawEvent extends MagicEvent {
|
|||
super(
|
||||
source,
|
||||
player,
|
||||
new Object[]{amount},
|
||||
EVENT_ACTION,
|
||||
new MagicEventAction() {
|
||||
@Override
|
||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object data[],final Object[] choices) {
|
||||
game.doAction(new MagicDrawAction(event.getPlayer(),amount));
|
||||
}
|
||||
},
|
||||
"PN " + genDescription(amount)
|
||||
);
|
||||
}
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||
@Override
|
||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object data[],final Object[] choices) {
|
||||
game.doAction(new MagicDrawAction(event.getPlayer(),(Integer)data[0]));
|
||||
}
|
||||
};
|
||||
|
||||
private static final String genDescription(final int amount) {
|
||||
if (amount!=1) {
|
||||
return " draws "+amount+" cards.";
|
||||
|
|
|
@ -7,7 +7,6 @@ import magic.model.MagicGame;
|
|||
import magic.model.MagicPermanent;
|
||||
import magic.model.MagicLocationType;
|
||||
import magic.model.stack.MagicCardOnStack;
|
||||
import magic.model.action.MagicMoveCardAction;
|
||||
import magic.model.action.MagicPermanentAction;
|
||||
import magic.model.action.MagicCardOnStackAction;
|
||||
import magic.model.action.MagicDestroyAction;
|
||||
|
@ -38,7 +37,6 @@ public class MagicEventActionFactory {
|
|||
final MagicEvent event,
|
||||
final Object[] data,
|
||||
final Object[] choiceResults) {
|
||||
game.doAction(new MagicMoveCardAction(event.getCardOnStack()));
|
||||
event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() {
|
||||
public void doAction(final MagicPermanent creature) {
|
||||
game.doAction(new MagicDestroyAction(creature));
|
||||
|
@ -55,7 +53,6 @@ public class MagicEventActionFactory {
|
|||
final MagicEvent event,
|
||||
final Object[] data,
|
||||
final Object[] choiceResults) {
|
||||
game.doAction(new MagicMoveCardAction(event.getCardOnStack()));
|
||||
event.processTargetCardOnStack(game,choiceResults,0,new MagicCardOnStackAction() {
|
||||
public void doAction(final MagicCardOnStack targetSpell) {
|
||||
game.doAction(new MagicCounterItemOnStackAction(targetSpell));
|
||||
|
@ -72,7 +69,6 @@ public class MagicEventActionFactory {
|
|||
final MagicEvent event,
|
||||
final Object[] data,
|
||||
final Object[] choiceResults) {
|
||||
game.doAction(new MagicMoveCardAction(event.getCardOnStack()));
|
||||
event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() {
|
||||
public void doAction(final MagicPermanent perm) {
|
||||
game.doAction(new MagicRemoveFromPlayAction(perm,MagicLocationType.Exile));
|
||||
|
|
|
@ -7,6 +7,16 @@ import magic.model.choice.MagicExcludeResult;
|
|||
|
||||
public class MagicExcludeEvent extends MagicEvent {
|
||||
|
||||
public MagicExcludeEvent(final MagicPlayer player) {
|
||||
super(
|
||||
MagicEvent.NO_SOURCE,
|
||||
player,
|
||||
MagicExcludeChoice.getInstance(),
|
||||
EVENT_ACTION,
|
||||
""
|
||||
);
|
||||
}
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||
@Override
|
||||
public void executeEvent(
|
||||
|
@ -18,14 +28,4 @@ public class MagicExcludeEvent extends MagicEvent {
|
|||
result.exclude(game);
|
||||
}
|
||||
};
|
||||
|
||||
public MagicExcludeEvent(final MagicPlayer player) {
|
||||
super(
|
||||
MagicEvent.NO_SOURCE,
|
||||
player,
|
||||
MagicExcludeChoice.getInstance(),
|
||||
EVENT_ACTION,
|
||||
""
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,20 @@ import magic.model.choice.MagicTargetChoice;
|
|||
|
||||
public class MagicExileCardEvent extends MagicEvent {
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION = new MagicEventAction() {
|
||||
public MagicExileCardEvent(
|
||||
final MagicSource source,
|
||||
final MagicPlayer player,
|
||||
final MagicTargetChoice targetChoice) {
|
||||
super(
|
||||
source,
|
||||
player,
|
||||
targetChoice,
|
||||
EVENT_ACTION,
|
||||
"Choose " + targetChoice.getTargetDescription() + "$."
|
||||
);
|
||||
}
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||
@Override
|
||||
public void executeEvent(
|
||||
final MagicGame game,
|
||||
|
@ -34,17 +47,4 @@ public class MagicExileCardEvent extends MagicEvent {
|
|||
});
|
||||
}
|
||||
};
|
||||
|
||||
public MagicExileCardEvent(
|
||||
final MagicSource source,
|
||||
final MagicPlayer player,
|
||||
final MagicTargetChoice targetChoice) {
|
||||
super(
|
||||
source,
|
||||
player,
|
||||
targetChoice,
|
||||
EVENT_ACTION,
|
||||
"Choose " + targetChoice.getTargetDescription() + "$."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,16 @@ import magic.model.choice.MagicMulliganChoice;
|
|||
|
||||
public class MagicMulliganEvent extends MagicEvent {
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION = new MagicEventAction() {
|
||||
public MagicMulliganEvent(final MagicPlayer player) {
|
||||
super(
|
||||
MagicEvent.NO_SOURCE,
|
||||
player,
|
||||
new MagicMulliganChoice(),
|
||||
EVENT_ACTION,
|
||||
"PN may$ take a mulligan."
|
||||
);
|
||||
}
|
||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||
@Override
|
||||
public void executeEvent(
|
||||
final MagicGame game,
|
||||
|
@ -26,12 +35,14 @@ public class MagicMulliganEvent extends MagicEvent {
|
|||
final int size = hand.size();
|
||||
for (final MagicCard card : hand) {
|
||||
game.doAction(new MagicMoveCardAction(
|
||||
card,
|
||||
MagicLocationType.OwnersHand,
|
||||
MagicLocationType.OwnersLibrary));
|
||||
card,
|
||||
MagicLocationType.OwnersHand,
|
||||
MagicLocationType.OwnersLibrary
|
||||
));
|
||||
game.doAction(new MagicRemoveCardAction(
|
||||
card,
|
||||
MagicLocationType.OwnersHand));
|
||||
card,
|
||||
MagicLocationType.OwnersHand
|
||||
));
|
||||
}
|
||||
final MagicCardList library = player.getLibrary();
|
||||
library.shuffle();
|
||||
|
@ -40,14 +51,4 @@ public class MagicMulliganEvent extends MagicEvent {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
public MagicMulliganEvent(final MagicPlayer player) {
|
||||
super(
|
||||
MagicEvent.NO_SOURCE,
|
||||
player,
|
||||
new MagicMulliganChoice(),
|
||||
EVENT_ACTION,
|
||||
"PN may$ take a mulligan."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,21 +6,17 @@ import magic.model.MagicSource;
|
|||
import magic.model.action.MagicChangeLifeAction;
|
||||
|
||||
public class MagicPayLifeEvent extends MagicEvent {
|
||||
|
||||
public MagicPayLifeEvent(final MagicSource source,final MagicPlayer player,final int amount) {
|
||||
super(
|
||||
source,
|
||||
player,
|
||||
new Object[]{-amount},
|
||||
EVENT_ACTION,
|
||||
new MagicEventAction() {
|
||||
@Override
|
||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object data[],final Object[] choices) {
|
||||
game.doAction(new MagicChangeLifeAction(event.getPlayer(),-amount));
|
||||
}
|
||||
},
|
||||
"Pay "+amount+" life."
|
||||
);
|
||||
}
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||
@Override
|
||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object data[],final Object[] choices) {
|
||||
game.doAction(new MagicChangeLifeAction(event.getPlayer(),(Integer)data[0]));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -7,17 +7,6 @@ import magic.model.MagicSource;
|
|||
import magic.model.choice.MagicPayManaCostChoice;
|
||||
|
||||
public class MagicPayManaCostEvent extends MagicEvent {
|
||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||
@Override
|
||||
public void executeEvent(
|
||||
final MagicGame game,
|
||||
final MagicEvent event,
|
||||
final Object data[],
|
||||
final Object[] choiceResults) {
|
||||
MagicEvent.payManaCost(game,event.getPlayer(),choiceResults,0);
|
||||
}
|
||||
};
|
||||
|
||||
public MagicPayManaCostEvent(final MagicSource source,final MagicPlayer player,final MagicManaCost cost) {
|
||||
super(
|
||||
source,
|
||||
|
@ -27,4 +16,15 @@ public class MagicPayManaCostEvent extends MagicEvent {
|
|||
"Pay "+cost.getText()+"$."
|
||||
);
|
||||
}
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||
@Override
|
||||
public void executeEvent(
|
||||
final MagicGame game,
|
||||
final MagicEvent event,
|
||||
final Object data[],
|
||||
final Object[] choiceResults) {
|
||||
MagicEvent.payManaCost(game,event.getPlayer(),choiceResults,0);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,21 +10,21 @@ import magic.model.choice.MagicPayManaCostChoice;
|
|||
|
||||
public class MagicPayManaCostSacrificeEvent extends MagicEvent {
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||
@Override
|
||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object data[],final Object[] choiceResults) {
|
||||
MagicEvent.payManaCost(game,event.getPlayer(),choiceResults,0);
|
||||
game.doAction(new MagicSacrificeAction(event.getPermanent()));
|
||||
}
|
||||
};
|
||||
|
||||
public MagicPayManaCostSacrificeEvent(final MagicSource source,final MagicPlayer player,final MagicManaCost cost) {
|
||||
super(
|
||||
source,
|
||||
player,
|
||||
new MagicPayManaCostChoice(cost),
|
||||
EVENT_ACTION,
|
||||
"Pay "+cost.getText()+"$. Sacrifice "+source.getName()+"."
|
||||
"Pay "+cost.getText()+"$. Sacrifice SN."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||
@Override
|
||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object data[],final Object[] choiceResults) {
|
||||
MagicEvent.payManaCost(game,event.getPlayer(),choiceResults,0);
|
||||
game.doAction(new MagicSacrificeAction(event.getPermanent()));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,21 +10,20 @@ import magic.model.choice.MagicPayManaCostChoice;
|
|||
|
||||
public class MagicPayManaCostTapEvent extends MagicEvent {
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||
@Override
|
||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object data[],final Object[] choiceResults) {
|
||||
MagicEvent.payManaCost(game,event.getPlayer(),choiceResults,0);
|
||||
game.doAction(new MagicTapAction(event.getPermanent(),true));
|
||||
}
|
||||
};
|
||||
|
||||
public MagicPayManaCostTapEvent(final MagicSource source,final MagicPlayer player,final MagicManaCost cost) {
|
||||
super(
|
||||
source,
|
||||
player,
|
||||
new MagicPayManaCostChoice(cost),
|
||||
EVENT_ACTION,
|
||||
"Pay "+cost.getText()+"$. Tap "+source.getName()+"."
|
||||
"Pay "+cost.getText()+"$. Tap SN."
|
||||
);
|
||||
}
|
||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||
@Override
|
||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object data[],final Object[] choiceResults) {
|
||||
MagicEvent.payManaCost(game,event.getPlayer(),choiceResults,0);
|
||||
game.doAction(new MagicTapAction(event.getPermanent(),true));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package magic.model.event;
|
|||
import magic.model.MagicGame;
|
||||
import magic.model.MagicPayedCost;
|
||||
import magic.model.MagicPermanent;
|
||||
import magic.model.action.MagicMoveCardAction;
|
||||
import magic.model.action.MagicPermanentAction;
|
||||
import magic.model.action.MagicPlayCardFromStackAction;
|
||||
import magic.model.choice.MagicTargetChoice;
|
||||
|
@ -29,11 +28,12 @@ public class MagicPlayAuraEvent extends MagicSpellCardEvent {
|
|||
@Override
|
||||
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
|
||||
return new MagicEvent(
|
||||
cardOnStack,
|
||||
targetChoice,
|
||||
targetPicker,
|
||||
this,
|
||||
"Enchant "+targetChoice.getTargetDescription()+"$ with "+cardOnStack.getName()+".");
|
||||
cardOnStack,
|
||||
targetChoice,
|
||||
targetPicker,
|
||||
this,
|
||||
"Enchant "+targetChoice.getTargetDescription()+"$ with SN."
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -42,15 +42,11 @@ public class MagicPlayAuraEvent extends MagicSpellCardEvent {
|
|||
final MagicEvent event,
|
||||
final Object[] data,
|
||||
final Object[] choiceResults) {
|
||||
final MagicCardOnStack cardOnStack = event.getCardOnStack();
|
||||
final boolean success = event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() {
|
||||
event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() {
|
||||
public void doAction(final MagicPermanent creature) {
|
||||
game.doAction(new MagicPlayCardFromStackAction(cardOnStack,creature));
|
||||
game.doAction(new MagicPlayCardFromStackAction(event.getCardOnStack(),creature));
|
||||
}
|
||||
});
|
||||
if (!success) {
|
||||
game.doAction(new MagicMoveCardAction(cardOnStack));
|
||||
}
|
||||
}
|
||||
|
||||
public static MagicPlayAuraEvent create(String script) {
|
||||
|
|
|
@ -20,9 +20,10 @@ public class MagicPlayCardEvent {
|
|||
@Override
|
||||
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
|
||||
return new MagicEvent(
|
||||
cardOnStack,
|
||||
this,
|
||||
"Put " + cardOnStack.getName() + " onto the battlefield.");
|
||||
cardOnStack,
|
||||
this,
|
||||
"Put SN onto the battlefield."
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -39,12 +40,12 @@ public class MagicPlayCardEvent {
|
|||
return new MagicSpellCardEvent() {
|
||||
@Override
|
||||
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
|
||||
final MagicCard card = cardOnStack.getCard();
|
||||
return new MagicEvent(
|
||||
cardOnStack,
|
||||
new MagicKickerChoice(kickerCost,multi),
|
||||
this,
|
||||
"$Play " + card + ". If " + card + " was kicked$, " + desc + ".");
|
||||
cardOnStack,
|
||||
new MagicKickerChoice(kickerCost,multi),
|
||||
this,
|
||||
"$Play SN. If SN was kicked$, " + desc + "."
|
||||
);
|
||||
}
|
||||
@Override
|
||||
public void executeEvent(
|
||||
|
@ -62,12 +63,12 @@ public class MagicPlayCardEvent {
|
|||
return new MagicSpellCardEvent() {
|
||||
@Override
|
||||
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
|
||||
final MagicCard card = cardOnStack.getCard();
|
||||
return new MagicEvent(
|
||||
cardOnStack,
|
||||
new Object[]{payedCost.getX()},
|
||||
this,
|
||||
"$Play " + card + ". " + desc + ".");
|
||||
cardOnStack,
|
||||
new Object[]{payedCost.getX()},
|
||||
this,
|
||||
"$Play SN. " + desc + "."
|
||||
);
|
||||
}
|
||||
@Override
|
||||
public void executeEvent(
|
||||
|
|
|
@ -24,13 +24,13 @@ public class MagicPlayMulticounterEvent extends MagicSpellCardEvent {
|
|||
|
||||
@Override
|
||||
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
|
||||
final MagicCard card = cardOnStack.getCard();
|
||||
return new MagicEvent(
|
||||
cardOnStack,
|
||||
new MagicKickerChoice(cost,true),
|
||||
this,
|
||||
"$Play " + card + ". " + card + " enters the battlefield " +
|
||||
"with a +1/+1 counter on it for each time it was kicked$");
|
||||
cardOnStack,
|
||||
new MagicKickerChoice(cost,true),
|
||||
this,
|
||||
"$Play SN. SN enters the battlefield " +
|
||||
"with a +1/+1 counter on it for each time it was kicked$"
|
||||
);
|
||||
}
|
||||
@Override
|
||||
public void executeEvent(
|
||||
|
@ -38,17 +38,19 @@ public class MagicPlayMulticounterEvent extends MagicSpellCardEvent {
|
|||
final MagicEvent event,
|
||||
final Object[] data,
|
||||
final Object[] choiceResults) {
|
||||
final int kickerCount = (Integer)choiceResults[1];
|
||||
final MagicCardOnStack cardOnStack = event.getCardOnStack();
|
||||
final MagicPlayCardFromStackAction action = new MagicPlayCardFromStackAction(cardOnStack);
|
||||
game.doAction(action);
|
||||
|
||||
final int kickerCount = (Integer)choiceResults[1];
|
||||
if (kickerCount > 0) {
|
||||
final MagicPermanent permanent = action.getPermanent();
|
||||
game.doAction(new MagicChangeCountersAction(
|
||||
permanent,
|
||||
MagicCounterType.PlusOne,
|
||||
kickerCount,
|
||||
true));
|
||||
permanent,
|
||||
MagicCounterType.PlusOne,
|
||||
kickerCount,
|
||||
true
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package magic.model.event;
|
|||
|
||||
import magic.model.MagicGame;
|
||||
import magic.model.MagicPermanent;
|
||||
import magic.model.action.MagicMoveCardAction;
|
||||
import magic.model.action.MagicPermanentAction;
|
||||
import magic.model.action.MagicPlayCardFromStackAction;
|
||||
import magic.model.choice.MagicTargetChoice;
|
||||
|
@ -13,15 +12,18 @@ import magic.model.stack.MagicCardOnStack;
|
|||
*/
|
||||
public class MagicReturnAuraEvent extends MagicEvent {
|
||||
public MagicReturnAuraEvent(final MagicCardOnStack cardOnStack) {
|
||||
super(cardOnStack,
|
||||
new MagicTargetChoice(
|
||||
cardOnStack.getEvent().getTargetChoice().getTargetFilter(),
|
||||
false,
|
||||
cardOnStack.getEvent().getTargetChoice().getTargetHint(true),
|
||||
cardOnStack.getEvent().getTargetChoice().getDescription()),
|
||||
cardOnStack.getEvent().getTargetPicker(),
|
||||
EVENT_ACTION,
|
||||
cardOnStack.getEvent().getChoiceDescription());
|
||||
super(
|
||||
cardOnStack,
|
||||
new MagicTargetChoice(
|
||||
cardOnStack.getEvent().getTargetChoice().getTargetFilter(),
|
||||
false,
|
||||
cardOnStack.getEvent().getTargetChoice().getTargetHint(true),
|
||||
cardOnStack.getEvent().getTargetChoice().getDescription()
|
||||
),
|
||||
cardOnStack.getEvent().getTargetPicker(),
|
||||
EVENT_ACTION,
|
||||
cardOnStack.getEvent().getChoiceDescription()
|
||||
);
|
||||
}
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION = new MagicEventAction() {
|
||||
|
@ -32,14 +34,11 @@ public class MagicReturnAuraEvent extends MagicEvent {
|
|||
final Object[] data,
|
||||
final Object[] choiceResults) {
|
||||
final MagicCardOnStack cardOnStack = event.getCardOnStack();
|
||||
final boolean success = event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() {
|
||||
event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() {
|
||||
public void doAction(final MagicPermanent creature) {
|
||||
game.doAction(new MagicPlayCardFromStackAction(cardOnStack,creature));
|
||||
}
|
||||
});
|
||||
if (!success) {
|
||||
game.doAction(new MagicMoveCardAction(cardOnStack));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -39,5 +39,4 @@ public class MagicSacrificePermanentEvent extends MagicEvent {
|
|||
});
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -9,22 +9,6 @@ import magic.model.target.MagicTargetFilter;
|
|||
import magic.model.target.MagicTargetHint;
|
||||
|
||||
public class MagicSoulbondEvent extends MagicEvent {
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION = new MagicEventAction() {
|
||||
@Override
|
||||
public void executeEvent(
|
||||
final MagicGame game,
|
||||
final MagicEvent event,
|
||||
final Object[] data,
|
||||
final Object[] choiceResults) {
|
||||
if (MagicMayChoice.isYesChoice(choiceResults[0])) {
|
||||
game.doAction(new MagicSoulbondAction(
|
||||
event.getPermanent(),
|
||||
(MagicPermanent)choiceResults[1],
|
||||
true));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public MagicSoulbondEvent(final MagicPermanent permanent,final boolean hasSoulbond) {
|
||||
super(
|
||||
|
@ -47,4 +31,21 @@ public class MagicSoulbondEvent extends MagicEvent {
|
|||
"PN may$ pair a creature$ with SN."
|
||||
);
|
||||
}
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION = new MagicEventAction() {
|
||||
@Override
|
||||
public void executeEvent(
|
||||
final MagicGame game,
|
||||
final MagicEvent event,
|
||||
final Object[] data,
|
||||
final Object[] choiceResults) {
|
||||
if (MagicMayChoice.isYesChoice(choiceResults[0])) {
|
||||
game.doAction(new MagicSoulbondAction(
|
||||
event.getPermanent(),
|
||||
(MagicPermanent)choiceResults[1],
|
||||
true
|
||||
));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -49,11 +49,12 @@ public abstract class MagicSpellCardEvent implements MagicCardEvent,MagicEventAc
|
|||
@Override
|
||||
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
|
||||
return new MagicEvent(
|
||||
cardOnStack,
|
||||
choice,
|
||||
(picker != null ? picker : MagicDefaultTargetPicker.create()),
|
||||
action,
|
||||
effect + "$.");
|
||||
cardOnStack,
|
||||
choice,
|
||||
(picker != null ? picker : MagicDefaultTargetPicker.create()),
|
||||
action,
|
||||
effect + "$."
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue