📄 gameautofight.h
字号:
/*
* name: GameAutoFight.h
*
* desc: 自动战斗,自动打怪的控制,目前只做了战士的自动战斗
*
*/
#pragma once
#include "StdAfx.h"
class CGameMir;
class CGameAutoFight
{
public:
CGameAutoFight(CGameMir&game);
~CGameAutoFight();
protected:
static UINT AutoFightThread( LPVOID pParam );
void _AutoFightThread( void );
static BOOL FindPathAStar(CGameMir& game, const POINT& from, const POINT& to, std::vector<POINT>& path);
virtual bool DoAttack(DWORD ServerId, const POINT& Position)=0;
virtual bool InAttackRange(const POINT& self, const POINT& target)=0;
virtual bool FindTarget()=0;
virtual void PreAttack(void)=0;
virtual bool SwitchTarget(void)=0;
private:
POINT GetCruisePoint(void);
public:
void Go(void);
void ActorAppear( void ) { m_HasNewActor = true; }
void Stop( ); // add by zdl. 2007-10-15
bool isRunning() const
{
return pThread_ != NULL ? true : false;
}
private:
CWinThread *pThread_;
protected:
CGameMir&m_Game;
struct
{
char type;
POINT pos;
DWORD ServerId;
}m_Target;
CRITICAL_SECTION m_RunSC;
bool m_HasNewActor;
bool m_EnableAutoFight;
};
/*
* name: CAutoFightWarrior.h
*
* desc: 战士自动战斗
*
*/
class CAutoFightWarrior : public CGameAutoFight
{
public:
CAutoFightWarrior(CGameMir&game) : CGameAutoFight(game) {}
protected:
virtual bool InAttackRange(const POINT& self, const POINT& target);
virtual bool DoAttack(DWORD ServerId, const POINT& Position);
virtual bool FindTarget();
virtual void PreAttack(void);
virtual bool SwitchTarget(void);
private:
itActor HasMonster[0x10];
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -