Ejemplo n.º 1
0
    public void Battle(BasePiece attacker, BasePiece defender)
    {
        NihilChecks(attacker, defender);
        D10Skills(attacker, defender);
        D4Skills(attacker, defender);
        wheel.Colors(attacker.spriteColor);
        wheel.attackerColor = attacker.spriteColor;
        wheel.defenderColor = defender.spriteColor;
        int avoid = AvoidCalculator(attacker, defender, defender.Stats[3]);

        Debug.Log((object)("Final Avo was: " + avoid));
        SetWheelTextValues(attacker, avoid);
        wheel.transform.SetAsLastSibling();
        int Hitrate = HitCalculator();

        Debug.Log((object)("Hitrate was: " + Hitrate));
        if (Hitrate > avoid)
        {
            attacker.atkConfirm    = true;
            wheel.animationsCalled = 2;
            int dmg = DamageCalculator(attacker, defender);
            Debug.Log((object)("Final Dmg: " + dmg));
            defender.Stats[0] -= dmg;
        }
        else
        {
            attacker.atkConfirm    = false;
            wheel.animationsCalled = 1;
            Debug.Log((object)"Missed Attack");
        }
        wheel.SpinBegin(attacker);
        if (defender.Stats[0] <= 0)
        {
            if (!miracle)
            {
                defender.Stats[0] = 0;
                if (attacker.Skills[1] == "Lifetaker" && attacker.promoted)
                {
                    attacker.Stats[0] = attacker.Stats[4];
                }
                attacker.killConfirm = true;
                Debug.Log((object)"Defender died");
            }
            else
            {
                defender.Stats[0] = 1;
            }
        }
        else
        {
            attacker.killConfirm = false;
            Debug.Log((object)"Defender survived");
        }
        if (attacker.Skills[1] == "Grisly Wound" && attacker.promoted)
        {
            defender.Stats[0] -= 2;
            if (defender.Stats[0] < 1)
            {
                defender.Stats[0] = 1;
            }
        }
    }