mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 11:02:00 -08:00
fix Zombie Mob
This commit is contained in:
parent
b48e92a3df
commit
bfba6aefbc
1 changed files with 29 additions and 37 deletions
|
|
@ -1,27 +1,27 @@
|
||||||
|
|
||||||
package mage.cards.z;
|
package mage.cards.z;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldAbility;
|
import mage.abilities.common.EntersBattlefieldAbility;
|
||||||
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
|
import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||||
import mage.cards.*;
|
import mage.cards.*;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.StaticFilters;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
/**
|
import java.util.UUID;
|
||||||
*
|
|
||||||
* @author tcontis
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xenohedron
|
||||||
|
*/
|
||||||
public final class ZombieMob extends CardImpl {
|
public final class ZombieMob extends CardImpl {
|
||||||
|
|
||||||
public ZombieMob(UUID ownerId, CardSetInfo setInfo) {
|
public ZombieMob(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
|
@ -31,8 +31,12 @@ public final class ZombieMob extends CardImpl {
|
||||||
this.toughness = new MageInt(0);
|
this.toughness = new MageInt(0);
|
||||||
|
|
||||||
// Zombie Mob enters the battlefield with a +1/+1 counter on it for each creature card in your graveyard.
|
// Zombie Mob enters the battlefield with a +1/+1 counter on it for each creature card in your graveyard.
|
||||||
|
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(
|
||||||
|
CounterType.P1P1.createInstance(0), new CardsInControllerGraveyardCount(StaticFilters.FILTER_CARD_CREATURE), false
|
||||||
|
), "with a +1/+1 counter on it for each creature card in your graveyard"));
|
||||||
|
|
||||||
// When Zombie Mob enters the battlefield, exile all creature cards from your graveyard.
|
// When Zombie Mob enters the battlefield, exile all creature cards from your graveyard.
|
||||||
this.addAbility(new EntersBattlefieldAbility(new ZombieMobEffect(), "with a +1/+1 counter on it for each creature card in your graveyard. When {this} enters the battlefield, exile all creature cards from your graveyard."));
|
this.addAbility(new EntersBattlefieldTriggeredAbility(new ZombieMobExileEffect()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -46,42 +50,30 @@ public final class ZombieMob extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ZombieMobEffect extends OneShotEffect {
|
class ZombieMobExileEffect extends OneShotEffect {
|
||||||
|
|
||||||
private static final FilterCard filter = new FilterCard();
|
ZombieMobExileEffect() {
|
||||||
static {
|
super(Outcome.Benefit);
|
||||||
filter.add(CardType.CREATURE.getPredicate());
|
staticText = "exile all creature cards from your graveyard";
|
||||||
}
|
}
|
||||||
|
|
||||||
public ZombieMobEffect() {
|
private ZombieMobExileEffect(final ZombieMobExileEffect effect) {
|
||||||
super(Outcome.BoostCreature);
|
|
||||||
staticText = "{this} enters the battlefield with a +1/+1 counter on it for each creature card in your graveyard. When {this} enters the battlefield, exile all creature cards from your graveyard.";
|
|
||||||
}
|
|
||||||
|
|
||||||
private ZombieMobEffect(final ZombieMobEffect effect) {
|
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ZombieMobExileEffect copy() {
|
||||||
|
return new ZombieMobExileEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
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());
|
||||||
Permanent permanent = game.getPermanentEntering(source.getSourceId());
|
if (controller == null) {
|
||||||
if (permanent != null && controller != null) {
|
return false;
|
||||||
int amount = 0;
|
|
||||||
amount += controller.getGraveyard().count(filter, game);
|
|
||||||
if (amount > 0) {
|
|
||||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), source.getControllerId(), source, game);
|
|
||||||
}
|
|
||||||
Cards cards = new CardsImpl(controller.getGraveyard().getCards(filter, game));
|
|
||||||
controller.moveCards(cards, Zone.EXILED, source, game);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
Cards cards = new CardsImpl(controller.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game));
|
||||||
|
controller.moveCards(cards, Zone.EXILED, source, game);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ZombieMobEffect copy() {
|
|
||||||
return new ZombieMobEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue