Merge branch 'master' into 'master'

Better AI logic for Sensei's Divining Top.

See merge request core-developers/forge!1140
This commit is contained in:
Michael Kamensky
2018-11-26 16:32:08 +00:00
4 changed files with 11 additions and 11 deletions

View File

@@ -1392,8 +1392,11 @@ public class AiController {
private final SpellAbility getSpellAbilityToPlay() {
// if top of stack is owned by me
if (!game.getStack().isEmpty() && game.getStack().peekAbility().getActivatingPlayer().equals(player)) {
// probably should let my stuff resolve
return null;
boolean canRespondToSelf = game.getStack().peekAbility().hasParam("AIRespondsToOwnAbility");
if (!canRespondToSelf) {
// probably should let my stuff resolve
return null;
}
}
final CardCollection cards = ComputerUtilAbility.getAvailableCards(game, player);

View File

@@ -131,9 +131,8 @@ public class DrawAi extends SpellAbilityAi {
return true;
} else if (logic.equals("AlwaysAtOppEOT")) {
return ph.is(PhaseType.END_OF_TURN) && ph.getNextTurn().equals(ai);
} else if (logic.equals("AtEOTIfActivatedBefore")) {
return AiCardMemory.isRememberedCard(ai, sa.getHostCard(), AiCardMemory.MemorySet.ACTIVATED_THIS_TURN)
&& ph.is(PhaseType.END_OF_TURN);
} else if (logic.equals("RespondToOwnActivation")) {
return !ai.getGame().getStack().isEmpty() && ai.getGame().getStack().peekAbility().getHostCard().equals(sa.getHostCard());
}
// Don't use draw abilities before main 2 if possible

View File

@@ -28,10 +28,8 @@ public class RearrangeTopOfLibraryAi extends SpellAbilityAi {
if (source.isPermanent() && sa.getPayCosts() != null
&& (sa.getPayCosts().hasTapCost() || sa.getPayCosts().hasManaCost())) {
// If it has an associated cost, try to only do this before own turn unless there are special logic considerations
if ("Main2BeforeOwnTurn".equals(sa.getParam("AILogic")) && !(ph.is(PhaseType.MAIN2) && ph.getNextTurn() == aiPlayer)) {
return false;
} else if (!sa.hasParam("AILogic") && !(ph.is(PhaseType.END_OF_TURN) && ph.getNextTurn() == aiPlayer)) {
// If it has an associated cost, try to only do this before own turn
if (!(ph.is(PhaseType.END_OF_TURN) && ph.getNextTurn() == aiPlayer)) {
return false;
}
}

View File

@@ -1,8 +1,8 @@
Name:Sensei's Divining Top
ManaCost:1
Types:Artifact
A:AB$ RearrangeTopOfLibrary | Cost$ 1 | Defined$ You | NumCards$ 3 | AILogic$ Main2BeforeOwnTurn | SpellDescription$ Look at the top three cards of your library, then put them back in any order.
A:AB$ Draw | Cost$ T | Defined$ You | NumCards$ 1 | SubAbility$ DBChangeZone | AILogic$ AtEOTIfActivatedBefore | SpellDescription$ Draw a card, then put CARDNAME on top of its owner's library.
A:AB$ RearrangeTopOfLibrary | Cost$ 1 | Defined$ You | NumCards$ 3 | AILogic$ EOTBeforeOwnTurn | AIRespondsToOwnAbility$ True | SpellDescription$ Look at the top three cards of your library, then put them back in any order.
A:AB$ Draw | Cost$ T | Defined$ You | NumCards$ 1 | SubAbility$ DBChangeZone | AILogic$ RespondToOwnActivation | SpellDescription$ Draw a card, then put CARDNAME on top of its owner's library.
SVar:DBChangeZone:DB$ChangeZone | Defined$ Self | Origin$ Battlefield | Destination$ Library | LibraryPosition$ 0
SVar:Picture:http://www.wizards.com/global/images/magic/general/senseis_divining_top.jpg
Oracle:{1}: Look at the top three cards of your library, then put them back in any order.\n{T}: Draw a card, then put Sensei's Divining Top on top of its owner's library.