mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
- Fixed #8001
This commit is contained in:
parent
db1792468c
commit
d334504131
1 changed files with 42 additions and 30 deletions
|
@ -1537,9 +1537,9 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return spells for possible cast
|
||||
* Uses in GUI to show only playable spells for choosing from the card
|
||||
* (example: effect allow to cast card and player must choose the spell ability)
|
||||
* Return spells for possible cast Uses in GUI to show only playable spells
|
||||
* for choosing from the card (example: effect allow to cast card and player
|
||||
* must choose the spell ability)
|
||||
*
|
||||
* @param playerId
|
||||
* @param object
|
||||
|
@ -1622,6 +1622,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
|
||||
// workaround to find all abilities first and filter it for one object
|
||||
List<ActivatedAbility> allPlayable = getPlayable(game, true, zone, false);
|
||||
System.out.println("PlayerImpl : (getPlayableActivatedAbilities) " + allPlayable);
|
||||
System.out.println("PlayerImpl : (getPlayableActivatedAbilities) If last line is empty, then nothing returned. If not, useable should have something in it! ");
|
||||
for (ActivatedAbility ability : allPlayable) {
|
||||
if (needIds.contains(ability.getSourceId())) {
|
||||
useable.putIfAbsent(ability.getId(), ability);
|
||||
|
@ -2761,7 +2763,6 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
|
||||
// AI NOTICE: if you want AI implement here then remove selected card from castable after each
|
||||
// choice (otherwise you catch infinite freeze on uncastable use case)
|
||||
|
||||
// casting selected card
|
||||
// TODO: fix costs (why is Panglacial Wurm automatically accepting payment?)
|
||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
|
||||
|
@ -3423,8 +3424,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
// Even mana cost can't be checked here without lookahead
|
||||
// So make it available all the time
|
||||
boolean canUse;
|
||||
if (ability instanceof MorphAbility && object instanceof Card && (game.canPlaySorcery(getId()) ||
|
||||
(null != game.getContinuousEffects().asThough(object.getId(), AsThoughEffectType.CAST_AS_INSTANT, playAbility, this.getId(), game)))) {
|
||||
if (ability instanceof MorphAbility && object instanceof Card && (game.canPlaySorcery(getId())
|
||||
|| (null != game.getContinuousEffects().asThough(object.getId(), AsThoughEffectType.CAST_AS_INSTANT, playAbility, this.getId(), game)))) {
|
||||
canUse = canPlayCardByAlternateCost((Card) object, availableMana, playAbility, game);
|
||||
} else {
|
||||
canUse = canPlay(playAbility, availableMana, object, game); // canPlay already checks alternative source costs and all conditions
|
||||
|
@ -3562,13 +3563,11 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
|
||||
/**
|
||||
* Returns a list of all available spells and abilities the player can
|
||||
* currently cast/activate with his available ressources
|
||||
* currently cast/activate with his available resources
|
||||
*
|
||||
* @param game
|
||||
* @param hidden also from hidden objects (e.g. turned face
|
||||
* down cards ?)
|
||||
* @param fromZone of objects from which zone (ALL = from all
|
||||
* zones)
|
||||
* @param hidden also from hidden objects (e.g. turned face down cards ?)
|
||||
* @param fromZone of objects from which zone (ALL = from all zones)
|
||||
* @param hideDuplicatedAbilities if equal abilities exist return only the
|
||||
* first instance
|
||||
* @return
|
||||
|
@ -3680,6 +3679,20 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
// check the hand zone (Sen Triplets)
|
||||
if (fromAll || fromZone == Zone.HAND) {
|
||||
for (UUID playerInRangeId : game.getState().getPlayersInRange(getId(), game)) {
|
||||
Player player = game.getPlayer(playerInRangeId);
|
||||
if (player != null && !player.getHand().isEmpty()) {
|
||||
for (Card card : player.getHand().getCards(game)) {
|
||||
if (card != null) {
|
||||
getPlayableFromObjectAll(game, Zone.HAND, card, availableMana, playable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// eliminate duplicate activated abilities (uses for AI plays)
|
||||
Map<String, ActivatedAbility> activatedUnique = new HashMap<>();
|
||||
List<ActivatedAbility> activatedAll = new ArrayList<>();
|
||||
|
@ -3784,7 +3797,6 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
playableObjects.get(objectId).add(ability);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Skip "silent" phase step when players are not allowed to cast anything.
|
||||
* E.g. players can't play or cast anything during declaring attackers.
|
||||
|
|
Loading…
Reference in a new issue