mirror of
https://github.com/correl/mage.git
synced 2025-03-12 17:00:08 -09:00
* Lion's Eye Diamond - Fixed that it now only can be cast at the time an instant spell could be cast.
This commit is contained in:
parent
c958a1af25
commit
8d8a2074f0
5 changed files with 40 additions and 2 deletions
|
@ -1007,9 +1007,16 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
log.debug("findPlayables: " + playableInstant.toString() + "---" + playableNonInstant.toString() + "---" + playableAbilities.toString() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean playMana(ManaCost unpaid, Game game) {
|
||||
payManaMode = true;
|
||||
boolean result = playManaHandling(unpaid, game);
|
||||
payManaMode = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
protected boolean playManaHandling(ManaCost unpaid, Game game) {
|
||||
// log.info("paying for " + unpaid.getText());
|
||||
ManaCost cost;
|
||||
List<Permanent> producers;
|
||||
|
|
|
@ -604,8 +604,17 @@ public class HumanPlayer extends PlayerImpl {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean playMana(ManaCost unpaid, Game game) {
|
||||
payManaMode = true;
|
||||
boolean result = playManaHandling(unpaid, game);
|
||||
payManaMode = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
protected boolean playManaHandling(ManaCost unpaid, Game game) {
|
||||
updateGameStatePriority("playMana", game);
|
||||
game.firePlayManaEvent(playerId, "Pay " + unpaid.getText());
|
||||
waitForResponse(game);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
|
@ -39,6 +39,8 @@ import mage.cards.CardImpl;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -82,6 +84,15 @@ class LionsEyeDiamondAbility extends ManaAbility {
|
|||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canActivate(UUID playerId, Game game) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null && !player.isInPayManaMode()) {
|
||||
return super.canActivate(playerId, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LionsEyeDiamondAbility copy() {
|
||||
return new LionsEyeDiamondAbility(this);
|
||||
|
|
|
@ -529,4 +529,6 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
boolean isRequestToShowHandCardsAllowed();
|
||||
Set<UUID> getUsersAllowedToSeeHandCards();
|
||||
|
||||
boolean isInPayManaMode();
|
||||
|
||||
}
|
||||
|
|
|
@ -225,6 +225,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
|
||||
// indicates that a sourceId will be cast without paying mana
|
||||
protected UUID castSourceIdWithoutMana;
|
||||
// indicates that the player is in mana payment phase
|
||||
protected boolean payManaMode = false;
|
||||
|
||||
protected UserData userData;
|
||||
|
||||
|
@ -321,6 +323,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
this.reachedNextTurnAfterLeaving = player.reachedNextTurnAfterLeaving;
|
||||
|
||||
this.castSourceIdWithoutMana = player.castSourceIdWithoutMana;
|
||||
this.payManaMode = player.payManaMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -434,6 +437,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
this.canGainLife = true;
|
||||
this.canLoseLife = true;
|
||||
this.topCardRevealed = false;
|
||||
this.payManaMode = false;
|
||||
this.setLife(game.getLife(), game);
|
||||
this.setReachedNextTurnAfterLeaving(false);
|
||||
game.getState().getWatchers().add(new BloodthirstWatcher(playerId));
|
||||
|
@ -904,6 +908,11 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
return castSourceIdWithoutMana;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInPayManaMode() {
|
||||
return payManaMode;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean cast(SpellAbility ability, Game game, boolean noMana) {
|
||||
|
|
Loading…
Add table
Reference in a new issue