mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
- Added Drain Life
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -2624,6 +2624,7 @@ res/cardsfolder/d/dragonsoul_knight.txt svneol=native#text/plain
|
|||||||
res/cardsfolder/d/dragonspeaker_shaman.txt svneol=native#text/plain
|
res/cardsfolder/d/dragonspeaker_shaman.txt svneol=native#text/plain
|
||||||
res/cardsfolder/d/dragonstalker.txt svneol=native#text/plain
|
res/cardsfolder/d/dragonstalker.txt svneol=native#text/plain
|
||||||
res/cardsfolder/d/dragonstorm.txt svneol=native#text/plain
|
res/cardsfolder/d/dragonstorm.txt svneol=native#text/plain
|
||||||
|
res/cardsfolder/d/drain_life.txt -text
|
||||||
res/cardsfolder/d/drain_the_well.txt svneol=native#text/plain
|
res/cardsfolder/d/drain_the_well.txt svneol=native#text/plain
|
||||||
res/cardsfolder/d/drainpipe_vermin.txt -text
|
res/cardsfolder/d/drainpipe_vermin.txt -text
|
||||||
res/cardsfolder/d/drake_familiar.txt -text
|
res/cardsfolder/d/drake_familiar.txt -text
|
||||||
|
|||||||
24
res/cardsfolder/d/drain_life.txt
Normal file
24
res/cardsfolder/d/drain_life.txt
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
Name:Drain Life
|
||||||
|
ManaCost:X 1 B
|
||||||
|
Types:Sorcery
|
||||||
|
Text:no text
|
||||||
|
SVar:XColor:B
|
||||||
|
A:SP$ StoreSVar | Cost$ X 1 B | Tgt$ TgtCP | SVar$ Limit | Type$ Targeted | Expression$ CardToughness | SubAbility$ StoreTgtP | ConditionDefined$ Targeted | ConditionPresent$ Card.Creature | ConditionCompare$ GE1 | SpellDescription$ CARDNAME deals X damage to target creature or player. You gain life equal to the damage dealt, but not more life than the player's life total before CARDNAME dealt damage or the creature's toughness.
|
||||||
|
SVar:StoreTgtP:DB$ StoreSVar | SVar$ Limit | Type$ Count | Expression$ TargetedLifeTotal | SubAbility$ DBDamage | ConditionDefined$ Targeted | ConditionPresent$ Card.Creature | ConditionCompare$ EQ0
|
||||||
|
SVar:DBDamage:DB$ DealDamage | Defined$ Targeted | NumDmg$ X | SubAbility$ DBGainLife | References$ X
|
||||||
|
SVar:DBGainLife:DB$ GainLife | Defined$ You | LifeAmount$ DrainedLifeCard | References$ DrainedLifeCard
|
||||||
|
SVar:X:Count$xPaid
|
||||||
|
SVar:DrainedLifeCard:SVar$X/LimitMax.Limit
|
||||||
|
SVar:Limit:Count$xPaid
|
||||||
|
SVar:RemAIDeck:True
|
||||||
|
SVar:Rarity:Common
|
||||||
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/drain_life.jpg
|
||||||
|
SetInfo:LEA|Common|http://magiccards.info/scans/en/al/14.jpg
|
||||||
|
SetInfo:LEB|Common|http://magiccards.info/scans/en/be/14.jpg
|
||||||
|
SetInfo:5ED|Common|http://magiccards.info/scans/en/5e/18.jpg
|
||||||
|
SetInfo:4ED|Common|http://magiccards.info/scans/en/4e/16.jpg
|
||||||
|
SetInfo:3ED|Common|http://magiccards.info/scans/en/rv/14.jpg
|
||||||
|
SetInfo:MIR|Common|http://magiccards.info/scans/en/mr/16.jpg
|
||||||
|
SetInfo:2ED|Common|http://magiccards.info/scans/en/un/14.jpg
|
||||||
|
Oracle:Spend only black mana on X.\nDrain Life deals X damage to target creature or player. You gain life equal to the damage dealt, but not more life than the player's life total before Drain Life dealt damage or the creature's toughness.
|
||||||
|
End
|
||||||
@@ -1,9 +1,14 @@
|
|||||||
package forge.card.abilityfactory.effects;
|
package forge.card.abilityfactory.effects;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
|
import forge.card.abilityfactory.AbilityFactory;
|
||||||
import forge.card.abilityfactory.SpellEffect;
|
import forge.card.abilityfactory.SpellEffect;
|
||||||
import forge.card.cardfactory.CardFactoryUtil;
|
import forge.card.cardfactory.CardFactoryUtil;
|
||||||
import forge.card.spellability.SpellAbility;
|
import forge.card.spellability.SpellAbility;
|
||||||
|
import forge.card.spellability.Target;
|
||||||
|
|
||||||
public class StoreSVarEffect extends SpellEffect {
|
public class StoreSVarEffect extends SpellEffect {
|
||||||
|
|
||||||
@@ -44,6 +49,42 @@ public class StoreSVarEffect extends SpellEffect {
|
|||||||
else if (type.equals("CountSVar")) {
|
else if (type.equals("CountSVar")) {
|
||||||
value = CardFactoryUtil.xCount(source, "SVar$" + expr);
|
value = CardFactoryUtil.xCount(source, "SVar$" + expr);
|
||||||
}
|
}
|
||||||
|
else if (type.equals("Targeted")) {
|
||||||
|
List<Card> list = new ArrayList<Card>();
|
||||||
|
final Target t = sa.getTarget();
|
||||||
|
if (null != t) {
|
||||||
|
final ArrayList<Object> all = t.getTargets();
|
||||||
|
list = new ArrayList<Card>();
|
||||||
|
if (!all.isEmpty() && (all.get(0) instanceof SpellAbility)) {
|
||||||
|
final SpellAbility saTargeting = sa.getParentTargetingSA();
|
||||||
|
// possible NPE on next line
|
||||||
|
final ArrayList<SpellAbility> sas = saTargeting.getTarget().getTargetSAs();
|
||||||
|
for (final SpellAbility tgtsa : sas) {
|
||||||
|
list.add(tgtsa.getSourceCard());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
final SpellAbility saTargeting = sa.getParentTargetingCard();
|
||||||
|
if (null != saTargeting.getTarget()) {
|
||||||
|
list.addAll(saTargeting.getTarget().getTargetCards());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
final SpellAbility parent = sa.getParentTargetingCard();
|
||||||
|
if (parent.getTarget() != null) {
|
||||||
|
final ArrayList<Object> all = parent.getTarget().getTargets();
|
||||||
|
if (!all.isEmpty() && (all.get(0) instanceof SpellAbility)) {
|
||||||
|
list = new ArrayList<Card>();
|
||||||
|
final ArrayList<SpellAbility> sas = parent.getTarget().getTargetSAs();
|
||||||
|
for (final SpellAbility tgtsa : sas) {
|
||||||
|
list.add(tgtsa.getSourceCard());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
list = new ArrayList<Card>(parent.getTarget().getTargetCards());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
value = CardFactoryUtil.handlePaid(list, expr, source);
|
||||||
|
}
|
||||||
//TODO For other types call a different function
|
//TODO For other types call a different function
|
||||||
|
|
||||||
StringBuilder numBuilder = new StringBuilder();
|
StringBuilder numBuilder = new StringBuilder();
|
||||||
@@ -53,7 +94,7 @@ public class StoreSVarEffect extends SpellEffect {
|
|||||||
source.setSVar(key, numBuilder.toString());
|
source.setSVar(key, numBuilder.toString());
|
||||||
|
|
||||||
SpellAbility root = sa.getRootAbility();
|
SpellAbility root = sa.getRootAbility();
|
||||||
while(root != null) {
|
while (root != null) {
|
||||||
root.setSVar(key, numBuilder.toString());
|
root.setSVar(key, numBuilder.toString());
|
||||||
root = root.getSubAbility();
|
root = root.getSubAbility();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user