replace groovy code with ability in card script
parent
c417879b2b
commit
c926e31e23
|
@ -1,4 +1,4 @@
|
||||||
name=Insect4
|
name=1/1 green Insect creature token
|
||||||
token=Insect
|
token=Insect
|
||||||
image=http://magiccards.info/extras/token/magic-2010/insect.jpg
|
image=http://magiccards.info/extras/token/magic-2010/insect.jpg
|
||||||
value=2
|
value=2
|
|
@ -1,23 +0,0 @@
|
||||||
[
|
|
||||||
new MagicPermanentActivation(
|
|
||||||
new MagicActivationHints(MagicTiming.Flash),
|
|
||||||
"Token"
|
|
||||||
) {
|
|
||||||
@Override
|
|
||||||
public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
|
|
||||||
return [new MagicPayManaCostEvent(source,"{1}{G}")];
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
|
|
||||||
return new MagicEvent(
|
|
||||||
source,
|
|
||||||
this,
|
|
||||||
"Put a 1/1 green Insect creature token onto the battlefield."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void executeEvent(final MagicGame game, final MagicEvent event) {
|
|
||||||
game.doAction(new MagicPlayTokenAction(event.getPlayer(), TokenCardDefinitions.get("Insect4")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
|
@ -7,5 +7,5 @@ type=Creature
|
||||||
subtype=Insect
|
subtype=Insect
|
||||||
cost={3}{G}{G}
|
cost={3}{G}{G}
|
||||||
pt=5/5
|
pt=5/5
|
||||||
|
ability=pay {1}{G}: PN puts a 1/1 green Insect creature token onto the battlefield.
|
||||||
timing=main
|
timing=main
|
||||||
requires_groovy_code
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
[
|
|
||||||
new MagicWhenDiesTrigger() {
|
|
||||||
@Override
|
|
||||||
public MagicEvent getEvent(final MagicPermanent permanent) {
|
|
||||||
return new MagicEvent(
|
|
||||||
permanent,
|
|
||||||
this,
|
|
||||||
"PN puts four 1/1 green Insect creature tokens onto the battlefield."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void executeEvent(final MagicGame game, final MagicEvent event) {
|
|
||||||
game.doAction(new MagicPlayTokensAction(
|
|
||||||
event.getPlayer(),
|
|
||||||
TokenCardDefinitions.get("Insect4"),
|
|
||||||
4
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
|
@ -7,5 +7,5 @@ type=Creature
|
||||||
subtype=Insect,Beast
|
subtype=Insect,Beast
|
||||||
cost={4}{G}{G}
|
cost={4}{G}{G}
|
||||||
pt=4/4
|
pt=4/4
|
||||||
|
ability=dies effect PN puts four 1/1 green Insect creature tokens onto the battlefield.
|
||||||
timing=main
|
timing=main
|
||||||
requires_groovy_code
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
[
|
|
||||||
new MagicWhenDiesTrigger() {
|
|
||||||
@Override
|
|
||||||
public MagicEvent getEvent(final MagicPermanent permanent) {
|
|
||||||
return new MagicEvent(
|
|
||||||
permanent,
|
|
||||||
this,
|
|
||||||
"PN puts two 1/1 green Insect creature tokens onto the battlefield."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void executeEvent(final MagicGame game, final MagicEvent event) {
|
|
||||||
game.doAction(new MagicPlayTokensAction(
|
|
||||||
event.getPlayer(),
|
|
||||||
TokenCardDefinitions.get("Insect4"),
|
|
||||||
2
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
|
@ -7,5 +7,5 @@ type=Creature
|
||||||
subtype=Elf
|
subtype=Elf
|
||||||
cost={3}{G}
|
cost={3}{G}
|
||||||
pt=2/2
|
pt=2/2
|
||||||
|
ability=dies effect PN puts two 1/1 green Insect creature tokens onto the battlefield.
|
||||||
timing=main
|
timing=main
|
||||||
requires_groovy_code
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
[
|
|
||||||
new MagicWhenDiesTrigger() {
|
|
||||||
@Override
|
|
||||||
public MagicEvent getEvent(final MagicPermanent permanent) {
|
|
||||||
return new MagicEvent(
|
|
||||||
permanent,
|
|
||||||
this,
|
|
||||||
"PN puts seven 1/1 green Insect creature tokens onto the battlefield."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void executeEvent(final MagicGame game, final MagicEvent event) {
|
|
||||||
game.doAction(new MagicPlayTokensAction(
|
|
||||||
event.getPlayer(),
|
|
||||||
TokenCardDefinitions.get("Insect4"),
|
|
||||||
7
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
|
@ -7,5 +7,5 @@ type=Creature
|
||||||
subtype=Wurm
|
subtype=Wurm
|
||||||
cost={5}{G}{G}{G}
|
cost={5}{G}{G}{G}
|
||||||
pt=7/7
|
pt=7/7
|
||||||
|
ability=dies effect PN puts seven 1/1 green Insect creature tokens onto the battlefield.
|
||||||
timing=main
|
timing=main
|
||||||
requires_groovy_code
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ import magic.model.action.MagicChangeLifeAction;
|
||||||
import magic.model.action.MagicTapAction;
|
import magic.model.action.MagicTapAction;
|
||||||
import magic.model.action.MagicUntapAction;
|
import magic.model.action.MagicUntapAction;
|
||||||
import magic.model.action.MagicChangeCountersAction;
|
import magic.model.action.MagicChangeCountersAction;
|
||||||
import magic.model.action.MagicPlayTokenAction;
|
import magic.model.action.MagicPlayTokensAction;
|
||||||
import magic.model.stack.MagicCardOnStack;
|
import magic.model.stack.MagicCardOnStack;
|
||||||
import magic.model.target.MagicTarget;
|
import magic.model.target.MagicTarget;
|
||||||
import magic.model.target.MagicTargetHint;
|
import magic.model.target.MagicTargetHint;
|
||||||
|
@ -321,18 +321,20 @@ public enum MagicRuleEventAction {
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
Token(
|
Token(
|
||||||
"pn puts a(n)? (?<name>[^\\.]*) onto the battlefield.",
|
"pn puts (?<amount>[a-z]+) (?<name>[^\\.]*) onto the battlefield.",
|
||||||
MagicTiming.Token,
|
MagicTiming.Token,
|
||||||
"Token"
|
"Token"
|
||||||
) {
|
) {
|
||||||
public MagicEventAction getAction(final String rule) {
|
public MagicEventAction getAction(final String rule) {
|
||||||
final Matcher matcher = matched(rule);
|
final Matcher matcher = matched(rule);
|
||||||
|
final int amount = englishToInt(matcher.group("amount"));
|
||||||
return new MagicEventAction() {
|
return new MagicEventAction() {
|
||||||
@Override
|
@Override
|
||||||
public void executeEvent(final MagicGame game, final MagicEvent event) {
|
public void executeEvent(final MagicGame game, final MagicEvent event) {
|
||||||
game.doAction(new MagicPlayTokenAction(
|
game.doAction(new MagicPlayTokensAction(
|
||||||
event.getPlayer(),
|
event.getPlayer(),
|
||||||
TokenCardDefinitions.get(matcher.group("name"))
|
TokenCardDefinitions.get(matcher.group("name")),
|
||||||
|
amount
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -447,6 +449,7 @@ public enum MagicRuleEventAction {
|
||||||
public static int englishToInt(String num) {
|
public static int englishToInt(String num) {
|
||||||
switch (num) {
|
switch (num) {
|
||||||
case "a": return 1;
|
case "a": return 1;
|
||||||
|
case "an": return 1;
|
||||||
case "two": return 2;
|
case "two": return 2;
|
||||||
case "three" : return 3;
|
case "three" : return 3;
|
||||||
case "four" : return 4;
|
case "four" : return 4;
|
||||||
|
|
Loading…
Reference in New Issue