mirror of
https://github.com/correl/mage.git
synced 2025-01-11 19:13:02 +00:00
* Added calculation of mana sources of hand cards (related to #6698).
This commit is contained in:
parent
818952bf2d
commit
c19af65431
2 changed files with 33 additions and 3 deletions
|
@ -334,4 +334,19 @@ public class NonTappingManaAbilitiesTest extends CardTestPlayerBase {
|
|||
assertManaOptions("{C}{C}", manaOptions);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAvailableManaWithSpiritGuides() {
|
||||
// Exile Simian Spirit Guide from your hand: Add {R}.
|
||||
addCard(Zone.HAND, playerA, "Simian Spirit Guide", 1);
|
||||
// Exile Simian Spirit Guide from your hand: Add {R}.
|
||||
addCard(Zone.HAND, playerA, "Elvish Spirit Guide", 1);
|
||||
|
||||
setStopAt(1, PhaseStep.UPKEEP);
|
||||
execute();
|
||||
|
||||
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
|
||||
Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
|
||||
assertManaOptions("{R}{G}", manaOptions);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2891,12 +2891,26 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
|
||||
List<Abilities<ActivatedManaAbilityImpl>> sourceWithoutManaCosts = new ArrayList<>();
|
||||
List<Abilities<ActivatedManaAbilityImpl>> sourceWithCosts = new ArrayList<>();
|
||||
for (Card card : getHand().getCards(game)) {
|
||||
Abilities<ActivatedManaAbilityImpl> manaAbilities
|
||||
= card.getAbilities(game).getAvailableActivatedManaAbilities(Zone.HAND, playerId, game);
|
||||
for (Iterator<ActivatedManaAbilityImpl> it = manaAbilities.iterator(); it.hasNext();) {
|
||||
ActivatedManaAbilityImpl ability = it.next();
|
||||
Abilities<ActivatedManaAbilityImpl> noTapAbilities = new AbilitiesImpl<>(ability);
|
||||
if (ability.getManaCosts().isEmpty() && !ability.isPoolDependant()) {
|
||||
sourceWithoutManaCosts.add(noTapAbilities);
|
||||
} else {
|
||||
sourceWithCosts.add(noTapAbilities);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(playerId, game)) { // Some permanents allow use of abilities from non controlling players. so check all permanents in range
|
||||
Boolean canUse = null;
|
||||
boolean canAdd = false;
|
||||
boolean useLater = false; // sources with mana costs or mana pool dependency
|
||||
Abilities<ActivatedManaAbilityImpl> manaAbilities
|
||||
= permanent.getAbilities().getAvailableActivatedManaAbilities(Zone.BATTLEFIELD, playerId, game); // returns ability only if canActivate is true
|
||||
= permanent.getAbilities(game).getAvailableActivatedManaAbilities(Zone.BATTLEFIELD, playerId, game); // returns ability only if canActivate is true
|
||||
for (Iterator<ActivatedManaAbilityImpl> it = manaAbilities.iterator(); it.hasNext();) {
|
||||
ActivatedManaAbilityImpl ability = it.next();
|
||||
if (canUse == null) {
|
||||
|
@ -2978,7 +2992,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
* abaility
|
||||
*/
|
||||
@Override
|
||||
public void addAvailableTriggeredMana(List<Mana> netManaAvailable) {
|
||||
public void addAvailableTriggeredMana(List<Mana> netManaAvailable
|
||||
) {
|
||||
this.availableTriggeredManaList.add(netManaAvailable);
|
||||
}
|
||||
|
||||
|
@ -2993,8 +3008,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
public List<List<Mana>> getAvailableTriggeredMana() {
|
||||
return availableTriggeredManaList;
|
||||
}
|
||||
|
||||
// returns only mana producers that don't require mana payment
|
||||
|
||||
protected List<MageObject> getAvailableManaProducers(Game game) {
|
||||
List<MageObject> result = new ArrayList<>();
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(playerId, game)) { // Some permanents allow use of abilities from non controlling players. so check all permanents in range
|
||||
|
|
Loading…
Reference in a new issue