public override void DoUpdate(int max = -1)
    {
        AIAction action = null;

        if (--AI.confused > 0)
        {
            AI.forceState(999);
        }
        if (--AI.delay <= 0)
        {
            action = AI.TakeAction();
        }
        memAction = null;
        if (action != null)
        {
            if (action.newx >= 0)
            {
                x = action.newx;
            }
            else
            {
                x += action.dx;
            }
            if (x >= boardwidth)
            {
                x = 0;
            }
            else if (x < 0)
            {
                x = boardwidth - 1;
            }
            if (action.newy >= 0)
            {
                y = action.newy;
            }
            else
            {
                y += action.dy;
            }
            this.memAction = action;
        }
        MainUpdate();
    }
Example #2
0
    public void CreateAI(BoardWar myBoard, BoardWar theirBoard, int type, int difficulty = 0)
    {
        switch (type)
        {
        case (int)PersistData.GT.Training: AI = new TrainingAI(myBoard, theirBoard, this); break;

        case (int)PersistData.GT.Challenge: AI = new TrainingAI(myBoard, theirBoard, this); break;

        default: AI = new AIversion2(myBoard, theirBoard, this, difficulty); break;
        }
        if (type == (int)PersistData.GT.Training && difficulty == 2)
        {
            AI.forceState(3);
        }
        if (PD.GetSaveData().savedOptions["easymode"] == 1)
        {
            AI.EasyModo(); AI.boostDifficulty(difficulty);
        }
    }