mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 03:51:58 -08:00
* Fixed a problem with the check what spells are castable for a player.
This commit is contained in:
parent
f56e9b1de1
commit
e4dcb35afa
3 changed files with 13 additions and 7 deletions
|
|
@ -73,8 +73,10 @@ public class SpendOtherManaTest extends CardTestPlayerBase {
|
||||||
/**
|
/**
|
||||||
* Tron mana doesn't work with Oath of Nissa. (e.g. can't cast Chandra,
|
* Tron mana doesn't work with Oath of Nissa. (e.g. can't cast Chandra,
|
||||||
* Flamecaller with Urza's Tower, Power Plant, and Mine.)
|
* 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
|
@Test
|
||||||
public void testOathOfNissa() {
|
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.
|
// 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.
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,7 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
boolean getPassedUntilStackResolved();
|
boolean getPassedUntilStackResolved();
|
||||||
|
|
||||||
boolean getPassedUntilEndStepBeforeMyTurn();
|
boolean getPassedUntilEndStepBeforeMyTurn();
|
||||||
|
|
||||||
boolean getPassedAllTurns();
|
boolean getPassedAllTurns();
|
||||||
|
|
||||||
AbilityType getJustActivatedType();
|
AbilityType getJustActivatedType();
|
||||||
|
|
@ -791,11 +791,11 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
* cost
|
* cost
|
||||||
* @param costs alternate other costs you need to pay
|
* @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();
|
UUID getCastSourceIdWithAlternateMana();
|
||||||
|
|
||||||
ManaCosts getCastSourceIdManaCosts();
|
ManaCosts<ManaCost> getCastSourceIdManaCosts();
|
||||||
|
|
||||||
Costs<Cost> getCastSourceIdCosts();
|
Costs<Cost> getCastSourceIdCosts();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -865,7 +865,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean putCardsOnBottomOfLibrary(Cards cards, Game game, Ability source, boolean anyOrder) {
|
public boolean putCardsOnBottomOfLibrary(Cards cards, Game game, Ability source, boolean anyOrder) {
|
||||||
if (cards.size() != 0) {
|
if (!cards.isEmpty()) {
|
||||||
if (!anyOrder) {
|
if (!anyOrder) {
|
||||||
for (UUID objectId : cards) {
|
for (UUID objectId : cards) {
|
||||||
moveObjectToLibrary(objectId, source == null ? null : source.getSourceId(), game, false, false);
|
moveObjectToLibrary(objectId, source == null ? null : source.getSourceId(), game, false, false);
|
||||||
|
|
@ -938,7 +938,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
castSourceIdWithAlternateMana = sourceId;
|
||||||
castSourceIdManaCosts = manaCosts;
|
castSourceIdManaCosts = manaCosts;
|
||||||
castSourceIdCosts = costs;
|
castSourceIdCosts = costs;
|
||||||
|
|
@ -2442,9 +2442,13 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
if (available == null) {
|
if (available == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
boolean spendAnyMana = game.getContinuousEffects().asThough(ability.getSourceId(), AsThoughEffectType.SPEND_OTHER_MANA, ability, ability.getControllerId(), game);
|
||||||
for (Mana mana : abilityOptions) {
|
for (Mana mana : abilityOptions) {
|
||||||
for (Mana avail : available) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue