Exemplo n.º 1
0
        private void CalcDamage(Bio caster, Bio target, int triggerIndex)
        {
            BuffData.Trigger trigger = this._buff.trigger;
            if (trigger.damaged == null)
            {
                return;
            }

            int index = trigger.damaged.Length - 1;

            index = triggerIndex <= index ? triggerIndex : index;

            if (!trigger.damaged[index])
            {
                return;
            }

            float damage = this.CalcDamageInternal(caster, target, index);

            target.property.Add(Attr.Hp, -damage);

            if (target.property.hp <= 0)
            {
                target.sensorySystem.killer = caster;
            }

            SyncEventHelper.Damage(this._buff.rid, damage, caster.rid, target.rid);
            this.OnDamage(damage, caster, target, triggerIndex);
            caster.OnDamage(this._buff, target, damage);
            target.OnHurt(this._buff, caster, damage);
        }