#ifndef PLAYERABILITY_H
#define PLAYERABILITY_H

#include <stdint.h>

#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>

#include <vector>
using namespace std;

#include "Ability.h"

//PlayerAbility involves powers only the player can use.

class PlayerAbility : public Ability {
 public:
  PlayerAbility ();
  ~PlayerAbility ();

  uint8_t getMinLevel (uint8_t clas);
  void setMinLevel (uint8_t clas, uint8_t lev);

  uint8_t getBuffID ();
  void setSelfBuff (bool sb);
  void setBuffID (uint8_t bid);

  bool loadPlayerAbility (const string &);
  bool loadPlayerAbilityHelper (xmlDocPtr doc, xmlXPathContextPtr xpathCtx, const string & xpath);

  uint8_t getRechargeTime();
  void setRechargeTime(uint8_t);

  const string & getDescription ();
  void setDescription (const string &);

  const string & getAttackPath ();
  void setAttackPath (const string &);

  const string & getButtonIcon ();
  void setButtonIcon (const string &);

  //These functions are called during battle.
  //clears battle data
  void clearDuringBattleData();
  //Resets battle data, used to start the battle.
  void startDuringBattleData(int startTime=0);
  
  //adds to the timeSpentRecharging
  void addTime (int amount);

  //returns true if the ability has recharged
  bool abilityIsRecharged();

  //call when power has been used to reset the timeSpentRecharging and oneTimeRechargeBoost
  void useRecharge();

  //returns the amount of time left to recharge
  int getTimeSpentRecharging();

 private:
  vector <uint8_t> minLevel;

  bool selfBuff; //if true, this attack will not harm the enemy when it hits.
  uint8_t buffID; //if it is not null, this is the buff granted when the attack hits.
  uint8_t rechargeTime;
  string description, attackPath, buttonIcon;

  //battle data.
  bool oneTimeRechargeBoost;
  int timeSpentRecharging;
};
#endif
