mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 09:48:02 +00:00
Fix NeedsPrevention logic
This commit is contained in:
@@ -67,7 +67,7 @@ public class ChooseSourceAi extends SpellAbilityAi {
|
|||||||
if (sa.getParam("AILogic").equals("NeedsPrevention")) {
|
if (sa.getParam("AILogic").equals("NeedsPrevention")) {
|
||||||
if (!game.getStack().isEmpty()) {
|
if (!game.getStack().isEmpty()) {
|
||||||
final SpellAbility topStack = game.getStack().peekAbility();
|
final SpellAbility topStack = game.getStack().peekAbility();
|
||||||
if (sa.hasParam("Choices") && !topStack.getHostCard().isValid(sa.getParam("Choices"), ai, source, sa)) {
|
if (sa.hasParam("Choices") && !topStack.matchesValid(topStack.getHostCard(), sa.getParam("Choices").split(","))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final ApiType threatApi = topStack.getApi();
|
final ApiType threatApi = topStack.getApi();
|
||||||
@@ -111,8 +111,6 @@ public class ChooseSourceAi extends SpellAbilityAi {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Card chooseSingleCard(final Player aiChoser, SpellAbility sa, Iterable<Card> options, boolean isOptional, Player targetedPlayer, Map<String, Object> params) {
|
public Card chooseSingleCard(final Player aiChoser, SpellAbility sa, Iterable<Card> options, boolean isOptional, Player targetedPlayer, Map<String, Object> params) {
|
||||||
if ("NeedsPrevention".equals(sa.getParam("AILogic"))) {
|
if ("NeedsPrevention".equals(sa.getParam("AILogic"))) {
|
||||||
@@ -178,7 +176,7 @@ public class ChooseSourceAi extends SpellAbilityAi {
|
|||||||
final Card source = si.getSourceCard();
|
final Card source = si.getSourceCard();
|
||||||
final SpellAbility abilityOnStack = si.getSpellAbility(true);
|
final SpellAbility abilityOnStack = si.getSpellAbility(true);
|
||||||
|
|
||||||
if (sa.hasParam("Choices") && !abilityOnStack.getHostCard().isValid(sa.getParam("Choices"), ai, sa.getHostCard(), sa)) {
|
if (sa.hasParam("Choices") && !abilityOnStack.matchesValid(source, sa.getParam("Choices").split(","))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final ApiType threatApi = abilityOnStack.getApi();
|
final ApiType threatApi = abilityOnStack.getApi();
|
||||||
|
|||||||
Reference in New Issue
Block a user