mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
[VOW] Implemented Spiked Ripsaw
This commit is contained in:
parent
2ed7aff291
commit
902fec22dd
4 changed files with 72 additions and 3 deletions
|
@ -35,7 +35,7 @@ public final class FractalHarness extends CardImpl {
|
|||
|
||||
// Whenever equipped creature attacks, double the number of +1/+1 counters on it.
|
||||
this.addAbility(new AttacksAttachedTriggeredAbility(
|
||||
new FractalHarnessDoubleEffect(), AttachmentType.EQUIPMENT, false
|
||||
new FractalHarnessDoubleEffect(), AttachmentType.EQUIPMENT, false, true
|
||||
));
|
||||
|
||||
// Equip {2}
|
||||
|
@ -108,7 +108,7 @@ class FractalHarnessDoubleEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent((UUID) getValue("sourceId"));
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
|
|
55
Mage.Sets/src/mage/cards/s/SpikedRipsaw.java
Normal file
55
Mage.Sets/src/mage/cards/s/SpikedRipsaw.java
Normal file
|
@ -0,0 +1,55 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.common.AttacksAttachedTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.effects.common.DoIfCostPaid;
|
||||
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
|
||||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.constants.AttachmentType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author weirddan455
|
||||
*/
|
||||
public final class SpikedRipsaw extends CardImpl {
|
||||
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent(SubType.FOREST, "forest");
|
||||
|
||||
public SpikedRipsaw(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}{G}");
|
||||
|
||||
this.subtype.add(SubType.EQUIPMENT);
|
||||
|
||||
// Equipped creature gets +3/+3.
|
||||
this.addAbility(new SimpleStaticAbility(new BoostEquippedEffect(3, 3)));
|
||||
|
||||
// Whenever equipped creature attacks, you may sacrifice a Forest. If you do, that creature gains trample until end of turn.
|
||||
this.addAbility(new AttacksAttachedTriggeredAbility(
|
||||
new DoIfCostPaid(new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn, "that creature gains trample until end of turn"), new SacrificeTargetCost(filter)),
|
||||
AttachmentType.EQUIPMENT, false, true
|
||||
));
|
||||
|
||||
// Equip {3}
|
||||
this.addAbility(new EquipAbility(3));
|
||||
}
|
||||
|
||||
private SpikedRipsaw(final SpikedRipsaw card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpikedRipsaw copy() {
|
||||
return new SpikedRipsaw(this);
|
||||
}
|
||||
}
|
|
@ -262,6 +262,7 @@ public final class InnistradCrimsonVow extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Snarling Wolf", 219, Rarity.COMMON, mage.cards.s.SnarlingWolf.class));
|
||||
cards.add(new SetCardInfo("Sorin the Mirthless", 131, Rarity.MYTHIC, mage.cards.s.SorinTheMirthless.class));
|
||||
cards.add(new SetCardInfo("Spectral Binding", 48, Rarity.COMMON, mage.cards.s.SpectralBinding.class));
|
||||
cards.add(new SetCardInfo("Spiked Ripsaw", 220, Rarity.UNCOMMON, mage.cards.s.SpikedRipsaw.class));
|
||||
cards.add(new SetCardInfo("Splendid Reclamation", 221, Rarity.RARE, mage.cards.s.SplendidReclamation.class));
|
||||
cards.add(new SetCardInfo("Spore Crawler", 222, Rarity.COMMON, mage.cards.s.SporeCrawler.class));
|
||||
cards.add(new SetCardInfo("Sporeback Wolf", 223, Rarity.COMMON, mage.cards.s.SporebackWolf.class));
|
||||
|
|
|
@ -8,6 +8,7 @@ import mage.constants.Zone;
|
|||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
@ -19,6 +20,7 @@ import java.util.Locale;
|
|||
public class AttacksAttachedTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
private AttachmentType attachmentType;
|
||||
private final boolean setTargetPointer;
|
||||
|
||||
public AttacksAttachedTriggeredAbility(Effect effect) {
|
||||
this(effect, false);
|
||||
|
@ -29,13 +31,19 @@ public class AttacksAttachedTriggeredAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
|
||||
public AttacksAttachedTriggeredAbility(Effect effect, AttachmentType attachmentType, boolean optional) {
|
||||
this(effect, attachmentType, optional, false);
|
||||
}
|
||||
|
||||
public AttacksAttachedTriggeredAbility(Effect effect, AttachmentType attachmentType, boolean optional, boolean setTargetPointer) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
this.attachmentType = attachmentType;
|
||||
this.setTargetPointer = setTargetPointer;
|
||||
}
|
||||
|
||||
public AttacksAttachedTriggeredAbility(final AttacksAttachedTriggeredAbility abiltity) {
|
||||
super(abiltity);
|
||||
this.attachmentType = abiltity.attachmentType;
|
||||
this.setTargetPointer = abiltity.setTargetPointer;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,7 +64,12 @@ public class AttacksAttachedTriggeredAbility extends TriggeredAbilityImpl {
|
|||
getEffects().setValue("sourceId", event.getSourceId());
|
||||
// TODO: Passing a permanent object like this can cause bugs. May need refactoring to use UUID instead.
|
||||
// See https://github.com/magefree/mage/issues/8377
|
||||
getEffects().setValue("attachedPermanent", game.getPermanent(event.getSourceId()));
|
||||
// 11-08-2021: Added a new constructor to set target pointer. Should probably be using this instead.
|
||||
Permanent attachedPermanent = game.getPermanent(event.getSourceId());
|
||||
getEffects().setValue("attachedPermanent", attachedPermanent);
|
||||
if (setTargetPointer && attachedPermanent != null) {
|
||||
getEffects().setTargetPointer(new FixedTarget(attachedPermanent, game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue