mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 17:58:01 +00:00
Merge branch 'master' into 'master'
Fix AI logic for ETB CloneAi with Choices See merge request core-developers/forge!4350
This commit is contained in:
@@ -9,6 +9,7 @@ import forge.game.Game;
|
|||||||
import forge.game.ability.AbilityUtils;
|
import forge.game.ability.AbilityUtils;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
import forge.game.card.CardCollection;
|
import forge.game.card.CardCollection;
|
||||||
|
import forge.game.card.CardCollectionView;
|
||||||
import forge.game.card.CardLists;
|
import forge.game.card.CardLists;
|
||||||
import forge.game.phase.PhaseHandler;
|
import forge.game.phase.PhaseHandler;
|
||||||
import forge.game.phase.PhaseType;
|
import forge.game.phase.PhaseType;
|
||||||
@@ -95,11 +96,17 @@ public class CloneAi extends SpellAbilityAi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean doTriggerAINoCost(Player aiPlayer, SpellAbility sa, boolean mandatory) {
|
protected boolean doTriggerAINoCost(Player aiPlayer, SpellAbility sa, boolean mandatory) {
|
||||||
|
Card host = sa.getHostCard();
|
||||||
boolean chance = true;
|
boolean chance = true;
|
||||||
|
|
||||||
if (sa.usesTargeting()) {
|
if (sa.usesTargeting()) {
|
||||||
chance = cloneTgtAI(sa);
|
chance = cloneTgtAI(sa);
|
||||||
|
} else {
|
||||||
|
CardCollectionView choices = host.getGame().getCardsIn(ZoneType.Battlefield);
|
||||||
|
if (sa.hasParam("Choices")) {
|
||||||
|
choices = CardLists.getValidCards(choices, sa.getParam("Choices"), host.getController(), host, sa);
|
||||||
|
}
|
||||||
|
chance = !choices.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Improve AI for triggers. If source is a creature with:
|
// Improve AI for triggers. If source is a creature with:
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class ScryAi extends SpellAbilityAi {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected boolean checkPhaseRestrictions(final Player ai, final SpellAbility sa, final PhaseHandler ph) {
|
protected boolean checkPhaseRestrictions(final Player ai, final SpellAbility sa, final PhaseHandler ph) {
|
||||||
// For Brain Jar, avoid competing against the other ability in the opponent's EOT.
|
// For Brain in a Jar, avoid competing against the other ability in the opponent's EOT.
|
||||||
if ("BrainJar".equals(sa.getParam("AILogic"))) {
|
if ("BrainJar".equals(sa.getParam("AILogic"))) {
|
||||||
return ph.getPhase().isAfter(PhaseType.MAIN2);
|
return ph.getPhase().isAfter(PhaseType.MAIN2);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user