@@ -451,7 +451,7 @@ public final int getLife() {
451451 }
452452
453453 public final boolean gainLife (int lifeGain , final Card source , final SpellAbility sa ) {
454- if (!canGainLife ()) {
454+ if (!canGainLife () || lifeGain <= 0 ) {
455455 return false ;
456456 }
457457
@@ -466,10 +466,6 @@ public final boolean gainLife(int lifeGain, final Card source, final SpellAbilit
466466 // check if this is still the affected player
467467 if (this .equals (repParams .get (AbilityKey .Affected ))) {
468468 lifeGain = (int ) repParams .get (AbilityKey .LifeGained );
469- // there is nothing that changes lifegain into lifeloss this way
470- if (lifeGain <= 0 ) {
471- return false ;
472- }
473469 } else {
474470 return false ;
475471 }
@@ -478,32 +474,31 @@ public final boolean gainLife(int lifeGain, final Card source, final SpellAbilit
478474 return false ;
479475 }
480476
481- if (lifeGain > 0 ) {
482- int oldLife = life ;
483- life += lifeGain ;
484- view .updateLife (this );
485- boolean firstGain = lifeGainedTimesThisTurn == 0 ;
486- lifeGainedThisTurn += lifeGain ;
487- lifeGainedTimesThisTurn ++;
488-
489- // team mates need to be notified about life gained
490- for (final Player p : getTeamMates (true )) {
491- p .addLifeGainedByTeamThisTurn (lifeGain );
492- }
477+ if (lifeGain <= 0 ) {
478+ return false ;
479+ }
493480
494- final Map < AbilityKey , Object > runParams = AbilityKey . mapFromPlayer ( this ) ;
495- runParams . put ( AbilityKey . LifeAmount , lifeGain ) ;
496- runParams . put ( AbilityKey . Source , source );
497- runParams . put ( AbilityKey . SourceSA , sa ) ;
498- runParams . put ( AbilityKey . FirstTime , firstGain ) ;
499- game . getTriggerHandler (). runTrigger ( TriggerType . LifeGained , runParams , false ) ;
481+ int oldLife = life ;
482+ life += lifeGain ;
483+ view . updateLife ( this );
484+ boolean firstGain = lifeGainedTimesThisTurn == 0 ;
485+ lifeGainedThisTurn += lifeGain ;
486+ lifeGainedTimesThisTurn ++ ;
500487
501- game .fireEvent (new GameEventPlayerLivesChanged (this , oldLife , life ));
502- return true ;
488+ // team mates need to be notified about life gained
489+ for (final Player p : getTeamMates (true )) {
490+ p .addLifeGainedByTeamThisTurn (lifeGain );
503491 }
504492
505- System .out .println ("Player - trying to gain negative or 0 life" );
506- return false ;
493+ final Map <AbilityKey , Object > runParams = AbilityKey .mapFromPlayer (this );
494+ runParams .put (AbilityKey .LifeAmount , lifeGain );
495+ runParams .put (AbilityKey .Source , source );
496+ runParams .put (AbilityKey .SourceSA , sa );
497+ runParams .put (AbilityKey .FirstTime , firstGain );
498+ game .getTriggerHandler ().runTrigger (TriggerType .LifeGained , runParams , false );
499+
500+ game .fireEvent (new GameEventPlayerLivesChanged (this , oldLife , life ));
501+ return true ;
507502 }
508503
509504 public final boolean canGainLife () {
0 commit comments