- Blood Tribute will now gain life equal to the life really lost by it.

This commit is contained in:
Sloth
2012-09-16 11:57:30 +00:00
parent 723a440859
commit c12234e320
4 changed files with 17 additions and 15 deletions

View File

@@ -4,8 +4,10 @@ Types:Sorcery
Text:no text Text:no text
K:Kicker tapXType<1/Vampire> K:Kicker tapXType<1/Vampire>
A:SP$ LoseLife | Cost$ 4 B B | ValidTgts$ Opponent | LifeAmount$ X | References$ X | SubAbility$ DBGainLife | SpellDescription$ Target opponent loses half his or her life, rounded up. If CARDNAME was kicked, you gain life equal to the life lost this way. A:SP$ LoseLife | Cost$ 4 B B | ValidTgts$ Opponent | LifeAmount$ X | References$ X | SubAbility$ DBGainLife | SpellDescription$ Target opponent loses half his or her life, rounded up. If CARDNAME was kicked, you gain life equal to the life lost this way.
SVar:DBGainLife:DB$GainLife | Defined$ You | LifeAmount$ X | References$ X | Condition$ Kicked SVar:DBGainLife:DB$GainLife | Defined$ You | LifeAmount$ AFLifeLost | Condition$ Kicked | ConditionDescription$ If it was kicked,
SVar:X:Count$OppLifeTotal/HalfUp SVar:X:Count$OppLifeTotal/HalfUp
#This SVar will be overridden by AF LoseLife
SVar:AFLifeLost:Count$OppLifeTotal/HalfUp
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/blood_tribute.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/blood_tribute.jpg
SetInfo:ZEN|Rare|http://magiccards.info/scans/en/zen/81.jpg SetInfo:ZEN|Rare|http://magiccards.info/scans/en/zen/81.jpg

View File

@@ -1591,7 +1591,8 @@ public class AbilityFactory {
if (svarval.equals("")) { if (svarval.equals("")) {
try { try {
Integer.parseInt(amount); Integer.parseInt(amount);
}
catch(NumberFormatException ignored) {
//If this is reached, amount wasn't an integer //If this is reached, amount wasn't an integer
//Print a warning to console to help debug if an ability is not stolen properly. //Print a warning to console to help debug if an ability is not stolen properly.
System.out.println("WARNING:SVar fallback to card with ability present!"); System.out.println("WARNING:SVar fallback to card with ability present!");
@@ -1599,9 +1600,6 @@ public class AbilityFactory {
System.out.println("Ability:" + ability.toString()); System.out.println("Ability:" + ability.toString());
svarval = card.getSVar(amount); svarval = card.getSVar(amount);
} }
catch(NumberFormatException ignored) {}
} }
} else { } else {
svarval = card.getSVar(amount); svarval = card.getSVar(amount);

View File

@@ -899,6 +899,7 @@ public class AbilityFactoryAlterLife {
*/ */
public static void loseLifeResolve(final AbilityFactory af, final SpellAbility sa) { public static void loseLifeResolve(final AbilityFactory af, final SpellAbility sa) {
final HashMap<String, String> params = af.getMapParams(); final HashMap<String, String> params = af.getMapParams();
int lifeLost = 0;
final int lifeAmount = AbilityFactory.calculateAmount(sa.getSourceCard(), params.get("LifeAmount"), sa); final int lifeAmount = AbilityFactory.calculateAmount(sa.getSourceCard(), params.get("LifeAmount"), sa);
@@ -913,9 +914,10 @@ public class AbilityFactoryAlterLife {
for (final Player p : tgtPlayers) { for (final Player p : tgtPlayers) {
if ((tgt == null) || p.canBeTargetedBy(sa)) { if ((tgt == null) || p.canBeTargetedBy(sa)) {
p.loseLife(lifeAmount, sa.getSourceCard()); lifeLost += p.loseLife(lifeAmount, sa.getSourceCard());
} }
} }
sa.getSourceCard().setSVar("AFLifeLost", "Number$" + Integer.toString(lifeLost));
} }
// ************************************************************************* // *************************************************************************

View File

@@ -273,7 +273,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
boolean change = false; boolean change = false;
// rule 118.5 // rule 118.5
if (this.life > newLife) { if (this.life > newLife) {
change = this.loseLife(this.life - newLife, source); change = (this.loseLife(this.life - newLife, source) > 0);
} else if (newLife > this.life) { } else if (newLife > this.life) {
change = this.gainLife(newLife - this.life, source); change = this.gainLife(newLife - this.life, source);
} else { } else {
@@ -399,16 +399,16 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
* a int. * a int.
* @param c * @param c
* a {@link forge.Card} object. * a {@link forge.Card} object.
* @return a boolean. * @return an int.
*/ */
public final boolean loseLife(final int toLose, final Card c) { public final int loseLife(final int toLose, final Card c) {
boolean newLifeSet = false; int lifeLost = 0;
if (!this.canLoseLife()) { if (!this.canLoseLife()) {
return false; return 0;
} }
if (toLose > 0) { if (toLose > 0) {
this.subtractLife(toLose); this.subtractLife(toLose);
newLifeSet = true; lifeLost = toLose;
this.updateObservers(); this.updateObservers();
} else if (toLose == 0) { } else if (toLose == 0) {
// Rule 118.4 // Rule 118.4
@@ -416,7 +416,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
// nothing to do // nothing to do
} else { } else {
System.out.println("Player - trying to lose negative life"); System.out.println("Player - trying to lose negative life");
return false; return 0;
} }
this.lifeLostThisTurn += toLose; this.lifeLostThisTurn += toLose;
@@ -427,7 +427,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
runParams.put("LifeAmount", toLose); runParams.put("LifeAmount", toLose);
AllZone.getTriggerHandler().runTrigger(TriggerType.LifeLost, runParams); AllZone.getTriggerHandler().runTrigger(TriggerType.LifeLost, runParams);
return newLifeSet; return lifeLost;
} }
/** /**
@@ -493,7 +493,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
} }
// rule 118.8 // rule 118.8
if (this.life >= lifePayment) { if (this.life >= lifePayment) {
return this.loseLife(lifePayment, source); return (this.loseLife(lifePayment, source) > 0);
} }
return false; return false;