mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
[GNT] implemented Militant Angel
This commit is contained in:
parent
209bccef0c
commit
9986c1d365
6 changed files with 186 additions and 10 deletions
|
@ -7,15 +7,12 @@ import mage.abilities.costs.mana.ManaCostsImpl;
|
|||
import mage.abilities.dynamicvalue.common.OpponentsCount;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.keyword.FlashAbility;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.game.permanent.token.ThopterColorlessToken;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -25,12 +22,6 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class InspiredSphinx extends CardImpl {
|
||||
|
||||
private static final FilterSpell filter = new FilterSpell("Wizard");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate(SubType.WIZARD));
|
||||
}
|
||||
|
||||
public InspiredSphinx(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{U}{U}");
|
||||
this.subtype.add(SubType.SPHINX);
|
||||
|
|
49
Mage.Sets/src/mage/cards/m/MilitantAngel.java
Normal file
49
Mage.Sets/src/mage/cards/m/MilitantAngel.java
Normal file
|
@ -0,0 +1,49 @@
|
|||
package mage.cards.m;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.common.AttackedThisTurnOpponentsCount;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.keyword.LifelinkAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.permanent.token.KnightToken;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
*/
|
||||
public final class MilitantAngel extends CardImpl {
|
||||
|
||||
public MilitantAngel(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}{W}");
|
||||
this.subtype.add(SubType.ANGEL);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// Lifelink
|
||||
this.addAbility(LifelinkAbility.getInstance());
|
||||
|
||||
// When Militant Angel enters the battlefield, create a number of 2/2 white Knight creature tokens with vigilance equal to the number of opponents you attacked this turn.
|
||||
Effect effect = new CreateTokenEffect(new KnightToken(), new AttackedThisTurnOpponentsCount());
|
||||
effect.setText("create a number of 2/2 white Knight creature tokens with vigilance equal to the number of opponents you attacked this turn");
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(effect));
|
||||
}
|
||||
|
||||
public MilitantAngel(final MilitantAngel card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MilitantAngel copy() {
|
||||
return new MilitantAngel(this);
|
||||
}
|
||||
}
|
|
@ -59,7 +59,7 @@ public final class GameNight extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Lord of the Accursed", 33, Rarity.UNCOMMON, mage.cards.l.LordOfTheAccursed.class));
|
||||
cards.add(new SetCardInfo("Manalith", 54, Rarity.COMMON, mage.cards.m.Manalith.class));
|
||||
cards.add(new SetCardInfo("Mesa Unicorn", 15, Rarity.COMMON, mage.cards.m.MesaUnicorn.class));
|
||||
// TODO: cards.add(new SetCardInfo("Militant Angel", 1, Rarity.MYTHIC, mage.cards.m.MilitantAngel.class));
|
||||
cards.add(new SetCardInfo("Militant Angel", 1, Rarity.MYTHIC, mage.cards.m.MilitantAngel.class));
|
||||
cards.add(new SetCardInfo("Mountain", 65, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Mountain", 66, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Nissa's Revelation", 47, Rarity.RARE, mage.cards.n.NissasRevelation.class));
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
|
||||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.game.Game;
|
||||
import mage.watchers.common.PlayersAttackedThisTurnWatcher;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
*/
|
||||
public class AttackedThisTurnOpponentsCount implements DynamicValue {
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
return this.calculate(game, sourceAbility.getControllerId());
|
||||
}
|
||||
|
||||
public int calculate(Game game, UUID controllerId) {
|
||||
PlayersAttackedThisTurnWatcher watcher = (PlayersAttackedThisTurnWatcher) game.getState().getWatchers().get(PlayersAttackedThisTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
return watcher.getAttackedOpponentsCount(controllerId);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttackedThisTurnOpponentsCount copy() {
|
||||
return new AttackedThisTurnOpponentsCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "1";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "the number of opponents you attacked this turn";
|
||||
}
|
||||
}
|
|
@ -1026,6 +1026,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
watchers.add(new BlockedAttackerWatcher());
|
||||
watchers.add(new DamageDoneWatcher());
|
||||
watchers.add(new PlanarRollWatcher());
|
||||
watchers.add(new PlayersAttackedThisTurnWatcher());
|
||||
|
||||
//20100716 - 103.5
|
||||
for (UUID playerId : state.getPlayerList(startingPlayerId)) {
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
package mage.watchers.common;
|
||||
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.players.PlayerList;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
*/
|
||||
public class PlayersAttackedThisTurnWatcher extends Watcher {
|
||||
|
||||
// how many players or opponents each player attacked this turn
|
||||
private final Map<UUID, PlayerList> playersAttackedThisTurn = new HashMap<>();
|
||||
private final Map<UUID, PlayerList> opponentsAttackedThisTurn = new HashMap<>();
|
||||
|
||||
public PlayersAttackedThisTurnWatcher() {
|
||||
super(PlayersAttackedThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public PlayersAttackedThisTurnWatcher(final PlayersAttackedThisTurnWatcher watcher) {
|
||||
super(watcher);
|
||||
|
||||
for (Map.Entry<UUID, PlayerList> entry : watcher.playersAttackedThisTurn.entrySet()) {
|
||||
this.playersAttackedThisTurn.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
for (Map.Entry<UUID, PlayerList> entry : watcher.opponentsAttackedThisTurn.entrySet()) {
|
||||
this.opponentsAttackedThisTurn.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayersAttackedThisTurnWatcher copy() {
|
||||
return new PlayersAttackedThisTurnWatcher(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.BEGINNING_PHASE_PRE) {
|
||||
playersAttackedThisTurn.clear();
|
||||
opponentsAttackedThisTurn.clear();
|
||||
}
|
||||
|
||||
if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED) {
|
||||
|
||||
// players
|
||||
PlayerList playersAttacked = playersAttackedThisTurn.get(event.getPlayerId());
|
||||
if (playersAttacked == null) {
|
||||
playersAttacked = new PlayerList();
|
||||
}
|
||||
UUID playerDefender = game.getCombat().getDefendingPlayerId(event.getSourceId(), game);
|
||||
if (playerDefender != null) {
|
||||
playersAttacked.add(playerDefender);
|
||||
}
|
||||
playersAttackedThisTurn.put(event.getPlayerId(), playersAttacked);
|
||||
|
||||
// opponents
|
||||
PlayerList opponentsAttacked = opponentsAttackedThisTurn.get(event.getPlayerId());
|
||||
if (opponentsAttacked == null) {
|
||||
opponentsAttacked = new PlayerList();
|
||||
}
|
||||
UUID opponentDefender = game.getCombat().getDefendingPlayerId(event.getSourceId(), game);
|
||||
if (opponentDefender != null && game.getOpponents(event.getPlayerId()).contains(opponentDefender)) {
|
||||
opponentsAttacked.add(opponentDefender);
|
||||
}
|
||||
opponentsAttackedThisTurn.put(event.getPlayerId(), opponentsAttacked);
|
||||
}
|
||||
}
|
||||
|
||||
public int getAttackedPlayersCount(UUID playerID) {
|
||||
PlayerList defendersList = playersAttackedThisTurn.getOrDefault(playerID, null);
|
||||
if (defendersList != null) {
|
||||
return defendersList.size();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getAttackedOpponentsCount(UUID playerID) {
|
||||
PlayerList defendersList = opponentsAttackedThisTurn.getOrDefault(playerID, null);
|
||||
if (defendersList != null) {
|
||||
return defendersList.size();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue