* Fixed some more available mana calculation problems. Mana of the pool is now taken into account (e.g. Coal Golem problem). Crucible of the Spirit Dragon - Conditional mana curretnly not handled correctly in available mana calculation. Crystalline Crawler works now.Related to #6698.

This commit is contained in:
LevelX2 2020-07-16 22:37:51 +02:00
parent e3b2fa1240
commit 3a82840e66
16 changed files with 253 additions and 89 deletions

View file

@ -1,5 +1,9 @@
package mage.player.ai;
import java.io.IOException;
import java.io.Serializable;
import java.util.*;
import java.util.Map.Entry;
import mage.ConditionalMana;
import mage.MageObject;
import mage.MageObjectReference;
@ -57,11 +61,6 @@ import mage.util.TournamentUtil;
import mage.util.TreeNode;
import org.apache.log4j.Logger;
import java.io.IOException;
import java.io.Serializable;
import java.util.*;
import java.util.Map.Entry;
/**
* suitable for two player games and some multiplayer games
*
@ -137,8 +136,6 @@ public class ComputerPlayer extends PlayerImpl implements Player {
// - target.getTargetController(), this.getId() -- player that must makes choices (must be same with this.getId)
// - target.getAbilityController(), abilityControllerId -- affected player/controller for all actions/filters
// - affected controler can be different from target controller (another player makes choices for controller)
// sometimes a target selection can be made from a player that does not control the ability
UUID abilityControllerId = playerId;
if (target.getTargetController() != null
@ -478,7 +475,6 @@ public class ComputerPlayer extends PlayerImpl implements Player {
// target - real target, make all changes and add targets to it
// target.getOriginalTarget() - copy spell effect replaces original target with TargetWithAdditionalFilter
// use originalTarget to get filters and target class info
// source can be null (as example: legendary rule permanent selection)
UUID sourceId = source != null ? source.getSourceId() : null;
@ -731,9 +727,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
// TODO: in multiplayer game there many opponents - if random opponents don't have targets then AI must use next opponent, but it skips
// (e.g. you randomOpponentId must be replaced by List<UUID> randomOpponents)
// normal cycle (good for you, bad for opponents)
// possible good/bad permanents
if (outcome.isGood()) {
targets = threats(abilityControllerId, source.getSourceId(), ((FilterPermanentOrPlayer) target.getFilter()).getPermanentFilter(), game, target.getTargets());
@ -1312,7 +1306,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
playableAbilities.clear();
Set<Card> nonLands = hand.getCards(new FilterNonlandCard(), game);
ManaOptions available = getManaAvailable(game);
available.addMana(manaPool.getMana());
// available.addMana(manaPool.getMana());
for (Card card : nonLands) {
ManaOptions options = card.getManaCost().getOptions();
@ -2562,7 +2556,6 @@ public class ComputerPlayer extends PlayerImpl implements Player {
}
}
protected List<Permanent> threats(UUID playerId, UUID sourceId, FilterPermanent filter, Game game, List<UUID> targets) {
return threats(playerId, sourceId, filter, game, targets, true);
}
@ -2688,7 +2681,6 @@ public class ComputerPlayer extends PlayerImpl implements Player {
return before != after;
}
/**
* Sets a possible target player
*/