예제 #1
0
    //3. 内伤
    //int MagicalDamage(Player attacker, string param, Target target){}

    //4. 对自己造成真实伤害
    int DirectDamage(BattleUnit attacker, string param, BattleUnit target)
    {
        int value = int.Parse(param);

        target.Damage(value);
        return(value);
    }
예제 #2
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);
    }