[CLB] Implemented Owlbear Shepherd

This commit is contained in:
Evan Kranzler 2022-05-29 21:16:20 -04:00
parent 9124529f67
commit 72d92a80e8
2 changed files with 100 additions and 0 deletions

View file

@ -0,0 +1,99 @@
package mage.cards.o;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.hint.Hint;
import mage.abilities.hint.ValueHint;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.filter.StaticFilters;
import mage.game.Game;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class OwlbearShepherd extends CardImpl {
private static final Hint hint = new ValueHint(
"Total power and toughness of creatures you control", OwlbearShepherdValue.instance
);
public OwlbearShepherd(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}");
this.subtype.add(SubType.GOBLIN);
this.subtype.add(SubType.DRUID);
this.power = new MageInt(1);
this.toughness = new MageInt(4);
// At the beginning of your end step, if creatures you control have total power and toughness 8 or greater, draw a card.
this.addAbility(new BeginningOfEndStepTriggeredAbility(
new DrawCardSourceControllerEffect(1),
TargetController.YOU, OwlbearShepherdCondition.instance, false
).addHint(hint));
}
private OwlbearShepherd(final OwlbearShepherd card) {
super(card);
}
@Override
public OwlbearShepherd copy() {
return new OwlbearShepherd(this);
}
}
enum OwlbearShepherdCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
return OwlbearShepherdValue.instance.calculate(game, source, null) >= 8;
}
@Override
public String toString() {
return "creatures you control have total power and toughness 8 or greater";
}
}
enum OwlbearShepherdValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
return game
.getBattlefield()
.getActivePermanents(
StaticFilters.FILTER_CONTROLLED_CREATURE,
sourceAbility.getControllerId(), sourceAbility, game
).stream()
.mapToInt(permanent -> permanent.getPower().getValue() + permanent.getToughness().getValue())
.sum();
}
@Override
public OwlbearShepherdValue copy() {
return this;
}
@Override
public String getMessage() {
return "";
}
@Override
public String toString() {
return "";
}
}

View file

@ -188,6 +188,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet {
cards.add(new SetCardInfo("Oceanus Dragon", 87, Rarity.COMMON, mage.cards.o.OceanusDragon.class));
cards.add(new SetCardInfo("Oji, the Exquisite Blade", 290, Rarity.UNCOMMON, mage.cards.o.OjiTheExquisiteBlade.class));
cards.add(new SetCardInfo("Overwhelming Encounter", 245, Rarity.UNCOMMON, mage.cards.o.OverwhelmingEncounter.class));
cards.add(new SetCardInfo("Owlbear Shepherd", 247, Rarity.UNCOMMON, mage.cards.o.OwlbearShepherd.class));
cards.add(new SetCardInfo("Parasitic Impetus", 140, Rarity.COMMON, mage.cards.p.ParasiticImpetus.class));
cards.add(new SetCardInfo("Passageway Seer", 141, Rarity.UNCOMMON, mage.cards.p.PassagewaySeer.class));
cards.add(new SetCardInfo("Patriar's Seal", 332, Rarity.UNCOMMON, mage.cards.p.PatriarsSeal.class));