Merge pull request #9402 from weirddan455/raven-man

[DMU] Implemented The Raven Man
This commit is contained in:
Daniel Bomar 2022-08-23 10:09:36 -05:00 committed by GitHub
commit 356091c750
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 131 additions and 0 deletions

View file

@ -0,0 +1,59 @@
package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.condition.common.PlayerDiscardedThisTurnCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.discard.DiscardEachPlayerEffect;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TargetController;
import mage.game.permanent.token.BlackBirdToken;
import mage.watchers.common.DiscardedCardWatcher;
/**
*
* @author weirddan455
*/
public final class TheRavenMan extends CardImpl {
public TheRavenMan(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// At the beginning of each end step, if a player discarded a card this turn, create a 1/1 black Bird creature token with flying and "This creature can't block."
this.addAbility(new BeginningOfEndStepTriggeredAbility(
new CreateTokenEffect(new BlackBirdToken()),
TargetController.ANY,
PlayerDiscardedThisTurnCondition.instance,
false
), new DiscardedCardWatcher());
// {3}{B}, {T}: Each opponent discards a card. Activate only as a sorcery.
Ability ability = new ActivateAsSorceryActivatedAbility(new DiscardEachPlayerEffect(TargetController.OPPONENT), new ManaCostsImpl<>("{3}{B}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}
private TheRavenMan(final TheRavenMan card) {
super(card);
}
@Override
public TheRavenMan copy() {
return new TheRavenMan(this);
}
}

View file

@ -97,6 +97,7 @@ public final class DominariaUnited extends ExpansionSet {
cards.add(new SetCardInfo("Tattered Apparition", 111, Rarity.COMMON, mage.cards.t.TatteredApparition.class));
cards.add(new SetCardInfo("Temporal Firestorm", 147, Rarity.RARE, mage.cards.t.TemporalFirestorm.class));
cards.add(new SetCardInfo("Territorial Maro", 184, Rarity.UNCOMMON, mage.cards.t.TerritorialMaro.class));
cards.add(new SetCardInfo("The Raven Man", 103, Rarity.RARE, mage.cards.t.TheRavenMan.class));
cards.add(new SetCardInfo("Threats Undetected", 185, Rarity.RARE, mage.cards.t.ThreatsUndetected.class));
cards.add(new SetCardInfo("Timeless Lotus", 239, Rarity.MYTHIC, mage.cards.t.TimelessLotus.class));
cards.add(new SetCardInfo("Tolarian Geyser", 71, Rarity.COMMON, mage.cards.t.TolarianGeyser.class));

View file

@ -0,0 +1,24 @@
package mage.abilities.condition.common;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.game.Game;
import mage.watchers.common.DiscardedCardWatcher;
/**
*
* @author weirddan455
*/
public enum PlayerDiscardedThisTurnCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
return DiscardedCardWatcher.playerInRangeDiscarded(source.getControllerId(), game);
}
@Override
public String toString() {
return "a player discarded a card this turn";
}
}

View file

@ -0,0 +1,35 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.abilities.common.CantBlockAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.constants.CardType;
import mage.constants.SubType;
/**
*
* @author weirddan455
*/
public final class BlackBirdToken extends TokenImpl {
public BlackBirdToken() {
super("Bird Token", "1/1 black Bird creature token with flying and \"This creature can't block.\"");
cardType.add(CardType.CREATURE);
color.setBlack(true);
subtype.add(SubType.BIRD);
power = new MageInt(1);
toughness = new MageInt(1);
addAbility(FlyingAbility.getInstance());
addAbility(new CantBlockAbility());
}
private BlackBirdToken(final BlackBirdToken token) {
super(token);
}
@Override
public BlackBirdToken copy() {
return new BlackBirdToken(this);
}
}

View file

@ -43,4 +43,16 @@ public class DiscardedCardWatcher extends Watcher {
DiscardedCardWatcher watcher = game.getState().getWatcher(DiscardedCardWatcher.class);
return watcher == null ? 0 : watcher.playerMap.getOrDefault(playerId, 0);
}
public static boolean playerInRangeDiscarded(UUID controllerId, Game game) {
DiscardedCardWatcher watcher = game.getState().getWatcher(DiscardedCardWatcher.class);
if (watcher != null) {
for (UUID playerId : game.getState().getPlayersInRange(controllerId, game)) {
if (watcher.playerMap.getOrDefault(playerId, 0) > 0) {
return true;
}
}
}
return false;
}
}