[STX] Implemented Brackish Trudge

This commit is contained in:
Evan Kranzler 2021-04-05 19:13:27 -04:00
parent f2f04be08b
commit 3914aa656a
3 changed files with 59 additions and 6 deletions

View file

@ -0,0 +1,56 @@
package mage.cards.b;
import mage.MageInt;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.common.EntersBattlefieldTappedAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.YouGainedLifeCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToHandEffect;
import mage.abilities.hint.ConditionHint;
import mage.abilities.hint.Hint;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.watchers.common.PlayerGainedLifeWatcher;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class BrackishTrudge extends CardImpl {
private static final Condition condition = new YouGainedLifeCondition(ComparisonType.MORE_THAN, 0);
private static final Hint hint = new ConditionHint(condition, "You gained life this turn");
public BrackishTrudge(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
this.subtype.add(SubType.FUNGUS);
this.subtype.add(SubType.BEAST);
this.power = new MageInt(4);
this.toughness = new MageInt(2);
// Brackish Trudge enters the battlefield tapped.
this.addAbility(new EntersBattlefieldTappedAbility());
// {1}{B}: Return Brackish Trudge from your graveyard to your hand. Activate only if you gained life this turn.
this.addAbility(new ActivateIfConditionActivatedAbility(
Zone.GRAVEYARD, new ReturnSourceFromGraveyardToHandEffect(),
new ManaCostsImpl<>("{1}{B}"), condition
).addHint(hint), new PlayerGainedLifeWatcher());
}
private BrackishTrudge(final BrackishTrudge card) {
super(card);
}
@Override
public BrackishTrudge copy() {
return new BrackishTrudge(this);
}
}

View file

@ -52,6 +52,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
cards.add(new SetCardInfo("Blood Researcher", 166, Rarity.COMMON, mage.cards.b.BloodResearcher.class));
cards.add(new SetCardInfo("Blot Out the Sky", 167, Rarity.MYTHIC, mage.cards.b.BlotOutTheSky.class));
cards.add(new SetCardInfo("Body of Research", 168, Rarity.MYTHIC, mage.cards.b.BodyOfResearch.class));
cards.add(new SetCardInfo("Brackish Trudge", 65, Rarity.UNCOMMON, mage.cards.b.BrackishTrudge.class));
cards.add(new SetCardInfo("Burrog Befuddler", 38, Rarity.COMMON, mage.cards.b.BurrogBefuddler.class));
cards.add(new SetCardInfo("Bury in Books", 39, Rarity.COMMON, mage.cards.b.BuryInBooks.class));
cards.add(new SetCardInfo("Callous Bloodmage", 66, Rarity.RARE, mage.cards.c.CallousBloodmage.class));

View file

@ -17,16 +17,12 @@ public class YouGainedLifeCondition extends IntCompareCondition {
@Override
protected int getInputValue(Game game, Ability source) {
int gainedLife = 0;
PlayerGainedLifeWatcher watcher = game.getState().getWatcher(PlayerGainedLifeWatcher.class);
if (watcher != null) {
gainedLife = watcher.getLifeGained(source.getControllerId());
}
return gainedLife;
return watcher == null ? 0 : watcher.getLifeGained(source.getControllerId());
}
@Override
public String toString() {
return String.format("if you gained %s or more life this turn", value + 1);
return "if you gained " + (value == 0 ? "" : (value + 1) + " or more ") + "life this turn";
}
}