mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
SetStateAi: fixed problem with SetState with TurnFace Mode
This commit is contained in:
@@ -17,8 +17,9 @@ public class SetStateAi extends SpellAbilityAi {
|
|||||||
@Override
|
@Override
|
||||||
protected boolean checkApiLogic(final Player aiPlayer, final SpellAbility sa) {
|
protected boolean checkApiLogic(final Player aiPlayer, final SpellAbility sa) {
|
||||||
final Card source = sa.getHostCard();
|
final Card source = sa.getHostCard();
|
||||||
|
final String mode = sa.getParam("Mode");
|
||||||
|
|
||||||
if (!source.hasAlternateState()) {
|
if (!"TurnFace".equals(mode) && !source.hasAlternateState()) {
|
||||||
System.err.println("Warning: SetState without ALTERNATE on " + source.getName() + ".");
|
System.err.println("Warning: SetState without ALTERNATE on " + source.getName() + ".");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -51,9 +52,9 @@ public class SetStateAi extends SpellAbilityAi {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if("Transform".equals(sa.getParam("Mode"))) {
|
if("Transform".equals(mode)) {
|
||||||
return !source.hasKeyword("CARDNAME can't transform");
|
return !source.hasKeyword("CARDNAME can't transform");
|
||||||
} else if ("Flip".equals(sa.getParam("Mode"))) {
|
} else if ("Flip".equals(mode)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -69,13 +70,14 @@ public class SetStateAi extends SpellAbilityAi {
|
|||||||
@Override
|
@Override
|
||||||
protected boolean checkPhaseRestrictions(Player ai, SpellAbility sa, PhaseHandler ph) {
|
protected boolean checkPhaseRestrictions(Player ai, SpellAbility sa, PhaseHandler ph) {
|
||||||
final Card source = sa.getHostCard();
|
final Card source = sa.getHostCard();
|
||||||
|
final String mode = sa.getParam("Mode");
|
||||||
|
|
||||||
if (!source.hasAlternateState()) {
|
if (!"TurnFace".equals(mode) && !source.hasAlternateState()) {
|
||||||
System.err.println("Warning: SetState without ALTERNATE on " + source.getName() + ".");
|
System.err.println("Warning: SetState without ALTERNATE on " + source.getName() + ".");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if("Transform".equals(sa.getParam("Mode"))) {
|
if("Transform".equals(mode)) {
|
||||||
// need a copy for evaluation
|
// need a copy for evaluation
|
||||||
Card transformed = CardUtil.getLKICopy(source);
|
Card transformed = CardUtil.getLKICopy(source);
|
||||||
transformed.getCurrentState().copyFrom(source, source.getAlternateState());
|
transformed.getCurrentState().copyFrom(source, source.getAlternateState());
|
||||||
|
|||||||
Reference in New Issue
Block a user