- The AI will now react to Nether Void.

- Added Spelltithe Enforcer by swordshine.
This commit is contained in:
Sloth
2012-12-01 11:59:44 +00:00
parent f92318487a
commit 92c3d3ba96
4 changed files with 40 additions and 18 deletions

1
.gitattributes vendored
View File

@@ -9392,6 +9392,7 @@ res/cardsfolder/s/spellbreaker_behemoth.txt svneol=native#text/plain
res/cardsfolder/s/spellgorger_barbarian.txt svneol=native#text/plain
res/cardsfolder/s/spellshock.txt svneol=native#text/plain
res/cardsfolder/s/spellstutter_sprite.txt svneol=native#text/plain
res/cardsfolder/s/spelltithe_enforcer.txt -text
res/cardsfolder/s/spelltwine.txt -text
res/cardsfolder/s/spellweaver_helix.txt -text svneol=unset#text/plain
res/cardsfolder/s/spellwild_ouphe.txt -text

View File

@@ -5,6 +5,7 @@ Text:no text
T:Mode$ SpellCast | ValidCard$ Card | ValidActivatingPlayer$ Player | TriggerZones$ Battlefield | Execute$ TrigCounter | TriggerDescription$ Whenever a player casts a spell, counter it unless its controller pays 3.
SVar:TrigCounter:DB$ Counter | Cost$ 0 | UnlessCost$ 3 | Defined$ TriggeredSpellAbility | UnlessPayer$ TriggeredCardController
SVar:RemRandomDeck:True
SVar:SpellsNeedExtraMana:3
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/nether_void.jpg
SetInfo:LEG|Rare|http://magiccards.info/scans/en/lg/27.jpg

View File

@@ -0,0 +1,13 @@
Name:Spelltithe Enforcer
ManaCost:3 W W
Types:Creature Elephant Wizard
Text:no text
PT:3/3
T:Mode$ SpellCast | ValidCard$ Card | ValidActivatingPlayer$ Opponent | TriggerZones$ Battlefield | Execute$ TrigSac | TriggerDescription$ Whenever an opponent casts a spell, that player sacrifices a permanent unless he or she pays {1}.
SVar:TrigSac:DB$ Sacrifice | Defined$ TriggeredCardController | SacValid$ Permanent | SacMessage$ Permanent | UnlessCost$ 1 | UnlessPayer$ TriggeredCardController
SVar:SpellsNeedExtraMana:1
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/spelltithe_enforcer.jpg
SetInfo:GPT|Rare|http://magiccards.info/scans/en/gp/18.jpg
Oracle:Whenever an opponent casts a spell, that player sacrifices a permanent unless he or she pays {1}.
End

View File

@@ -52,6 +52,7 @@ import forge.card.mana.ManaCost;
import forge.card.mana.ManaPool;
import forge.card.spellability.AbilityManaPart;
import forge.card.spellability.AbilityStatic;
import forge.card.spellability.Spell;
import forge.card.spellability.SpellAbility;
import forge.card.spellability.Target;
import forge.control.input.InputPayManaCostUtil;
@@ -395,7 +396,7 @@ public class ComputerUtil {
newSA.setDescription(sb.toString());
newSA.setActivatingPlayer(ai);
if (!ComputerUtil.canPayAdditionalCosts(ai, newSA)) {
if (!ComputerUtil.canPayAdditionalCosts(newSA, ai)) {
return;
}
@@ -500,7 +501,25 @@ public class ComputerUtil {
* @return a boolean.
*/
public static boolean canPayCost(final SpellAbility sa, final Player player) {
if (!ComputerUtil.payManaCost(sa, player, true, 0, true)) {
// Check for stuff like Nether Void
int extraManaNeeded = 0;
if (sa instanceof Spell && player.isComputer()) {
for (Player opp : player.getOpponents()) {
for (Card c : opp.getCardsIn(ZoneType.Battlefield)) {
final String snem = c.getSVar("SpellsNeedExtraMana");
if (!snem.equals("")) {
try {
extraManaNeeded += Integer.parseInt(snem);
} catch (final NumberFormatException e) {
System.out.println("wrong SpellsNeedExtraMana SVar format on " + c);
}
}
}
}
}
if (!ComputerUtil.payManaCost(sa, player, true, extraManaNeeded, true)) {
return false;
}
@@ -533,19 +552,6 @@ public class ComputerUtil {
return xMana;
}
/**
* <p>
* canPayAdditionalCosts.
* </p>
*
* @param sa
* a {@link forge.card.spellability.SpellAbility} object.
* @return a boolean.
*/
public static boolean canPayAdditionalCosts(final Player ai, final SpellAbility sa) {
return ComputerUtil.canPayAdditionalCosts(sa, ai);
}
/**
* <p>
* canPayAdditionalCosts.
@@ -887,11 +893,12 @@ public class ComputerUtil {
final Card card = sa.getSourceCard();
// Tack xMana Payments into mana here if X is a set value
if ((sa.getPayCosts() != null) && (cost.getXcounter() > 0)) {
if ((sa.getPayCosts() != null) && (cost.getXcounter() > 0 || extraMana > 0)) {
int manaToAdd = 0;
if (test && (extraMana > 0)) {
manaToAdd = extraMana * cost.getXcounter();
if (test && extraMana > 0) {
final int multiplicator = Math.max(cost.getXcounter(), 1);
manaToAdd = extraMana * multiplicator;
} else {
// For Count$xPaid set PayX in the AFs then use that here
// Else calculate it as appropriate.