mirror of
https://github.com/correl/mage.git
synced 2025-04-02 03:18:09 -09:00
[J22] Implement Magnanimous Magistrate
This commit is contained in:
parent
20e3088c8f
commit
26f9f63e78
3 changed files with 104 additions and 0 deletions
Mage.Sets/src/mage
Mage/src/main/java/mage/counters
102
Mage.Sets/src/mage/cards/m/MagnanimousMagistrate.java
Normal file
102
Mage.Sets/src/mage/cards/m/MagnanimousMagistrate.java
Normal file
|
@ -0,0 +1,102 @@
|
|||
package mage.cards.m;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DiesCreatureTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.AnotherPredicate;
|
||||
import mage.filter.predicate.mageobject.ManaValuePredicate;
|
||||
import mage.filter.predicate.permanent.TokenPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class MagnanimousMagistrate extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter
|
||||
= new FilterControlledCreaturePermanent("another nontoken creature you control");
|
||||
|
||||
static {
|
||||
filter.add(AnotherPredicate.instance);
|
||||
filter.add(TokenPredicate.FALSE);
|
||||
filter.add(new ManaValuePredicate(ComparisonType.MORE_THAN, 0));
|
||||
}
|
||||
|
||||
public MagnanimousMagistrate(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{W}");
|
||||
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.ADVISOR);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// Magnanimous Magistrate enters the battlefield with five reprieve counters on it.
|
||||
this.addAbility(new EntersBattlefieldAbility(
|
||||
new AddCountersSourceEffect(CounterType.REPRIEVE.createInstance(5)),
|
||||
"with five reprieve counters on it"
|
||||
));
|
||||
|
||||
// Whenever another nontoken creature you control dies, if its mana value was 1 or greater, you may remove that many reprieve counters from Magnanimous Magistrate. If you do, return that card to the battlefield under its owner's control.
|
||||
this.addAbility(new DiesCreatureTriggeredAbility(new MagnanimousMagistrateEffect(), false, filter));
|
||||
}
|
||||
|
||||
private MagnanimousMagistrate(final MagnanimousMagistrate card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MagnanimousMagistrate copy() {
|
||||
return new MagnanimousMagistrate(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MagnanimousMagistrateEffect extends OneShotEffect {
|
||||
|
||||
MagnanimousMagistrateEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "if its mana value was 1 or greater, you may remove that many reprieve counters " +
|
||||
"from {this}. If you do, return that card to the battlefield under its owner's control";
|
||||
}
|
||||
|
||||
private MagnanimousMagistrateEffect(final MagnanimousMagistrateEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MagnanimousMagistrateEffect copy() {
|
||||
return new MagnanimousMagistrateEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
|
||||
Permanent creature = (Permanent) getValue("creatureDied");
|
||||
if (player == null || sourcePermanent == null || creature == null
|
||||
|| sourcePermanent.getCounters(game).getCount(CounterType.REPRIEVE) < creature.getManaValue()
|
||||
|| game.getState().getZoneChangeCounter(creature.getId()) != creature.getZoneChangeCounter(game) + 1
|
||||
|| !player.chooseUse(outcome, "Remove " + creature.getManaValue() +
|
||||
" reprieve counters from " + sourcePermanent.getName() + '?', source, game)) {
|
||||
return false;
|
||||
}
|
||||
sourcePermanent.removeCounters(CounterType.REPRIEVE.createInstance(creature.getManaValue()), source, game);
|
||||
player.moveCards(
|
||||
game.getCard(creature.getId()), Zone.BATTLEFIELD, source, game,
|
||||
false, false, true, null
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -445,6 +445,7 @@ public final class Jumpstart2022 extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Maalfeld Twins", 438, Rarity.COMMON, mage.cards.m.MaalfeldTwins.class));
|
||||
cards.add(new SetCardInfo("Mad Ratter", 570, Rarity.UNCOMMON, mage.cards.m.MadRatter.class));
|
||||
cards.add(new SetCardInfo("Magmatic Channeler", 571, Rarity.RARE, mage.cards.m.MagmaticChanneler.class));
|
||||
cards.add(new SetCardInfo("Magnanimous Magistrate", 7, Rarity.UNCOMMON, mage.cards.m.MagnanimousMagistrate.class));
|
||||
cards.add(new SetCardInfo("Magnifying Glass", 95, Rarity.UNCOMMON, mage.cards.m.MagnifyingGlass.class));
|
||||
cards.add(new SetCardInfo("Make a Stand", 211, Rarity.UNCOMMON, mage.cards.m.MakeAStand.class));
|
||||
cards.add(new SetCardInfo("Mammoth Spider", 687, Rarity.COMMON, mage.cards.m.MammothSpider.class));
|
||||
|
|
|
@ -161,6 +161,7 @@ public enum CounterType {
|
|||
PUPA("pupa"),
|
||||
REACH("reach"),
|
||||
REPAIR("repair"),
|
||||
REPRIEVE("reprieve"),
|
||||
RITUAL("ritual"),
|
||||
ROPE("rope"),
|
||||
RUST("rust"),
|
||||
|
|
Loading…
Add table
Reference in a new issue