Пример #1
0
    //2.外伤,返回伤害值
    int PhysicalDamage(BattleUnit attacker, string param, BattleUnit target)
    {
        //闪避
        if (MathCalculator.IsDodge(target.Dodge))
        {
            return(0);
        }

        int value = int.Parse(param) * (attacker.Attack - target.Defence) / 10000;

        //生命盾
        if (value > 0 && target.Shield > 0)
        {
            DamageAfterShield(target, ref value);
        }

        value = Mathf.Max(0, value);

        //内力盾
        if (target.DamageToManaShiled > 0)
        {
            target.DamageToManaShiled--;
            value -= target.DamageMp(value);
        }

        //造成伤害
        if (value > 0)
        {
            target.Damage(value);
        }

        Debug.Log("PhysicalDamage" + value);
        return(value);
    }