determine equippedCreature on resolution

master
melvin 2012-10-02 22:41:58 +08:00
parent 0e2da534eb
commit 38b584e9e4
1 changed files with 11 additions and 12 deletions

View File

@ -13,17 +13,13 @@ public class Blade_of_the_Bloodchief {
@Override @Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent otherPermanent) { public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent otherPermanent) {
final MagicPermanent equippedCreature = permanent.getEquippedCreature(); final MagicPermanent equippedCreature = permanent.getEquippedCreature();
final boolean isVampire = equippedCreature.hasSubType(MagicSubType.Vampire); return (equippedCreature.isValid() && otherPermanent.isCreature()) ?
final int numCounters = isVampire ? 2 : 1;
return (equippedCreature != MagicPermanent.NONE && otherPermanent.isCreature()) ?
new MagicEvent( new MagicEvent(
permanent, permanent,
permanent.getController(),
new Object[]{equippedCreature,numCounters},
this, this,
isVampire ? "Put a +1/+1 counter on equipped creature. " +
"Put two +1/+1 counters on " + equippedCreature + "." : "If equipped creature is a Vampire, put two +1/+1 counters on it instead."
"Put a +1/+1 counter on " + equippedCreature + ".") : ):
MagicEvent.NONE; MagicEvent.NONE;
} }
@Override @Override
@ -32,11 +28,14 @@ public class Blade_of_the_Bloodchief {
final MagicEvent event, final MagicEvent event,
final Object[] data, final Object[] data,
final Object[] choiceResults) { final Object[] choiceResults) {
final MagicPermanent equippedCreature = event.getPermanent().getEquippedCreature();
final int amount = equippedCreature.hasSubType(MagicSubType.Vampire) ? 2 : 1;
game.doAction(new MagicChangeCountersAction( game.doAction(new MagicChangeCountersAction(
(MagicPermanent)data[0], equippedCreature,
MagicCounterType.PlusOne, MagicCounterType.PlusOne,
(Integer)data[1], amount,
true)); true
));
} }
}; };
} }