- Adding DamageSource$ parameter for AF_DealDamage

- Adding Repentance as an example.
This commit is contained in:
jendave
2011-08-06 20:03:02 +00:00
parent e2bcb01c18
commit 37624e5e65
3 changed files with 27 additions and 5 deletions

1
.gitattributes vendored
View File

@@ -5057,6 +5057,7 @@ res/cardsfolder/repay_in_kind.txt -text svneol=native#text/plain
res/cardsfolder/repeal.txt -text svneol=native#text/plain
res/cardsfolder/repel.txt -text svneol=native#text/plain
res/cardsfolder/repel_the_darkness.txt -text svneol=native#text/plain
res/cardsfolder/repentance.txt -text svneol=native#text/plain
res/cardsfolder/repentant_blacksmith.txt -text svneol=native#text/plain
res/cardsfolder/repentant_vampire.txt -text svneol=native#text/plain
res/cardsfolder/repercussion.txt svneol=native#text/plain

View File

@@ -0,0 +1,10 @@
Name:Repentance
ManaCost:2 W
Types:Sorcery
Text:no text
A:SP$DealDamage | Cost$ 2 W | Tgt$ TgtC | DamageSource$ Targeted | NumDmg$ X | SpellDescription$ Target creature deals damage to itself equal to its power.
SVar:X:Targeted$CardPower
SVar:RemAIDeck:True
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/repentance.jpg
End

View File

@@ -123,7 +123,15 @@ public class AbilityFactory_DealDamage {
if (!(sa instanceof Ability_Sub))
sb.append(name).append(" - ");
sb.append("Deals ").append(dmg).append(" damage to ");
ArrayList<Card> definedSources = AbilityFactory.getDefinedCards(sa.getSourceCard(), af.getMapParams().get("DamageSource"), sa);
Card source = definedSources.get(0);
if (source != sa.getSourceCard())
sb.append(source.toString()).append(" deals");
else
sb.append("Deals");
sb.append(" ").append(dmg).append(" damage to ");
for(int i = 0; i < tgts.size(); i++){
if (i != 0)
@@ -494,15 +502,18 @@ public class AbilityFactory_DealDamage {
tgts = saMe.getTarget().getTargets();
boolean targeted = (AF.getAbTgt() != null);
ArrayList<Card> definedSources = AbilityFactory.getDefinedCards(saMe.getSourceCard(), params.get("DamageSource"), saMe);
Card source = definedSources.get(0);
for(Object o : tgts){
if (o instanceof Card){
Card c = (Card)o;
if(AllZone.GameAction.isCardInPlay(c) && (!targeted || CardFactoryUtil.canTarget(AF.getHostCard(), c))) {
if (noPrevention)
c.addDamageWithoutPrevention(dmg, AF.getHostCard());
c.addDamageWithoutPrevention(dmg, source);
else
c.addDamage(dmg, AF.getHostCard());
c.addDamage(dmg, source);
}
}
@@ -510,9 +521,9 @@ public class AbilityFactory_DealDamage {
Player p = (Player) o;
if (!targeted || p.canTarget(AF.getHostCard())) {
if (noPrevention)
p.addDamageWithoutPrevention(dmg, AF.getHostCard());
p.addDamageWithoutPrevention(dmg, source);
else
p.addDamage(dmg, AF.getHostCard());
p.addDamage(dmg, source);
}
}
}