* Some minor changes.

This commit is contained in:
LevelX2 2015-02-01 16:47:21 +01:00
parent 47ca2bdc65
commit 2544c12d48
6 changed files with 23 additions and 14 deletions

View file

@ -940,7 +940,8 @@ public class GameController implements GameCallback {
private void sendMessage(UUID userId, Command command) { private void sendMessage(UUID userId, Command command) {
final UUID playerId = userPlayerMap.get(userId); final UUID playerId = userPlayerMap.get(userId);
// player has game under control (is not cotrolled by other player) // player has game under control (is not cotrolled by other player)
if (game.getPlayer(playerId).isGameUnderControl()) { Player player = game.getPlayer(playerId);
if (player != null && player.isGameUnderControl()) {
// if it's your priority (or game not started yet in which case it will be null) // if it's your priority (or game not started yet in which case it will be null)
// then execute only your action // then execute only your action
if (game.getPriorityPlayerId() == null || game.getPriorityPlayerId().equals(playerId)) { if (game.getPriorityPlayerId() == null || game.getPriorityPlayerId().equals(playerId)) {
@ -950,13 +951,10 @@ public class GameController implements GameCallback {
} }
} else { } else {
// otherwise execute the action under other player's control // otherwise execute the action under other player's control
Player player = game.getPlayer(playerId); for (UUID controlled : player.getPlayersUnderYourControl()) {
if (player != null) { if (gameSessions.containsKey(controlled) && game.getPriorityPlayerId().equals(controlled)) {
for (UUID controlled : player.getPlayersUnderYourControl()) { cancelTimeout();
if (gameSessions.containsKey(controlled) && game.getPriorityPlayerId().equals(controlled)) { command.execute(controlled);
cancelTimeout();
command.execute(controlled);
}
} }
} }
// else player has no priority to do something, so ignore the command // else player has no priority to do something, so ignore the command

View file

@ -109,7 +109,7 @@ class MistbindCliqueAbility extends ZoneChangeTriggeredAbility {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getSourceId() != null && event.getSourceId().equals(getSourceId())) { if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getSourceId() != null && event.getSourceId().equals(getSourceId())) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event; ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.EXILED) { if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.EXILED) {
if (zEvent.getTarget() != null && zEvent.getTarget().getSubtype().contains("Faerie")) { if (zEvent.getTarget() != null && zEvent.getTarget().hasSubtype("Faerie")) {
return true; return true;
} }
} }

View file

@ -48,6 +48,8 @@ public class GloriousAnthem extends CardImpl {
super(ownerId, 17, "Glorious Anthem", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}{W}"); super(ownerId, 17, "Glorious Anthem", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}{W}");
this.expansionSetCode = "10E"; this.expansionSetCode = "10E";
this.color.setWhite(true); this.color.setWhite(true);
// Creatures you control get +1/+1.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, new FilterCreaturePermanent(), false))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, new FilterCreaturePermanent(), false)));
} }

View file

@ -34,6 +34,7 @@ import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone; import mage.constants.Zone;
import mage.MageInt; import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
@ -149,12 +150,13 @@ class GoblinGuideEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player defender = game.getPlayer(getTargetPointer().getFirst(game, source)); Player defender = game.getPlayer(getTargetPointer().getFirst(game, source));
if (defender != null) { MageObject sourceObject = game.getObject(source.getSourceId());
if (sourceObject != null && defender != null) {
Cards cards = new CardsImpl(); Cards cards = new CardsImpl();
Card card = defender.getLibrary().getFromTop(game); Card card = defender.getLibrary().getFromTop(game);
if (card != null) { if (card != null) {
cards.add(card); cards.add(card);
defender.revealCards("Goblin Guide", cards, game); defender.revealCards(sourceObject.getLogName(), cards, game);
if (card.getCardType().contains(CardType.LAND)) { if (card.getCardType().contains(CardType.LAND)) {
defender.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY); defender.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
} }

View file

@ -22,9 +22,17 @@ public class MomentousFallTest extends CardTestPlayerBase {
public void testSacrificeCostAndLKI() { public void testSacrificeCostAndLKI() {
addCard(Zone.BATTLEFIELD, playerA, "Forest", 4); addCard(Zone.BATTLEFIELD, playerA, "Forest", 4);
addCard(Zone.HAND, playerA, "Momentous Fall"); addCard(Zone.HAND, playerA, "Momentous Fall");
// Geralf's Messenger enters the battlefield tapped.
// When Geralf's Messenger enters the battlefield, target opponent loses 2 life.
// Undying (When this creature dies, if it had no +1/+1 counters on it, return it to the battlefield under its owner's control with a +1/+1 counter on it.)
addCard(Zone.BATTLEFIELD, playerA, "Geralf's Messenger", 1); addCard(Zone.BATTLEFIELD, playerA, "Geralf's Messenger", 1);
// Creatures you control get +1/+1.
addCard(Zone.BATTLEFIELD, playerA, "Glorious Anthem", 1); addCard(Zone.BATTLEFIELD, playerA, "Glorious Anthem", 1);
// As an additional cost to cast Momentous Fall, sacrifice a creature.
// You draw cards equal to the sacrificed creature's power, then you gain life equal to its toughness.
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Momentous Fall"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Momentous Fall");
setStopAt(1, PhaseStep.BEGIN_COMBAT); setStopAt(1, PhaseStep.BEGIN_COMBAT);

View file

@ -1,19 +1,18 @@
package mage.abilities.keyword; package mage.abilities.keyword;
import java.util.UUID; import java.util.UUID;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.DiesTriggeredAbility; import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect; import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
/** /**
* @author Loki * @author Loki