Exemplo n.º 1
0
    internal float GetBaseAtk()
    {
        if (emitRunner == null)
        {
            return(0.0f);
        }

        float attackValue = emitRunner.GetAttribute(Pathea.AttribType.Atk);

        float spaceDamagePercent = 1.0f;

        if (minDampRadius > PETools.PEMath.Epsilon && maxDampRadius > PETools.PEMath.Epsilon && maxDampRadius > minDampRadius)
        {
            float moveDistance = Mathf.Max(0.0f, Vector3.Distance(spawnPosition, transform.position) - minDampRadius);

            spaceDamagePercent = Mathf.Lerp(1.0f, MindamagePercent, moveDistance / (maxDampRadius - minDampRadius));
        }

        return(attackValue * energyShieldPercent * spaceDamagePercent);
    }
Exemplo n.º 2
0
    internal override void ApplyHpChange(SkillRunner caster, float hpChange, float damagePercent, int type)
    {
        if (OnBuff(Buff_Sp.INVENSIBLE))
        {
            return;
        }

        if (!GameConfig.IsMultiMode)
        {
            float _defence = (float)defence / (float)(defence + 0);

            if (caster != null)
            {
                float attack = caster.GetAttribute(Pathea.AttribType.Atk) * damagePercent + hpChange;
                float damage = attack * (1 - _defence) * Random.Range(0.9f, 1.1f);

                int damageType = type == 0 ? AiDamageTypeData.GetDamageType(caster) : type;
                damage *= AiDamageTypeData.GetDamageScale(damageType, defenceType);

                //Debug.Log(caster + " attack " + this.gameObject + (int)damage + " hp");
                if (caster.gameObject.Equals(this.gameObject))
                {
                    ApplyDamage(Mathf.CeilToInt(damage));
                }
                else
                {
                    ApplyDamage(caster.transform, Mathf.CeilToInt(damage));
                }
            }
            else
            {
                float attack = hpChange;
                float damage = attack * (1 - _defence) * Random.Range(0.9f, 1.1f);

                ApplyDamage(Mathf.CeilToInt(damage));
            }
        }
    }