override public void ReceiveDamage(int amount) { amount = (int)((float)amount * DefensiveDamageMultiplier()); DisplayPopupAfterDelay(0.2f, amount + " damage"); if (currentStamina >= amount) { currentStamina -= amount; } else { if (!firstBlood) { firstBlood = true; BoostConcentration(); } currentHealth -= (amount - currentStamina); if (currentHealth <= 0 && StatusEffect.HasEffectType(ref statusEffects, StatusEffect.EffectType.CANNOT_DIE)) { currentHealth = 1; } currentStamina = 0; } healthBarScript.SetPercent(PercentHealth()); staminaBarScript.SetPercent(PercentStamina()); if (currentHealth <= 0) { SoundManager.PlaySound(dieSound); Die(); } else { SoundManager.PlaySound(damagedSound); Animate("IsGettingDamaged"); } }
// Poison damages health but not stamina. public void ReceivePureDamage(int amount) { amount = (int)((float)amount * DefensiveDamageMultiplier()); DisplayPopup(amount + " poison"); currentHealth -= amount; if (currentHealth <= 0 && StatusEffect.HasEffectType(ref statusEffects, StatusEffect.EffectType.CANNOT_DIE)) { currentHealth = 1; } if (currentHealth <= 0) { SoundManager.PlaySound(dieSound); Die(); } else { SoundManager.PlaySound(damagedSound); healthBarScript.SetPercent(PercentHealth()); Animate("IsGettingDamaged"); } }
public void Init(int inputMaxHealth, int inputCurrentHealth, int spe, int end, int str, int agi, int intel, string name) { displayName = name; speed = spe; endurance = end; strength = str; agility = agi; intelligence = intel; rng = new System.Random(); healthBarScript = transform.Find("HealthBar").GetComponent <IndicatorBar>(); staminaBarScript = transform.Find("StaminaBar").GetComponent <IndicatorBar>(); maxHealth = inputMaxHealth; maxStamina = endurance * 15 + 10; currentStamina = maxStamina; currentHealth = inputCurrentHealth; maxConcentration = 20 + GetEffectiveIntelligence() * 3; healthBarScript.SetPercent(PercentHealth()); }