Merge branch 'donate' into 'master'

Donate refactor

See merge request core-developers/forge!6177
This commit is contained in:
Michael Kamensky
2022-02-13 18:27:02 +00:00
3 changed files with 10 additions and 7 deletions

View File

@@ -26,6 +26,7 @@ import com.google.common.collect.Lists;
import forge.ai.ComputerUtilCard;
import forge.ai.ComputerUtilCombat;
import forge.ai.SpecialCardAi;
import forge.ai.SpellAbilityAi;
import forge.game.Game;
import forge.game.ability.AbilityUtils;
@@ -296,6 +297,13 @@ public class ControlGainAi extends SpellAbilityAi {
@Override
public boolean chkAIDrawback(SpellAbility sa, final Player ai) {
final Game game = ai.getGame();
// Special card logic that is processed elsewhere
if (sa.getParam("AILogic").equals("DonateTargetPerm")) {
// Donate step 2 - target a donatable permanent.
return SpecialCardAi.Donate.considerDonatingPermanent(ai, sa);
}
if (!sa.usesTargeting()) {
if (sa.hasParam("AllValid")) {
CardCollectionView tgtCards = CardLists.filterControlledBy(game.getCardsIn(ZoneType.Battlefield), ai.getOpponents());

View File

@@ -451,9 +451,6 @@ public class PumpAi extends PumpAiBase {
} else {
return false;
}
} else if (sa.getParam("AILogic").equals("DonateTargetPerm")) {
// Donate step 2 - target a donatable permanent.
return SpecialCardAi.Donate.considerDonatingPermanent(ai, sa);
} else if (sa.getParam("AILogic").equals("SacOneEach")) {
// each player sacrifices one permanent, e.g. Vaevictis, Asmadi the Dire - grab the worst for allied and
// the best for opponents

View File

@@ -1,10 +1,8 @@
Name:Donate
ManaCost:2 U
Types:Sorcery
A:SP$ Pump | Cost$ 2 U | ValidTgts$ Player | TgtPrompt$ Select target player | SubAbility$ D1 | AILogic$ DonateTargetPlayer | RememberObjects$ Targeted | SpellDescription$ Target player gains control of target permanent you control. | StackDescription$ None
SVar:D1:DB$ Pump | ValidTgts$ Permanent.YouCtrl | TgtPrompt$ Select target permanent you control | SubAbility$ D2 | AILogic$ DonateTargetPerm | StackDescription$ None
SVar:D2:DB$ GainControl | Defined$ Targeted | NewController$ Remembered | SubAbility$ D3
SVar:D3:DB$ Cleanup | ClearRemembered$ True
A:SP$ Pump | ValidTgts$ Player | TgtPrompt$ Select target player | SubAbility$ DBGiveControl | AILogic$ DonateTargetPlayer | SpellDescription$ Target player gains control of target permanent you control. | StackDescription$ None
SVar:DBGiveControl:DB$ GainControl | ValidTgts$ Permanent.YouCtrl | TgtPrompt$ Select target permanent you control | Defined$ Targeted | NewController$ ParentTarget | AILogic$ DonateTargetPerm
AI:RemoveDeck:Random
SVar:DoNotDiscardIfAble:TRUE
Oracle:Target player gains control of target permanent you control.