replace groovy code with card script

master
melvinzhang 2015-05-22 11:40:24 +08:00
parent 3b5db64fcc
commit 262c56166c
4 changed files with 20 additions and 32 deletions

View File

@ -1,30 +0,0 @@
[
new MagicWhenDiesTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game, final MagicPermanent permanent, final MagicPermanent died) {
return new MagicEvent(
permanent,
this,
"PN puts a 1/1 white Kithkin Soldier creature token onto the battlefield for each counter on SN."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
int amount = 0;
final MagicPermanent permanent = event.getPermanent();
for (final MagicCounterType counterType : MagicCounterType.values()) {
if (permanent.hasCounters(counterType)) {
amount+=permanent.getCounters(counterType);
}
}
final MagicPlayer player = event.getPlayer();
game.logAppendMessage(player, "("+amount+")");
game.doAction(new PlayTokensAction(
player,
CardDefinitions.getToken("1/1 white Kithkin Soldier creature token"),
amount
));
}
}
]

View File

@ -6,7 +6,7 @@ type=Creature
subtype=Kithkin,Soldier
cost={1}{W}{W}
pt=1/1
ability=SN enters the battlefield with a +1/+1 counter on it for each other Kithkin you control.
ability=SN enters the battlefield with a +1/+1 counter on it for each other Kithkin you control.;\
When SN dies, put a 1/1 white Kithkin Soldier creature token onto the battlefield for each counter on it.
timing=main
requires_groovy_code
oracle=Kinsbaile Borderguard enters the battlefield with a +1/+1 counter on it for each other Kithkin you control.\nWhen Kinsbaile Borderguard dies, put a 1/1 white Kithkin Soldier creature token onto the battlefield for each counter on it.

View File

@ -24,6 +24,19 @@ public class MagicAmountFactory {
}
};
}
public static MagicAmount AllCountersOnSource =
new MagicAmount() {
@Override
public int getAmount(final MagicSource source, final MagicPlayer player) {
final MagicPermanent perm = (MagicPermanent)source;
int amount = 0;
for (final MagicCounterType counterType : MagicCounterType.values()) {
amount+=perm.getCounters(counterType);
}
return amount;
}
};
public static MagicAmount One =
new MagicAmount() {

View File

@ -35,6 +35,11 @@ public enum MagicAmountParser {
return MagicAmountFactory.SN_Power;
}
},
AllCounterOnSN("counter(s)? on (it|SN)") {
public MagicAmount toAmount(final Matcher arg) {
return MagicAmountFactory.AllCountersOnSource;
}
},
CounterOnSN(ARG.WORD1 + " counter(s)? on (it|SN)") {
public MagicAmount toAmount(final Matcher arg) {
return MagicAmountFactory.CounterOnSource(