StupidAI.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * StupidAI.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "../../lib/battle/BattleHex.h"
  12. #include "../../lib/battle/ReachabilityInfo.h"
  13. class EnemyInfo;
  14. class CStupidAI : public CBattleGameInterface
  15. {
  16. int side;
  17. std::shared_ptr<CBattleCallback> cb;
  18. std::shared_ptr<Environment> env;
  19. void print(const std::string &text) const;
  20. public:
  21. CStupidAI();
  22. ~CStupidAI();
  23. void init(std::shared_ptr<Environment> ENV, std::shared_ptr<CBattleCallback> CB) override;
  24. void actionFinished(const BattleAction &action) override;//occurs AFTER every action taken by any stack or by the hero
  25. void actionStarted(const BattleAction &action) override;//occurs BEFORE every action taken by any stack or by the hero
  26. BattleAction activeStack(const CStack * stack) override; //called when it's turn of that stack
  27. void battleAttack(const BattleAttack *ba) override; //called when stack is performing attack
  28. void battleStacksAttacked(const std::vector<BattleStackAttacked> & bsa) override; //called when stack receives damage (after battleAttack())
  29. void battleEnd(const BattleResult *br) override;
  30. //void battleResultsApplied() override; //called when all effects of last battle are applied
  31. void battleNewRoundFirst(int round) override; //called at the beginning of each turn before changes are applied;
  32. void battleNewRound(int round) override; //called at the beginning of each turn, round=-1 is the tactic phase, round=0 is the first "normal" turn
  33. void battleStackMoved(const CStack * stack, std::vector<BattleHex> dest, int distance) override;
  34. void battleSpellCast(const BattleSpellCast *sc) override;
  35. void battleStacksEffectsSet(const SetStackEffect & sse) override;//called when a specific effect is set to stacks
  36. //void battleTriggerEffect(const BattleTriggerEffect & bte) override;
  37. void battleStart(const CCreatureSet *army1, const CCreatureSet *army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2, bool side) override; //called by engine when battle starts; side=0 - left, side=1 - right
  38. void battleCatapultAttacked(const CatapultAttack & ca) override; //called when catapult makes an attack
  39. private:
  40. BattleAction goTowards(const CStack * stack, std::vector<BattleHex> hexes) const;
  41. };