Esempio n. 1
0
    private int CalculateParryChance(LivingEntity target, LivingEntity attacker)
    {
        Debug.Log("CombatLogic.CalculateParryChance() called...");
        int parryChanceReturned = 0;

        // Get total parry chance
        bool swordPlay = false;

        parryChanceReturned += EntityLogic.GetTotalParry(target);
        Debug.Log(target.name + " total parry chance: " + parryChanceReturned.ToString() + "%");

        // Check for sword play
        if (target.myPassiveManager.swordPlay &&
            target.timesMeleeAttackedThisTurnCycle == 0)
        {
            Debug.Log(target.myName + " has 'Sword Play' passive, increasing " + target.myName + " parry chance to 100...");
            parryChanceReturned = 100;
            swordPlay           = true;
        }

        // Check for recklessness
        if (attacker.myPassiveManager.recklessness)
        {
            Debug.Log(attacker.name + " has 'Recklessness' passive, reducing " + target.name + " parry chance to 0...");
            parryChanceReturned = 0;
        }

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

        // Check for m*******t
        if (attacker.myPassiveManager.m*******t &&
            (attacker.currentMaxHealth / 2) > attacker.currentHealth
            )
        {
            Debug.Log(attacker.name + " has 'M*******t' passive and is below 50% health, reducing " + target.name + " parry chance to 0...");
            parryChanceReturned = 0;
        }

        // Check for virtuoso
        if (attacker.myPassiveManager.virtuoso)
        {
            Debug.Log(attacker.name + " has 'Virtuoso' passive, reducing " + target.name + " parry chance to 0...");
            parryChanceReturned = 0;
        }

        // Cap Parry Chance at 80%
        if (parryChanceReturned > 80 && swordPlay == false)
        {
            Debug.Log(target.name + " has exceeded the parry chance cap, reducing to 80%...");
            parryChanceReturned = 80;
        }


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