mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
refactor: improved search in stack
This commit is contained in:
parent
26adccdfd5
commit
384ce67cc3
20 changed files with 101 additions and 119 deletions
|
|
@ -398,7 +398,10 @@ public class ComputerPlayer6 extends ComputerPlayer {
|
|||
}
|
||||
|
||||
protected void resolve(SimulationNode2 node, int depth, Game game) {
|
||||
StackObject stackObject = game.getStack().getFirst();
|
||||
StackObject stackObject = game.getStack().getFirstOrNull();
|
||||
if (stackObject == null) {
|
||||
throw new IllegalStateException("Catch empty stack on resolve (something wrong with sim code)");
|
||||
}
|
||||
if (stackObject instanceof StackAbility) {
|
||||
// AI hint for search effects (calc all possible cards for best score)
|
||||
SearchEffect effect = getSearchEffect((StackAbility) stackObject);
|
||||
|
|
|
|||
|
|
@ -638,8 +638,8 @@ public class HumanPlayer extends PlayerImpl {
|
|||
// Check check if the spell being paid for cares about the color of mana being paid
|
||||
// See: https://github.com/magefree/mage/issues/9070
|
||||
boolean caresAboutManaColor = false;
|
||||
if (!game.getStack().isEmpty() && game.getStack().getFirst() instanceof Spell) {
|
||||
Spell spellBeingCast = (Spell) game.getStack().getFirst();
|
||||
if (game.getStack().getFirstOrNull() instanceof Spell) {
|
||||
Spell spellBeingCast = (Spell) game.getStack().getFirstOrNull();
|
||||
if (!spellBeingCast.isResolving() && spellBeingCast.getControllerId().equals(this.getId())) {
|
||||
CardImpl card = (CardImpl) game.getCard(spellBeingCast.getSourceId());
|
||||
caresAboutManaColor = card.caresAboutManaColor(game);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue