CGeniusAI.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef __CGENIUSAI_H__
  2. #define __CGENIUSAI_H__
  3. #include "Common.h"
  4. #include "BattleLogic.h"
  5. #include "GeneralAI.h"
  6. namespace GeniusAI {
  7. class CGeniusAI : public CGlobalAI
  8. {
  9. private:
  10. ICallback* m_cb;
  11. GeniusAI::BattleAI::CBattleLogic* m_battleLogic;
  12. GeniusAI::GeneralAI::CGeneralAI m_generalAI;
  13. public:
  14. CGeniusAI();
  15. virtual ~CGeniusAI();
  16. virtual void init(ICallback * CB);
  17. virtual void yourTurn();
  18. virtual void heroKilled(const CGHeroInstance *);
  19. virtual void heroCreated(const CGHeroInstance *);
  20. virtual void heroMoved(const TryMoveHero &);
  21. virtual void heroPrimarySkillChanged(const CGHeroInstance * hero, int which, int val) {};
  22. virtual void showSelDialog(std::string text, std::vector<CSelectableComponent*> & components, int askID){};
  23. virtual void showBlockingDialog(const std::string &text, const std::vector<Component> &components, ui32 askID, const int soundID, bool selection, bool cancel); //Show a dialog, player must take decision. If selection then he has to choose between one of given components, if cancel he is allowed to not choose. After making choice, CCallback::selectionMade should be called with number of selected component (1 - n) or 0 for cancel (if allowed) and askID.
  24. virtual void tileRevealed(int3 pos){};
  25. virtual void tileHidden(int3 pos){};
  26. virtual void heroGotLevel(const CGHeroInstance *hero, int pskill, std::vector<ui16> &skills, boost::function<void(ui32)> &callback);
  27. virtual void showGarrisonDialog(const CArmedInstance *up, const CGHeroInstance *down, boost::function<void()> &onEnd);
  28. // battle
  29. virtual void actionFinished(const BattleAction *action);//occurs AFTER every action taken by any stack or by the hero
  30. virtual void actionStarted(const BattleAction *action);//occurs BEFORE every action taken by any stack or by the hero
  31. virtual void battleAttack(BattleAttack *ba); //called when stack is performing attack
  32. virtual void battleStacksAttacked(std::set<BattleStackAttacked> & bsa); //called when stack receives damage (after battleAttack())
  33. virtual void battleEnd(BattleResult *br);
  34. virtual void battleNewRound(int round); //called at the beggining of each turn, round=-1 is the tactic phase, round=0 is the first "normal" turn
  35. virtual void battleStackMoved(int ID, int dest, int distance, bool end);
  36. virtual void battleSpellCast(SpellCast *sc);
  37. virtual void battleStart(CCreatureSet *army1, CCreatureSet *army2, int3 tile, CGHeroInstance *hero1, CGHeroInstance *hero2, bool side); //called by engine when battle starts; side=0 - left, side=1 - right
  38. virtual void battlefieldPrepared(int battlefieldType, std::vector<CObstacle*> obstacles); //called when battlefield is prepared, prior the battle beginning
  39. //
  40. virtual void battleStackMoved(int ID, int dest, bool startMoving, bool endMoving);
  41. virtual void battleStackAttacking(int ID, int dest);
  42. virtual void battleStackIsAttacked(int ID, int dmg, int killed, int IDby, bool byShooting);
  43. virtual BattleAction activeStack(int stackID);
  44. };
  45. }
  46. #endif // __CGENIUSAI_H__