magarena/release/Magarena/scripts/Karn_s_Touch.groovy

48 lines
1.9 KiB
Groovy
Raw Normal View History

2013-05-30 22:11:58 -07:00
def PT = new MagicStatic(MagicLayer.SetPT, MagicStatic.UntilEOT) {
@Override
public void modPowerToughness(final MagicPermanent source,final MagicPermanent permanent,final MagicPowerToughness pt) {
final int cmc = permanent.getConvertedCost();
pt.set(cmc,cmc);
}
};
def ST = new MagicStatic(MagicLayer.Type, MagicStatic.UntilEOT) {
@Override
public int getTypeFlags(final MagicPermanent permanent,final int flags) {
return flags|MagicType.Artifact.getMask()|MagicType.Creature.getMask();
}
};
def TP = new MagicTargetPicker<MagicPermanent>() {
@Override
protected int getTargetScore(final MagicGame game,final MagicPlayer player,final MagicPermanent permanent) {
final MagicPowerToughness pt=permanent.getPowerToughness();
final int power = permanent.getConvertedCost();
final int toughness = permanent.getConvertedCost();
final int score = (pt.power()-power)*2+(pt.toughness()-toughness);
return permanent.getController() == player ? -score:score;
}
};
2013-05-18 22:41:59 -07:00
[
new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
return new MagicEvent(
cardOnStack,
MagicTargetChoice.POS_TARGET_NONCREATURE_ARTIFACT,
TP,
this,
2013-06-23 18:29:26 -07:00
"Target noncreature artifact\$ becomes an artifact creature with " +
2013-05-18 22:41:59 -07:00
"power and toughness each equal to its converted mana cost until end of turn"
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
event.processTargetPermanent(game, {
2013-05-30 22:11:58 -07:00
final MagicPermanent creature ->
game.doAction(new MagicBecomesCreatureAction(creature,PT,ST));
});
2013-05-18 22:41:59 -07:00
}
}
]