123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- #include "stdafx.h"
- #include "StupidAI.h"
- #include "../../lib/BattleState.h"
- CStupidAI::CStupidAI(void)
- : side(-1), cb(NULL)
- {
- print("created");
- }
- CStupidAI::~CStupidAI(void)
- {
- print("destroyed");
- }
- void CStupidAI::init( IBattleCallback * CB )
- {
- print("init called, saving ptr to IBattleCallback");
- cb = CB;
- }
- void CStupidAI::actionFinished( const BattleAction *action )
- {
- print("actionFinished called");
- }
- void CStupidAI::actionStarted( const BattleAction *action )
- {
- print("actionStarted called");
- }
- BattleAction CStupidAI::activeStack( const CStack * stack )
- {
- print("activeStack called");
- if(stack->position % 17 < 5) //move army little towards enemy
- {
- THex dest = stack->position + !side*2 - 1;
- print(stack->nodeName() + "will be moved to " + boost::lexical_cast<std::string>(dest));
- return BattleAction::makeMove(stack, dest);
- }
- return BattleAction::makeDefend(stack);
- }
- void CStupidAI::battleAttack(const BattleAttack *ba)
- {
- print("battleAttack called");
- }
- void CStupidAI::battleStacksAttacked(const std::vector<BattleStackAttacked> & bsa)
- {
- print("battleStacksAttacked called");
- }
- void CStupidAI::battleEnd(const BattleResult *br)
- {
- print("battleEnd called");
- }
- void CStupidAI::battleResultsApplied()
- {
- print("battleResultsApplied called");
- }
- void CStupidAI::battleNewRoundFirst(int round)
- {
- print("battleNewRoundFirst called");
- }
- void CStupidAI::battleNewRound(int round)
- {
- print("battleNewRound called");
- }
- void CStupidAI::battleStackMoved(const CStack * stack, THex dest, int distance, bool end)
- {
- print("battleStackMoved called");;
- }
- void CStupidAI::battleSpellCast(const BattleSpellCast *sc)
- {
- print("battleSpellCast called");
- }
- void CStupidAI::battleStacksEffectsSet(const SetStackEffect & sse)
- {
- print("battleStacksEffectsSet called");
- }
- void CStupidAI::battleStart(const CCreatureSet *army1, const CCreatureSet *army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2, bool Side)
- {
- print("battleStart called");
- side = Side;
- }
- void CStupidAI::battleStacksHealedRes(const std::vector<std::pair<ui32, ui32> > & healedStacks, bool lifeDrain, si32 lifeDrainFrom)
- {
- print("battleStacksHealedRes called");
- }
- void CStupidAI::battleNewStackAppeared(const CStack * stack)
- {
- print("battleNewStackAppeared called");
- }
- void CStupidAI::battleObstaclesRemoved(const std::set<si32> & removedObstacles)
- {
- print("battleObstaclesRemoved called");
- }
- void CStupidAI::battleCatapultAttacked(const CatapultAttack & ca)
- {
- print("battleCatapultAttacked called");
- }
- void CStupidAI::battleStacksRemoved(const BattleStacksRemoved & bsr)
- {
- print("battleStacksRemoved called");
- }
- void CStupidAI::print(const std::string &text) const
- {
- tlog0 << "CStupidAI [" << this <<"]: " << text << std::endl;
- }
|