mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
- Improved and patched up the Snapcaster AI logic, enabled it for Snapcaster Mage (was previously disabled, most likely due to a crash).
- Added a variant of the Snapcaster logic called PlaySpellForFree used for cards that allow to play spells without paying their mana cost. Set this for Goblin Dark-Dwellers.
This commit is contained in:
@@ -477,23 +477,13 @@ public class PumpAi extends PumpAiBase {
|
|||||||
list = ComputerUtil.getSafeTargets(ai, sa, list);
|
list = ComputerUtil.getSafeTargets(ai, sa, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("Snapcaster".equals(sa.getParam("AILogic"))) { // can afford to and will play snap-casted spell
|
if ("Snapcaster".equals(sa.getParam("AILogic"))) {
|
||||||
AiController aic = ((PlayerControllerAi) ai.getController()).getAi();
|
if (!doTargetSpellToPlayLogic(ai, list, sa, false)) {
|
||||||
Card targetSnapcast = null;
|
return false;
|
||||||
for (Card c : list) {
|
}
|
||||||
for (SpellAbility ab : c.getSpellAbilities()) {
|
} else if ("PlaySpellForFree".equals(sa.getParam("AILogic"))) {
|
||||||
final boolean play = AiPlayDecision.WillPlay == aic.canPlaySa(ab);
|
if (!doTargetSpellToPlayLogic(ai, list, sa, true)) {
|
||||||
final boolean pay = ComputerUtilCost.canPayCost(ab, ai);
|
|
||||||
if (play && pay) {
|
|
||||||
targetSnapcast = c;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (targetSnapcast == null) {
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
sa.getTargets().add(targetSnapcast);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -530,6 +520,32 @@ public class PumpAi extends PumpAiBase {
|
|||||||
return true;
|
return true;
|
||||||
} // pumpTgtAI()
|
} // pumpTgtAI()
|
||||||
|
|
||||||
|
private boolean doTargetSpellToPlayLogic(final Player ai, CardCollection options, final SpellAbility sa, final boolean withoutPayingManaCost) {
|
||||||
|
// determine and target a card with a SA that the AI can afford and will play
|
||||||
|
AiController aic = ((PlayerControllerAi) ai.getController()).getAi();
|
||||||
|
Card targetSpellCard = null;
|
||||||
|
for (Card c : options) {
|
||||||
|
for (SpellAbility ab : c.getSpellAbilities()) {
|
||||||
|
SpellAbility abTest = withoutPayingManaCost ? ab.copyWithNoManaCost() : ab.copy();
|
||||||
|
// at this point, we're assuming that card will be castable from whichever zone it's in by the AI player.
|
||||||
|
abTest.setActivatingPlayer(ai);
|
||||||
|
abTest.getRestrictions().setZone(c.getZone().getZoneType());
|
||||||
|
final boolean play = AiPlayDecision.WillPlay == aic.canPlaySa(abTest);
|
||||||
|
final boolean pay = ComputerUtilCost.canPayCost(abTest, ai);
|
||||||
|
if (play && pay) {
|
||||||
|
targetSpellCard = c;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (targetSpellCard == null) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
sa.getTargets().add(targetSpellCard);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean pumpMandatoryTarget(final Player ai, final SpellAbility sa) {
|
private boolean pumpMandatoryTarget(final Player ai, final SpellAbility sa) {
|
||||||
final Game game = ai.getGame();
|
final Game game = ai.getGame();
|
||||||
final TargetRestrictions tgt = sa.getTargetRestrictions();
|
final TargetRestrictions tgt = sa.getTargetRestrictions();
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Types:Creature Goblin
|
|||||||
PT:4/4
|
PT:4/4
|
||||||
K:Menace
|
K:Menace
|
||||||
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigPump | TriggerDescription$ When CARDNAME enters the battlefield, you may cast target instant or sorcery card with converted mana cost 3 or less from your graveyard without paying its mana cost. If that card would be put into your graveyard this turn, exile it instead.
|
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigPump | TriggerDescription$ When CARDNAME enters the battlefield, you may cast target instant or sorcery card with converted mana cost 3 or less from your graveyard without paying its mana cost. If that card would be put into your graveyard this turn, exile it instead.
|
||||||
SVar:TrigPump:AB$ Pump | Cost$ 0 | TgtZone$ Graveyard | ValidTgts$ Instant.YouCtrl+cmcLE3,Sorcery.YouCtrl+cmcLE3 | TgtPrompt$ Choose target instant or sorcery card with converted mana cost 3 or less from your graveyard |KW$ HIDDEN If CARDNAME would be put into a graveyard, exile it instead. | PumpZone$ Graveyard | SubAbility$ TrigPlay
|
SVar:TrigPump:AB$ Pump | Cost$ 0 | TgtZone$ Graveyard | ValidTgts$ Instant.YouCtrl+cmcLE3,Sorcery.YouCtrl+cmcLE3 | TgtPrompt$ Choose target instant or sorcery card with converted mana cost 3 or less from your graveyard | KW$ HIDDEN If CARDNAME would be put into a graveyard, exile it instead. | PumpZone$ Graveyard | AILogic$ PlaySpellForFree | SubAbility$ TrigPlay
|
||||||
SVar:TrigPlay:DB$ Play | Defined$ Targeted | WithoutManaCost$ True | Optional$ True
|
SVar:TrigPlay:DB$ Play | Defined$ Targeted | WithoutManaCost$ True | Optional$ True
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/goblin_dark_dwellers.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/goblin_dark_dwellers.jpg
|
||||||
Oracle:Menace\nWhen Goblin Dark-Dwellers enters the battlefield, you may cast target instant or sorcery card with converted mana cost 3 or less from your graveyard without paying its mana cost. If that card would be put into your graveyard this turn, exile it instead.
|
Oracle:Menace\nWhen Goblin Dark-Dwellers enters the battlefield, you may cast target instant or sorcery card with converted mana cost 3 or less from your graveyard without paying its mana cost. If that card would be put into your graveyard this turn, exile it instead.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Types:Creature Human Wizard
|
|||||||
PT:2/1
|
PT:2/1
|
||||||
K:Flash
|
K:Flash
|
||||||
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigRearrange | TriggerDescription$ When CARDNAME enters the battlefield, target instant or sorcery card in your graveyard gains flashback until end of turn. The flashback cost is equal to its mana cost. (You may cast that card from your graveyard for its flashback cost. Then exile it.)
|
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigRearrange | TriggerDescription$ When CARDNAME enters the battlefield, target instant or sorcery card in your graveyard gains flashback until end of turn. The flashback cost is equal to its mana cost. (You may cast that card from your graveyard for its flashback cost. Then exile it.)
|
||||||
SVar:TrigRearrange:AB$ Pump | Cost$ 0 | ValidTgts$ Instant.YouCtrl,Sorcery.YouCtrl | TgtZone$ Graveyard | TgtPrompt$ Select target instant or sorcery card | KW$ Flashback | PumpZone$ Graveyard
|
SVar:TrigRearrange:AB$ Pump | Cost$ 0 | ValidTgts$ Instant.YouCtrl,Sorcery.YouCtrl | TgtZone$ Graveyard | TgtPrompt$ Select target instant or sorcery card | KW$ Flashback | PumpZone$ Graveyard | AILogic$ Snapcaster
|
||||||
SVar:RemAIDeck:True
|
SVar:RemAIDeck:True
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/snapcaster_mage.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/snapcaster_mage.jpg
|
||||||
Oracle:Flash\nWhen Snapcaster Mage enters the battlefield, target instant or sorcery card in your graveyard gains flashback until end of turn. The flashback cost is equal to its mana cost. (You may cast that card from your graveyard for its flashback cost. Then exile it.)
|
Oracle:Flash\nWhen Snapcaster Mage enters the battlefield, target instant or sorcery card in your graveyard gains flashback until end of turn. The flashback cost is equal to its mana cost. (You may cast that card from your graveyard for its flashback cost. Then exile it.)
|
||||||
|
|||||||
Reference in New Issue
Block a user