- DOM: Fixed Firesong and Sunspeaker so cycling Renewed Faith wouldn't trigger it

This commit is contained in:
swordshine
2018-03-12 09:10:18 +08:00
parent 7b837b4468
commit 0251d5776e
7 changed files with 17 additions and 6 deletions

View File

@@ -65,11 +65,11 @@ public class LifeExchangeEffect extends SpellAbilityEffect {
if ((life1 > life2) && p1.canLoseLife() && p2.canGainLife()) {
final int diff = life1 - life2;
p1.loseLife(diff);
p2.gainLife(diff, source);
p2.gainLife(diff, source, sa);
} else if ((life2 > life1) && p2.canLoseLife() && p1.canGainLife()) {
final int diff = life2 - life1;
p2.loseLife(diff);
p1.gainLife(diff, source);
p1.gainLife(diff, source, sa);
} else {
// they are equal, so nothing to do
}

View File

@@ -84,7 +84,7 @@ public class LifeExchangeVariantEffect extends SpellAbilityEffect {
game.fireEvent(new GameEventCardStatsChanged(source));
} else if ((num > pLife) && p.canGainLife()) {
final int diff = num - pLife;
p.gainLife(diff, source);
p.gainLife(diff, source, sa);
source.addNewPT(power, toughness, timestamp);
game.fireEvent(new GameEventCardStatsChanged(source));
} else {

View File

@@ -46,7 +46,7 @@ public class LifeGainEffect extends SpellAbilityEffect {
for (final Player p : tgtPlayers) {
if (!sa.usesTargeting() || p.canBeTargetedBy(sa)) {
p.gainLife(lifeAmount, sa.getHostCard());
p.gainLife(lifeAmount, sa.getHostCard(), sa);
}
}
}

View File

@@ -114,7 +114,7 @@ public class CostGainLife extends CostPart {
return false;
playersLeft--;
opp.gainLife(c, null);
opp.gainLife(c, ability.getHostCard(), ability);
}
return true;
}

View File

@@ -360,6 +360,10 @@ public class Player extends GameEntity implements Comparable<Player> {
}
public final boolean gainLife(int lifeGain, final Card source) {
return gainLife(lifeGain, source, null);
}
public final boolean gainLife(int lifeGain, final Card source, final SpellAbility sa) {
// Run any applicable replacement effects.
final Map<String, Object> repParams = Maps.newHashMap();
@@ -406,6 +410,7 @@ public class Player extends GameEntity implements Comparable<Player> {
runParams.put("Player", this);
runParams.put("LifeAmount", lifeGain);
runParams.put("Source", source);
runParams.put("SourceSA", sa);
game.getTriggerHandler().runTrigger(TriggerType.LifeGained, runParams, false);
game.fireEvent(new GameEventPlayerLivesChanged(this, oldLife, life));

View File

@@ -61,6 +61,12 @@ public class TriggerLifeGained extends Trigger {
return false;
}
}
if (this.mapParams.containsKey("Spell")) {
final SpellAbility spellAbility = (SpellAbility) runParams2.get("SourceSA");
if (spellAbility == null || !spellAbility.isSpell()) {
return false;
}
}
return true;
}