convert from java code to groovy code

master
melvin 2013-04-01 13:37:44 +08:00
parent 333d4735b0
commit d25d5b8e04
3 changed files with 23 additions and 35 deletions

View File

@ -0,0 +1,22 @@
[
new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
return new MagicEvent(
cardOnStack,
this,
"All creatures get -2/-2 until end of turn."
);
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event) {
final Collection<MagicPermanent> targets=
game.filterPermanents(event.getPlayer(),MagicTargetFilter.TARGET_CREATURE);
for (final MagicPermanent target : targets) {
game.doAction(new MagicChangeTurnPTAction(target,-2,-2));
}
}
}
]

View File

@ -7,4 +7,4 @@ rarity=U
type=Sorcery
cost={1}{B}{B}
timing=removal
requires_card_code
requires_groovy_code

View File

@ -1,34 +0,0 @@
package magic.card;
import magic.model.MagicGame;
import magic.model.MagicPayedCost;
import magic.model.MagicPermanent;
import magic.model.action.MagicChangeTurnPTAction;
import magic.model.event.MagicEvent;
import magic.model.event.MagicSpellCardEvent;
import magic.model.stack.MagicCardOnStack;
import magic.model.target.MagicTargetFilter;
import java.util.Collection;
public class Infest {
public static final MagicSpellCardEvent S = new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
return new MagicEvent(
cardOnStack,
this,
"All creatures get -2/-2 until end of turn.");
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event) {
final Collection<MagicPermanent> targets=
game.filterPermanents(event.getPlayer(),MagicTargetFilter.TARGET_CREATURE);
for (final MagicPermanent target : targets) {
game.doAction(new MagicChangeTurnPTAction(target,-2,-2));
}
}
};
}