create local var to access outer variable from inner class

master
melvin 2013-05-20 17:34:04 +08:00
parent 4c0cdec5c3
commit 7a21921286
2 changed files with 5 additions and 2 deletions

View File

@ -19,9 +19,10 @@ def PT = new MagicStatic(MagicLayer.SetPT, MagicStatic.UntilEOT) {
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
final MagicStatic setPT = PT;
event.processTargetPermanent(game,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
game.doAction(new MagicBecomesCreatureAction(creature,PT));
game.doAction(new MagicBecomesCreatureAction(creature,setPT));
}
});
}

View File

@ -18,9 +18,11 @@ def TP = Karn__Silver_Golem.getTP();
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
final MagicStatic setPT = PT;
final MagicStatic giveST = ST;
event.processTargetPermanent(game,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
game.doAction(new MagicBecomesCreatureAction(creature,PT,ST));
game.doAction(new MagicBecomesCreatureAction(creature,setPT,giveST));
}
});
}