Implemented Obosh, the Preypiercer

This commit is contained in:
Evan Kranzler 2020-04-12 10:17:29 -04:00
parent 56d73b6595
commit f626d42c99
4 changed files with 115 additions and 4 deletions

View file

@ -42,7 +42,7 @@ public final class KerugaTheMacrosage extends CardImpl {
this.toughness = new MageInt(4); this.toughness = new MageInt(4);
// Companion Your starting deck contains only cards with converted mana cost 3 or greater and land cards. // Companion Your starting deck contains only cards with converted mana cost 3 or greater and land cards.
this.addAbility(new CompanionAbility(new KerugaCondition())); this.addAbility(new CompanionAbility(KerugaCondition.instance));
// When Keruga, the Macrosage enters the battlefield, draw a card for each other permanent you control with converted mana cost 3 or greater. // When Keruga, the Macrosage enters the battlefield, draw a card for each other permanent you control with converted mana cost 3 or greater.
this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(new PermanentsOnBattlefieldCount(filter)))); this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(new PermanentsOnBattlefieldCount(filter))));
} }
@ -57,7 +57,8 @@ public final class KerugaTheMacrosage extends CardImpl {
} }
} }
class KerugaCondition implements CompanionCondition { enum KerugaCondition implements CompanionCondition {
instance;
@Override @Override
public String getRule() { public String getRule() {

View file

@ -0,0 +1,108 @@
package mage.cards.o;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.keyword.CompanionAbility;
import mage.abilities.keyword.CompanionCondition;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.util.CardUtil;
import java.util.Set;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class OboshThePreypiercer extends CardImpl {
public OboshThePreypiercer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B/R}{B/R}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HELLION);
this.subtype.add(SubType.HORROR);
this.power = new MageInt(3);
this.toughness = new MageInt(5);
// Companion Your starting deck contains only cards with odd converted mana costs and land cards.
this.addAbility(new CompanionAbility(OboshThePreypiercerCompanionCondition.instance));
// If a source you control with an odd converted mana cost would deal damage to a permanent or player, it deals double that damage to that permanent or player instead.
this.addAbility(new SimpleStaticAbility(new OboshThePreypiercerEffect()));
}
private OboshThePreypiercer(final OboshThePreypiercer card) {
super(card);
}
@Override
public OboshThePreypiercer copy() {
return new OboshThePreypiercer(this);
}
}
enum OboshThePreypiercerCompanionCondition implements CompanionCondition {
instance;
@Override
public String getRule() {
return "Your starting deck contains only cards with odd converted mana costs and land cards.";
}
@Override
public boolean isLegal(Set<Card> deck) {
return deck
.stream()
.filter(card -> !card.isLand())
.mapToInt(MageObject::getConvertedManaCost)
.map(i -> i & 1)
.allMatch(i -> i == 1);
}
}
class OboshThePreypiercerEffect extends ReplacementEffectImpl {
OboshThePreypiercerEffect() {
super(Duration.WhileOnBattlefield, Outcome.Damage);
staticText = "If a source you control with an odd converted mana cost would deal damage " +
"to a permanent or player, it deals double that damage to that permanent or player instead.";
}
private OboshThePreypiercerEffect(final OboshThePreypiercerEffect effect) {
super(effect);
}
@Override
public OboshThePreypiercerEffect copy() {
return new OboshThePreypiercerEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER)
|| event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE)
|| event.getType().equals(GameEvent.EventType.DAMAGE_PLANESWALKER);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
MageObject sourceObject = source.getSourceObjectIfItStillExists(game);
return sourceObject != null
&& sourceObject.getConvertedManaCost() % 2 == 1
&& game.getControllerId(event.getSourceId()).equals(source.getControllerId());
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
event.setAmount(CardUtil.addWithOverflowCheck(event.getAmount(), event.getAmount()));
return false;
}
}

View file

@ -36,7 +36,7 @@ public final class UmoriTheCollector extends CardImpl {
this.toughness = new MageInt(5); this.toughness = new MageInt(5);
// Companion Each nonland card in your starting deck shares a card type. // Companion Each nonland card in your starting deck shares a card type.
this.addAbility(new CompanionAbility(new UmoriCondition())); this.addAbility(new CompanionAbility(UmoriCondition.instance));
// As Umori, the Collector enters the battlefield, choose a card type. // As Umori, the Collector enters the battlefield, choose a card type.
this.addAbility(new AsEntersBattlefieldAbility(new ChooseCardTypeEffect(Outcome.Benefit))); this.addAbility(new AsEntersBattlefieldAbility(new ChooseCardTypeEffect(Outcome.Benefit)));
@ -55,7 +55,8 @@ public final class UmoriTheCollector extends CardImpl {
} }
} }
class UmoriCondition implements CompanionCondition { enum UmoriCondition implements CompanionCondition {
instance;
@Override @Override
public String getRule() { public String getRule() {

View file

@ -214,6 +214,7 @@ public final class IkoriaLairOfBehemoths extends ExpansionSet {
cards.add(new SetCardInfo("Nethroi, Apex of Death", 197, Rarity.MYTHIC, mage.cards.n.NethroiApexOfDeath.class)); cards.add(new SetCardInfo("Nethroi, Apex of Death", 197, Rarity.MYTHIC, mage.cards.n.NethroiApexOfDeath.class));
cards.add(new SetCardInfo("Neutralize", 59, Rarity.UNCOMMON, mage.cards.n.Neutralize.class)); cards.add(new SetCardInfo("Neutralize", 59, Rarity.UNCOMMON, mage.cards.n.Neutralize.class));
cards.add(new SetCardInfo("Nightsquad Commando", 98, Rarity.COMMON, mage.cards.n.NightsquadCommando.class)); cards.add(new SetCardInfo("Nightsquad Commando", 98, Rarity.COMMON, mage.cards.n.NightsquadCommando.class));
cards.add(new SetCardInfo("Obosh, the Preypiercer", 228, Rarity.RARE, mage.cards.o.OboshThePreypiercer.class));
cards.add(new SetCardInfo("Of One Mind", 60, Rarity.COMMON, mage.cards.o.OfOneMind.class)); cards.add(new SetCardInfo("Of One Mind", 60, Rarity.COMMON, mage.cards.o.OfOneMind.class));
cards.add(new SetCardInfo("Offspring's Revenge", 198, Rarity.RARE, mage.cards.o.OffspringsRevenge.class)); cards.add(new SetCardInfo("Offspring's Revenge", 198, Rarity.RARE, mage.cards.o.OffspringsRevenge.class));
cards.add(new SetCardInfo("Ominous Seas", 61, Rarity.UNCOMMON, mage.cards.o.OminousSeas.class)); cards.add(new SetCardInfo("Ominous Seas", 61, Rarity.UNCOMMON, mage.cards.o.OminousSeas.class));