mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
SetStateAi: fixed problem with recent fix
This commit is contained in:
@@ -19,14 +19,13 @@ public class SetStateAi extends SpellAbilityAi {
|
|||||||
final Card source = sa.getHostCard();
|
final Card source = sa.getHostCard();
|
||||||
final String mode = sa.getParam("Mode");
|
final String mode = sa.getParam("Mode");
|
||||||
|
|
||||||
if (!"TurnFace".equals(mode) && !source.hasAlternateState()) {
|
|
||||||
System.err.println("Warning: SetState without ALTERNATE on " + source.getName() + ".");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prevent transform into legendary creature if copy already exists
|
// Prevent transform into legendary creature if copy already exists
|
||||||
// Check first if Legend Rule does still apply
|
// Check first if Legend Rule does still apply
|
||||||
if (!aiPlayer.getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noLegendRule)) {
|
if (!aiPlayer.getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noLegendRule)) {
|
||||||
|
if (!source.hasAlternateState()) {
|
||||||
|
System.err.println("Warning: SetState without ALTERNATE on " + source.getName() + ".");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// check if the other side is legendary and if such Card already is in Play
|
// check if the other side is legendary and if such Card already is in Play
|
||||||
final CardState other = source.getAlternateState();
|
final CardState other = source.getAlternateState();
|
||||||
@@ -48,11 +47,14 @@ public class SetStateAi extends SpellAbilityAi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sa.getTargetRestrictions() != null) {
|
if (sa.usesTargeting()) {
|
||||||
|
// TODO add Logic for tgts
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if("Transform".equals(mode)) {
|
if("TurnFace".equals(mode)) {
|
||||||
|
return true;
|
||||||
|
} else if("Transform".equals(mode)) {
|
||||||
return !source.hasKeyword("CARDNAME can't transform");
|
return !source.hasKeyword("CARDNAME can't transform");
|
||||||
} else if ("Flip".equals(mode)) {
|
} else if ("Flip".equals(mode)) {
|
||||||
return true;
|
return true;
|
||||||
@@ -70,14 +72,13 @@ 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 (!"TurnFace".equals(mode) && !source.hasAlternateState()) {
|
if("Transform".equals(sa.getParam("Mode"))) {
|
||||||
|
if (!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(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