- 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
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.
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
#This SVar will be overridden by AF LoseLife
SVar:AFLifeLost:Count$OppLifeTotal/HalfUp
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/blood_tribute.jpg
SetInfo:ZEN|Rare|http://magiccards.info/scans/en/zen/81.jpg

View File

@@ -1591,7 +1591,8 @@ public class AbilityFactory {
if (svarval.equals("")) {
try {
Integer.parseInt(amount);
}
catch(NumberFormatException ignored) {
//If this is reached, amount wasn't an integer
//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!");
@@ -1599,9 +1600,6 @@ public class AbilityFactory {
System.out.println("Ability:" + ability.toString());
svarval = card.getSVar(amount);
}
catch(NumberFormatException ignored) {}
}
} else {
svarval = card.getSVar(amount);

View File

@@ -899,6 +899,7 @@ public class AbilityFactoryAlterLife {
*/
public static void loseLifeResolve(final AbilityFactory af, final SpellAbility sa) {
final HashMap<String, String> params = af.getMapParams();
int lifeLost = 0;
final int lifeAmount = AbilityFactory.calculateAmount(sa.getSourceCard(), params.get("LifeAmount"), sa);
@@ -913,9 +914,10 @@ public class AbilityFactoryAlterLife {
for (final Player p : tgtPlayers) {
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;
// rule 118.5
if (this.life > newLife) {
change = this.loseLife(this.life - newLife, source);
change = (this.loseLife(this.life - newLife, source) > 0);
} else if (newLife > this.life) {
change = this.gainLife(newLife - this.life, source);
} else {
@@ -399,16 +399,16 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
* a int.
* @param c
* a {@link forge.Card} object.
* @return a boolean.
* @return an int.
*/
public final boolean loseLife(final int toLose, final Card c) {
boolean newLifeSet = false;
public final int loseLife(final int toLose, final Card c) {
int lifeLost = 0;
if (!this.canLoseLife()) {
return false;
return 0;
}
if (toLose > 0) {
this.subtractLife(toLose);
newLifeSet = true;
lifeLost = toLose;
this.updateObservers();
} else if (toLose == 0) {
// Rule 118.4
@@ -416,7 +416,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
// nothing to do
} else {
System.out.println("Player - trying to lose negative life");
return false;
return 0;
}
this.lifeLostThisTurn += toLose;
@@ -427,7 +427,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
runParams.put("LifeAmount", toLose);
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
if (this.life >= lifePayment) {
return this.loseLife(lifePayment, source);
return (this.loseLife(lifePayment, source) > 0);
}
return false;