added method setToughness. added Tree of Redemption
parent
a0858d44e8
commit
f5cde29568
|
@ -5099,3 +5099,16 @@ color=r
|
|||
converted=3
|
||||
cost={1}{R}{R}
|
||||
timing=removal
|
||||
|
||||
>Tree of Redemption
|
||||
image=http://magiccards.info/scans/en/isd/207.jpg
|
||||
value=4
|
||||
rarity=M
|
||||
type=Creature
|
||||
subtype=Plant
|
||||
color=g
|
||||
converted=4
|
||||
cost={3}{G}
|
||||
pt=0/13
|
||||
ability=defender
|
||||
timing=main
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
package magic.card;
|
||||
|
||||
import magic.model.MagicGame;
|
||||
import magic.model.MagicPayedCost;
|
||||
import magic.model.MagicPermanent;
|
||||
import magic.model.MagicPlayer;
|
||||
import magic.model.MagicPowerToughness;
|
||||
import magic.model.MagicSource;
|
||||
import magic.model.action.MagicAddStaticAction;
|
||||
import magic.model.action.MagicChangeLifeAction;
|
||||
import magic.model.condition.MagicCondition;
|
||||
import magic.model.event.MagicActivationHints;
|
||||
import magic.model.event.MagicEvent;
|
||||
import magic.model.event.MagicPermanentActivation;
|
||||
import magic.model.event.MagicTapEvent;
|
||||
import magic.model.event.MagicTiming;
|
||||
import magic.model.mstatic.MagicStatic;
|
||||
import magic.model.mstatic.MagicLayer;
|
||||
|
||||
public class Tree_of_Redemption {
|
||||
public static final MagicPermanentActivation A = new MagicPermanentActivation(
|
||||
new MagicCondition[]{MagicCondition.CAN_TAP_CONDITION},
|
||||
new MagicActivationHints(MagicTiming.Main),
|
||||
"Life") {
|
||||
|
||||
@Override
|
||||
public MagicEvent[] getCostEvent(final MagicSource source) {
|
||||
return new MagicEvent[]{new MagicTapEvent((MagicPermanent)source)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public MagicEvent getPermanentEvent(
|
||||
final MagicPermanent source,
|
||||
final MagicPayedCost payedCost) {
|
||||
return new MagicEvent(
|
||||
source,
|
||||
source.getController(),
|
||||
new Object[]{source,source.getController()},
|
||||
this,
|
||||
"Exchange your life total with "+ source + "'s toughness.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeEvent(
|
||||
final MagicGame game,
|
||||
final MagicEvent event,
|
||||
final Object[] data,
|
||||
final Object[] choiceResults) {
|
||||
final MagicPermanent permanent = (MagicPermanent)data[0];
|
||||
final MagicPlayer player = (MagicPlayer)data[1];
|
||||
final int life = player.getLife();
|
||||
final int toughness = permanent.getToughness(game);
|
||||
// exchange life with toughness even when they are equal
|
||||
// because toughness can be modified in layer ModPT (7c)
|
||||
game.doAction(new MagicChangeLifeAction(player,toughness - life));
|
||||
game.doAction(new MagicAddStaticAction(permanent, new MagicStatic(
|
||||
MagicLayer.SetPT) {
|
||||
@Override
|
||||
public void getPowerToughness(
|
||||
final MagicGame game,
|
||||
final MagicPermanent permanent,
|
||||
final MagicPowerToughness pt) {
|
||||
pt.setToughness(life);
|
||||
}
|
||||
}));
|
||||
}
|
||||
};
|
||||
}
|
|
@ -40,6 +40,10 @@ public class MagicPowerToughness {
|
|||
power = pAmount;
|
||||
toughness = tAmount;
|
||||
}
|
||||
|
||||
public void setToughness(final int tAmount) {
|
||||
toughness = tAmount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
|
Loading…
Reference in New Issue