/* beast.h: Declaration of a class that is used to control the behaviour of the beasts within the maze

   Copyright (C) 2008  Stuart William Coulson

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/

#ifndef _BEAST_H_
#define _BEAST_H_

#include "maze.h"

class beastState {
	public:
		mazePosition beastPos;							//Current position (x, y) of the beast instance
		mazeDirection previousMove, previousMove2;		//Record of the last two moves of the beast instance. Used to control the beast AI when backtracking
		int attackCount;								//Variable used to control the time it takes the beast to make a successful attack
		float aiProcessSlot;							//Value used to schedule when an AI update needs to take place on this beast. Helps distribute the AI processing over multiple frames which ensures a smoother frame rate.
		
		beastState(int posX, int posY) {beastPos.x = posX; beastPos.y = posY; attackCount = 0;};		//Constructor of a beast object. Takes in two parameters which are the beast's starting position, attack count set to 0.
		void moveUp() {beastPos.y--; previousMove2 = previousMove; previousMove = up;};					//Function which moves the beast upward one square (x - 1). Updates the previous move variables as required.
		void moveDown() {beastPos.y++; previousMove2 = previousMove; previousMove = down;};				//Function which moves the beast downward one square (x + 1). Updates the previous move variables as required.
		void moveLeft() {beastPos.x--; previousMove2 = previousMove; previousMove = left;};				//Function which moves the beast left one square (y - 1). Updates the previous move variables as required.
		void moveRight() {beastPos.x++; previousMove2 = previousMove; previousMove = right;};			//Function which moves the beast right one square (y + 1). Updates the previous move variables as required.
};

#endif
