Sanguosha.Core.Games.Game.LoseMaxHealth C# (CSharp) Méthode

LoseMaxHealth() public méthode

public LoseMaxHealth ( Player source, int magnitude ) : void
source Player
magnitude int
Résultat void
        public void LoseMaxHealth(Player source, int magnitude)
        {
            if (source.IsDead) return;
            int result = source.MaxHealth - magnitude;
            bool trigger = false;
            if (source.Health > result)
            {
                source.Health = result;
                trigger = true;
            }
            source.MaxHealth = result;
            Game.CurrentGame.NotificationProxy.NotifyLoseMaxHealth(source, magnitude);
            if (source.MaxHealth <= 0) Emit(GameEvent.GameProcessPlayerIsDead, new GameEventArgs() { Source = null, Targets = new List<Player>() { source } });
            if (trigger && !source.IsDead) Game.CurrentGame.Emit(Triggers.GameEvent.AfterHealthChanged, new HealthChangedEventArgs() { Source = null, Delta = 0, Targets = new List<Player>() { source } });
        }