Make charm choices for triggers more like other SA

This commit is contained in:
tool4EvEr
2022-05-24 22:36:57 +02:00
parent 9c9cbf5bd3
commit 6f42fcdc26
5 changed files with 17 additions and 36 deletions

View File

@@ -131,10 +131,9 @@ public class ComputerUtil {
sa = GameActionUtil.addExtraKeywordCost(sa);
if (sa.getApi() == ApiType.Charm && !sa.isWrapper()) {
if (!CharmEffect.makeChoices(sa)) {
return false;
}
if (sa.getApi() == ApiType.Charm && !sa.isCopied() && !CharmEffect.makeChoices(sa)) {
// 603.3c If no mode is chosen, the ability is removed from the stack.
return false;
}
if (chooseTargets != null) {
chooseTargets.run();
@@ -295,10 +294,9 @@ public class ComputerUtil {
if (newSA.isSpell() && !source.isCopiedSpell()) {
newSA.setHostCard(game.getAction().moveToStack(source, newSA));
if (newSA.getApi() == ApiType.Charm && !newSA.isWrapper()) {
if (!CharmEffect.makeChoices(newSA)) {
return false;
}
if (newSA.getApi() == ApiType.Charm && !sa.isCopied() && !CharmEffect.makeChoices(newSA)) {
// 603.3c If no mode is chosen, the ability is removed from the stack.
return false;
}
}

View File

@@ -34,6 +34,7 @@ import forge.game.GameObject;
import forge.game.GameType;
import forge.game.ability.AbilityUtils;
import forge.game.ability.ApiType;
import forge.game.ability.effects.CharmEffect;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardCollectionView;
@@ -1064,6 +1065,10 @@ public class PlayerControllerAi extends PlayerController {
}
private boolean prepareSingleSa(final Card host, final SpellAbility sa, boolean isMandatory) {
if (sa.getApi() == ApiType.Charm && !sa.isCopied() && !CharmEffect.makeChoices(sa)) {
// 603.3c If no mode is chosen, the ability is removed from the stack.
return false;
}
if (sa.hasParam("TargetingPlayer")) {
Player targetingPlayer = AbilityUtils.getDefinedPlayers(host, sa.getParam("TargetingPlayer"), sa).get(0);
sa.setTargetingPlayer(targetingPlayer);

View File

@@ -255,15 +255,6 @@ public class CharmAi extends SpellAbilityAi {
return Aggregates.random(opponents);
}
@Override
protected boolean doTriggerAINoCost(final Player aiPlayer, final SpellAbility sa, final boolean mandatory) {
// already done by chooseOrderOfSimultaneousStackEntry
if (sa.getChosenList() != null) {
return true;
}
return super.doTriggerAINoCost(aiPlayer, sa, mandatory);
}
@Override
public boolean chkDrawbackWithSubs(Player aiPlayer, AbilitySub ab) {
// choices were already targeted