mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
- Made Mizzium Meddler use AI SpellMagnet and thus made it AI-playable.
This commit is contained in:
@@ -28,12 +28,40 @@ public class ChangeTargetsAi extends SpellAbilityAi {
|
|||||||
|
|
||||||
if (sa.hasParam("AILogic")) {
|
if (sa.hasParam("AILogic")) {
|
||||||
if ("SpellMagnet".equals(sa.getParam("AILogic"))) {
|
if ("SpellMagnet".equals(sa.getParam("AILogic"))) {
|
||||||
// Cards like Spellskite that retarget spells to itself
|
return doSpellMagnet(sa, topSa, aiPlayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The AI can't otherwise play this ability, but should at least not miss mandatory activations (e.g. triggers).
|
||||||
|
return sa.isMandatory();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean doTriggerAINoCost(Player aiPlayer, SpellAbility sa, boolean mandatory) {
|
||||||
|
final Game game = sa.getHostCard().getGame();
|
||||||
|
final SpellAbility topSa = game.getStack().isEmpty() ? null : ComputerUtilAbility.getTopSpellAbilityOnStack(game, sa);
|
||||||
|
|
||||||
|
if (sa.hasParam("AILogic")) {
|
||||||
|
if ("SpellMagnet".equals(sa.getParam("AILogic"))) {
|
||||||
|
return doSpellMagnet(sa, topSa, aiPlayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean doSpellMagnet(SpellAbility sa, SpellAbility topSa, Player aiPlayer) {
|
||||||
|
// For cards like Spellskite that retarget spells to itself
|
||||||
if (topSa == null) {
|
if (topSa == null) {
|
||||||
// nothing on stack, so nothing to target
|
// nothing on stack, so nothing to target
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sa.getTargets().getNumTargeted() != 0) {
|
||||||
|
// something was already chosen before (e.g. in response to a trigger - Mizzium Meddler), so just proceed
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!topSa.usesTargeting() || topSa.getTargets().getTargetCards().contains(sa.getHostCard())) {
|
if (!topSa.usesTargeting() || topSa.getTargets().getTargetCards().contains(sa.getHostCard())) {
|
||||||
// if this does not target at all or already targets host, no need to redirect it again
|
// if this does not target at all or already targets host, no need to redirect it again
|
||||||
return false;
|
return false;
|
||||||
@@ -43,7 +71,7 @@ public class ChangeTargetsAi extends SpellAbilityAi {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!topSa.canTarget(sa.getHostCard())) {
|
if (!topSa.canTarget(sa.getHostCard())) {
|
||||||
// don't try targeting it if we can't legally target Spellskite with it in the first place
|
// don't try targeting it if we can't legally target the host card with it in the first place
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,13 +89,3 @@ public class ChangeTargetsAi extends SpellAbilityAi {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The AI can't otherwise play this ability, but should at least not miss mandatory activations (e.g. triggers).
|
|
||||||
return sa.isMandatory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean doTriggerAINoCost(Player aiPlayer, SpellAbility sa, boolean mandatory) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ Types:Creature Vedalken Wizard
|
|||||||
PT:1/4
|
PT:1/4
|
||||||
K:Flash
|
K:Flash
|
||||||
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigChange | OptionalDecider$ You | TriggerDescription$ When CARDNAME enters the battlefield, you may change a target of target spell or ability to CARDNAME.
|
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigChange | OptionalDecider$ You | TriggerDescription$ When CARDNAME enters the battlefield, you may change a target of target spell or ability to CARDNAME.
|
||||||
SVar:TrigChange:AB$ ChangeTargets | Cost$ 0 | TargetType$ Spell,Activated,Triggered | ValidTgts$ Card | DefinedMagnet$ Self | ChangeSingleTarget$ True
|
SVar:TrigChange:AB$ ChangeTargets | Cost$ 0 | TargetType$ Spell,Activated,Triggered | ValidTgts$ Card | DefinedMagnet$ Self | ChangeSingleTarget$ True | AILogic$ SpellMagnet
|
||||||
SVar:RemAIDeck:True
|
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/mizzium_meddler.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/mizzium_meddler.jpg
|
||||||
Oracle:Flash (You may cast this spell any time you could cast an instant.)\nWhen Mizzium Meddler enters the battlefield, you may change a target of target spell or ability to Mizzium Meddler.
|
Oracle:Flash (You may cast this spell any time you could cast an instant.)\nWhen Mizzium Meddler enters the battlefield, you may change a target of target spell or ability to Mizzium Meddler.
|
||||||
Reference in New Issue
Block a user