예제 #1
0
    private int CalculateDodgeChance(LivingEntity target, LivingEntity attacker)
    {
        Debug.Log("CombatLogic.CalculateDodgeChance() called...");
        int dodgeChanceReturned = 0;

        // Get Total Dodge
        dodgeChanceReturned += EntityLogic.GetTotalDodge(target);
        Debug.Log(target.name + " base Dodge chance: " + dodgeChanceReturned.ToString());

        // Check for Perfect aim
        if (attacker.myPassiveManager.perfectAim)
        {
            Debug.Log(attacker.name + " has 'Perfect Aim' passive, reducing " + target.name + " dodge chance to 0...");
            dodgeChanceReturned = 0;
        }

        // Check for Concentration Power
        if (attacker.myPassiveManager.concentration)
        {
            Debug.Log(attacker.name + " has 'Concentration' passive, reducing " + target.name + " dodge chance to 0...");
            dodgeChanceReturned = 0;
        }

        // Check for Marked
        if (target.myPassiveManager.marked)
        {
            Debug.Log(target.myName + " has 'Marked' passive, reducing " + target.myName + " dodge chance to 0...");
            dodgeChanceReturned = 0;
        }

        // Cap Dodge Chance at 80%
        if (dodgeChanceReturned > 80)
        {
            Debug.Log(target.name + " has exceeded the dodge chance cap, reducing to 80%...");
            dodgeChanceReturned = 80;
        }

        Debug.Log("Final dodge chance calculated for " + target.name + ", being attacked by " + attacker.name + ": " + dodgeChanceReturned.ToString());
        return(dodgeChanceReturned);
    }