mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
LegendaryRuleAi: Support SacMe
This commit is contained in:
committed by
Michael Kamensky
parent
fd03367ac4
commit
b7b647746e
@@ -4,8 +4,10 @@ import java.util.Map;
|
|||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
|
import forge.ai.ComputerUtil;
|
||||||
import forge.ai.SpellAbilityAi;
|
import forge.ai.SpellAbilityAi;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
|
import forge.game.card.CardCollection;
|
||||||
import forge.game.card.CounterEnumType;
|
import forge.game.card.CounterEnumType;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
@@ -23,15 +25,17 @@ public class LegendaryRuleAi extends SpellAbilityAi {
|
|||||||
protected boolean canPlayAI(Player aiPlayer, SpellAbility sa) {
|
protected boolean canPlayAI(Player aiPlayer, SpellAbility sa) {
|
||||||
return false; // should not get here
|
return false; // should not get here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Card chooseSingleCard(Player ai, SpellAbility sa, Iterable<Card> options, boolean isOptional, Player targetedPlayer, Map<String, Object> params) {
|
public Card chooseSingleCard(Player ai, SpellAbility sa, Iterable<Card> options, boolean isOptional, Player targetedPlayer, Map<String, Object> params) {
|
||||||
// Choose a single legendary/planeswalker card to keep
|
// Choose a single legendary/planeswalker card to keep
|
||||||
Card firstOption = Iterables.getFirst(options, null);
|
CardCollection legends = new CardCollection(options);
|
||||||
|
CardCollection badOptions = ComputerUtil.choosePermanentsToSacrifice(ai, legends, legends.size() -1, sa, false, false);
|
||||||
|
legends.removeAll(badOptions);
|
||||||
|
Card firstOption = Iterables.getFirst(legends, null);
|
||||||
boolean choosingFromPlanewalkers = firstOption.isPlaneswalker();
|
boolean choosingFromPlanewalkers = firstOption.isPlaneswalker();
|
||||||
|
|
||||||
if ( choosingFromPlanewalkers ) {
|
if (choosingFromPlanewalkers) {
|
||||||
// AI decision making - should AI compare counters?
|
// AI decision making - should AI compare counters?
|
||||||
} else {
|
} else {
|
||||||
// AI decision making - should AI compare damage and debuffs?
|
// AI decision making - should AI compare damage and debuffs?
|
||||||
|
|||||||
@@ -1633,7 +1633,7 @@ public class GameAction {
|
|||||||
|
|
||||||
recheck = true;
|
recheck = true;
|
||||||
|
|
||||||
Card toKeep = p.getController().chooseSingleEntityForEffect(new CardCollection(cc), new SpellAbility.EmptySa(ApiType.InternalLegendaryRule, null, p),
|
Card toKeep = p.getController().chooseSingleEntityForEffect(new CardCollection(cc), new SpellAbility.EmptySa(ApiType.InternalLegendaryRule, new Card(-1, game), p),
|
||||||
"You have multiple legendary permanents named \""+name+"\" in play.\n\nChoose the one to stay on battlefield (the rest will be moved to graveyard)", null);
|
"You have multiple legendary permanents named \""+name+"\" in play.\n\nChoose the one to stay on battlefield (the rest will be moved to graveyard)", null);
|
||||||
for (Card c: cc) {
|
for (Card c: cc) {
|
||||||
if (c != toKeep) {
|
if (c != toKeep) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Types:Creature Human Warrior
|
|||||||
PT:3/3
|
PT:3/3
|
||||||
K:Haste
|
K:Haste
|
||||||
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigChange | TriggerDescription$ When CARDNAME enters the battlefield, untap target permanent and gain control of it until end of turn. It gains haste until end of turn.
|
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigChange | TriggerDescription$ When CARDNAME enters the battlefield, untap target permanent and gain control of it until end of turn. It gains haste until end of turn.
|
||||||
SVar:TrigChange:DB$GainControl | TgtPrompt$ Choose target permanent | ValidTgts$ Permanent | LoseControl$ EOT | Untap$ True | AddKWs$ Haste | SpellDescription$ Untap target permanent gain control of it until end of turn. It gains haste until end of turn.
|
SVar:TrigChange:DB$ GainControl | TgtPrompt$ Choose target permanent | ValidTgts$ Permanent | LoseControl$ EOT | Untap$ True | AddKWs$ Haste | SpellDescription$ Untap target permanent gain control of it until end of turn. It gains haste until end of turn.
|
||||||
SVar:PlayMain1:OPPONENTCREATURES
|
SVar:PlayMain1:OPPONENTCREATURES
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/zealous_conscripts.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/zealous_conscripts.jpg
|
||||||
Oracle:Haste\nWhen Zealous Conscripts enters the battlefield, gain control of target permanent until end of turn. Untap that permanent. It gains haste until end of turn.
|
Oracle:Haste\nWhen Zealous Conscripts enters the battlefield, gain control of target permanent until end of turn. Untap that permanent. It gains haste until end of turn.
|
||||||
|
|||||||
Reference in New Issue
Block a user