- The AI will now use Multikicker for Permanents.

This commit is contained in:
Sloth
2015-12-11 07:53:19 +00:00
parent 53eb31cfba
commit 05511671f9
3 changed files with 29 additions and 4 deletions

View File

@@ -29,6 +29,7 @@ import java.util.Map;
import java.util.Map.Entry;
import com.esotericsoftware.minlog.Log;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
@@ -713,6 +714,21 @@ public class AiController {
}
}
if (sa.hasParam("Announce") && sa.getParam("Announce").startsWith("Multikicker")) {
//String announce = sa.getParam("Announce");
ManaCost mkCost = sa.getMultiKickerManaCost();
ManaCost mCost = sa.getPayCosts().getTotalMana();
for (int i = 0; i < 10; i++) {
mCost = ManaCost.combine(mCost, mkCost);
ManaCostBeingPaid mcbp = new ManaCostBeingPaid(mCost);
if (!ComputerUtilMana.canPayManaCost(mcbp, sa, player)) {
card.setKickerMagnitude(i);
break;
}
card.setKickerMagnitude(i+1);
}
}
// Prevent the computer from summoning Ball Lightning type creatures after attacking
if (card.hasSVar("EndOfTurnLeavePlay")
&& (game.getPhaseHandler().isPlayerTurn(player.getOpponent())

View File

@@ -959,10 +959,11 @@ public class ComputerUtilMana {
* @return ManaCost
*/
static ManaCostBeingPaid calculateManaCost(final SpellAbility sa, final boolean test, final int extraMana) {
Card card = sa.getHostCard();
ZoneType castFromBackup = null;
if (test && sa.isSpell()) {
castFromBackup = sa.getHostCard().getCastFrom();
sa.getHostCard().setCastFrom(sa.getHostCard().getZone().getZoneType());
castFromBackup = card.getCastFrom();
sa.getHostCard().setCastFrom(card.getZone().getZoneType());
}
Cost payCosts = sa.getPayCosts();
@@ -976,9 +977,8 @@ public class ComputerUtilMana {
ManaCostBeingPaid cost = new ManaCostBeingPaid(mana, restriction);
ManaCostAdjustment.adjust(cost, sa, null, test);
final Card card = sa.getHostCard();
// Tack xMana Payments into mana here if X is a set value
if ((sa.getPayCosts() != null) && (cost.getXcounter() > 0 || extraMana > 0)) {
if (sa.getPayCosts() != null && (cost.getXcounter() > 0 || extraMana > 0)) {
int manaToAdd = 0;
if (test && extraMana > 0) {
final int multiplicator = Math.max(cost.getXcounter(), 1);
@@ -1004,6 +1004,14 @@ public class ComputerUtilMana {
card.setXManaCostPaid(manaToAdd / cost.getXcounter());
}
}
int timesMultikicked = card.getKickerMagnitude();
if (timesMultikicked > 0 && sa.hasParam("Announce") && sa.getParam("Announce").startsWith("Multikicker")) {
ManaCost mkCost = sa.getMultiKickerManaCost();
for (int i = 0; i < timesMultikicked; i++) {
cost.addManaCost(mkCost);
}
}
if (test && sa.isSpell()) {
sa.getHostCard().setCastFrom(castFromBackup);

View File

@@ -3,5 +3,6 @@ ManaCost:2 R
Types:Sorcery
A:SP$ DamageAll | Cost$ 2 R | NumDmg$ X | ValidCards$ Creature | ValidDescription$ each creature. | References$ X | SpellDescription$ Converge — CARDNAME deals X damage to each creature, where X is the number of colors of mana spent to cast CARDNAME.
SVar:X:Count$Converge
SVar:RemAIDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/radiant_flames.jpg
Oracle:Converge — Radiant Flames deals X damage to each creature, where X is the number of colors of mana spent to cast Radiant Flames.