mirror of
https://github.com/correl/mage.git
synced 2025-03-07 20:53:18 -10:00
refactored Player.gainLife() to include source
This commit is contained in:
parent
254935da39
commit
3798f34c38
209 changed files with 221 additions and 218 deletions
|
@ -98,7 +98,7 @@ class AbattoirGhoulEffect extends OneShotEffect {
|
|||
if (creature != null) {
|
||||
int toughness = creature.getToughness().getValue();
|
||||
if (you != null) {
|
||||
you.gainLife(toughness, game);
|
||||
you.gainLife(toughness, game, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ class AgentOfMasksEffect extends OneShotEffect {
|
|||
loseLife += game.getPlayer(opponentId).loseLife(1, game, false);
|
||||
}
|
||||
if (loseLife > 0)
|
||||
game.getPlayer(source.getControllerId()).gainLife(loseLife, game);
|
||||
game.getPlayer(source.getControllerId()).gainLife(loseLife, game, source);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ class WellEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
int life = 2 * game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game);
|
||||
if (player != null) {
|
||||
player.gainLife(life, game);
|
||||
player.gainLife(life, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ class AnHavvaInnEffect extends OneShotEffect {
|
|||
FilterCreaturePermanent filter = new FilterCreaturePermanent("green creatures");
|
||||
filter.add(new ColorPredicate(ObjectColor.GREEN));
|
||||
int greenCreatures = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game);
|
||||
player.gainLife(greenCreatures+1, game);
|
||||
player.gainLife(greenCreatures+1, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ class AngelicChorusEffect extends OneShotEffect {
|
|||
int amount = creature.getToughness().getValue();
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
player.gainLife(amount, game);
|
||||
player.gainLife(amount, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ class AnimalBoneyardEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
if (toughness > 0) {
|
||||
controller.gainLife(toughness, game);
|
||||
controller.gainLife(toughness, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ class ApproachOfTheSecondSunEffect extends OneShotEffect {
|
|||
controller.won(game);
|
||||
} else {
|
||||
// Gain 7 life and put this back into library.
|
||||
controller.gainLife(7, game);
|
||||
controller.gainLife(7, game, source);
|
||||
|
||||
// Put this into the library as the 7th from the top
|
||||
if (spell.isCopiedSpell()) {
|
||||
|
|
|
@ -81,7 +81,7 @@ class ArchangelsLightEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
DynamicValue value = new CardsInControllerGraveyardCount();
|
||||
if (controller != null) {
|
||||
controller.gainLife(value.calculate(game, source, this) * 2, game);
|
||||
controller.gainLife(value.calculate(game, source, this) * 2, game, source);
|
||||
for (Card card: controller.getGraveyard().getCards(game)) {
|
||||
controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD, true, true);
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ class AuguryAdeptEffect extends OneShotEffect {
|
|||
|
||||
int cmc = card.getConvertedManaCost();
|
||||
if (cmc > 0) {
|
||||
controller.gainLife(cmc, game);
|
||||
controller.gainLife(cmc, game, source);
|
||||
}
|
||||
cards.add(card);
|
||||
controller.revealCards(sourceObject.getName(), cards, game);
|
||||
|
|
|
@ -130,7 +130,7 @@ class AvenShrineEffect extends OneShotEffect {
|
|||
count += player.getGraveyard().count(filterCardName, game);
|
||||
}
|
||||
}
|
||||
controller.gainLife(count, game);
|
||||
controller.gainLife(count, game, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ class AvengerEnDalEffect extends OneShotEffect {
|
|||
if (permanent != null) {
|
||||
Player player = game.getPlayer(permanent.getControllerId());
|
||||
if (player != null) {
|
||||
player.gainLife(permanent.getToughness().getValue(), game);
|
||||
player.gainLife(permanent.getToughness().getValue(), game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ class AweStrikeEffect extends PreventionEffectImpl {
|
|||
PreventionEffectData preventionData = preventDamageAction(event, source, game);
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
player.gainLife(preventionData.getPreventedDamage(), game);
|
||||
player.gainLife(preventionData.getPreventedDamage(), game, source);
|
||||
}
|
||||
this.used = true;
|
||||
this.discard();
|
||||
|
|
|
@ -193,7 +193,7 @@ class AzorTheLawbringerAttacksEffect extends OneShotEffect {
|
|||
cost.add(new GenericManaCost(costX));
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
|
||||
controller.resetStoredBookmark(game); // otherwise you can undo the payment
|
||||
controller.gainLife(costX, game);
|
||||
controller.gainLife(costX, game, source);
|
||||
controller.drawCards(costX, game);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ class AzorsGatewayEffect extends OneShotEffect {
|
|||
usedCMC.add(card.getConvertedManaCost());
|
||||
}
|
||||
if (usedCMC.size() > 4) {
|
||||
controller.gainLife(4, game);
|
||||
controller.gainLife(4, game, source);
|
||||
new UntapSourceEffect().apply(game, source);
|
||||
new TransformSourceEffect(true).apply(game, source);
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ class BeaconOfImmortalityEffect extends OneShotEffect {
|
|||
return true;
|
||||
}
|
||||
if (amount > 0) {
|
||||
player.gainLife(amount, game);
|
||||
player.gainLife(amount, game, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,9 +131,9 @@ class BenevolentOfferingEffect2 extends OneShotEffect {
|
|||
Player opponent = game.getPlayer(target.getFirstTarget());
|
||||
if (opponent != null) {
|
||||
int count = game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_CREATURE, controller.getId(), game) * 2;
|
||||
controller.gainLife(count, game);
|
||||
controller.gainLife(count, game, source);
|
||||
count = game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_CREATURE, opponent.getId(), game) * 2;
|
||||
opponent.gainLife(count, game);
|
||||
opponent.gainLife(count, game, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ class BiorhythmEffect extends OneShotEffect {
|
|||
player.loseLife(diff, game, false);
|
||||
}
|
||||
if(diff < 0) {
|
||||
player.gainLife(-diff, game);
|
||||
player.gainLife(-diff, game, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ class BloodTitheEffect extends OneShotEffect {
|
|||
for (UUID opponentId: game.getOpponents(source.getControllerId())) {
|
||||
damage += game.getPlayer(opponentId).damage(3, source.getSourceId(), game, false, true);
|
||||
}
|
||||
game.getPlayer(source.getControllerId()).gainLife(damage, game);
|
||||
game.getPlayer(source.getControllerId()).gainLife(damage, game, source);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ class BloodTributeGainLifeEffect extends OneShotEffect {
|
|||
if (player != null) {
|
||||
Integer amount = (Integer) game.getState().getValue(source.getSourceId().toString() + "_BloodTribute");
|
||||
if (amount != null && amount > 0) {
|
||||
player.gainLife(amount, game);
|
||||
player.gainLife(amount, game, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ public class BlossomingWreath extends CardImpl {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
controller.gainLife(controller.getGraveyard().count(new FilterCreatureCard(), game), game);
|
||||
controller.gainLife(controller.getGraveyard().count(new FilterCreatureCard(), game), game, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -94,7 +94,7 @@ class BounteousKirinEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
int life = spell.getConvertedManaCost();
|
||||
controller.gainLife(life, game);
|
||||
controller.gainLife(life, game, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ class BrightflameEffect extends OneShotEffect {
|
|||
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
if (you != null && damageDealt > 0) {
|
||||
you.gainLife(damageDealt, game);
|
||||
you.gainLife(damageDealt, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ class BubblingCauldronEffect extends OneShotEffect {
|
|||
Player opponent = game.getPlayer(opponentId);
|
||||
damage += opponent.loseLife(4, game, false);
|
||||
}
|
||||
game.getPlayer(source.getControllerId()).gainLife(damage, game);
|
||||
game.getPlayer(source.getControllerId()).gainLife(damage, game, source);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ class CandlesGlowPreventDamageTargetEffect extends PreventionEffectImpl {
|
|||
if (prevented > 0) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
controller.gainLife(prevented, game);
|
||||
controller.gainLife(prevented, game, source);
|
||||
game.informPlayers(new StringBuilder("Candles' Glow: Prevented ").append(prevented).append(" damage ").toString());
|
||||
game.informPlayers(new StringBuilder("Candles' Glow: ").append(controller.getLogName()).append(" gained ").append(prevented).append("life").toString());
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ class CelestialMantleEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
player.gainLife(player.getLife(), game);
|
||||
player.gainLife(player.getLife(), game, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -88,7 +88,7 @@ class CertainDeathEffect extends OneShotEffect {
|
|||
Player permController = game.getPlayer(permanent.getControllerId());
|
||||
if (permController != null) {
|
||||
permController.loseLife(2, game, false);
|
||||
you.gainLife(2, game);
|
||||
you.gainLife(2, game, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ class ChaliceOfLifeEffect extends OneShotEffect {
|
|||
if (permanent != null) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
//gain 1 life
|
||||
player.gainLife(1, game);
|
||||
player.gainLife(1, game, source);
|
||||
|
||||
// if you have at least 10 life more than your starting life total, transform Chalice of Life.
|
||||
if (player.getLife() >= game.getLife() + 10) {
|
||||
|
|
|
@ -119,7 +119,7 @@ class ChancellorOfTheDrossEffect extends OneShotEffect {
|
|||
loseLife += game.getPlayer(opponentId).loseLife(3, game, false);
|
||||
}
|
||||
if (loseLife > 0) {
|
||||
game.getPlayer(source.getControllerId()).gainLife(loseLife, game);
|
||||
game.getPlayer(source.getControllerId()).gainLife(loseLife, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ class ChantOfVituGhaziPreventEffect extends PreventAllDamageByAllPermanentsEffec
|
|||
PreventionEffectData preventionData = preventDamageAction(event, source, game);
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
controller.gainLife(preventionData.getPreventedDamage(), game);
|
||||
controller.gainLife(preventionData.getPreventedDamage(), game, source);
|
||||
}
|
||||
// damage amount is reduced or set to 0 so complete replacement of damage event is never neccessary
|
||||
return false;
|
||||
|
|
|
@ -89,7 +89,7 @@ class ChastiseEffect extends OneShotEffect {
|
|||
int power = permanent.getPower().getValue();
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
player.gainLife(power, game);
|
||||
player.gainLife(power, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ class ChoArrimAlchemistEffect extends PreventionEffectImpl {
|
|||
if (preventionData.getPreventedDamage() > 0) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
player.gainLife(preventionData.getPreventedDamage(), game);
|
||||
player.gainLife(preventionData.getPreventedDamage(), game, source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -91,7 +91,7 @@ class CondemnEffect extends OneShotEffect {
|
|||
if (permanent != null) {
|
||||
Player player = game.getPlayer(permanent.getControllerId());
|
||||
if (player != null) {
|
||||
player.gainLife(permanent.getToughness().getValue(), game);
|
||||
player.gainLife(permanent.getToughness().getValue(), game, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ class ConsumeSpiritEffect extends OneShotEffect {
|
|||
}
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
controller.gainLife(amount, game);
|
||||
controller.gainLife(amount, game, source);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ class ConsumingVaporsEffect extends OneShotEffect {
|
|||
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if ( permanent != null ) {
|
||||
controller.gainLife(permanent.getToughness().getValue(), game);
|
||||
controller.gainLife(permanent.getToughness().getValue(), game, source);
|
||||
return permanent.sacrifice(source.getSourceId(), game);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -78,7 +78,7 @@ class ConvalescenceEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player.getLife() <= 10) {
|
||||
player.gainLife(1, game);
|
||||
player.gainLife(1, game, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -107,7 +107,7 @@ class CorruptEffect extends OneShotEffect {
|
|||
}
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
if (you != null) {
|
||||
you.gainLife(damageDealt, game);
|
||||
you.gainLife(damageDealt, game, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ class CrumbleEffect extends OneShotEffect {
|
|||
int cost = permanent.getConvertedManaCost();
|
||||
Player player = game.getPlayer(permanent.getControllerId());
|
||||
if (player != null) {
|
||||
player.gainLife(cost, game);
|
||||
player.gainLife(cost, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ class CryptIncursionEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
}
|
||||
player.gainLife(exiledCards * 3, game);
|
||||
player.gainLife(exiledCards * 3, game, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -184,7 +184,7 @@ class CurseOfVengeanceDrawLifeEffect extends OneShotEffect {
|
|||
if (sourceObject != null && controller != null) {
|
||||
if (sourceObject.getCounters(game).containsKey(CounterType.SPITE)) {
|
||||
controller.drawCards(sourceObject.getCounters(game).getCount(CounterType.SPITE), game);
|
||||
controller.gainLife(sourceObject.getCounters(game).getCount(CounterType.SPITE), game);
|
||||
controller.gainLife(sourceObject.getCounters(game).getCount(CounterType.SPITE), game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ class DaxosOfMeletisEffect extends OneShotEffect {
|
|||
// player gains life
|
||||
int cmc = card.getConvertedManaCost();
|
||||
if (cmc > 0) {
|
||||
controller.gainLife(cmc, game);
|
||||
controller.gainLife(cmc, game, source);
|
||||
}
|
||||
// Add effects only if the card has a spellAbility (e.g. not for lands).
|
||||
if (card.getSpellAbility() != null) {
|
||||
|
|
|
@ -89,7 +89,7 @@ class DazzlingReflectionEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Permanent targetCreature = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
|
||||
controller.gainLife(targetCreature.getPower().getValue(), game);
|
||||
controller.gainLife(targetCreature.getPower().getValue(), game, source);
|
||||
ContinuousEffect effect = new DazzlingReflectionPreventEffect();
|
||||
effect.setTargetPointer(new FixedTarget(targetCreature, game));
|
||||
game.addEffect(effect, source);
|
||||
|
|
|
@ -99,7 +99,7 @@ public class DeathWatch extends CardImpl {
|
|||
if (opponent != null) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
controller.gainLife(creature.getToughness().getValue(), game);
|
||||
controller.gainLife(creature.getToughness().getValue(), game, source);
|
||||
opponent.loseLife(creature.getPower().getValue(), game, false);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ class DeathgorgeScavengerEffect extends OneShotEffect {
|
|||
if (card != null) {
|
||||
controller.moveCards(card, Zone.EXILED, source, game);
|
||||
if (card.isCreature()) {
|
||||
controller.gainLife(2, game);
|
||||
controller.gainLife(2, game, source);
|
||||
} else {
|
||||
game.addEffect(new BoostSourceEffect(1, 1, Duration.EndOfTurn), source);
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ class DeathsCaressEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent creature = (Permanent) game.getLastKnownInformation(source.getFirstTarget(), Zone.BATTLEFIELD);
|
||||
if (player != null && creature != null && creature.hasSubtype(SubType.HUMAN, game)) {
|
||||
player.gainLife(creature.getToughness().getValue(), game);
|
||||
player.gainLife(creature.getToughness().getValue(), game, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -88,7 +88,7 @@ class DebtToTheDeathlessEffect extends OneShotEffect {
|
|||
lifeLost += opponent.loseLife(xValue * 2, game, false);
|
||||
}
|
||||
}
|
||||
controller.gainLife(lifeLost, game);
|
||||
controller.gainLife(lifeLost, game, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -100,7 +100,7 @@ class DevourFleshSacrificeEffect extends OneShotEffect {
|
|||
int gainLife = permanent.getToughness().getValue();
|
||||
permanent.sacrifice(source.getSourceId(), game);
|
||||
game.applyEffects();
|
||||
player.gainLife(gainLife, game);
|
||||
player.gainLife(gainLife, game, source);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ class DevouringGreedEffect extends OneShotEffect {
|
|||
Player sourcePlayer = game.getPlayer(source.getControllerId());
|
||||
if (targetPlayer != null && sourcePlayer != null) {
|
||||
targetPlayer.loseLife(amount, game, false);
|
||||
sourcePlayer.gainLife(amount, game);
|
||||
sourcePlayer.gainLife(amount, game, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -100,7 +100,7 @@ class DiscipleOfBolasEffect extends OneShotEffect {
|
|||
if (sacrificed != null) {
|
||||
sacrificed.sacrifice(source.getSourceId(), game);
|
||||
int power = sacrificed.getPower().getValue();
|
||||
controller.gainLife(power, game);
|
||||
controller.gainLife(power, game, source);
|
||||
controller.drawCards(power, game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ class DiscipleOfGriselbrandEffect extends OneShotEffect {
|
|||
amount = ((SacrificeTargetCost) cost).getPermanents().get(0).getToughness().getValue();
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (amount > 0 && player != null) {
|
||||
player.gainLife(amount, game);
|
||||
player.gainLife(amount, game, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ class DivineCongregationEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(source.getFirstTarget());
|
||||
if (controller != null) {
|
||||
int critters = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game).size();
|
||||
controller.gainLife(2 * critters, game);
|
||||
controller.gainLife(2 * critters, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ class DoomgapeEffect extends OneShotEffect {
|
|||
Permanent creature = game.getPermanent(target.getFirstTarget());
|
||||
if (creature != null) {
|
||||
if (creature.sacrifice(source.getSourceId(), game)) {
|
||||
controller.gainLife(creature.getToughness().getValue(), game);
|
||||
controller.gainLife(creature.getToughness().getValue(), game, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ class DrainLifeEffect extends OneShotEffect {
|
|||
}
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
controller.gainLife(lifetogain, game);
|
||||
controller.gainLife(lifetogain, game, source);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ class DruidicSatchelEffect extends OneShotEffect {
|
|||
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId());
|
||||
}
|
||||
if (!card.isCreature() && !card.isLand()) {
|
||||
player.gainLife(2, game);
|
||||
player.gainLife(2, game, source);
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl();
|
||||
|
|
|
@ -99,7 +99,7 @@ class EbonyCharmDrainEffect extends OneShotEffect {
|
|||
Player controllerPlayer = game.getPlayer(source.getControllerId());
|
||||
if (targetPlayer != null && controllerPlayer != null) {
|
||||
targetPlayer.damage(1, source.getSourceId(), game, false, true);
|
||||
controllerPlayer.gainLife(1, game);
|
||||
controllerPlayer.gainLife(1, game, source);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ class ElixerOfImmortalityEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (player != null) {
|
||||
player.gainLife(5, game);
|
||||
player.gainLife(5, game, source);
|
||||
if (permanent != null) {
|
||||
player.moveCardToLibraryWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD, true, true);
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ class ElspethTirelFirstEffect extends OneShotEffect {
|
|||
int amount = game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game);
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
player.gainLife(amount, game);
|
||||
player.gainLife(amount, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ class EmissaryOfHopeEffect extends OneShotEffect {
|
|||
if (targetPlayer != null && sourcePlayer != null) {
|
||||
int amount = game.getBattlefield().count(filter, source.getSourceId(), targetPlayer.getId(), game);
|
||||
if (amount > 0) {
|
||||
sourcePlayer.gainLife(amount, game);
|
||||
sourcePlayer.gainLife(amount, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ class EngulfingSlagwurmEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent creature = game.getPermanentOrLKIBattlefield(this.getTargetPointer().getFirst(game, source));
|
||||
if (creature != null && controller != null) {
|
||||
controller.gainLife(creature.getPower().getValue(), game);
|
||||
controller.gainLife(creature.getPower().getValue(), game, source);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ class EssenceBottleEffect extends OneShotEffect {
|
|||
}
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
player.gainLife(countersRemoved * 2, game);
|
||||
player.gainLife(countersRemoved * 2, game, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -97,7 +97,7 @@ class EssenceHarvestEffect extends OneShotEffect {
|
|||
|
||||
if (amount > 0) {
|
||||
targetPlayer.loseLife(amount, game, false);
|
||||
player.gainLife(amount, game);
|
||||
player.gainLife(amount, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ class EssenceSliverGainThatMuchLifeEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
int amount = (Integer) getValue("damage");
|
||||
if (amount > 0) {
|
||||
controller.gainLife(amount, game);
|
||||
controller.gainLife(amount, game, source);
|
||||
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -96,7 +96,7 @@ class ExileEffect extends OneShotEffect {
|
|||
if (permanent != null) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
player.gainLife(permanent.getToughness().getValue(), game);
|
||||
player.gainLife(permanent.getToughness().getValue(), game, source);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -78,7 +78,7 @@ class ExsanguinateEffect extends OneShotEffect {
|
|||
loseLife += game.getPlayer(opponentId).loseLife(damage, game, false);
|
||||
}
|
||||
if (loseLife > 0)
|
||||
game.getPlayer(source.getControllerId()).gainLife(loseLife, game);
|
||||
game.getPlayer(source.getControllerId()).gainLife(loseLife, game, source);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ class FastingReplacementEffect extends ReplacementEffectImpl {
|
|||
if (event.getPlayerId().equals(source.getControllerId())
|
||||
&& controller != null
|
||||
&& controller.chooseUse(outcome, "Would you like to skip your draw step to gain 2 life?", source, game)) {
|
||||
controller.gainLife(2, game);
|
||||
controller.gainLife(2, game, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -84,7 +84,7 @@ class FeudkillersVerdictEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
controller.gainLife(10, game);
|
||||
controller.gainLife(10, game, source);
|
||||
boolean moreLife = false;
|
||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
|
|
|
@ -98,7 +98,7 @@ class FiligreeAngelEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
int life = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game) * 3;
|
||||
player.gainLife(life, game);
|
||||
player.gainLife(life, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ class ForceDrainEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (player != null) {
|
||||
if (player.damage(2, source.getId(), game, false, true) > 0) {
|
||||
controller.gainLife(2, game);
|
||||
controller.gainLife(2, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ class ForceMasteryEffect extends OneShotEffect {
|
|||
Cards cards = new CardsImpl(card);
|
||||
controller.revealCards(sourcePermanent.getIdName(), cards, game);
|
||||
controller.moveCards(card, Zone.HAND, source, game);
|
||||
controller.gainLife(card.getConvertedManaCost(), game);
|
||||
controller.gainLife(card.getConvertedManaCost(), game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ class FoulTongueInvocationEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get(DragonOnTheBattlefieldWhileSpellWasCastWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.castWithConditionTrue(source.getId())) {
|
||||
controller.gainLife(4, game);
|
||||
controller.gainLife(4, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ class FoulTongueShriekEffect extends OneShotEffect {
|
|||
int amount = new AttackingFilterCreatureCount(filter).calculate(game, source, this);
|
||||
if (amount > 0) {
|
||||
targetOpponent.loseLife(amount, game, false);
|
||||
controller.gainLife(amount, game);
|
||||
controller.gainLife(amount, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ class FracturingGustDestroyEffect extends OneShotEffect {
|
|||
}
|
||||
game.applyEffects(); // needed in case a destroyed permanent did prevent life gain
|
||||
if (destroyedPermanents > 0) {
|
||||
controller.gainLife(2 * destroyedPermanents, game);
|
||||
controller.gainLife(2 * destroyedPermanents, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ class FruitOfTheFirstTreeEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent creature = (Permanent) getValue("attachedTo");
|
||||
if (controller != null && creature != null) {
|
||||
controller.gainLife(creature.getToughness().getValue(), game);
|
||||
controller.gainLife(creature.getToughness().getValue(), game, source);
|
||||
controller.drawCards(creature.getToughness().getValue(), game);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ class FumigateEffect extends OneShotEffect {
|
|||
}
|
||||
game.applyEffects();
|
||||
if (destroyedCreature > 0) {
|
||||
controller.gainLife(destroyedCreature, game);
|
||||
controller.gainLife(destroyedCreature, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ class GameOfChaosEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
private void handleLifeChangesFromFlip(Game game, Player playerGainingLife, Player playerLosingLife, int lifeAmount) {
|
||||
playerGainingLife.gainLife(lifeAmount, game);
|
||||
playerGainingLife.gainLife(lifeAmount, game, source);
|
||||
playerLosingLife.loseLife(lifeAmount, game, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ class GarrukApexPredatorEffect3 extends OneShotEffect {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent creature = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
|
||||
if (player != null && creature != null) {
|
||||
player.gainLife(creature.getToughness().getValue(), game);
|
||||
player.gainLife(creature.getToughness().getValue(), game, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -104,7 +104,7 @@ class GerrardCapashenEffect extends OneShotEffect {
|
|||
if (controller != null && targetOpponent != null) {
|
||||
int cardsInHand = targetOpponent.getHand().size();
|
||||
if (cardsInHand > 0) {
|
||||
controller.gainLife(cardsInHand, game);
|
||||
controller.gainLife(cardsInHand, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ class GerrardsVerdictEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (controller != null && targetPlayer != null) {
|
||||
controller.gainLife(targetPlayer.discard(2, false, source, game).count(new FilterLandCard(), game) * 3, game);
|
||||
controller.gainLife(targetPlayer.discard(2, false, source, game).count(new FilterLandCard(), game) * 3, game, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -102,7 +102,7 @@ class GhostCouncilOfOrzhovaEffect extends OneShotEffect {
|
|||
Player controllerPlayer = game.getPlayer(source.getControllerId());
|
||||
if (targetPlayer != null && controllerPlayer != null) {
|
||||
targetPlayer.loseLife(1, game, false);
|
||||
controllerPlayer.gainLife(1, game);
|
||||
controllerPlayer.gainLife(1, game, source);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ class GideonsDefeatEffect extends OneShotEffect {
|
|||
controller.moveCards(permanent, Zone.EXILED, source, game);
|
||||
game.applyEffects();
|
||||
if (permanent.isPlaneswalker() && permanent.hasSubtype(SubType.GIDEON, game)) {
|
||||
controller.gainLife(5, game);
|
||||
controller.gainLife(5, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ class GlimmerpostEffect extends OneShotEffect {
|
|||
int amount = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game);
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
player.gainLife(amount, game);
|
||||
player.gainLife(amount, game, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -140,7 +140,7 @@ class GlyphOfLifeGainLifeEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
player.gainLife((Integer) this.getValue("damageAmount"), game);
|
||||
player.gainLife((Integer) this.getValue("damageAmount"), game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ class GontisMachinationsEffect extends OneShotEffect {
|
|||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
damage += game.getPlayer(opponentId).loseLife(3, game, false);
|
||||
}
|
||||
game.getPlayer(source.getControllerId()).gainLife(damage, game);
|
||||
game.getPlayer(source.getControllerId()).gainLife(damage, game, source);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ class GraveyardShovelEffect extends OneShotEffect {
|
|||
targetPlayer.getGraveyard().remove(card);
|
||||
card.moveToExile(null, "", source.getSourceId(), game);
|
||||
if (card.isCreature()) {
|
||||
controller.gainLife(2, game);
|
||||
controller.gainLife(2, game, source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -99,7 +99,7 @@ class GrayMerchantOfAsphodelEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
}
|
||||
controller.gainLife(lifeLost, game);
|
||||
controller.gainLife(lifeLost, game, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -85,7 +85,7 @@ class GroveOfTheBurnwillowsEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
for (UUID playerId : game.getOpponents(source.getControllerId())) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
player.gainLife(1, game);
|
||||
player.gainLife(1, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ class HallowPreventDamageByTargetEffect extends PreventionEffectImpl {
|
|||
PreventionEffectData preventionEffectData = preventDamageAction(event, source, game);
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
controller.gainLife(preventionEffectData.getPreventedDamage(), game);
|
||||
controller.gainLife(preventionEffectData.getPreventedDamage(), game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ class HarmonyOfNatureEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
if (tappedAmount > 0) {
|
||||
controller.gainLife(tappedAmount * 4, game);
|
||||
controller.gainLife(tappedAmount * 4, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ class HealTheScarsEffect extends OneShotEffect {
|
|||
if (permanent != null) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
player.gainLife(permanent.getToughness().getValue(), game);
|
||||
player.gainLife(permanent.getToughness().getValue(), game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ class SeekEffect extends OneShotEffect {
|
|||
player.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, Zone.LIBRARY, true);
|
||||
int cmc = card.getConvertedManaCost();
|
||||
if (cmc > 0) {
|
||||
player.gainLife(cmc, game);
|
||||
player.gainLife(cmc, game, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ class HonorTheFallenEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
}
|
||||
controller.gainLife(exiledCards, game);
|
||||
controller.gainLife(exiledCards, game, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -111,7 +111,7 @@ class IlluminationEffect extends OneShotEffect {
|
|||
int cost = spell.getConvertedManaCost();
|
||||
Player player = game.getPlayer(spell.getControllerId());
|
||||
if (player != null) {
|
||||
player.gainLife(cost, game);
|
||||
player.gainLife(cost, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ class InterventionPactPreventDamageEffect extends PreventionEffectImpl {
|
|||
used = true;
|
||||
Player player = game .getPlayer(source.getControllerId());
|
||||
if(player != null){
|
||||
player.gainLife(preventEffectData.getPreventedDamage(), game);
|
||||
player.gainLife(preventEffectData.getPreventedDamage(), game, source);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -85,7 +85,7 @@ class InvincibleHymnEffect extends OneShotEffect {
|
|||
int oldValue = player.getLife();
|
||||
|
||||
if (newValue - oldValue > 0) {
|
||||
player.gainLife(newValue - oldValue, game);
|
||||
player.gainLife(newValue - oldValue, game, source);
|
||||
}
|
||||
if (oldValue - newValue > 0) {
|
||||
player.loseLife(oldValue - newValue, game, false);
|
||||
|
|
|
@ -79,7 +79,7 @@ class IvoryTowerEffect extends OneShotEffect {
|
|||
if(player != null) {
|
||||
int amount = player.getHand().size() - 4;
|
||||
if(amount > 0) {
|
||||
player.gainLife(amount, game);
|
||||
player.gainLife(amount, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ class JaddiLifestriderEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
if (tappedAmount > 0) {
|
||||
you.gainLife(tappedAmount * 2, game);
|
||||
you.gainLife(tappedAmount * 2, game, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -107,7 +107,7 @@ class LoseGainEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
if (you != null) {
|
||||
you.gainLife(2, game);
|
||||
you.gainLife(2, game, source);
|
||||
}
|
||||
if (them != null) {
|
||||
them.loseLife(2, game, false);
|
||||
|
|
|
@ -133,7 +133,7 @@ class KamiOfTheHonoredDeadGainLifeEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
player.gainLife((Integer) this.getValue("damageAmount"), game);
|
||||
player.gainLife((Integer) this.getValue("damageAmount"), game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ class KithkinZealotEffect extends OneShotEffect {
|
|||
|
||||
if (you!= null && opponent != null) {
|
||||
int amount = game.getBattlefield().countAll(filter, opponent.getId(), game);
|
||||
you.gainLife(amount, game);
|
||||
you.gainLife(amount, game, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -87,7 +87,7 @@ class KokushoTheEveningStarEffect extends OneShotEffect {
|
|||
loseLife += game.getPlayer(opponentId).loseLife(5, game, false);
|
||||
}
|
||||
if (loseLife > 0)
|
||||
game.getPlayer(source.getControllerId()).gainLife(loseLife, game);
|
||||
game.getPlayer(source.getControllerId()).gainLife(loseLife, game, source);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ class LammastideWeaveEffect extends OneShotEffect {
|
|||
if (card != null) {
|
||||
controller.moveCards(card, Zone.GRAVEYARD, source, game);
|
||||
if (card.getName().equals(cardName)) {
|
||||
controller.gainLife(card.getConvertedManaCost(), game);
|
||||
controller.gainLife(card.getConvertedManaCost(), game, source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue