mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Add zombie count hint to The Scarab God
This commit is contained in:
parent
7b69628da2
commit
3692e05dac
1 changed files with 16 additions and 9 deletions
|
@ -11,10 +11,14 @@ import mage.abilities.common.DiesSourceTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
|
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
|
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
|
||||||
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
||||||
|
import mage.abilities.hint.Hint;
|
||||||
|
import mage.abilities.hint.ValueHint;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
|
@ -37,6 +41,12 @@ import mage.target.targetpointer.FixedTarget;
|
||||||
*/
|
*/
|
||||||
public final class TheScarabGod extends CardImpl {
|
public final class TheScarabGod extends CardImpl {
|
||||||
|
|
||||||
|
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent(SubType.ZOMBIE, "Zombies you control");
|
||||||
|
private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(filter, null);
|
||||||
|
private static final Hint hint = new ValueHint(
|
||||||
|
"Number of Zombies you control", xValue
|
||||||
|
);
|
||||||
|
|
||||||
public TheScarabGod(UUID ownerId, CardSetInfo setInfo) {
|
public TheScarabGod(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{B}");
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{B}");
|
||||||
|
|
||||||
|
@ -46,7 +56,7 @@ public final class TheScarabGod extends CardImpl {
|
||||||
this.toughness = new MageInt(5);
|
this.toughness = new MageInt(5);
|
||||||
|
|
||||||
// At the beginning of your upkeep, each opponent loses X life and you scry X, where X is the number of Zombies you control.
|
// At the beginning of your upkeep, each opponent loses X life and you scry X, where X is the number of Zombies you control.
|
||||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new TheScarabGodEffect(), TargetController.YOU, false));
|
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new TheScarabGodEffect(xValue), TargetController.YOU, false).addHint(hint));
|
||||||
|
|
||||||
// {2}{U}{B}: Exile target creature card from a graveyard. Create a token that's a copy of it, except it's a 4/4 black Zombie.
|
// {2}{U}{B}: Exile target creature card from a graveyard. Create a token that's a copy of it, except it's a 4/4 black Zombie.
|
||||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TheScarabGodEffect2(), new ManaCostsImpl<>("{2}{U}{B}"));
|
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TheScarabGodEffect2(), new ManaCostsImpl<>("{2}{U}{B}"));
|
||||||
|
@ -69,19 +79,17 @@ public final class TheScarabGod extends CardImpl {
|
||||||
|
|
||||||
class TheScarabGodEffect extends OneShotEffect {
|
class TheScarabGodEffect extends OneShotEffect {
|
||||||
|
|
||||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped Zombies you control");
|
private final DynamicValue numOfZombies;
|
||||||
|
|
||||||
static {
|
public TheScarabGodEffect(DynamicValue numOfZombies) {
|
||||||
filter.add(SubType.ZOMBIE.getPredicate());
|
|
||||||
}
|
|
||||||
|
|
||||||
public TheScarabGodEffect() {
|
|
||||||
super(Outcome.Benefit);
|
super(Outcome.Benefit);
|
||||||
|
this.numOfZombies = numOfZombies;
|
||||||
staticText = "each opponent loses X life and you scry X, where X is the number of Zombies you control";
|
staticText = "each opponent loses X life and you scry X, where X is the number of Zombies you control";
|
||||||
}
|
}
|
||||||
|
|
||||||
public TheScarabGodEffect(final TheScarabGodEffect effect) {
|
public TheScarabGodEffect(final TheScarabGodEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
|
this.numOfZombies = effect.numOfZombies;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -93,8 +101,7 @@ class TheScarabGodEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
int numZombies = game.getBattlefield().countAll(filter, source.getControllerId(), game);
|
int numZombies = numOfZombies.calculate(game, source, this);
|
||||||
|
|
||||||
if (numZombies > 0) {
|
if (numZombies > 0) {
|
||||||
for (UUID playerId : game.getOpponents(source.getControllerId())) {
|
for (UUID playerId : game.getOpponents(source.getControllerId())) {
|
||||||
Player opponent = game.getPlayer(playerId);
|
Player opponent = game.getPlayer(playerId);
|
||||||
|
|
Loading…
Reference in a new issue