Implemented Weapon Rack

This commit is contained in:
Evan Kranzler 2019-09-21 16:09:02 -04:00
parent 0077ad5a07
commit d5ab4a60d5
2 changed files with 83 additions and 0 deletions

View file

@ -0,0 +1,82 @@
package mage.cards.w;
import mage.abilities.Ability;
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class WeaponRack extends CardImpl {
public WeaponRack(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
// Weapon Rack enters the battlefield with three +1/+1 counters on it.
this.addAbility(new EntersBattlefieldAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance(3)),
"{this} enters the battlefield with three +1/+1 counters on it"
));
// {T}: Move a +1/+1 counter from Weapon Rack onto target creature. Activate this ability only any time you could cast a sorcery.
Ability ability = new ActivateAsSorceryActivatedAbility(
Zone.BATTLEFIELD, new WeaponRackEffect(), new TapSourceCost()
);
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
private WeaponRack(final WeaponRack card) {
super(card);
}
@Override
public WeaponRack copy() {
return new WeaponRack(this);
}
}
class WeaponRackEffect extends OneShotEffect {
WeaponRackEffect() {
super(Outcome.Benefit);
staticText = "move a +1/+1 counter from {this} onto target creature";
}
private WeaponRackEffect(final WeaponRackEffect effect) {
super(effect);
}
@Override
public WeaponRackEffect copy() {
return new WeaponRackEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (sourcePermanent == null || !sourcePermanent.getCounters(game).containsKey(CounterType.P1P1)) {
return false;
}
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null || !permanent.addCounters(CounterType.P1P1.createInstance(), source, game)) {
return false;
}
sourcePermanent.removeCounters(CounterType.P1P1.createInstance(), game);
return true;
}
}

View file

@ -300,6 +300,7 @@ public final class ThroneOfEldraine extends ExpansionSet {
cards.add(new SetCardInfo("Vantress Paladin", 72, Rarity.COMMON, mage.cards.v.VantressPaladin.class));
cards.add(new SetCardInfo("Venerable Knight", 35, Rarity.UNCOMMON, mage.cards.v.VenerableKnight.class));
cards.add(new SetCardInfo("Wandermare", 204, Rarity.UNCOMMON, mage.cards.w.Wandermare.class));
cards.add(new SetCardInfo("Weapon Rack", 236, Rarity.COMMON, mage.cards.w.WeaponRack.class));
cards.add(new SetCardInfo("Weaselback Redcap", 148, Rarity.COMMON, mage.cards.w.WeaselbackRedcap.class));
cards.add(new SetCardInfo("Wicked Guardian", 109, Rarity.COMMON, mage.cards.w.WickedGuardian.class));
cards.add(new SetCardInfo("Wicked Wolf", 181, Rarity.RARE, mage.cards.w.WickedWolf.class));