1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-11 17:00:08 -09:00

* 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
Mage.Tests/src/test/java/org/mage/test/cards/asthough
Mage/src/main/java/mage/players

View file

@ -73,8 +73,10 @@ public class SpendOtherManaTest extends CardTestPlayerBase {
/**
* Tron mana doesn't work with Oath of Nissa. (e.g. can't cast Chandra,
* Flamecaller with Urza's Tower, Power Plant, and Mine.)
*
* AI don't get the Planeswalker as playable card (probably because of the
* as thought effect)
*/
@Test
public void testOathOfNissa() {
// When Oath of Nissa enters the battlefield, look at the top three cards of your library. You may reveal a creature, land, or planeswalker card from among them and put it into your hand. Put the rest on the bottom of your library in any order.

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;
}
}