mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- Added a chkAIDrawback function to AF LoseLife.
This commit is contained in:
@@ -3,8 +3,8 @@ ManaCost:3 B B
|
|||||||
Types:Sorcery
|
Types:Sorcery
|
||||||
Text:no text
|
Text:no text
|
||||||
A:SP$ Draw | Cost$ 3 B B | NumCards$ 3 | ValidTgts$ Player | TgtPrompt$ Choose a player | SubAbility$ DBLoseLife | SpellDescription$ Target player draws three cards, loses 3 life, and gets three poison counters.
|
A:SP$ Draw | Cost$ 3 B B | NumCards$ 3 | ValidTgts$ Player | TgtPrompt$ Choose a player | SubAbility$ DBLoseLife | SpellDescription$ Target player draws three cards, loses 3 life, and gets three poison counters.
|
||||||
SVar:DBLoseLife:DB$LoseLife | LifeAmount$ 3 | Defined$ Targeted | SubAbility$ DBPoison
|
SVar:DBLoseLife:DB$ LoseLife | LifeAmount$ 3 | Defined$ Targeted | SubAbility$ DBPoison
|
||||||
SVar:DBPoison:DB$Poison | Num$ 3 | Defined$ Targeted
|
SVar:DBPoison:DB$ Poison | Num$ 3 | Defined$ Targeted
|
||||||
SVar:Rarity:Uncommon
|
SVar:Rarity:Uncommon
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/caress_of_phyrexia.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/caress_of_phyrexia.jpg
|
||||||
SetInfo:NPH|Uncommon|http://magiccards.info/scans/en/nph/53.jpg
|
SetInfo:NPH|Uncommon|http://magiccards.info/scans/en/nph/53.jpg
|
||||||
|
|||||||
@@ -18,6 +18,35 @@ import forge.util.MyRandom;
|
|||||||
|
|
||||||
public class LifeLoseAi extends SpellAiLogic {
|
public class LifeLoseAi extends SpellAiLogic {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean chkAIDrawback(SpellAbility sa, Player ai) {
|
||||||
|
|
||||||
|
final Target tgt = sa.getTarget();
|
||||||
|
ArrayList<Player> tgtPlayers;
|
||||||
|
if (tgt != null) {
|
||||||
|
tgtPlayers = tgt.getTargetPlayers();
|
||||||
|
} else {
|
||||||
|
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), sa.getParam("Defined"), sa);
|
||||||
|
}
|
||||||
|
|
||||||
|
final Card source = sa.getSourceCard();
|
||||||
|
final String amountStr = sa.getParam("LifeAmount");
|
||||||
|
int amount = 0;
|
||||||
|
if (amountStr.equals("X") && source.getSVar(amountStr).equals("Count$xPaid")) {
|
||||||
|
// Set PayX here to maximum value.
|
||||||
|
final int xPay = ComputerUtil.determineLeftoverMana(sa, ai);
|
||||||
|
source.setSVar("PayX", Integer.toString(xPay));
|
||||||
|
amount = xPay;
|
||||||
|
} else {
|
||||||
|
amount = AbilityFactory.calculateAmount(source, amountStr, sa);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tgtPlayers.contains(ai) && amount > 0 && amount + 3 > ai.getLife()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see forge.card.abilityfactory.AbilityFactoryAlterLife.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
* @see forge.card.abilityfactory.AbilityFactoryAlterLife.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
|
||||||
*/
|
*/
|
||||||
@@ -141,11 +170,9 @@ public class LifeLoseAi extends SpellAiLogic {
|
|||||||
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), sa.getParam("Defined"), sa);
|
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), sa.getParam("Defined"), sa);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mandatory && tgtPlayers.contains(ai)) {
|
if (!mandatory && tgtPlayers.contains(ai) && amount > 0 && amount + 3 > ai.getLife()) {
|
||||||
// For cards like Foul Imp, ETB you lose life
|
// For cards like Foul Imp, ETB you lose life
|
||||||
if ((amount + 3) > ai.getLife()) {
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user