public void RecoverStamina(int amount) { if (amount <= 0) { return; } lock (Stats) { PlayerStat stat = Stats[PlayerStatId.Stamina]; if (stat.Current < stat.Max) { Stats.Increase(PlayerStatId.Stamina, Math.Min(amount, stat.Max - stat.Current)); Session.Send(StatPacket.UpdateStats(Session.FieldPlayer, PlayerStatId.Stamina)); } } }
public void ConsumeStamina(int amount) { if (amount <= 0) { return; } lock (Stats) { PlayerStat stat = Stats[PlayerStatId.Stamina]; Stats.Decrease(PlayerStatId.Stamina, Math.Min(amount, stat.Current)); } if (StaRegenThread == null || StaRegenThread.IsCompleted) { StaRegenThread = StartRegen(PlayerStatId.Stamina, PlayerStatId.StaRegen, PlayerStatId.StaRegenTime); } }
public void ConsumeHp(int amount) { if (amount <= 0) { return; } lock (Stats) { PlayerStat stat = Stats[PlayerStatId.Hp]; Stats.Decrease(PlayerStatId.Hp, Math.Min(amount, stat.Current)); } if (HpRegenThread == null || HpRegenThread.IsCompleted) { HpRegenThread = StartRegen(PlayerStatId.Hp, PlayerStatId.HpRegen, PlayerStatId.HpRegenTime); } }