2011-10-06 20:55:19 +00:00
|
|
|
#include <cstring>
|
|
|
|
#include "../../AI_Base.h"
|
2011-10-11 13:16:28 +00:00
|
|
|
#include "../../lib/CBattleCallback.h"
|
2011-10-06 20:55:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
const char *g_cszAiName = "Mad AI";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CMadAI : public CBattleGameInterface
|
|
|
|
{
|
|
|
|
CBattleCallback *cb;
|
|
|
|
virtual void init(CBattleCallback * CB)
|
|
|
|
{
|
|
|
|
cb = CB;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual BattleAction activeStack(const CStack * stack)
|
|
|
|
{
|
2011-10-11 13:16:28 +00:00
|
|
|
// int *g = 0;
|
|
|
|
// *g = 4;
|
|
|
|
// while(1);
|
|
|
|
|
2011-10-06 20:55:19 +00:00
|
|
|
srand(time(NULL));
|
|
|
|
BattleAction ba;
|
|
|
|
ba.actionType = rand() % 14;
|
|
|
|
ba.additionalInfo = rand() % BFIELD_SIZE + 5;
|
|
|
|
ba.side = rand() % 7;
|
|
|
|
ba.destinationTile = rand() % BFIELD_SIZE + 5;
|
2011-10-11 13:16:28 +00:00
|
|
|
ba.stackNumber = rand() % cb->battleGetAllStacks().size() + 1;
|
2011-10-06 20:55:19 +00:00
|
|
|
return ba;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
extern "C" DLL_F_EXPORT void GetAiName(char* name)
|
|
|
|
{
|
|
|
|
strcpy_s(name, strlen(g_cszAiName) + 1, g_cszAiName);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" DLL_F_EXPORT CBattleGameInterface* GetNewBattleAI()
|
|
|
|
{
|
|
|
|
return new CMadAI();
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" DLL_F_EXPORT void ReleaseBattleAI(CBattleGameInterface* i)
|
|
|
|
{
|
|
|
|
delete (CMadAI*)i;
|
|
|
|
}
|