- Some preparations for triggered counter abilities with defined controlled by the AI.

This commit is contained in:
jendave
2011-08-07 01:36:58 +00:00
parent f063246763
commit 935241920e
3 changed files with 49 additions and 45 deletions

View File

@@ -3,7 +3,7 @@ ManaCost:3 B
Types:World Enchantment Types:World Enchantment
Text:no text Text:no text
T:Mode$ SpellCast | ValidCard$ Card | ValidActivatingPlayer$ Each | TriggerZones$ Battlefield | Execute$ TrigCounter | TriggerDescription$ Whenever a player casts a spell, counter it unless its controller pays 3. T:Mode$ SpellCast | ValidCard$ Card | ValidActivatingPlayer$ Each | TriggerZones$ Battlefield | Execute$ TrigCounter | TriggerDescription$ Whenever a player casts a spell, counter it unless its controller pays 3.
SVar:TrigCounter:AB$Counter | Cost$ 0 | UnlessCost$ 3 | Defined$ TriggeredSpellAbility | UnlessPayer$ TriggeredCardController SVar:TrigCounter:DB$Counter | Cost$ 0 | UnlessCost$ 3 | Defined$ TriggeredSpellAbility | UnlessPayer$ TriggeredCardController
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/nether_void.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/nether_void.jpg

View File

@@ -25,7 +25,6 @@ import forge.card.spellability.Target_Selection;
// -Hand // -Hand
// -BottomOfLibrary // -BottomOfLibrary
// -ShuffleIntoLibrary // -ShuffleIntoLibrary
//UnlessCost - counter target spell unless it's controller pays this cost
//PowerSink - true if the drawback type part of Power Sink should be used //PowerSink - true if the drawback type part of Power Sink should be used
//ExtraActions - this has been removed. All SubAbilitys should now use the standard SubAbility system //ExtraActions - this has been removed. All SubAbilitys should now use the standard SubAbility system
@@ -161,16 +160,20 @@ public class AbilityFactory_CounterMagic {
} }
} }
Target tgt = sa.getTarget();
if (tgt != null) {
SpellAbility topSA = AllZone.Stack.peek(); SpellAbility topSA = AllZone.Stack.peek();
if (!CardFactoryUtil.isCounterable(topSA.getSourceCard()) || topSA.getActivatingPlayer().isComputer()) if (!CardFactoryUtil.isCounterable(topSA.getSourceCard()) || topSA.getActivatingPlayer().isComputer())
return false; return false;
Target tgt = sa.getTarget();
tgt.resetTargets(); tgt.resetTargets();
if (Target_Selection.matchSpellAbility(sa, topSA, tgt)) if (Target_Selection.matchSpellAbility(sa, topSA, tgt))
tgt.addTarget(topSA); tgt.addTarget(topSA);
else else
return false; return false;
}
if (unlessCost != null){ if (unlessCost != null){
// Is this Usable Mana Sources? Or Total Available Mana? // Is this Usable Mana Sources? Or Total Available Mana?
@@ -216,15 +219,15 @@ public class AbilityFactory_CounterMagic {
return false; return false;
} }
Target tgt = sa.getTarget();
if (tgt != null) {
SpellAbility topSA = AllZone.Stack.peek(); SpellAbility topSA = AllZone.Stack.peek();
if (!CardFactoryUtil.isCounterable(topSA.getSourceCard()) || topSA.getActivatingPlayer().isComputer()) if (!CardFactoryUtil.isCounterable(topSA.getSourceCard()) || topSA.getActivatingPlayer().isComputer())
return false; return false;
Target tgt = sa.getTarget();
tgt.resetTargets(); tgt.resetTargets();
if (Target_Selection.matchSpellAbility(sa, topSA, tgt)) if (Target_Selection.matchSpellAbility(sa, topSA, tgt))
tgt.addTarget(topSA); tgt.addTarget(topSA);
else else
return false; return false;
@@ -253,6 +256,7 @@ public class AbilityFactory_CounterMagic {
if (setPayX) if (setPayX)
source.setSVar("PayX", Integer.toString(toPay)); source.setSVar("PayX", Integer.toString(toPay));
} }
}
// TODO: Improve AI // TODO: Improve AI

View File

@@ -2518,7 +2518,7 @@ public class CardFactoryUtil {
// Count$TopOfLibraryCMC // Count$TopOfLibraryCMC
if(sq[0].contains("TopOfLibraryCMC")) { if(sq[0].contains("TopOfLibraryCMC")) {
CardList topcard = AllZoneUtil.getPlayerCardsInLibrary(AllZone.HumanPlayer, 1); CardList topcard = AllZoneUtil.getPlayerCardsInLibrary(cardController, 1);
return doXMath(topcard.getTotalConvertedManaCost(), m, c); return doXMath(topcard.getTotalConvertedManaCost(), m, c);
} }