public void ModifyHealth(int amount, Stats.DamageType damageType) { if (amount >= 0) { currentHealth += amount; } else { if (!isImmortal && !isInvinsible) { currentHealth += amount; } } currentHealth = Mathf.Clamp(currentHealth, 0, GetMaxHealth()); OnHealthModified(new HealthData { currentHealth = currentHealth, maxHealth = GetMaxHealth(), percentageHealth = GetHealthPercentage(), amountHealthChanged = amount, isInvinsible = isInvinsible, damageType = damageType }); if (currentHealth <= 0 && !isDead) { isDead = true; myEntity.Kill(); } }
public void Hit(int amount, Stats.DamageType damageType, List <WeaponSlot.WeaponBuff> weaponBuffs = null) { photonView.RPC("HitRPC", RpcTarget.All, CalculateAmount(amount), health.isInvinsible, (int)damageType); if (weaponBuffs != null) { statusEffects.ApplyWeaponBuffs(weaponBuffs); } }
public Style GetStyle(Stats.DamageType _damageType) { for (int i = 0; i < styles.Length; i++) { if (styles[i].damageType == _damageType) { return(styles[i]); } } print("No style found!"); return(styles[0]); }
public void Hurt(Unit aggressor, Stats.DamageType damageType, int value) { if (occupant) { if (occupant is Unit) { ((Unit)occupant).Hurt(aggressor, damageType, value); } else { occupant.health -= value; } } }
public void Hurt(Unit aggressor, Stats.DamageType damageType, int value) { health -= value; if (health <= 0) { health = 0; Die(aggressor); } if (luaLoaded) { DynValue result = CallFunction("OnHurt", this, aggressor, damageType, value); if (result.Type == DataType.String) { Debug.Log(result.String); } } }
public int CalculateDamage(Stats.DamageType damageType) { switch (damageType) { case Stats.DamageType.Melee: return((int)(stats.DamageEffectiveness * (stats.strength + (int)(0.2 * stats.agility)))); case Stats.DamageType.Ranged: return((int)(stats.DamageEffectiveness * (stats.agility + (int)(0.2 * stats.strength)))); case Stats.DamageType.Secondary: return((int)(stats.DamageEffectiveness * (stats.willpower * 2 + (int)(0.5 * stats.strength) + (int)(0.5 * stats.agility)))); } return(0); }