StupidAI.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. #include "../../lib/CGameInterface.h"
  14. class EnemyInfo;
  15. class CStupidAI : public CBattleGameInterface
  16. {
  17. BattleSide side;
  18. std::shared_ptr<CBattleCallback> cb;
  19. std::shared_ptr<Environment> env;
  20. bool wasWaitingForRealize;
  21. bool wasUnlockingGs;
  22. void print(const std::string &text) const;
  23. public:
  24. CStupidAI();
  25. ~CStupidAI();
  26. void initBattleInterface(std::shared_ptr<Environment> ENV, std::shared_ptr<CBattleCallback> CB) override;
  27. void initBattleInterface(std::shared_ptr<Environment> ENV, std::shared_ptr<CBattleCallback> CB, AutocombatPreferences autocombatPreferences) override;
  28. void actionFinished(const BattleID & battleID, const BattleAction &action) override;//occurs AFTER every action taken by any stack or by the hero
  29. void actionStarted(const BattleID & battleID, const BattleAction &action) override;//occurs BEFORE every action taken by any stack or by the hero
  30. void activeStack(const BattleID & battleID, const CStack * stack) override; //called when it's turn of that stack
  31. void yourTacticPhase(const BattleID & battleID, int distance) override;
  32. void battleAttack(const BattleID & battleID, const BattleAttack *ba) override; //called when stack is performing attack
  33. void battleStacksAttacked(const BattleID & battleID, const std::vector<BattleStackAttacked> & bsa, bool ranged) override; //called when stack receives damage (after battleAttack())
  34. void battleEnd(const BattleID & battleID, const BattleResult *br, QueryID queryID) override;
  35. //void battleResultsApplied() override; //called when all effects of last battle are applied
  36. void battleNewRoundFirst(const BattleID & battleID) override; //called at the beginning of each turn before changes are applied;
  37. void battleNewRound(const BattleID & battleID) override; //called at the beginning of each turn, round=-1 is the tactic phase, round=0 is the first "normal" turn
  38. void battleStackMoved(const BattleID & battleID, const CStack * stack, const BattleHexArray & dest, int distance, bool teleport) override;
  39. void battleSpellCast(const BattleID & battleID, const BattleSpellCast *sc) override;
  40. void battleStacksEffectsSet(const BattleID & battleID, const SetStackEffect & sse) override;//called when a specific effect is set to stacks
  41. //void battleTriggerEffect(const BattleTriggerEffect & bte) override;
  42. void battleStart(const BattleID & battleID, const CCreatureSet *army1, const CCreatureSet *army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2, BattleSide side, bool replayAllowed) override; //called by engine when battle starts; side=0 - left, side=1 - right
  43. void battleCatapultAttacked(const BattleID & battleID, const CatapultAttack & ca) override; //called when catapult makes an attack
  44. private:
  45. BattleAction goTowards(const BattleID & battleID, const CStack * stack, BattleHexArray hexes) const;
  46. };