merged changes to main repo with new cards
commit
cd11dca989
5
Makefile
5
Makefile
|
@ -180,7 +180,8 @@ inf: $(MAG)
|
||||||
|
|
||||||
%.t: $(MAG)
|
%.t: $(MAG)
|
||||||
echo `hg id -n` > $*.log
|
echo `hg id -n` > $*.log
|
||||||
$(JAVAEA) -DrndSeed=$* -Dmagarena.dir=`pwd`/release -DselfMode -jar $^ >> $*.log 2>&1
|
$(JAVA) -DrndSeed=$* -Dmagarena.dir=`pwd`/release magic.DeckStrCal --str1 1 --str2 1 --life 10 --games 1 --repeat 1000000 >> $*.log 2>&1
|
||||||
|
#$(JAVAEA) -DrndSeed=$* -Dmagarena.dir=`pwd`/release -DselfMode -jar $^ >> $*.log 2>&1
|
||||||
|
|
||||||
test: $(MAG)
|
test: $(MAG)
|
||||||
-make `date +%s`.d
|
-make `date +%s`.d
|
||||||
|
@ -409,7 +410,7 @@ update_value_from_rankings: cards/gatherer_rankings
|
||||||
hg add $^
|
hg add $^
|
||||||
|
|
||||||
check_data: scripts/check_data.awk
|
check_data: scripts/check_data.awk
|
||||||
for i in src/magic/card/*; do \
|
for i in src/magic/card/* src/magic/model/event/* src/magic/model/trigger/* ; do \
|
||||||
grep "new Object\|data\[[0-9\]" $$i > /dev/null && echo $$i; \
|
grep "new Object\|data\[[0-9\]" $$i > /dev/null && echo $$i; \
|
||||||
grep "new Object\|data\[[0-9\]" $$i | awk -f $^ | sed 's/ //g' | sed 's/:/:\t/'; \
|
grep "new Object\|data\[[0-9\]" $$i | awk -f $^ | sed 's/ //g' | sed 's/:/:\t/'; \
|
||||||
done > $@
|
done > $@
|
||||||
|
|
|
@ -5,6 +5,7 @@ import magic.ai.MagicAIImpl;
|
||||||
import magic.data.DeckUtils;
|
import magic.data.DeckUtils;
|
||||||
import magic.data.DuelConfig;
|
import magic.data.DuelConfig;
|
||||||
import magic.model.MagicGame;
|
import magic.model.MagicGame;
|
||||||
|
import magic.model.MagicGameReport;
|
||||||
import magic.model.MagicDuel;
|
import magic.model.MagicDuel;
|
||||||
import magic.ui.GameController;
|
import magic.ui.GameController;
|
||||||
|
|
||||||
|
@ -13,8 +14,10 @@ import java.io.File;
|
||||||
public class DeckStrCal {
|
public class DeckStrCal {
|
||||||
|
|
||||||
private static int games = 10;
|
private static int games = 10;
|
||||||
|
private static int repeat = 1;
|
||||||
private static int str1 = 6;
|
private static int str1 = 6;
|
||||||
private static int str2 = 6;
|
private static int str2 = 6;
|
||||||
|
private static int life = 20;
|
||||||
private static String deck1 = "";
|
private static String deck1 = "";
|
||||||
private static String deck2 = "";
|
private static String deck2 = "";
|
||||||
private static MagicAIImpl ai1 = MagicAIImpl.MMAB;
|
private static MagicAIImpl ai1 = MagicAIImpl.MMAB;
|
||||||
|
@ -65,24 +68,35 @@ public class DeckStrCal {
|
||||||
System.err.println("Error: " + next + " is not valid AI");
|
System.err.println("Error: " + next + " is not valid AI");
|
||||||
validArgs = false;
|
validArgs = false;
|
||||||
}
|
}
|
||||||
|
} else if ("--life".equals(curr)) {
|
||||||
|
try { //parse CLI option
|
||||||
|
life = Integer.parseInt(next);
|
||||||
|
} catch (final NumberFormatException ex) {
|
||||||
|
System.err.println("ERROR! starting life is not an integer");
|
||||||
|
validArgs = false;
|
||||||
}
|
}
|
||||||
else {
|
} else if ("--repeat".equals(curr)) {
|
||||||
|
try { //parse CLI option
|
||||||
|
repeat = Integer.parseInt(next);
|
||||||
|
} catch (final NumberFormatException ex) {
|
||||||
|
System.err.println("ERROR! repeat is not an integer");
|
||||||
|
validArgs = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
System.err.println("Error: unknown option " + curr);
|
System.err.println("Error: unknown option " + curr);
|
||||||
validArgs = false;
|
validArgs = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deck1.length() == 0) {
|
if (deck1.length() == 0) {
|
||||||
System.err.println("Error: no file specified for deck 1");
|
System.err.println("Using player profile to generate deck 1");
|
||||||
validArgs = false;
|
|
||||||
} else if (!(new File(deck1)).exists()) {
|
} else if (!(new File(deck1)).exists()) {
|
||||||
System.err.println("Error: file " + deck1 + " does not exist");
|
System.err.println("Error: file " + deck1 + " does not exist");
|
||||||
validArgs = false;
|
validArgs = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deck2.length() == 0) {
|
if (deck2.length() == 0) {
|
||||||
System.err.println("Error: no file specified for deck 2");
|
System.err.println("Using player profile to generate deck 2");
|
||||||
validArgs = false;
|
|
||||||
} else if (!(new File(deck2)).exists()) {
|
} else if (!(new File(deck2)).exists()) {
|
||||||
System.err.println("Error: file " + deck2 + " does not exist");
|
System.err.println("Error: file " + deck2 + " does not exist");
|
||||||
validArgs = false;
|
validArgs = false;
|
||||||
|
@ -92,12 +106,10 @@ public class DeckStrCal {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MagicDuel setupDuel() {
|
private static MagicDuel setupDuel() {
|
||||||
// Load cards and cubes.
|
|
||||||
MagicMain.initializeEngine();
|
|
||||||
|
|
||||||
// Set number of games.
|
// Set number of games.
|
||||||
final DuelConfig config=new DuelConfig();
|
final DuelConfig config=new DuelConfig();
|
||||||
config.setNrOfGames(games);
|
config.setNrOfGames(games);
|
||||||
|
config.setStartLife(life);
|
||||||
|
|
||||||
// Set difficulty.
|
// Set difficulty.
|
||||||
final MagicDuel testDuel=new MagicDuel(config);
|
final MagicDuel testDuel=new MagicDuel(config);
|
||||||
|
@ -111,13 +123,20 @@ public class DeckStrCal {
|
||||||
testDuel.getPlayer(1).setArtificial(true);
|
testDuel.getPlayer(1).setArtificial(true);
|
||||||
|
|
||||||
// Set the deck.
|
// Set the deck.
|
||||||
|
if (deck1.length() > 0) {
|
||||||
DeckUtils.loadDeck(deck1, testDuel.getPlayer(0));
|
DeckUtils.loadDeck(deck1, testDuel.getPlayer(0));
|
||||||
|
}
|
||||||
|
if (deck2.length() > 0) {
|
||||||
DeckUtils.loadDeck(deck2, testDuel.getPlayer(1));
|
DeckUtils.loadDeck(deck2, testDuel.getPlayer(1));
|
||||||
|
}
|
||||||
|
|
||||||
return testDuel;
|
return testDuel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(final String[] args) {
|
public static void main(final String[] args) {
|
||||||
|
// setup the handler for any uncaught exception
|
||||||
|
Thread.setDefaultUncaughtExceptionHandler(new magic.model.MagicGameReport());
|
||||||
|
|
||||||
if (!parseArguments(args)) {
|
if (!parseArguments(args)) {
|
||||||
System.err.println("Usage: java -cp <path to Magarena.jar/exe> magic.DeckStrCal --deck1 <.dec file> --deck2 <.dec file> [options]");
|
System.err.println("Usage: java -cp <path to Magarena.jar/exe> magic.DeckStrCal --deck1 <.dec file> --deck2 <.dec file> [options]");
|
||||||
System.err.println("Options:");
|
System.err.println("Options:");
|
||||||
|
@ -128,6 +147,15 @@ public class DeckStrCal {
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load cards and cubes.
|
||||||
|
MagicMain.initializeEngine();
|
||||||
|
|
||||||
|
for (int i = 0; i < repeat; i++) {
|
||||||
|
runDuel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void runDuel() {
|
||||||
final MagicDuel testDuel = setupDuel();
|
final MagicDuel testDuel = setupDuel();
|
||||||
|
|
||||||
System.out.println(
|
System.out.println(
|
||||||
|
|
|
@ -36,9 +36,10 @@ public class Kjeldoran_Javelineer {
|
||||||
source,
|
source,
|
||||||
MagicTargetChoice.NEG_TARGET_ATTACKING_OR_BLOCKING_CREATURE,
|
MagicTargetChoice.NEG_TARGET_ATTACKING_OR_BLOCKING_CREATURE,
|
||||||
new MagicDamageTargetPicker(amount),
|
new MagicDamageTargetPicker(amount),
|
||||||
new Object[]{source,amount},
|
new Object[]{amount},
|
||||||
this,
|
this,
|
||||||
"SN deals " + amount + " damage to target creature$.");
|
"SN deals " + amount + " damage to target creature$."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -46,9 +47,9 @@ public class Kjeldoran_Javelineer {
|
||||||
event.processTarget(game,choiceResults,0,new MagicTargetAction() {
|
event.processTarget(game,choiceResults,0,new MagicTargetAction() {
|
||||||
public void doAction(final MagicTarget target) {
|
public void doAction(final MagicTarget target) {
|
||||||
final MagicDamage damage = new MagicDamage(
|
final MagicDamage damage = new MagicDamage(
|
||||||
(MagicSource)data[0],
|
event.getSource(),
|
||||||
target,
|
target,
|
||||||
(Integer)data[1],
|
(Integer)data[0],
|
||||||
false);
|
false);
|
||||||
game.doAction(new MagicDealDamageAction(damage));
|
game.doAction(new MagicDealDamageAction(damage));
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,10 +18,12 @@ import magic.model.mstatic.MagicLayer;
|
||||||
public class MagicCardActivation extends MagicActivation {
|
public class MagicCardActivation extends MagicActivation {
|
||||||
|
|
||||||
public MagicCardActivation(final MagicCardDefinition cdef) {
|
public MagicCardActivation(final MagicCardDefinition cdef) {
|
||||||
super(0,
|
super(
|
||||||
|
0,
|
||||||
new MagicCondition[]{
|
new MagicCondition[]{
|
||||||
MagicCondition.CARD_CONDITION,
|
MagicCondition.CARD_CONDITION,
|
||||||
cdef.getCost().getCondition()},
|
cdef.getCost().getCondition()
|
||||||
|
},
|
||||||
cdef.getActivationHints(),
|
cdef.getActivationHints(),
|
||||||
"Play"
|
"Play"
|
||||||
);
|
);
|
||||||
|
@ -46,12 +48,16 @@ public class MagicCardActivation extends MagicActivation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent getEvent(final MagicSource source) {
|
public MagicEvent getEvent(final MagicSource source) {
|
||||||
return new MagicEvent(source,source.getController(),new Object[]{source},this,"Play "+source.getName()+".");
|
return new MagicEvent(
|
||||||
|
source,
|
||||||
|
this,
|
||||||
|
"Play SN."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
||||||
final MagicCard card=(MagicCard)data[0];
|
final MagicCard card = event.getCard();
|
||||||
if (card.getCardDefinition().isLand()) {
|
if (card.getCardDefinition().isLand()) {
|
||||||
game.incLandPlayed();
|
game.incLandPlayed();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,21 @@ import magic.model.stack.MagicItemOnStack;
|
||||||
|
|
||||||
public class MagicCounterUnlessEvent extends MagicEvent {
|
public class MagicCounterUnlessEvent extends MagicEvent {
|
||||||
|
|
||||||
|
public MagicCounterUnlessEvent(final MagicSource source,final MagicItemOnStack itemOnStack,final MagicManaCost cost) {
|
||||||
|
super(
|
||||||
|
source,
|
||||||
|
itemOnStack.getController(),
|
||||||
|
new MagicMayChoice(
|
||||||
|
"You may pay "+cost.getText()+'.',
|
||||||
|
new MagicPayManaCostChoice(cost)
|
||||||
|
),
|
||||||
|
new Object[]{itemOnStack},
|
||||||
|
EVENT_ACTION,
|
||||||
|
"You may$ pay "+cost.getText()+"$. " +
|
||||||
|
"If you don't, counter "+itemOnStack.getName()+"."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(
|
public void executeEvent(
|
||||||
|
@ -25,19 +40,4 @@ public class MagicCounterUnlessEvent extends MagicEvent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public MagicCounterUnlessEvent(final MagicSource source,final MagicItemOnStack itemOnStack,final MagicManaCost cost) {
|
|
||||||
super(
|
|
||||||
source,
|
|
||||||
itemOnStack.getController(),
|
|
||||||
new MagicMayChoice(
|
|
||||||
"You may pay "+cost.getText()+'.',
|
|
||||||
new MagicPayManaCostChoice(cost)
|
|
||||||
),
|
|
||||||
new Object[]{itemOnStack},
|
|
||||||
EVENT_ACTION,
|
|
||||||
"You may$ pay "+cost.getText()+"$. " +
|
|
||||||
"If you don't, counter "+itemOnStack.getName()+"."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,24 +6,23 @@ import magic.model.MagicSource;
|
||||||
import magic.model.action.MagicDrawAction;
|
import magic.model.action.MagicDrawAction;
|
||||||
|
|
||||||
public class MagicDrawEvent extends MagicEvent {
|
public class MagicDrawEvent 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[] choices) {
|
|
||||||
game.doAction(new MagicDrawAction((MagicPlayer)data[0],(Integer)data[1]));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public MagicDrawEvent(final MagicSource source,final MagicPlayer player,final int amount) {
|
public MagicDrawEvent(final MagicSource source,final MagicPlayer player,final int amount) {
|
||||||
super(
|
super(
|
||||||
source,
|
source,
|
||||||
player,
|
player,
|
||||||
new Object[]{player,amount},
|
new Object[]{amount},
|
||||||
EVENT_ACTION,
|
EVENT_ACTION,
|
||||||
player.getName() + genDescription(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) {
|
private static final String genDescription(final int amount) {
|
||||||
if (amount!=1) {
|
if (amount!=1) {
|
||||||
return " draws "+amount+" cards.";
|
return " draws "+amount+" cards.";
|
||||||
|
|
|
@ -37,19 +37,18 @@ public class MagicEquipActivation extends MagicPermanentActivation {
|
||||||
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
|
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
|
||||||
return new MagicEvent(
|
return new MagicEvent(
|
||||||
source,
|
source,
|
||||||
source.getController(),
|
|
||||||
MagicTargetChoice.TARGET_CREATURE_YOU_CONTROL,
|
MagicTargetChoice.TARGET_CREATURE_YOU_CONTROL,
|
||||||
new MagicEquipTargetPicker(source),
|
new MagicEquipTargetPicker(source),
|
||||||
new Object[]{source},
|
|
||||||
this,
|
this,
|
||||||
"Attach " + source + " to target creature$ you control.");
|
"Attach SN to target creature$ you control."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choiceResults) {
|
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choiceResults) {
|
||||||
event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() {
|
event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() {
|
||||||
public void doAction(final MagicPermanent creature) {
|
public void doAction(final MagicPermanent creature) {
|
||||||
game.doAction(new MagicAttachEquipmentAction((MagicPermanent)data[0],creature));
|
game.doAction(new MagicAttachEquipmentAction(event.getPermanent(),creature));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,17 +7,18 @@ import magic.model.action.MagicRemoveFromPlayAction;
|
||||||
|
|
||||||
public class MagicExileEvent extends MagicEvent {
|
public class MagicExileEvent extends MagicEvent {
|
||||||
|
|
||||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
public MagicExileEvent(final MagicPermanent permanent) {
|
||||||
|
super(
|
||||||
|
permanent,
|
||||||
|
EVENT_ACTION,
|
||||||
|
"Exile SN."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
||||||
|
game.doAction(new MagicRemoveFromPlayAction(event.getPermanent(),MagicLocationType.Exile));
|
||||||
game.doAction(new MagicRemoveFromPlayAction((MagicPermanent)data[0],MagicLocationType.Exile));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public MagicExileEvent(final MagicPermanent permanent) {
|
|
||||||
|
|
||||||
super(permanent,permanent.getController(),new Object[]{permanent},EVENT_ACTION,"Exile "+permanent.getName()+".");
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -24,21 +24,21 @@ public class MagicGainActivation extends MagicPermanentActivation {
|
||||||
public MagicEvent[] getCostEvent(final MagicSource source) {
|
public MagicEvent[] getCostEvent(final MagicSource source) {
|
||||||
return new MagicEvent[]{
|
return new MagicEvent[]{
|
||||||
new MagicPayManaCostEvent(source,source.getController(),cost),
|
new MagicPayManaCostEvent(source,source.getController(),cost),
|
||||||
new MagicPlayAbilityEvent((MagicPermanent)source)};
|
new MagicPlayAbilityEvent((MagicPermanent)source)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
|
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
|
||||||
return new MagicEvent(
|
return new MagicEvent(
|
||||||
source,
|
source,
|
||||||
source.getController(),
|
|
||||||
new Object[]{source},
|
|
||||||
this,
|
this,
|
||||||
source + " gains "+ability+" until end of turn.");
|
"SN gains "+ability+" until end of turn."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
||||||
game.doAction(new MagicSetAbilityAction((MagicPermanent)data[0],ability));
|
game.doAction(new MagicSetAbilityAction(event.getPermanent(),ability));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,11 +23,13 @@ public class MagicLevelUpActivation extends MagicPermanentActivation {
|
||||||
MagicCondition.SORCERY_CONDITION,
|
MagicCondition.SORCERY_CONDITION,
|
||||||
new MagicArtificialCondition(
|
new MagicArtificialCondition(
|
||||||
MagicCondition.NONE,
|
MagicCondition.NONE,
|
||||||
new MaximumCondition(maximum)),
|
new MaximumCondition(maximum)
|
||||||
|
),
|
||||||
cost.getCondition()
|
cost.getCondition()
|
||||||
},
|
},
|
||||||
ACTIVATION_HINTS,
|
ACTIVATION_HINTS,
|
||||||
"Level");
|
"Level"
|
||||||
|
);
|
||||||
this.cost=cost;
|
this.cost=cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,15 +42,14 @@ public class MagicLevelUpActivation extends MagicPermanentActivation {
|
||||||
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
|
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
|
||||||
return new MagicEvent(
|
return new MagicEvent(
|
||||||
source,
|
source,
|
||||||
source.getController(),
|
|
||||||
new Object[]{source},
|
|
||||||
this,
|
this,
|
||||||
"Put a level counter on "+source+'.');
|
"Put a level counter on SN."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
||||||
game.doAction(new MagicChangeCountersAction((MagicPermanent)data[0],MagicCounterType.Charge,1,true));
|
game.doAction(new MagicChangeCountersAction(event.getPermanent(),MagicCounterType.Charge,1,true));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class MaximumCondition implements MagicCondition {
|
private static final class MaximumCondition implements MagicCondition {
|
||||||
|
|
|
@ -9,20 +9,21 @@ import magic.model.action.MagicTapAction;
|
||||||
|
|
||||||
public class MagicPainTapEvent extends MagicEvent {
|
public class MagicPainTapEvent extends MagicEvent {
|
||||||
|
|
||||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
public MagicPainTapEvent(final MagicSource source) {
|
||||||
|
super(
|
||||||
|
source,
|
||||||
|
EVENT_ACTION,
|
||||||
|
"Tap SN. SN deals 1 damage to you."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
||||||
|
final MagicPermanent permanent=event.getPermanent();
|
||||||
final MagicPermanent permanent=(MagicPermanent)data[0];
|
|
||||||
final MagicDamage damage=new MagicDamage(permanent,permanent.getController(),1,false);
|
final MagicDamage damage=new MagicDamage(permanent,permanent.getController(),1,false);
|
||||||
game.doAction(new MagicTapAction(permanent,true));
|
game.doAction(new MagicTapAction(permanent,true));
|
||||||
game.doAction(new MagicDealDamageAction(damage));
|
game.doAction(new MagicDealDamageAction(damage));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public MagicPainTapEvent(final MagicSource source) {
|
|
||||||
|
|
||||||
super(source,source.getController(),new Object[]{source},EVENT_ACTION,"Tap "+source.getName()+". "+source.getName()+" deals 1 damage to you.");
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -7,18 +7,20 @@ import magic.model.action.MagicChangeLifeAction;
|
||||||
|
|
||||||
public class MagicPayLifeEvent extends MagicEvent {
|
public class MagicPayLifeEvent extends MagicEvent {
|
||||||
|
|
||||||
|
public MagicPayLifeEvent(final MagicSource source,final MagicPlayer player,final int amount) {
|
||||||
|
super(
|
||||||
|
source,
|
||||||
|
player,
|
||||||
|
new Object[]{-amount},
|
||||||
|
EVENT_ACTION,
|
||||||
|
"Pay "+amount+" life."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object data[],final Object[] choices) {
|
public void executeEvent(final MagicGame game,final MagicEvent event,final Object data[],final Object[] choices) {
|
||||||
|
game.doAction(new MagicChangeLifeAction(event.getPlayer(),(Integer)data[0]));
|
||||||
game.doAction(new MagicChangeLifeAction((MagicPlayer)data[0],(Integer)data[1]));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public MagicPayLifeEvent(final MagicSource source,final MagicPlayer player,final int amount) {
|
|
||||||
|
|
||||||
super(source,player,new Object[]{player,-amount},EVENT_ACTION,"Pay "+amount+" life.");
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -13,22 +13,6 @@ import magic.model.stack.MagicAbilityOnStack;
|
||||||
|
|
||||||
public abstract class MagicPermanentActivation extends MagicActivation implements MagicChangeCardDefinition {
|
public abstract class MagicPermanentActivation extends MagicActivation implements MagicChangeCardDefinition {
|
||||||
|
|
||||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
|
||||||
@Override
|
|
||||||
public final void executeEvent(
|
|
||||||
final MagicGame game,
|
|
||||||
final MagicEvent event,
|
|
||||||
final Object[] data,
|
|
||||||
final Object[] choiceResults) {
|
|
||||||
|
|
||||||
final MagicPermanentActivation permanentActivation = (MagicPermanentActivation)data[0];
|
|
||||||
final MagicPermanent permanent = (MagicPermanent)data[1];
|
|
||||||
final MagicAbilityOnStack abilityOnStack =
|
|
||||||
new MagicAbilityOnStack(permanentActivation,permanent,game.getPayedCost());
|
|
||||||
game.doAction(new MagicPutItemOnStackAction(abilityOnStack));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private static int currentIndex = 1;
|
private static int currentIndex = 1;
|
||||||
|
|
||||||
public MagicPermanentActivation(
|
public MagicPermanentActivation(
|
||||||
|
@ -47,13 +31,30 @@ public abstract class MagicPermanentActivation extends MagicActivation implement
|
||||||
public final MagicEvent getEvent(final MagicSource source) {
|
public final MagicEvent getEvent(final MagicSource source) {
|
||||||
return new MagicEvent(
|
return new MagicEvent(
|
||||||
source,
|
source,
|
||||||
source.getController(),
|
new Object[]{this},
|
||||||
new Object[]{this,source},
|
|
||||||
EVENT_ACTION,
|
EVENT_ACTION,
|
||||||
"Play activated ability of "+source.getName()+"."
|
"Play activated ability of SN."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||||
|
@Override
|
||||||
|
public final void executeEvent(
|
||||||
|
final MagicGame game,
|
||||||
|
final MagicEvent event,
|
||||||
|
final Object[] data,
|
||||||
|
final Object[] choiceResults) {
|
||||||
|
final MagicPermanentActivation permanentActivation = (MagicPermanentActivation)data[0];
|
||||||
|
final MagicPermanent permanent = event.getPermanent();
|
||||||
|
final MagicAbilityOnStack abilityOnStack = new MagicAbilityOnStack(
|
||||||
|
permanentActivation,
|
||||||
|
permanent,
|
||||||
|
game.getPayedCost()
|
||||||
|
);
|
||||||
|
game.doAction(new MagicPutItemOnStackAction(abilityOnStack));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final MagicTargetChoice getTargetChoice(final MagicSource source) {
|
public final MagicTargetChoice getTargetChoice(final MagicSource source) {
|
||||||
// Not the cleanest way to do this by far...
|
// Not the cleanest way to do this by far...
|
||||||
|
|
|
@ -32,12 +32,11 @@ public class MagicPingActivation extends MagicPermanentActivation {
|
||||||
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
|
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
|
||||||
return new MagicEvent(
|
return new MagicEvent(
|
||||||
source,
|
source,
|
||||||
source.getController(),
|
|
||||||
MagicTargetChoice.NEG_TARGET_CREATURE_OR_PLAYER,
|
MagicTargetChoice.NEG_TARGET_CREATURE_OR_PLAYER,
|
||||||
new MagicDamageTargetPicker(n),
|
new MagicDamageTargetPicker(n),
|
||||||
new Object[]{source},
|
|
||||||
this,
|
this,
|
||||||
source + " deals " + n + " damage to target creature or player$.");
|
"SN deals " + n + " damage to target creature or player$."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(
|
public void executeEvent(
|
||||||
|
@ -47,7 +46,7 @@ public class MagicPingActivation extends MagicPermanentActivation {
|
||||||
final Object[] choiceResults) {
|
final Object[] choiceResults) {
|
||||||
event.processTarget(game,choiceResults,0,new MagicTargetAction() {
|
event.processTarget(game,choiceResults,0,new MagicTargetAction() {
|
||||||
public void doAction(final MagicTarget target) {
|
public void doAction(final MagicTarget target) {
|
||||||
final MagicDamage damage=new MagicDamage((MagicSource)data[0],target,n,false);
|
final MagicDamage damage=new MagicDamage(event.getSource(),target,n,false);
|
||||||
game.doAction(new MagicDealDamageAction(damage));
|
game.doAction(new MagicDealDamageAction(damage));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,17 +11,6 @@ import magic.model.choice.MagicPayManaCostChoice;
|
||||||
|
|
||||||
public class MagicPlayOgreUnlessEvent extends MagicEvent {
|
public class MagicPlayOgreUnlessEvent 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])) {
|
|
||||||
MagicEvent.payManaCost(game,event.getPlayer(),choiceResults,1);
|
|
||||||
} else {
|
|
||||||
game.doAction(new MagicPlayTokenAction((MagicPlayer)data[0],TokenCardDefinitions.get("Ogre")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public MagicPlayOgreUnlessEvent(final MagicSource source,final MagicPlayer player,final MagicPlayer controller,final MagicManaCost cost) {
|
public MagicPlayOgreUnlessEvent(final MagicSource source,final MagicPlayer player,final MagicPlayer controller,final MagicManaCost cost) {
|
||||||
super(
|
super(
|
||||||
source,
|
source,
|
||||||
|
@ -35,4 +24,15 @@ public class MagicPlayOgreUnlessEvent extends MagicEvent {
|
||||||
"You may$ pay "+cost.getText()+"$."
|
"You may$ 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[]) {
|
||||||
|
if (MagicMayChoice.isYesChoice(choiceResults[0])) {
|
||||||
|
MagicEvent.payManaCost(game,event.getPlayer(),choiceResults,1);
|
||||||
|
} else {
|
||||||
|
game.doAction(new MagicPlayTokenAction((MagicPlayer)data[0],TokenCardDefinitions.get("Ogre")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,14 +31,13 @@ public class MagicPumpActivation extends MagicPermanentActivation {
|
||||||
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
|
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
|
||||||
return new MagicEvent(
|
return new MagicEvent(
|
||||||
source,
|
source,
|
||||||
source.getController(),
|
|
||||||
new Object[]{source},
|
|
||||||
this,
|
this,
|
||||||
source+" gets +"+power+"/+"+toughness+" until end of turn.");
|
"SN gets +"+power+"/+"+toughness+" until end of turn."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
||||||
game.doAction(new MagicChangeTurnPTAction((MagicPermanent)data[0],power,toughness));
|
game.doAction(new MagicChangeTurnPTAction(event.getPermanent(),power,toughness));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,8 @@ public class MagicRegenerationActivation extends MagicPermanentActivation {
|
||||||
new MagicSingleActivationCondition(),
|
new MagicSingleActivationCondition(),
|
||||||
},
|
},
|
||||||
ACTIVATION_HINTS,
|
ACTIVATION_HINTS,
|
||||||
"Regen");
|
"Regen"
|
||||||
|
);
|
||||||
this.cost=cost;
|
this.cost=cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,14 +36,13 @@ public class MagicRegenerationActivation extends MagicPermanentActivation {
|
||||||
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
|
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
|
||||||
return new MagicEvent(
|
return new MagicEvent(
|
||||||
source,
|
source,
|
||||||
source.getController(),
|
|
||||||
new Object[]{source},
|
|
||||||
this,
|
this,
|
||||||
"Regenerate "+source+".");
|
"Regenerate SN."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
||||||
game.doAction(new MagicRegenerateAction((MagicPermanent)data[0]));
|
game.doAction(new MagicRegenerateAction(event.getPermanent()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,24 +7,28 @@ import magic.model.action.MagicChangeCountersAction;
|
||||||
|
|
||||||
public class MagicRemoveCounterEvent extends MagicEvent {
|
public class MagicRemoveCounterEvent 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[] choices) {
|
|
||||||
final int amount=(Integer)data[2];
|
|
||||||
game.doAction(new MagicChangeCountersAction((MagicPermanent)data[0],(MagicCounterType)data[1],-amount,true));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public MagicRemoveCounterEvent(final MagicPermanent permanent,final MagicCounterType counterType,final int amount) {
|
public MagicRemoveCounterEvent(final MagicPermanent permanent,final MagicCounterType counterType,final int amount) {
|
||||||
super(
|
super(
|
||||||
permanent,
|
permanent,
|
||||||
permanent.getController(),
|
new Object[]{counterType,amount},
|
||||||
new Object[]{permanent,counterType,amount},
|
|
||||||
EVENT_ACTION,
|
EVENT_ACTION,
|
||||||
genDescription(permanent,counterType,amount));
|
genDescription(permanent,counterType,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) {
|
||||||
|
final int amount=(Integer)data[1];
|
||||||
|
game.doAction(new MagicChangeCountersAction(
|
||||||
|
event.getPermanent(),
|
||||||
|
(MagicCounterType)data[0],
|
||||||
|
-amount,
|
||||||
|
true
|
||||||
|
));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private static String genDescription(final MagicPermanent permanent,final MagicCounterType counterType,final int amount) {
|
private static String genDescription(final MagicPermanent permanent,final MagicCounterType counterType,final int amount) {
|
||||||
final StringBuilder description=new StringBuilder("Remove ");
|
final StringBuilder description=new StringBuilder("Remove ");
|
||||||
if (amount==1) {
|
if (amount==1) {
|
||||||
|
|
|
@ -6,14 +6,18 @@ import magic.model.action.MagicSacrificeAction;
|
||||||
|
|
||||||
public class MagicSacrificeEvent extends MagicEvent {
|
public class MagicSacrificeEvent extends MagicEvent {
|
||||||
|
|
||||||
|
public MagicSacrificeEvent(final MagicPermanent permanent) {
|
||||||
|
super(
|
||||||
|
permanent,
|
||||||
|
EVENT_ACTION,
|
||||||
|
"Sacrifice SN."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
||||||
game.doAction(new MagicSacrificeAction((MagicPermanent)data[0]));
|
game.doAction(new MagicSacrificeAction(event.getPermanent()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public MagicSacrificeEvent(final MagicPermanent permanent) {
|
|
||||||
super(permanent,permanent.getController(),new Object[]{permanent},EVENT_ACTION,"Sacrifice "+permanent.getName()+".");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,16 +5,6 @@ import magic.model.stack.MagicItemOnStack;
|
||||||
|
|
||||||
public class MagicStackChangeTargetsEvent extends MagicEvent {
|
public class MagicStackChangeTargetsEvent 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 MagicItemOnStack itemOnStack=(MagicItemOnStack)data[0];
|
|
||||||
itemOnStack.getChoiceResults()[0]=choiceResults[0];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public MagicStackChangeTargetsEvent(final MagicItemOnStack itemOnStack) {
|
public MagicStackChangeTargetsEvent(final MagicItemOnStack itemOnStack) {
|
||||||
super(
|
super(
|
||||||
itemOnStack.getSource(),
|
itemOnStack.getSource(),
|
||||||
|
@ -23,6 +13,15 @@ public class MagicStackChangeTargetsEvent extends MagicEvent {
|
||||||
itemOnStack.getEvent().getTargetPicker(),
|
itemOnStack.getEvent().getTargetPicker(),
|
||||||
new Object[]{itemOnStack},
|
new Object[]{itemOnStack},
|
||||||
EVENT_ACTION,
|
EVENT_ACTION,
|
||||||
"");
|
""
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 MagicItemOnStack itemOnStack=(MagicItemOnStack)data[0];
|
||||||
|
itemOnStack.getChoiceResults()[0]=choiceResults[0];
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,18 @@ import magic.model.trigger.MagicTriggerType;
|
||||||
import magic.model.trigger.MagicTrigger;
|
import magic.model.trigger.MagicTrigger;
|
||||||
|
|
||||||
public class MagicStackGetChoicesEvent extends MagicEvent {
|
public class MagicStackGetChoicesEvent extends MagicEvent {
|
||||||
|
public MagicStackGetChoicesEvent(final MagicItemOnStack itemOnStack) {
|
||||||
|
super(
|
||||||
|
itemOnStack.getEvent().getSource(),
|
||||||
|
itemOnStack.getController(),
|
||||||
|
itemOnStack.getEvent().getChoice(),
|
||||||
|
itemOnStack.getEvent().getTargetPicker(),
|
||||||
|
new Object[]{itemOnStack},
|
||||||
|
EVENT_ACTION,
|
||||||
|
""
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(
|
public void executeEvent(
|
||||||
|
@ -40,15 +52,4 @@ public class MagicStackGetChoicesEvent extends MagicEvent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public MagicStackGetChoicesEvent(final MagicItemOnStack itemOnStack) {
|
|
||||||
super(
|
|
||||||
itemOnStack.getEvent().getSource(),
|
|
||||||
itemOnStack.getController(),
|
|
||||||
itemOnStack.getEvent().getChoice(),
|
|
||||||
itemOnStack.getEvent().getTargetPicker(),
|
|
||||||
new Object[]{itemOnStack},
|
|
||||||
EVENT_ACTION,
|
|
||||||
"");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,15 +5,18 @@ import magic.model.MagicPermanent;
|
||||||
import magic.model.action.MagicTapAction;
|
import magic.model.action.MagicTapAction;
|
||||||
|
|
||||||
public class MagicTapEvent extends MagicEvent {
|
public class MagicTapEvent extends MagicEvent {
|
||||||
|
public MagicTapEvent(final MagicPermanent permanent) {
|
||||||
|
super(
|
||||||
|
permanent,
|
||||||
|
EVENT_ACTION,
|
||||||
|
"Tap SN."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
||||||
game.doAction(new MagicTapAction((MagicPermanent)data[0],true));
|
game.doAction(new MagicTapAction(event.getPermanent(),true));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public MagicTapEvent(final MagicPermanent permanent) {
|
|
||||||
super(permanent,permanent.getController(),new Object[]{permanent},EVENT_ACTION,"Tap "+permanent.getName()+".");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,18 +5,18 @@ import magic.model.MagicPermanent;
|
||||||
import magic.model.action.MagicUntapAction;
|
import magic.model.action.MagicUntapAction;
|
||||||
|
|
||||||
public class MagicUntapEvent extends MagicEvent {
|
public class MagicUntapEvent extends MagicEvent {
|
||||||
|
public MagicUntapEvent(final MagicPermanent permanent) {
|
||||||
|
super(
|
||||||
|
permanent,
|
||||||
|
EVENT_ACTION,
|
||||||
|
"Untap SN."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
||||||
|
game.doAction(new MagicUntapAction(event.getPermanent()));
|
||||||
game.doAction(new MagicUntapAction((MagicPermanent)data[0]));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public MagicUntapEvent(final MagicPermanent permanent) {
|
|
||||||
|
|
||||||
super(permanent,permanent.getController(),new Object[]{permanent},EVENT_ACTION,"Untap "+permanent.getName()+".");
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -24,11 +24,10 @@ public class MagicAnnihilatorTrigger extends MagicWhenAttacksTrigger {
|
||||||
return (permanent == creature) ?
|
return (permanent == creature) ?
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
permanent.getController(),
|
opponent,
|
||||||
new Object[]{permanent,opponent},
|
|
||||||
this,
|
this,
|
||||||
opponent + " sacrifices " + amount +
|
"PN sacrifices " + amount + (amount == 1 ? " permanent." : " permanents.")
|
||||||
(amount == 1 ? " permanent." : " permanents.")):
|
):
|
||||||
MagicEvent.NONE;
|
MagicEvent.NONE;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,14 +36,14 @@ public class MagicAnnihilatorTrigger extends MagicWhenAttacksTrigger {
|
||||||
final MagicEvent event,
|
final MagicEvent event,
|
||||||
final Object data[],
|
final Object data[],
|
||||||
final Object[] choiceResults) {
|
final Object[] choiceResults) {
|
||||||
final MagicPermanent permanent = (MagicPermanent)data[0];
|
final MagicPlayer player = event.getPlayer();
|
||||||
final MagicPlayer player = (MagicPlayer)data[1];
|
|
||||||
int count = amount;
|
int count = amount;
|
||||||
while (count > 0 && player.getPermanents().size() > 0) {
|
while (count > 0 && player.getPermanents().size() > 0) {
|
||||||
game.addEvent(new MagicSacrificePermanentEvent(
|
game.addEvent(new MagicSacrificePermanentEvent(
|
||||||
permanent,
|
event.getSource(),
|
||||||
player,
|
player,
|
||||||
MagicTargetChoice.SACRIFICE_PERMANENT));
|
MagicTargetChoice.SACRIFICE_PERMANENT
|
||||||
|
));
|
||||||
count--;
|
count--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,11 +23,11 @@ public class MagicAttacksPumpTrigger extends MagicWhenAttacksTrigger {
|
||||||
return (permanent == creature) ?
|
return (permanent == creature) ?
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
permanent.getController(),
|
|
||||||
new Object[]{permanent},
|
|
||||||
this,
|
this,
|
||||||
permanent + " gets " + getString(power) +
|
"SN gets " +
|
||||||
"/" + getString(toughness) + " until end of turn.") :
|
getString(power) + "/" + getString(toughness) +
|
||||||
|
" until end of turn."
|
||||||
|
) :
|
||||||
MagicEvent.NONE;
|
MagicEvent.NONE;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,14 +37,13 @@ public class MagicAttacksPumpTrigger extends MagicWhenAttacksTrigger {
|
||||||
final Object data[],
|
final Object data[],
|
||||||
final Object[] choiceResults) {
|
final Object[] choiceResults) {
|
||||||
game.doAction(new MagicChangeTurnPTAction(
|
game.doAction(new MagicChangeTurnPTAction(
|
||||||
(MagicPermanent)data[0],
|
event.getPermanent(),
|
||||||
power,
|
power,
|
||||||
toughness));
|
toughness
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getString(final int pt) {
|
private String getString(final int pt) {
|
||||||
return pt >= 0 ?
|
return pt >= 0 ? "+" + pt : Integer.toString(pt);
|
||||||
"+" + pt :
|
|
||||||
Integer.toString(pt);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,14 +27,12 @@ public class MagicBattleCryTrigger extends MagicWhenAttacksTrigger {
|
||||||
final MagicGame game,
|
final MagicGame game,
|
||||||
final MagicPermanent permanent,
|
final MagicPermanent permanent,
|
||||||
final MagicPermanent data) {
|
final MagicPermanent data) {
|
||||||
final MagicPlayer player = permanent.getController();
|
|
||||||
return (permanent == data) ?
|
return (permanent == data) ?
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
player,
|
|
||||||
new Object[]{permanent,player},
|
|
||||||
this,
|
this,
|
||||||
"Each other attacking creature gets +1/+0 until end of turn."):
|
"Each other attacking creature gets +1/+0 until end of turn."
|
||||||
|
):
|
||||||
MagicEvent.NONE;
|
MagicEvent.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,9 +42,9 @@ public class MagicBattleCryTrigger extends MagicWhenAttacksTrigger {
|
||||||
final MagicEvent event,
|
final MagicEvent event,
|
||||||
final Object[] data,
|
final Object[] data,
|
||||||
final Object[] choiceResults) {
|
final Object[] choiceResults) {
|
||||||
final MagicPermanent permanent = (MagicPermanent)data[0];
|
final MagicPermanent permanent = event.getPermanent();
|
||||||
final Collection<MagicTarget> targets = game.filterTargets(
|
final Collection<MagicTarget> targets = game.filterTargets(
|
||||||
(MagicPlayer)data[1],
|
event.getPlayer(),
|
||||||
MagicTargetFilter.TARGET_ATTACKING_CREATURE);
|
MagicTargetFilter.TARGET_ATTACKING_CREATURE);
|
||||||
for (final MagicTarget target : targets) {
|
for (final MagicTarget target : targets) {
|
||||||
final MagicPermanent creature = (MagicPermanent)target;
|
final MagicPermanent creature = (MagicPermanent)target;
|
||||||
|
|
|
@ -33,11 +33,11 @@ public class MagicBecomesBlockedPumpTrigger extends MagicWhenBecomesBlockedTrigg
|
||||||
final int totalAmountToughness = amountToughness * size;
|
final int totalAmountToughness = amountToughness * size;
|
||||||
return new MagicEvent(
|
return new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
permanent.getController(),
|
|
||||||
new Object[]{permanent},
|
|
||||||
this,
|
this,
|
||||||
permanent + " gets " + getString(totalAmountPower) +
|
"SN gets " +
|
||||||
"/" + getString(totalAmountToughness) + " until end of turn.");
|
getString(totalAmountPower) + "/" + getString(totalAmountToughness) +
|
||||||
|
" until end of turn."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return MagicEvent.NONE;
|
return MagicEvent.NONE;
|
||||||
}
|
}
|
||||||
|
@ -48,9 +48,10 @@ public class MagicBecomesBlockedPumpTrigger extends MagicWhenBecomesBlockedTrigg
|
||||||
final Object data[],
|
final Object data[],
|
||||||
final Object[] choiceResults) {
|
final Object[] choiceResults) {
|
||||||
game.doAction(new MagicChangeTurnPTAction(
|
game.doAction(new MagicChangeTurnPTAction(
|
||||||
(MagicPermanent)data[0],
|
event.getPermanent(),
|
||||||
amountPower,
|
amountPower,
|
||||||
amountToughness));
|
amountToughness
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getString(final int pt) {
|
private String getString(final int pt) {
|
||||||
|
|
|
@ -21,19 +21,14 @@ public class MagicBloodthirstTrigger extends MagicWhenComesIntoPlayTrigger {
|
||||||
final MagicGame game,
|
final MagicGame game,
|
||||||
final MagicPermanent permanent,
|
final MagicPermanent permanent,
|
||||||
final MagicPlayer player) {
|
final MagicPlayer player) {
|
||||||
final MagicPlayer opponent = player.getOpponent();
|
return (player.getOpponent().hasState(MagicPlayerState.WasDealtDamage)) ?
|
||||||
return (opponent.hasState(MagicPlayerState.WasDealtDamage)) ?
|
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
player,
|
|
||||||
new Object[]{permanent},
|
|
||||||
this,
|
this,
|
||||||
amount > 1 ?
|
amount > 1 ?
|
||||||
permanent + " enters the battlefield with " +
|
"SN enters the battlefield with " + amount + " +1/+1 counters on it." :
|
||||||
amount + " +1/+1 counters on it."
|
"SN enters the battlefield with a +1/+1 counter on it."
|
||||||
:
|
):
|
||||||
permanent + " enters the battlefield with " +
|
|
||||||
"a +1/+1 counter on it."):
|
|
||||||
MagicEvent.NONE;
|
MagicEvent.NONE;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
@ -43,10 +38,11 @@ public class MagicBloodthirstTrigger extends MagicWhenComesIntoPlayTrigger {
|
||||||
final Object data[],
|
final Object data[],
|
||||||
final Object[] choiceResults) {
|
final Object[] choiceResults) {
|
||||||
game.doAction(new MagicChangeCountersAction(
|
game.doAction(new MagicChangeCountersAction(
|
||||||
(MagicPermanent)data[0],
|
event.getPermanent(),
|
||||||
MagicCounterType.PlusOne,
|
MagicCounterType.PlusOne,
|
||||||
amount,
|
amount,
|
||||||
false));
|
false
|
||||||
|
));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean usesStack() {
|
public boolean usesStack() {
|
||||||
|
|
|
@ -29,15 +29,11 @@ public class MagicComesIntoPlayWithCounterTrigger extends MagicWhenComesIntoPlay
|
||||||
final MagicPlayer player) {
|
final MagicPlayer player) {
|
||||||
return new MagicEvent(
|
return new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
player,
|
|
||||||
new Object[]{permanent},
|
|
||||||
this,
|
this,
|
||||||
amount > 1 ?
|
amount > 1 ?
|
||||||
permanent + " enters the battlefield with " + amount +
|
"SN enters the battlefield with " + amount + " " + description + " counters on it." :
|
||||||
" " + description + " counters on it."
|
"SN enters the battlefield with a " + description + " counter on it."
|
||||||
:
|
);
|
||||||
permanent + " enters the battlefield with a " +
|
|
||||||
description + " counter on it.");
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(
|
public void executeEvent(
|
||||||
|
@ -46,10 +42,11 @@ public class MagicComesIntoPlayWithCounterTrigger extends MagicWhenComesIntoPlay
|
||||||
final Object data[],
|
final Object data[],
|
||||||
final Object[] choiceResults) {
|
final Object[] choiceResults) {
|
||||||
game.doAction(new MagicChangeCountersAction(
|
game.doAction(new MagicChangeCountersAction(
|
||||||
(MagicPermanent)data[0],
|
event.getPermanent(),
|
||||||
counterType,
|
counterType,
|
||||||
amount,
|
amount,
|
||||||
false));
|
false
|
||||||
|
));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean usesStack() {
|
public boolean usesStack() {
|
||||||
|
|
|
@ -29,10 +29,9 @@ public class MagicDamageGrowTrigger extends MagicWhenDamageIsDealtTrigger {
|
||||||
(!combat || damage.isCombat())) ?
|
(!combat || damage.isCombat())) ?
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
permanent.getController(),
|
|
||||||
new Object[]{permanent},
|
|
||||||
this,
|
this,
|
||||||
"Put a +1/+1 counter on " + permanent + "."):
|
"Put a +1/+1 counter on SN."
|
||||||
|
):
|
||||||
MagicEvent.NONE;
|
MagicEvent.NONE;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,9 +41,10 @@ public class MagicDamageGrowTrigger extends MagicWhenDamageIsDealtTrigger {
|
||||||
final Object data[],
|
final Object data[],
|
||||||
final Object[] choiceResults) {
|
final Object[] choiceResults) {
|
||||||
game.doAction(new MagicChangeCountersAction(
|
game.doAction(new MagicChangeCountersAction(
|
||||||
(MagicPermanent)data[0],
|
event.getPermanent(),
|
||||||
MagicCounterType.PlusOne,
|
MagicCounterType.PlusOne,
|
||||||
1,
|
1,
|
||||||
true));
|
true
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,29 +28,27 @@ public class MagicDevourTrigger extends MagicWhenComesIntoPlayTrigger {
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(
|
public MagicEvent executeTrigger(
|
||||||
final MagicGame game,
|
final MagicGame game,
|
||||||
final MagicPermanent permanent,
|
final MagicPermanent perm,
|
||||||
final MagicPlayer player) {
|
final MagicPlayer player) {
|
||||||
final String name = getCardDefinition().getFullName();
|
|
||||||
final MagicTargetFilter targetFilter = new MagicTargetFilter.MagicOtherPermanentTargetFilter(
|
final MagicTargetFilter targetFilter = new MagicTargetFilter.MagicOtherPermanentTargetFilter(
|
||||||
MagicTargetFilter.TARGET_CREATURE_YOU_CONTROL,
|
MagicTargetFilter.TARGET_CREATURE_YOU_CONTROL,
|
||||||
permanent);
|
perm);
|
||||||
final MagicTargetChoice targetChoice = new MagicTargetChoice(
|
final MagicTargetChoice targetChoice = new MagicTargetChoice(
|
||||||
targetFilter,
|
targetFilter,
|
||||||
false,
|
false,
|
||||||
MagicTargetHint.None,
|
MagicTargetHint.None,
|
||||||
"a creature other than " + name + " to sacrifice");
|
"a creature other than " + perm + " to sacrifice");
|
||||||
final MagicChoice devourChoice = new MagicMayChoice(
|
final MagicChoice devourChoice = new MagicMayChoice(
|
||||||
"You may sacrifice a creature to " + name + ".",
|
"You may sacrifice a creature to " + perm + ".",
|
||||||
targetChoice);
|
targetChoice);
|
||||||
return (player.getNrOfPermanentsWithType(MagicType.Creature) > 1) ?
|
return (player.getNrOfPermanentsWithType(MagicType.Creature) > 1) ?
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
permanent,
|
perm,
|
||||||
player,
|
|
||||||
devourChoice,
|
devourChoice,
|
||||||
MagicSacrificeTargetPicker.create(),
|
MagicSacrificeTargetPicker.create(),
|
||||||
new Object[] {permanent},
|
|
||||||
this,
|
this,
|
||||||
"You may$ sacrifice a creature$ to " + name + ".") :
|
"You may$ sacrifice a creature$ to SN."
|
||||||
|
) :
|
||||||
MagicEvent.NONE;
|
MagicEvent.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +66,7 @@ public class MagicDevourTrigger extends MagicWhenComesIntoPlayTrigger {
|
||||||
if (MagicMayChoice.isYesChoice(choiceResults[0])) {
|
if (MagicMayChoice.isYesChoice(choiceResults[0])) {
|
||||||
event.processTargetPermanent(game,choiceResults,1,new MagicPermanentAction() {
|
event.processTargetPermanent(game,choiceResults,1,new MagicPermanentAction() {
|
||||||
public void doAction(final MagicPermanent creature) {
|
public void doAction(final MagicPermanent creature) {
|
||||||
final MagicPermanent permanent = (MagicPermanent)data[0];
|
final MagicPermanent permanent = event.getPermanent();
|
||||||
game.doAction(new MagicSacrificeAction(creature));
|
game.doAction(new MagicSacrificeAction(creature));
|
||||||
game.doAction(new MagicChangeCountersAction(
|
game.doAction(new MagicChangeCountersAction(
|
||||||
permanent,
|
permanent,
|
||||||
|
|
|
@ -24,10 +24,8 @@ public class MagicEntersDrawCardTrigger extends MagicWhenComesIntoPlayTrigger {
|
||||||
final MagicPlayer player) {
|
final MagicPlayer player) {
|
||||||
return new MagicEvent(
|
return new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
player,
|
|
||||||
new Object[]{player},
|
|
||||||
this,
|
this,
|
||||||
player + " draws a card.");
|
"PN draws a card.");
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(
|
public void executeEvent(
|
||||||
|
@ -35,7 +33,7 @@ public class MagicEntersDrawCardTrigger extends MagicWhenComesIntoPlayTrigger {
|
||||||
final MagicEvent event,
|
final MagicEvent event,
|
||||||
final Object data[],
|
final Object data[],
|
||||||
final Object[] choiceResults) {
|
final Object[] choiceResults) {
|
||||||
game.doAction(new MagicDrawAction((MagicPlayer)data[0],1));
|
game.doAction(new MagicDrawAction(event.getPlayer(),1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,13 +67,11 @@ public class MagicEntersExileCreatureOrSacrificeTrigger extends MagicWhenComesIn
|
||||||
targetChoice);
|
targetChoice);
|
||||||
return new MagicEvent(
|
return new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
player,
|
|
||||||
championChoice,
|
championChoice,
|
||||||
MagicExileTargetPicker.create(),
|
MagicExileTargetPicker.create(),
|
||||||
new Object[]{permanent},
|
|
||||||
this,
|
this,
|
||||||
"You may$ exile another " + targets + " you control$. " +
|
"You may$ exile another " + targets + " you control$. " +
|
||||||
"If you don't, sacrifice " + permanent + ".");
|
"If you don't, sacrifice SN.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -82,7 +80,7 @@ public class MagicEntersExileCreatureOrSacrificeTrigger extends MagicWhenComesIn
|
||||||
final MagicEvent event,
|
final MagicEvent event,
|
||||||
final Object data[],
|
final Object data[],
|
||||||
final Object[] choiceResults) {
|
final Object[] choiceResults) {
|
||||||
final MagicPermanent permanent = (MagicPermanent)data[0];
|
final MagicPermanent permanent = event.getPermanent();
|
||||||
if (MagicMayChoice.isYesChoice(choiceResults[0])) {
|
if (MagicMayChoice.isYesChoice(choiceResults[0])) {
|
||||||
event.processTargetPermanent(game,choiceResults,1,new MagicPermanentAction() {
|
event.processTargetPermanent(game,choiceResults,1,new MagicPermanentAction() {
|
||||||
public void doAction(final MagicPermanent creature) {
|
public void doAction(final MagicPermanent creature) {
|
||||||
|
|
|
@ -18,14 +18,14 @@ public class MagicExaltedTrigger extends MagicWhenAttacksTrigger {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent creature) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent creature) {
|
||||||
final MagicPlayer player=permanent.getController();
|
return (permanent.isFriend(creature) &&
|
||||||
return (creature.getController()==player&&player.getNrOfAttackers()==1) ?
|
permanent.getController().getNrOfAttackers()==1) ?
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
player,
|
|
||||||
new Object[]{creature},
|
new Object[]{creature},
|
||||||
this,
|
this,
|
||||||
creature.getName() + " gets +1/+1 until end of turn."):
|
creature + " gets +1/+1 until end of turn."
|
||||||
|
):
|
||||||
MagicEvent.NONE;
|
MagicEvent.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,8 @@ public class MagicFadeVanishCounterTrigger extends MagicAtUpkeepTrigger {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicPlayer data) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicPlayer upkeepPlayer) {
|
||||||
final MagicPlayer player = permanent.getController();
|
if (permanent.isController(upkeepPlayer)) {
|
||||||
if (player == data) {
|
|
||||||
boolean sacrifice = false;
|
boolean sacrifice = false;
|
||||||
final int amount = permanent.getCounters(MagicCounterType.Charge);
|
final int amount = permanent.getCounters(MagicCounterType.Charge);
|
||||||
if (counterType == "fade") {
|
if (counterType == "fade") {
|
||||||
|
@ -30,12 +29,12 @@ public class MagicFadeVanishCounterTrigger extends MagicAtUpkeepTrigger {
|
||||||
}
|
}
|
||||||
return new MagicEvent(
|
return new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
player,
|
new Object[]{sacrifice},
|
||||||
new Object[]{permanent,sacrifice},
|
|
||||||
this,
|
this,
|
||||||
sacrifice ?
|
sacrifice ?
|
||||||
player + " sacrifices " + permanent + "." :
|
"PN sacrifices SN." :
|
||||||
player + " removes a " + counterType + " counter from " + permanent + ".");
|
"PN removes a " + counterType + " counter from SN."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return MagicEvent.NONE;
|
return MagicEvent.NONE;
|
||||||
}
|
}
|
||||||
|
@ -45,15 +44,16 @@ public class MagicFadeVanishCounterTrigger extends MagicAtUpkeepTrigger {
|
||||||
final MagicEvent event,
|
final MagicEvent event,
|
||||||
final Object data[],
|
final Object data[],
|
||||||
final Object[] choiceResults) {
|
final Object[] choiceResults) {
|
||||||
final boolean sacrifice = (Boolean)data[1];
|
final boolean sacrifice = (Boolean)data[0];
|
||||||
if (sacrifice) {
|
if (sacrifice) {
|
||||||
game.doAction(new MagicSacrificeAction((MagicPermanent)data[0]));
|
game.doAction(new MagicSacrificeAction(event.getPermanent()));
|
||||||
} else {
|
} else {
|
||||||
game.doAction(new MagicChangeCountersAction(
|
game.doAction(new MagicChangeCountersAction(
|
||||||
(MagicPermanent)data[0],
|
event.getPermanent(),
|
||||||
MagicCounterType.Charge,
|
MagicCounterType.Charge,
|
||||||
-1,
|
-1,
|
||||||
true));
|
true
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,12 +29,12 @@ public class MagicFlankingTrigger extends MagicWhenBecomesBlockedTrigger {
|
||||||
if (!plist.isEmpty()) {
|
if (!plist.isEmpty()) {
|
||||||
return new MagicEvent(
|
return new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
permanent.getController(),
|
|
||||||
new Object[]{plist},
|
new Object[]{plist},
|
||||||
this,
|
this,
|
||||||
plist.size() > 1 ?
|
plist.size() > 1 ?
|
||||||
"Blocking creatures get -1/-1 until end of turn." :
|
"Blocking creatures get -1/-1 until end of turn." :
|
||||||
plist.get(0) + " gets -1/-1 until end of turn.");
|
plist.get(0) + " gets -1/-1 until end of turn."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return MagicEvent.NONE;
|
return MagicEvent.NONE;
|
||||||
|
@ -51,4 +51,3 @@ public class MagicFlankingTrigger extends MagicWhenBecomesBlockedTrigger {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,16 +24,15 @@ public class MagicFromGraveyardToLibraryTrigger extends MagicWhenPutIntoGraveyar
|
||||||
return (!card.isToken()) ?
|
return (!card.isToken()) ?
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
card,
|
card,
|
||||||
triggerData.card.getController(),
|
|
||||||
new Object[]{card},
|
|
||||||
this,
|
this,
|
||||||
"Shuffle "+card.getName()+" into its owners library."):
|
"Shuffle SN into its owners library."
|
||||||
|
):
|
||||||
MagicEvent.NONE;
|
MagicEvent.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choiceResults) {
|
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choiceResults) {
|
||||||
final MagicCard card=(MagicCard)data[0];
|
final MagicCard card = event.getCard();
|
||||||
if (card.getOwner().getGraveyard().contains(card)) {
|
if (card.getOwner().getGraveyard().contains(card)) {
|
||||||
game.doAction(new MagicRemoveCardAction(card,MagicLocationType.Graveyard));
|
game.doAction(new MagicRemoveCardAction(card,MagicLocationType.Graveyard));
|
||||||
game.doAction(new MagicMoveCardAction(card,MagicLocationType.Graveyard,MagicLocationType.OwnersLibrary));
|
game.doAction(new MagicMoveCardAction(card,MagicLocationType.Graveyard,MagicLocationType.OwnersLibrary));
|
||||||
|
|
|
@ -17,16 +17,14 @@ public class MagicLeavesGainLifeTrigger extends MagicWhenLeavesPlayTrigger {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicPermanent data) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicPermanent data) {
|
||||||
final MagicPlayer player = permanent.getController();
|
|
||||||
return (permanent == data) ?
|
return (permanent == data) ?
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
player,
|
|
||||||
new Object[]{player},
|
|
||||||
this,
|
this,
|
||||||
player +
|
"PN " +
|
||||||
(life > 0 ? " gains " + life : " loses " + -life) +
|
(life > 0 ? " gains " + life : " loses " + -life) +
|
||||||
" life."):
|
" life."
|
||||||
|
):
|
||||||
MagicEvent.NONE;
|
MagicEvent.NONE;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,6 +33,6 @@ public class MagicLeavesGainLifeTrigger extends MagicWhenLeavesPlayTrigger {
|
||||||
final MagicEvent event,
|
final MagicEvent event,
|
||||||
final Object data[],
|
final Object data[],
|
||||||
final Object[] choiceResults) {
|
final Object[] choiceResults) {
|
||||||
game.doAction(new MagicChangeLifeAction((MagicPlayer)data[0],life));
|
game.doAction(new MagicChangeLifeAction(event.getPlayer(),life));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,16 +19,16 @@ public class MagicLeavesReturnExileTrigger extends MagicWhenLeavesPlayTrigger {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicPermanent data) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicPermanent left) {
|
||||||
if (permanent == data &&
|
if (permanent == left &&
|
||||||
!permanent.getExiledCards().isEmpty()) {
|
!permanent.getExiledCards().isEmpty()) {
|
||||||
final MagicCard exiledCard = permanent.getExiledCards().get(0);
|
final MagicCard exiledCard = permanent.getExiledCards().get(0);
|
||||||
return new MagicEvent(
|
return new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
permanent.getController(),
|
new Object[]{exiledCard},
|
||||||
new Object[]{exiledCard,permanent.getController()},
|
|
||||||
this,
|
this,
|
||||||
"Return " + exiledCard + " to the battlefield");
|
"Return " + exiledCard + " to the battlefield"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return MagicEvent.NONE;
|
return MagicEvent.NONE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,9 @@ public class MagicLivingWeaponTrigger extends MagicWhenComesIntoPlayTrigger {
|
||||||
return new MagicEvent(
|
return new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
player,
|
player,
|
||||||
new Object[]{permanent,player},
|
|
||||||
this,
|
this,
|
||||||
player + " puts a 0/0 black Germ creature token onto the battlefield, then attaches this to it.");
|
"PN puts a 0/0 black Germ creature token onto the battlefield, then attaches SN to it."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,14 +40,16 @@ public class MagicLivingWeaponTrigger extends MagicWhenComesIntoPlayTrigger {
|
||||||
|
|
||||||
//create the token
|
//create the token
|
||||||
final MagicPlayTokenAction play_token=new MagicPlayTokenAction(
|
final MagicPlayTokenAction play_token=new MagicPlayTokenAction(
|
||||||
(MagicPlayer)data[1],
|
event.getPlayer(),
|
||||||
TokenCardDefinitions.get("Germ"));
|
TokenCardDefinitions.get("Germ")
|
||||||
|
);
|
||||||
game.doAction(play_token);
|
game.doAction(play_token);
|
||||||
|
|
||||||
//attach the equipment to the token
|
//attach the equipment to the token
|
||||||
final MagicAttachEquipmentAction attach_equip = new MagicAttachEquipmentAction(
|
final MagicAttachEquipmentAction attach_equip = new MagicAttachEquipmentAction(
|
||||||
(MagicPermanent)data[0],
|
event.getPermanent(),
|
||||||
play_token.getPermanent());
|
play_token.getPermanent()
|
||||||
|
);
|
||||||
game.doAction(attach_equip);
|
game.doAction(attach_equip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import magic.model.MagicCounterType;
|
||||||
import magic.model.MagicGame;
|
import magic.model.MagicGame;
|
||||||
import magic.model.MagicLocationType;
|
import magic.model.MagicLocationType;
|
||||||
import magic.model.MagicPermanent;
|
import magic.model.MagicPermanent;
|
||||||
import magic.model.MagicPlayer;
|
|
||||||
import magic.model.action.MagicChangeCountersAction;
|
import magic.model.action.MagicChangeCountersAction;
|
||||||
import magic.model.action.MagicPermanentAction;
|
import magic.model.action.MagicPermanentAction;
|
||||||
import magic.model.choice.MagicMayChoice;
|
import magic.model.choice.MagicMayChoice;
|
||||||
|
@ -26,22 +25,22 @@ public class MagicModularTrigger extends MagicWhenPutIntoGraveyardTrigger {
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicGraveyardTriggerData triggerData) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicGraveyardTriggerData triggerData) {
|
||||||
if (MagicLocationType.Play == triggerData.fromLocation) {
|
if (MagicLocationType.Play == triggerData.fromLocation) {
|
||||||
final MagicPlayer player = permanent.getController();
|
|
||||||
final int amount = permanent.getCounters(MagicCounterType.PlusOne);
|
final int amount = permanent.getCounters(MagicCounterType.PlusOne);
|
||||||
return new MagicEvent(
|
return new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
player,
|
|
||||||
new MagicMayChoice(
|
new MagicMayChoice(
|
||||||
amount > 1 ?
|
amount > 1 ?
|
||||||
player + " may put " + amount + " +1/+1 counters on target artifact creature." :
|
"You may put " + amount + " +1/+1 counters on target artifact creature." :
|
||||||
player + " may put a +1/+1 counter on target artifact creature.",
|
"You may put a +1/+1 counter on target artifact creature.",
|
||||||
MagicTargetChoice.POS_TARGET_ARTIFACT_CREATURE),
|
MagicTargetChoice.POS_TARGET_ARTIFACT_CREATURE
|
||||||
|
),
|
||||||
MagicPumpTargetPicker.create(),
|
MagicPumpTargetPicker.create(),
|
||||||
new Object[]{amount},
|
new Object[]{amount},
|
||||||
this,
|
this,
|
||||||
amount > 1 ?
|
amount > 1 ?
|
||||||
player + " may$ put " + amount + " +1/+1 counters on target artifact creature$." :
|
"PN may$ put " + amount + " +1/+1 counters on target artifact creature$." :
|
||||||
player + " may$ put a +1/+1 counter on target artifact creature$.");
|
"PN may$ put a +1/+1 counter on target artifact creature$."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return MagicEvent.NONE;
|
return MagicEvent.NONE;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +58,8 @@ public class MagicModularTrigger extends MagicWhenPutIntoGraveyardTrigger {
|
||||||
creature,
|
creature,
|
||||||
MagicCounterType.PlusOne,
|
MagicCounterType.PlusOne,
|
||||||
(Integer)data[0],
|
(Integer)data[0],
|
||||||
true));
|
true
|
||||||
|
));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,18 +17,19 @@ public class MagicPersistTrigger extends MagicWhenPutIntoGraveyardTrigger {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicGraveyardTriggerData triggerData) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicGraveyardTriggerData triggerData) {
|
||||||
if (triggerData.fromLocation==MagicLocationType.Play&&permanent.getCounters(MagicCounterType.MinusOne)==0) {
|
return (triggerData.fromLocation==MagicLocationType.Play &&
|
||||||
final MagicCard card=triggerData.card;
|
permanent.getCounters(MagicCounterType.MinusOne)==0) ?
|
||||||
return new MagicEvent(permanent,permanent.getController(),new Object[]{card},this,
|
new MagicEvent(
|
||||||
"Return "+card.getName()+" to play under its owner's control with a -1/-1 counter on it.");
|
permanent,
|
||||||
}
|
this,
|
||||||
return MagicEvent.NONE;
|
"Return SN to play under its owner's control with a -1/-1 counter on it."
|
||||||
|
):
|
||||||
|
MagicEvent.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choiceResults) {
|
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choiceResults) {
|
||||||
|
final MagicCard card = event.getPermanent().getCard();
|
||||||
final MagicCard card=(MagicCard)data[0];
|
|
||||||
game.doAction(new MagicReanimateAction(card.getOwner(),card,MagicPlayCardAction.PERSIST));
|
game.doAction(new MagicReanimateAction(card.getOwner(),card,MagicPlayCardAction.PERSIST));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,16 +17,15 @@ public class MagicRampageTrigger extends MagicWhenBecomesBlockedTrigger {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent creature) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent creature) {
|
||||||
final MagicPlayer player = permanent.getController();
|
|
||||||
final MagicPermanentList plist = permanent.getBlockingCreatures();
|
final MagicPermanentList plist = permanent.getBlockingCreatures();
|
||||||
final int amount = n * (plist.size() - 1);
|
final int amount = n * (plist.size() - 1);
|
||||||
return (creature == permanent && amount > 0) ?
|
return (creature == permanent && amount > 0) ?
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
player,
|
new Object[]{amount},
|
||||||
new Object[]{permanent,amount},
|
|
||||||
this,
|
this,
|
||||||
permanent + " gets +" + amount + "/+" + amount + " until end of turn."):
|
"SN gets +" + amount + "/+" + amount + " until end of turn."
|
||||||
|
):
|
||||||
MagicEvent.NONE;
|
MagicEvent.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,9 +35,11 @@ public class MagicRampageTrigger extends MagicWhenBecomesBlockedTrigger {
|
||||||
final MagicEvent event,
|
final MagicEvent event,
|
||||||
final Object data[],
|
final Object data[],
|
||||||
final Object[] choiceResults) {
|
final Object[] choiceResults) {
|
||||||
|
final int amount = (Integer)data[0];
|
||||||
game.doAction(new MagicChangeTurnPTAction(
|
game.doAction(new MagicChangeTurnPTAction(
|
||||||
(MagicPermanent)data[0],
|
event.getPermanent(),
|
||||||
(Integer)data[1],
|
amount,
|
||||||
(Integer)data[1]));
|
amount
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ public class MagicSpecterTrigger extends MagicWhenDamageIsDealtTrigger {
|
||||||
@Override
|
@Override
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicDamage damage) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicDamage damage) {
|
||||||
final MagicTarget target = damage.getTarget();
|
final MagicTarget target = damage.getTarget();
|
||||||
final String prefix = target + " discards a card";
|
|
||||||
return (damage.getSource() == permanent &&
|
return (damage.getSource() == permanent &&
|
||||||
target.isPlayer() &&
|
target.isPlayer() &&
|
||||||
((MagicPlayer)target).getHandSize() > 0 &&
|
((MagicPlayer)target).getHandSize() > 0 &&
|
||||||
|
@ -31,19 +30,20 @@ public class MagicSpecterTrigger extends MagicWhenDamageIsDealtTrigger {
|
||||||
(!combat || damage.isCombat())) ?
|
(!combat || damage.isCombat())) ?
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
permanent.getController(),
|
(MagicPlayer)target,
|
||||||
new Object[]{permanent,target},
|
|
||||||
this,
|
this,
|
||||||
random ? prefix + " at random." : prefix + "."):
|
"PN discards a card" + (random ? " at random." : ".")
|
||||||
|
):
|
||||||
MagicEvent.NONE;
|
MagicEvent.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object data[],final Object[] choices) {
|
public void executeEvent(final MagicGame game,final MagicEvent event,final Object data[],final Object[] choices) {
|
||||||
game.addEvent(new MagicDiscardEvent(
|
game.addEvent(new MagicDiscardEvent(
|
||||||
(MagicPermanent)data[0],
|
event.getSource(),
|
||||||
(MagicPlayer)data[1],
|
event.getPlayer(),
|
||||||
1,
|
1,
|
||||||
random));
|
random
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,17 +21,16 @@ public class MagicStormTrigger extends MagicWhenSpellIsCastTrigger {
|
||||||
public MagicEvent executeTrigger(
|
public MagicEvent executeTrigger(
|
||||||
final MagicGame game,
|
final MagicGame game,
|
||||||
final MagicPermanent permanent,
|
final MagicPermanent permanent,
|
||||||
final MagicCardOnStack data) {
|
final MagicCardOnStack spell) {
|
||||||
final MagicPlayer player = data.getController();
|
|
||||||
final int count = game.getSpellsPlayed();
|
final int count = game.getSpellsPlayed();
|
||||||
return (count > 0) ?
|
return (count > 0) ?
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
data.getSource(),
|
spell,
|
||||||
player,
|
new Object[]{count},
|
||||||
new Object[]{player,data,count},
|
|
||||||
this,
|
this,
|
||||||
"Copy " + data.getSource() + " " +
|
"Copy SN " + count +
|
||||||
count + (count == 1 ? " time." : " times.")) :
|
(count == 1 ? " time." : " times.")
|
||||||
|
) :
|
||||||
MagicEvent.NONE;
|
MagicEvent.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,11 +40,12 @@ public class MagicStormTrigger extends MagicWhenSpellIsCastTrigger {
|
||||||
final MagicEvent event,
|
final MagicEvent event,
|
||||||
final Object data[],
|
final Object data[],
|
||||||
final Object[] choiceResults) {
|
final Object[] choiceResults) {
|
||||||
int count = (Integer)data[2];
|
int count = (Integer)data[0];
|
||||||
for (;count>0;count--) {
|
for (;count>0;count--) {
|
||||||
game.doAction(new MagicCopyCardOnStackAction(
|
game.doAction(new MagicCopyCardOnStackAction(
|
||||||
(MagicPlayer)data[0],
|
event.getPlayer(),
|
||||||
(MagicCardOnStack)data[1]));
|
event.getCardOnStack()
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,15 +20,14 @@ public class MagicTappedIntoPlayTrigger extends MagicWhenComesIntoPlayTrigger {
|
||||||
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicPlayer player) {
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicPlayer player) {
|
||||||
return new MagicEvent(
|
return new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
permanent.getController(),
|
|
||||||
new Object[]{permanent},
|
|
||||||
this,
|
this,
|
||||||
permanent + " enters the battlefield tapped.");
|
"SN enters the battlefield tapped."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
||||||
game.doAction(new MagicTapAction((MagicPermanent)data[0],false));
|
game.doAction(new MagicTapAction(event.getPermanent(),false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -23,16 +23,15 @@ public class MagicTappedIntoPlayUnlessTrigger extends MagicWhenComesIntoPlayTrig
|
||||||
!player.controlsPermanentWithSubType(subType2)) ?
|
!player.controlsPermanentWithSubType(subType2)) ?
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
player,
|
|
||||||
new Object[]{permanent},
|
|
||||||
this,
|
this,
|
||||||
permanent+" enters the battlefield tapped."):
|
"SN enters the battlefield tapped."
|
||||||
|
):
|
||||||
MagicEvent.NONE;
|
MagicEvent.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
||||||
game.doAction(new MagicTapAction((MagicPermanent)data[0],false));
|
game.doAction(new MagicTapAction(event.getPermanent(),false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -22,16 +22,15 @@ public class MagicTappedIntoPlayUnlessTwoTrigger extends MagicWhenComesIntoPlayT
|
||||||
return (player.getNrOfPermanentsWithType(MagicType.Land) > 3) ?
|
return (player.getNrOfPermanentsWithType(MagicType.Land) > 3) ?
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
player,
|
|
||||||
new Object[]{permanent},
|
|
||||||
this,
|
this,
|
||||||
permanent+" enters the battlefield tapped."):
|
"SN enters the battlefield tapped."
|
||||||
|
):
|
||||||
MagicEvent.NONE;
|
MagicEvent.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choices) {
|
||||||
game.doAction(new MagicTapAction((MagicPermanent)data[0],false));
|
game.doAction(new MagicTapAction(event.getPermanent(),false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -20,18 +20,15 @@ public class MagicUndyingTrigger extends MagicWhenPutIntoGraveyardTrigger {
|
||||||
final MagicGame game,
|
final MagicGame game,
|
||||||
final MagicPermanent permanent,
|
final MagicPermanent permanent,
|
||||||
final MagicGraveyardTriggerData triggerData) {
|
final MagicGraveyardTriggerData triggerData) {
|
||||||
if (triggerData.fromLocation == MagicLocationType.Play &&
|
return (triggerData.fromLocation == MagicLocationType.Play &&
|
||||||
permanent.getCounters(MagicCounterType.PlusOne) == 0) {
|
permanent.getCounters(MagicCounterType.PlusOne) == 0) ?
|
||||||
final MagicCard card = triggerData.card;
|
new MagicEvent(
|
||||||
return new MagicEvent(
|
|
||||||
permanent,
|
permanent,
|
||||||
permanent.getController(),
|
|
||||||
new Object[] {card},
|
|
||||||
this,
|
this,
|
||||||
"Return " + card.getName() + " to play under its " +
|
"Return SN to play under its " +
|
||||||
"owner's control with a +1/+1 counter on it.");
|
"owner's control with a +1/+1 counter on it."
|
||||||
}
|
):
|
||||||
return MagicEvent.NONE;
|
MagicEvent.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,11 +37,12 @@ public class MagicUndyingTrigger extends MagicWhenPutIntoGraveyardTrigger {
|
||||||
final MagicEvent event,
|
final MagicEvent event,
|
||||||
final Object[] data,
|
final Object[] data,
|
||||||
final Object[] choiceResults) {
|
final Object[] choiceResults) {
|
||||||
final MagicCard card = (MagicCard)data[0];
|
final MagicCard card = event.getPermanent().getCard();
|
||||||
game.doAction(new MagicReanimateAction(
|
game.doAction(new MagicReanimateAction(
|
||||||
card.getOwner(),
|
card.getOwner(),
|
||||||
card,
|
card,
|
||||||
MagicPlayCardAction.UNDYING));
|
MagicPlayCardAction.UNDYING
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final MagicUndyingTrigger getInstance() {
|
public static final MagicUndyingTrigger getInstance() {
|
||||||
|
|
|
@ -20,11 +20,11 @@ public class MagicWhenBlocksPumpTrigger extends MagicWhenBlocksTrigger {
|
||||||
return (permanent == data) ?
|
return (permanent == data) ?
|
||||||
new MagicEvent(
|
new MagicEvent(
|
||||||
permanent,
|
permanent,
|
||||||
permanent.getController(),
|
|
||||||
new Object[]{permanent},
|
|
||||||
this,
|
this,
|
||||||
permanent + " gets " + getString(amountPower) +
|
"SN gets " +
|
||||||
"/" + getString(amountToughness) + " until end of turn.") :
|
getString(amountPower) + "/" + getString(amountToughness) +
|
||||||
|
" until end of turn."
|
||||||
|
):
|
||||||
MagicEvent.NONE;
|
MagicEvent.NONE;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
@ -34,15 +34,13 @@ public class MagicWhenBlocksPumpTrigger extends MagicWhenBlocksTrigger {
|
||||||
final Object data[],
|
final Object data[],
|
||||||
final Object[] choiceResults) {
|
final Object[] choiceResults) {
|
||||||
game.doAction(new MagicChangeTurnPTAction(
|
game.doAction(new MagicChangeTurnPTAction(
|
||||||
(MagicPermanent)data[0],
|
event.getPermanent(),
|
||||||
amountPower,
|
amountPower,
|
||||||
amountToughness));
|
amountToughness
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getString(final int pt) {
|
private String getString(final int pt) {
|
||||||
return pt >= 0 ?
|
return pt >= 0 ? "+" + pt : Integer.toString(pt);
|
||||||
"+" + pt :
|
|
||||||
Integer.toString(pt);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue