mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
Merge branch 'master' into 'master'
CopySpellAbilityAI improvements See merge request core-developers/forge!1149
This commit is contained in:
@@ -64,11 +64,17 @@ public class CopySpellAbilityAi extends SpellAbilityAi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (top.isWrapper() || !(top instanceof SpellAbility || top instanceof AbilityActivated)) {
|
if (top.isWrapper() || !(top instanceof SpellAbility || top instanceof AbilityActivated)) {
|
||||||
// Should even try with triggered or wrapped abilities first, will crash
|
// Shouldn't even try with triggered or wrapped abilities at this time, will crash
|
||||||
return false;
|
return false;
|
||||||
} else if (top.getApi() == ApiType.CopySpellAbility) {
|
} else if (top.getApi() == ApiType.CopySpellAbility) {
|
||||||
// Don't try to copy a copy ability, too complex for the AI to handle
|
// Don't try to copy a copy ability, too complex for the AI to handle
|
||||||
return false;
|
return false;
|
||||||
|
} else if (top.hasParam("ConditionManaSpent")) {
|
||||||
|
// Mana spent is not copied, so these spells generally do nothing when copied.
|
||||||
|
return false;
|
||||||
|
} else if (ComputerUtilCard.isCardRemAIDeck(top.getHostCard())) {
|
||||||
|
// Don't try to copy anything you can't understand how to handle
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// A copy is necessary to properly test the SA before targeting the copied spell, otherwise the copy SA will fizzle.
|
// A copy is necessary to properly test the SA before targeting the copied spell, otherwise the copy SA will fizzle.
|
||||||
@@ -77,7 +83,7 @@ public class CopySpellAbilityAi extends SpellAbilityAi {
|
|||||||
|
|
||||||
if (top.canBeTargetedBy(sa)) {
|
if (top.canBeTargetedBy(sa)) {
|
||||||
AiPlayDecision decision = AiPlayDecision.CantPlaySa;
|
AiPlayDecision decision = AiPlayDecision.CantPlaySa;
|
||||||
if (top instanceof Spell && !top.hasParam("ConditionManaSpent") /* mana spent is not copied */ ) {
|
if (top instanceof Spell) {
|
||||||
decision = ((PlayerControllerAi) aiPlayer.getController()).getAi().canPlayFromEffectAI((Spell) topCopy, true, true);
|
decision = ((PlayerControllerAi) aiPlayer.getController()).getAi().canPlayFromEffectAI((Spell) topCopy, true, true);
|
||||||
} else if (top instanceof AbilityActivated && top.getActivatingPlayer().equals(aiPlayer)
|
} else if (top instanceof AbilityActivated && top.getActivatingPlayer().equals(aiPlayer)
|
||||||
&& logic.contains("CopyActivatedAbilities")) {
|
&& logic.contains("CopyActivatedAbilities")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user