mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
* Look at card abilities -- improved dialog (now it's shown that card have extra abilities to call on "no" button);
This commit is contained in:
parent
00915c65d7
commit
e49be97879
5 changed files with 28 additions and 21 deletions
|
@ -934,24 +934,27 @@ public class HumanPlayer extends PlayerImpl {
|
|||
if (object != null) {
|
||||
Zone zone = game.getState().getZone(object.getId());
|
||||
if (zone != null) {
|
||||
// look at card or try to cast/activate abilities
|
||||
Player actingPlayer = null;
|
||||
LinkedHashMap<UUID, ActivatedAbility> useableAbilities = null;
|
||||
if (playerId.equals(game.getPriorityPlayerId())) {
|
||||
actingPlayer = this;
|
||||
} else if (getPlayersUnderYourControl().contains(game.getPriorityPlayerId())) {
|
||||
actingPlayer = game.getPlayer(game.getPriorityPlayerId());
|
||||
}
|
||||
if (actingPlayer != null) {
|
||||
useableAbilities = actingPlayer.getUseableActivatedAbilities(object, zone, game);
|
||||
}
|
||||
|
||||
if (object instanceof Card
|
||||
&& ((Card) object).isFaceDown(game)
|
||||
&& lookAtFaceDownCard((Card) object, game)) {
|
||||
&& lookAtFaceDownCard((Card) object, game, useableAbilities == null ? 0 : useableAbilities.size())) {
|
||||
result = true;
|
||||
} else {
|
||||
Player actingPlayer = null;
|
||||
if (playerId.equals(game.getPriorityPlayerId())) {
|
||||
actingPlayer = this;
|
||||
} else if (getPlayersUnderYourControl().contains(game.getPriorityPlayerId())) {
|
||||
actingPlayer = game.getPlayer(game.getPriorityPlayerId());
|
||||
}
|
||||
if (actingPlayer != null) {
|
||||
LinkedHashMap<UUID, ActivatedAbility> useableAbilities = actingPlayer.getUseableActivatedAbilities(object, zone, game);
|
||||
if (useableAbilities != null
|
||||
&& !useableAbilities.isEmpty()) {
|
||||
activateAbility(useableAbilities, object, game);
|
||||
result = true;
|
||||
}
|
||||
if (useableAbilities != null
|
||||
&& !useableAbilities.isEmpty()) {
|
||||
activateAbility(useableAbilities, object, game);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2864,8 +2864,8 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean lookAtFaceDownCard(Card card, Game game) {
|
||||
return computerPlayer.lookAtFaceDownCard(card, game);
|
||||
public boolean lookAtFaceDownCard(Card card, Game game, int abilitiesToActivate) {
|
||||
return computerPlayer.lookAtFaceDownCard(card, game, abilitiesToActivate);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1092,7 +1092,7 @@ public class PlayerStub implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean lookAtFaceDownCard(Card card, Game game) {
|
||||
public boolean lookAtFaceDownCard(Card card, Game game, int abilitiesToActivate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -654,9 +654,10 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
*
|
||||
* @param card
|
||||
* @param game
|
||||
* @param abilitiesToActivate extra info about abilities that can be activated on NO option
|
||||
* @return player looked at the card
|
||||
*/
|
||||
boolean lookAtFaceDownCard(Card card, Game game);
|
||||
boolean lookAtFaceDownCard(Card card, Game game, int abilitiesToActivate);
|
||||
|
||||
/**
|
||||
* Set seconds left to play the game.
|
||||
|
|
|
@ -3458,10 +3458,13 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean lookAtFaceDownCard(Card card, Game game
|
||||
) {
|
||||
public boolean lookAtFaceDownCard(Card card, Game game, int abilitiesToActivate) {
|
||||
if (null != game.getContinuousEffects().asThough(card.getId(), AsThoughEffectType.LOOK_AT_FACE_DOWN, card.getSpellAbility(), this.getId(), game)) {
|
||||
if (chooseUse(Outcome.Benefit, "Look at that card?", null, game)) {
|
||||
// two modes: look at card or not to look and activate other abilities
|
||||
String lookMessage = abilitiesToActivate > 0 ? "Look at that card (it's have " + abilitiesToActivate + " abilities to activate)?" : "Look at that card?";
|
||||
String lookYes = "Yes, look at card";
|
||||
String lookNo = abilitiesToActivate > 0 ? "No, activate ability" : "No";
|
||||
if (chooseUse(Outcome.Benefit, lookMessage, "", lookYes, lookNo, null, game)) {
|
||||
Cards cards = new CardsImpl(card);
|
||||
this.lookAtCards(getName() + " - " + sdf.format(System.currentTimeMillis()), cards, game);
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue