mirror of
https://github.com/correl/mage.git
synced 2024-12-25 19:25:41 +00:00
fixed issues with Gavi, Nest Warden
This commit is contained in:
parent
e520226962
commit
a91b210456
1 changed files with 14 additions and 15 deletions
|
@ -2,11 +2,9 @@ package mage.cards.g;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
|
||||||
import mage.abilities.common.DrawSecondCardTriggeredAbility;
|
import mage.abilities.common.DrawSecondCardTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
import mage.abilities.effects.Effect;
|
|
||||||
import mage.abilities.effects.common.CreateTokenEffect;
|
import mage.abilities.effects.common.CreateTokenEffect;
|
||||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||||
import mage.abilities.keyword.CyclingAbility;
|
import mage.abilities.keyword.CyclingAbility;
|
||||||
|
@ -16,6 +14,7 @@ import mage.constants.*;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.permanent.token.DinosaurCatToken;
|
import mage.game.permanent.token.DinosaurCatToken;
|
||||||
|
import mage.players.Player;
|
||||||
import mage.watchers.Watcher;
|
import mage.watchers.Watcher;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -23,14 +22,13 @@ import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author htrajan
|
* @author htrajan
|
||||||
*/
|
*/
|
||||||
public final class GaviNestWarden extends CardImpl {
|
public final class GaviNestWarden extends CardImpl {
|
||||||
|
|
||||||
public GaviNestWarden(UUID ownerId, CardSetInfo setInfo) {
|
public GaviNestWarden(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{R}{W}");
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{R}{W}");
|
||||||
|
|
||||||
this.addSuperType(SuperType.LEGENDARY);
|
this.addSuperType(SuperType.LEGENDARY);
|
||||||
this.subtype.add(SubType.HUMAN);
|
this.subtype.add(SubType.HUMAN);
|
||||||
this.subtype.add(SubType.SHAMAN);
|
this.subtype.add(SubType.SHAMAN);
|
||||||
|
@ -38,12 +36,10 @@ public final class GaviNestWarden extends CardImpl {
|
||||||
this.toughness = new MageInt(5);
|
this.toughness = new MageInt(5);
|
||||||
|
|
||||||
// You may pay {0} rather than pay the cycling cost of the first card you cycle each turn.
|
// You may pay {0} rather than pay the cycling cost of the first card you cycle each turn.
|
||||||
Effect effect = new CyclingZeroCostEffect();
|
this.addAbility(new SimpleStaticAbility(new CyclingZeroCostEffect()), new GaviNestWardenWatcher());
|
||||||
this.addAbility(new SimpleStaticAbility(effect), new GaviNestWardenWatcher());
|
|
||||||
|
|
||||||
// Whenever you draw your second card each turn, create a 2/2 red and white Dinosaur Cat creature token.
|
// Whenever you draw your second card each turn, create a 2/2 red and white Dinosaur Cat creature token.
|
||||||
Ability ability = new DrawSecondCardTriggeredAbility(new CreateTokenEffect(new DinosaurCatToken()), false);
|
this.addAbility(new DrawSecondCardTriggeredAbility(new CreateTokenEffect(new DinosaurCatToken()), false));
|
||||||
this.addAbility(ability);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private GaviNestWarden(final GaviNestWarden card) {
|
private GaviNestWarden(final GaviNestWarden card) {
|
||||||
|
@ -58,11 +54,10 @@ public final class GaviNestWarden extends CardImpl {
|
||||||
|
|
||||||
class GaviNestWardenWatcher extends Watcher {
|
class GaviNestWardenWatcher extends Watcher {
|
||||||
|
|
||||||
private final Map<UUID, Integer> playerCyclingActivations;
|
private final Map<UUID, Integer> playerCyclingActivations = new HashMap<>();
|
||||||
|
|
||||||
public GaviNestWardenWatcher() {
|
GaviNestWardenWatcher() {
|
||||||
super(WatcherScope.GAME);
|
super(WatcherScope.GAME);
|
||||||
playerCyclingActivations = new HashMap<>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -72,7 +67,7 @@ class GaviNestWardenWatcher extends Watcher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int cyclingActivationsThisTurn(UUID playerId) {
|
int cyclingActivationsThisTurn(UUID playerId) {
|
||||||
return playerCyclingActivations.getOrDefault(playerId, 0);
|
return playerCyclingActivations.getOrDefault(playerId, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,19 +80,23 @@ class GaviNestWardenWatcher extends Watcher {
|
||||||
|
|
||||||
class CyclingZeroCostEffect extends CostModificationEffectImpl {
|
class CyclingZeroCostEffect extends CostModificationEffectImpl {
|
||||||
|
|
||||||
|
CyclingZeroCostEffect() {
|
||||||
public CyclingZeroCostEffect() {
|
|
||||||
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.SET_COST);
|
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.SET_COST);
|
||||||
staticText = "You may pay {0} rather than pay the cycling cost of the first card you cycle each turn.";
|
staticText = "You may pay {0} rather than pay the cycling cost of the first card you cycle each turn.";
|
||||||
}
|
}
|
||||||
|
|
||||||
public CyclingZeroCostEffect(CyclingZeroCostEffect effect) {
|
private CyclingZeroCostEffect(CyclingZeroCostEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||||
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
|
if (player == null || !player.chooseUse(outcome, "Pay {0} to cycle this card?", source, game)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
abilityToModify.getManaCostsToPay().clear();
|
abilityToModify.getManaCostsToPay().clear();
|
||||||
|
abilityToModify.getCosts().clear();
|
||||||
abilityToModify.getManaCostsToPay().add(new GenericManaCost(0));
|
abilityToModify.getManaCostsToPay().add(new GenericManaCost(0));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue