Exemple #1
0
    public void chooseOption()
    {
        StatusWindowText.text = "The Enemy is Contemplating...";

        int[]       rootWeights = { 40, 40, 20 };
        List <Node> level2      = new List <Node>();
        List <Node> level3_1    = new List <Node>();
        List <Node> level3_2    = new List <Node>();

        level2.Add(new Call(basicAttack));
        level3_1.Add(new Call(debuffDefense));
        level3_2.Add(new Call(shoot));
        level2.Add(new If(playerBuffedDefense, level3_1));
        level2.Add(new IfInt(enoughSP, 10, level3_2));
        RandomSelector Root = new RandomSelector(3, level2, rootWeights);

        /*Current implementation: First check if player buffed defense.  If yes, debuff defense defense.  If no, attack
         */

        //if (PlayerStats.GetComponent<UnitStats>().defense > 10)
        //{
        //    CombatStateMachine.GetComponent<CombatStateM>().movePower = 0;
        //    PlayerStats.GetComponent<UnitStats>().defense = PlayerStats.GetComponent<UnitStats>().defense / 2;
        //    StatusWindowText.text = "The enemy screeched, lowering your defense";
        //}
        //else
        //{
        //    CombatStateMachine.GetComponent<CombatStateM>().movePower = 5;
        //    StatusWindowText.text = "The enemy strikes";

        //}

        if (Root.Evaluate() == Node.NodeStates.SUCCESS)
        {
            CombatStateMachine.GetComponent <CombatStateM>().currState = CombatStateM.CombatState.EnemyCombat;
        }
    }