* Fixed a problem with the check what spells are castable for a player.

This commit is contained in:
LevelX2 2016-04-08 15:45:12 +02:00
parent f56e9b1de1
commit e4dcb35afa
3 changed files with 13 additions and 7 deletions

View file

@ -194,7 +194,7 @@ public interface Player extends MageItem, Copyable<Player> {
boolean getPassedUntilStackResolved();
boolean getPassedUntilEndStepBeforeMyTurn();
boolean getPassedAllTurns();
AbilityType getJustActivatedType();
@ -791,11 +791,11 @@ public interface Player extends MageItem, Copyable<Player> {
* cost
* @param costs alternate other costs you need to pay
*/
void setCastSourceIdWithAlternateMana(UUID sourceId, ManaCosts<ManaCost> manaCosts, mage.abilities.costs.Costs costs);
void setCastSourceIdWithAlternateMana(UUID sourceId, ManaCosts<ManaCost> manaCosts, Costs<Cost> costs);
UUID getCastSourceIdWithAlternateMana();
ManaCosts getCastSourceIdManaCosts();
ManaCosts<ManaCost> getCastSourceIdManaCosts();
Costs<Cost> getCastSourceIdCosts();

View file

@ -865,7 +865,7 @@ public abstract class PlayerImpl implements Player, Serializable {
@Override
public boolean putCardsOnBottomOfLibrary(Cards cards, Game game, Ability source, boolean anyOrder) {
if (cards.size() != 0) {
if (!cards.isEmpty()) {
if (!anyOrder) {
for (UUID objectId : cards) {
moveObjectToLibrary(objectId, source == null ? null : source.getSourceId(), game, false, false);
@ -938,7 +938,7 @@ public abstract class PlayerImpl implements Player, Serializable {
}
@Override
public void setCastSourceIdWithAlternateMana(UUID sourceId, ManaCosts manaCosts, mage.abilities.costs.Costs costs) {
public void setCastSourceIdWithAlternateMana(UUID sourceId, ManaCosts<ManaCost> manaCosts, Costs<Cost> costs) {
castSourceIdWithAlternateMana = sourceId;
castSourceIdManaCosts = manaCosts;
castSourceIdCosts = costs;
@ -2442,9 +2442,13 @@ public abstract class PlayerImpl implements Player, Serializable {
if (available == null) {
return true;
}
boolean spendAnyMana = game.getContinuousEffects().asThough(ability.getSourceId(), AsThoughEffectType.SPEND_OTHER_MANA, ability, ability.getControllerId(), game);
for (Mana mana : abilityOptions) {
for (Mana avail : available) {
if (mana.enough(avail)) {
if (spendAnyMana && mana.count() <= avail.count()) {
return true;
}
if (mana.enough(avail)) { // here we need to check if spend mana as though allow to pay the mana cost
return true;
}
}