- Fixed Umezawas Jitte.

This commit is contained in:
jeffwadsworth 2012-07-29 10:51:49 -05:00
parent 8d66f0ee9c
commit 19eeb1076b

View file

@ -37,7 +37,6 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.RemoveCountersSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.continious.BoostEquippedEffect;
import mage.abilities.effects.common.continious.BoostTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.EquipAbility;
@ -50,6 +49,10 @@ import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continious.BoostSourceEffect;
/**
* @author Loki
@ -64,8 +67,10 @@ public class UmezawasJitte extends CardImpl<UmezawasJitte> {
// Whenever equipped creature deals combat damage, put two charge counters on Umezawa's Jitte.
this.addAbility(new UmezawasJitteAbility());
// Remove a charge counter from Umezawa's Jitte: Choose one Equipped creature gets +2/+2 until end of turn; or target creature gets -1/-1 until end of turn; or you gain 2 life.
Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new BoostEquippedEffect(2, 2, Constants.Duration.EndOfTurn), new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()));
Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new UmezawasJitteEffect(), new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()));
Mode mode = new Mode();
mode.getEffects().add(new BoostTargetEffect(-1, -1, Constants.Duration.EndOfTurn));
mode.getTargets().add(new TargetCreaturePermanent());
@ -74,6 +79,7 @@ public class UmezawasJitte extends CardImpl<UmezawasJitte> {
mode.getEffects().add(new GainLifeEffect(2));
ability.addMode(mode);
this.addAbility(ability);
// Equip {2}
this.addAbility(new EquipAbility(Constants.Outcome.AddAbility, new GenericManaCost(2)));
}
@ -107,7 +113,7 @@ class UmezawasJitteAbility extends TriggeredAbilityImpl<UmezawasJitteAbility> {
public boolean checkTrigger(GameEvent event, Game game) {
if (event instanceof DamagedEvent) {
Permanent p = game.getPermanent(event.getSourceId());
if (((DamagedEvent)event).isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) {
if (((DamagedEvent) event).isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) {
return true;
}
}
@ -119,3 +125,34 @@ class UmezawasJitteAbility extends TriggeredAbilityImpl<UmezawasJitteAbility> {
return "Whenever equipped creature deals combat damage, put two charge counters on {this}.";
}
}
class UmezawasJitteEffect extends OneShotEffect<UmezawasJitteEffect> {
UmezawasJitteEffect() {
super(Constants.Outcome.BoostCreature);
staticText = "Equipped creature gets +2/+2 until end of turn";
}
UmezawasJitteEffect(final UmezawasJitteEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent equipment = game.getPermanent(source.getSourceId());
if (equipment != null) {
Permanent equipped = game.getPermanent(equipment.getAttachedTo());
if (equipped != null) {
Effect effect = new BoostSourceEffect(2, 2, Constants.Duration.EndOfTurn);
equipped.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, effect), game);
return true;
}
}
return false;
}
@Override
public UmezawasJitteEffect copy() {
return new UmezawasJitteEffect(this);
}
}