📄 character.h
字号:
// Character.h: interface for the Character class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_CHARACTER_H__9D08E782_7B24_4FB5_AC78_160F70DED66D__INCLUDED_)
#define AFX_CHARACTER_H__9D08E782_7B24_4FB5_AC78_160F70DED66D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Object.h"
#include <SCCharacter.h>
#include <PacketStruct.h>
#include "ObjectList.h"
#include <bitset>
#include "PartyState.h"
#include "Attribute.h"
class CWorldBase;
class CPathExplorer;
struct WzVector;
struct AI_MSG;
class Status;
class Skill;
class Attributes;
class SummonedNPCs;
class Zone;
class StatusManager;
class AbilityStatus;
class Ability;
class SkillList;
class GameZone;
struct STATE_INFO;
class MoveStateControl;
/*
= Character啊 啊柳 Observers狼 狼固
* Character甫 傍拜 Target栏肺 瘤沥窍绊 乐绰 局甸
= Character啊 啊柳 Observers狼 侩档
* 傈捧俊 曼啊窍瘤 臼篮 局啊 A甫 摹丰窍绰 版快 --> A狼 Observers俊霸 舅赴促.
* 傈捧吝牢 A啊 field甫 栋唱绰 版快 --> A狼 Observers俊霸 舅赴促.
*/
class Character : public Object, public SCCharacter
{
public :
Character();
virtual ~Character();
virtual VOID Reuse() { Release(); }
virtual VOID Update( DWORD dwDeltaTick );
virtual VOID SetField(Field* pField);
//inline eZONE_STATE GetZone( Zone ** OUT ppZone, CODETYPE & OUT EnterFieldCodeOut, WzID * OUT pAreaID = NULL ){ if( ppZone ) { *ppZone = m_pZone; } EnterFieldCodeOut = m_EnterFieldCode; if(pAreaID) *pAreaID = m_AreaID; return m_eZoneState; }
inline eZONE_STATE GetGameZone( GameZone *& OUT pZone, CODETYPE & OUT EnterFieldCodeOut, WzID * OUT pAreaID = NULL ){ pZone = m_pGameZone; EnterFieldCodeOut = m_GameFieldCode; if(pAreaID) *pAreaID = m_GameAreaID; return m_eGameZoneState; }
inline eZONE_STATE GetGameZoneState() { return m_eGameZoneState; }
inline GameZone * GetGameZonePtr() { return m_pGameZone; }
//inline VOID SetZone( eZONE_STATE eState, Zone * pZone, CODETYPE EnterFieldCode, WzID AreaID = 0 ){ m_eZoneState = eState, m_pZone = pZone; m_EnterFieldCode = EnterFieldCode; m_AreaID = AreaID; }
inline VOID SetGameZone( eZONE_STATE eState, GameZone * pZone, CODETYPE EnterFieldCode, WzID AreaID = 0 ){ m_eGameZoneState = eState, m_pGameZone = pZone; m_GameFieldCode = EnterFieldCode; m_GameAreaID = AreaID; }
virtual VOID OnEnterField(Field* pField, WzVector* pwzVec);
virtual VOID OnLeaveField();
// 捞悼包访
BOOL CanMove();
virtual VOID SetPos( WzVector* pwzVec );
BOOL SetPath( WzVector *pwvCur, WzVector *pwvDest, int *pTileRoute, int iNumTileRoute); ///<辨茫扁 版肺 汲沥
inline CPathExplorer* GetPathExplorer() { return m_pPathExplorer; }
BOOL PathProgress( float fMove);
virtual BOOL ExecuteThrust( BOOL bForcedMove, WzVector *pwvDestPos, WzVector &wvPosAfterThrust, float fMoveDistance, BOOL bDownAfterThrust=FALSE ) { __UNUSED(pwvDestPos); __UNUSED(wvPosAfterThrust); return FALSE; }
virtual BOOL IsMoving();
VOID StopMoving();
virtual VOID SetActionDelay( DWORD delay ) { __UNUSED(delay); }
// BOOL CheckMapVersion(DWORD dwCheckSum); // C/S 甘滚傈捞 老摹窍绰瘤 八荤
BOOL IsStandingOnJumpTile();
int AllocEnemySlot(WzVector *pwvEnemyPos, WzVector &wvResultPos, float fAreaRadius); // 利苞 付林焊绰 馆盔阑 扁霖栏肺 厚绢乐绰 浇吩阑 且寸秦霖促.
VOID FreeEnemySlot(int iSlot);
VOID ModifyPosition( WzVector &vCurPos, WzVector &vDestPos, WzVector &vResultCurPos, WzVector &vResultDestPos, SLOTCODE SkillCode=0 );
float GetDist(Character* pTargetCharacter) const;
float GetDist(const WzVector& targetPos) const;
float GetDist2(Character* pTargetCharacter) const; // 芭府 力蚌
float GetDist2(const WzVector& targetPos) const;
virtual VOID GetPos( WzVector * pWzVecOut ) const;
WzVector GetRandomPosInAround( INT iDist );
//------------------------------------------------------------------------------------------------
// 颇扼固磐
//------------------------------------------------------------------------------------------------
virtual Attributes& GetAttr() = 0;
virtual const Attributes& GetAttr() const = 0;
virtual LEVELTYPE GetLevel() const = 0;
virtual LEVELTYPE GetDisplayLevel() const { return GetLevel(); }
virtual float GetAttackRange() const = 0;
virtual float GetSkillRangeBonus() const = 0;
virtual float GetSightRange() const = 0;
virtual eARMOR_TYPE GetArmorType() const = 0;
virtual eMELEE_TYPE GetMeleeType() const = 0;
virtual DWORD GetHP() const = 0;
virtual DWORD GetMP() const = 0;
virtual DWORD GetMaxHP() const = 0;
virtual DWORD GetMaxMP() const = 0;
virtual char* GetCharName() const = 0;
virtual int GetRegenHP() const { return 0; }
virtual int GetRegenMP() const { return 0; }
virtual BOOL IsAlive() const { return GetHP() > 0; }
virtual BOOL IsDead() const { return !IsAlive(); }
virtual DWORD GetPhysicalAvoidValue() const = 0;
virtual float GetPhysicalAttackSpeed() const = 0;
inline MoveStateControl* GetMoveStateControl() const { return m_pMoveStateControl; }
virtual DWORD GetExp() const = 0;
virtual SHORT GetExperty1() const { return 0; }
virtual SHORT GetExperty2() const { return 0; }
virtual int GetMoveSpeedRatio() const = 0;
virtual int GetAttSpeedRatio() const = 0;
VOID SendAttrChange(eATTR_TYPE attrType, DWORD dwValue);
virtual VOID SetAttr( eATTR_TYPE eAttrType, eATTR_KIND eAttrKind, int iValue ) = 0;
virtual VOID SetHP( DWORD dwHP ) = 0;
virtual VOID SetMP( DWORD dwMP ) = 0;
virtual DWORD IncreaseHP( DWORD dwIncrement );
virtual DWORD DecreaseHP( DWORD dwDecrement );
virtual DWORD IncreaseMP( DWORD dwIncrement );
virtual DWORD DecreaseMP( DWORD dwDecrement );
VOID SetMoveState( eCHAR_MOVE_STATE state );
virtual VOID AddExp( DWORD exp, DWORD dwTargetObjKey=0 ) { __UNUSED(exp); __UNUSED(dwTargetObjKey); }
inline VOID SetShield( int iShieldHP, int iDecreaseMP, float fRatio ) { m_iShieldHP = iShieldHP; m_iShieldMP = iDecreaseMP; m_fShieldAbsorbRatio = fRatio; }
virtual VOID UpdateHPMPRecover( BOOL bHPUpdate, BOOL bMPUpdate ) { __UNUSED(bHPUpdate); __UNUSED(bMPUpdate); }
BOOL CheckCondition( BYTE byCondition, WORD wParam );
BOOL CheckCondition_Under_HP( WORD wPercent );
BOOL CheckCondition_Under_MP( WORD wPercent );
BOOL CheckCondition_Same_HP( WORD wPercent );
BOOL CheckCondition_Same_MP( WORD wPercent );
//------------------------------------------------------------------------------------------------
// 菩哦 傈价
//------------------------------------------------------------------------------------------------
virtual BOOL SendPacket( MSG_BASE_FORWARD * pMsg, WORD wSize, BOOL bCrypt = FALSE ){ __UNUSED(pMsg); __UNUSED(wSize); return FALSE; }
virtual BOOL SendExPacket( DWORD dwNumberOfMessages, BYTE **pMsg, WORD *pwSize ){ __UNUSED(dwNumberOfMessages); __UNUSED(pMsg); __UNUSED(pwSize); return FALSE; }
virtual RC::ePACKET_SEND_RESULT SendPacketAround( MSG_BASE_FORWARD * pMsg, WORD wSize, BOOL bSendToMe = TRUE );
RC::ePACKET_SEND_RESULT SendExPacketAround( DWORD dwNumberOfMessages, BYTE **pMsg, WORD *pwSize, BOOL bSendToMe = TRUE );
// Observer : 唱甫 瘤难焊绰 局甸
VOID AddObserver(Character* pCharacter);
VOID RemoveObserver(DWORD dwObjKey);
VOID SendToObservers( AI_MSG *pMsg, WORD wSize );
virtual VOID SendAIMessage( AI_MSG *pMsg, WORD wSize, DWORD dwDelay=0 ) { __UNUSED(pMsg); __UNUSED(wSize); __UNUSED(dwDelay); }
ObjectList& GetObservers() { return m_Observers; }
// 磊脚捞 家券矫挪 NPC甸 沥焊
DWORD GetSummonerKey() { return m_dwSummonerKey; }
VOID SetSummonerKey( DWORD dwSummonerKey ) { m_dwSummonerKey = dwSummonerKey; }
// Status
StatusManager* GetStatusManager() { return m_pStatusManager; }
BOOL IsStatus( eCHAR_STATE_TYPE eStateID );
// 颇萍 包访
inline PartyState& GetPartyState() { return m_PartyState; }
virtual RC::ePARTY_RESULT JoinParty( DWORD dwPartyKey ) { return RC::RC_PARTY_SUCCESS; }
virtual RC::ePARTY_RESULT LeaveParty() { return RC::RC_PARTY_SUCCESS; }
virtual RC::ePARTY_RESULT DestroyParty( BOOL bSendPacket ) { return RC::RC_PARTY_SUCCESS; }
virtual RC::ePARTY_RESULT CanLeaveParty() { return RC::RC_PARTY_SUCCESS; }
VOID SendPacketToParty( MSG_BASE_FORWARD * pMsg, WORD wSize );
// 胶懦 包访
virtual RC::eSKILL_RESULT CanUseSkill( SLOTCODE SkillCode, BOOL bCoolTimerReset = TRUE );
virtual BOOL CanApplyPassiveSkill( SLOTCODE SkillCode ) { __UNUSED(SkillCode); return FALSE; }
BOOL CheckSkillRange( WzVector &vTargetPos, float fSkillRange );
BOOL CheckArea( WzVector &vTargetPos, WzVector &vMainTargetPos, BYTE byRangeForm, float fArea );
inline VOID AddFightingEnergy( SHORT sCount ) { m_sFightingEnergyCount = max( 0, m_sFightingEnergyCount + sCount ); }
inline VOID DelFightingEnergy( SHORT sCount ) { m_sFightingEnergyCount = max( 0, m_sFightingEnergyCount - sCount ); }
inline SHORT GetFightingEnergy() const { return m_sFightingEnergyCount; }
VOID ApplyMagicShield( DWORD &dwDecreaseHP );
VOID AddSkill( Skill * pSkill );
virtual BOOL CheckClassDefine( BYTE byUserType, CODETYPE dwClassDefine ) { return TRUE; }
// 傈捧包访
virtual BOOL OnResurrection( float fRecoverExp, float fRecoverHP, float fRecoverMP ); // 何劝阑 矫懦锭 龋免;
virtual VOID ApplyPenalty() {} // 荤噶矫 菩澄萍 利侩(泅犁绰 敲饭捞绢父 利侩)
virtual BOOL OnDead(); // 磷阑锭 龋免
virtual BOOL CanAttack() const;
virtual BOOL CanBeAttacked() const;
virtual VOID OnAttack( Character *pTarget, CODETYPE skillcode, DAMAGETYPE damage ); // 傍拜且锭
virtual VOID Attacked(); // 傍拜罐阑锭
virtual DAMAGETYPE Damaged( Character *pAttacker, eATTACK_TYPE attackType, DAMAGETYPE damage );
BOOL OnRecover( int recoverHP, int recoverMP );
VOID PeriodicRecover( eCHAR_STATE_TYPE eStateID, int recoverHP, int recoverMP, int iApplicationTime, int iPeriodicTime );
virtual VOID SetTargetChar( Character *pChar ) { __UNUSED(pChar); }
virtual Character* GetTargetChar() { return NULL; }
virtual VOID AddAttackPoint( Character* pAttacker, int attackPoint ) { __UNUSED(pAttacker); __UNUSED(attackPoint); }
virtual VOID AddTotalPoint( Character* pAttacker, int TotalPoint ) { __UNUSED(pAttacker); __UNUSED(TotalPoint); }
virtual BOOL IsFriend( Character *pTarget ) { __UNUSED(pTarget); return TRUE; }
virtual BOOL IsCoincidentWithTargetType( Character *pTarget, eSKILL_TARGET_TYPE eTargetType );
virtual VOID ChangeState( DWORD dwStateID, LPARAM param1 = 0, LPARAM param2 = 0, LPARAM param3 = 0 ) { __UNUSED(dwStateID); __UNUSED(param1); __UNUSED(param2); __UNUSED(param3); }
inline CWorldBase * GetWorldBase() { return m_pWorld; }
protected:
virtual BOOL Init();
virtual VOID Release();
private:
CWorldBase *m_pWorld;
CPathExplorer *m_pPathExplorer; ///< 辨茫扁侩
enum { MAX_ENEMYSLOT_NUM = 12 }; // 4狼 硅荐 眠玫!
int m_iEnemySlot[MAX_ENEMYSLOT_NUM]; // 利捞 笛矾轿绊 乐绰 Position 惑怕甫 啊瘤绊乐促.(鞍篮 困摹俊 利捞 乐栏搁 count啊 疵绢抄促.)
ObjectList m_Observers; // 娟啊 构窍绰瘤 瘤难焊绊 乐绰 荤恩甸
protected :
StatusManager *m_pStatusManager; // 某腐磐狼 泅犁 惑怕 府胶飘
DWORD m_dwSummonerKey; // 家券府胶飘(SummonedNPCs)狼 虐蔼, 家券磊老 荐档 乐绊 家券等 措惑老 荐档 乐促.
PartyState m_PartyState; // 颇萍惑怕 沥焊
MoveStateControl* m_pMoveStateControl;
GameZone * m_pGameZone;
eZONE_STATE m_eGameZoneState;
WzID m_GameAreaID;
CODETYPE m_GameFieldCode;
// 胶懦 包访(唱吝俊 腹酒瘤搁 弓绰霸 亮阑淀...)
int m_iShieldHP; // 付过 蒋靛俊 狼茄 HP
int m_iShieldMP; // 付过 蒋靛 利侩矫 MP 皑家 荐摹
float m_fShieldAbsorbRatio; // 蒋靛 HP 软荐 厚啦
SHORT m_sFightingEnergyCount; // 捧扁 俺荐
// 荤噶 菩澄萍 包访 函荐(腹捞瘤搁 弓阑荐档...)
DWORD m_dwDeadExp; // 荤噶栏肺 颊秦夯 版氰摹
SkillList * m_pSkillList;
// 磷牢 坷宏璃飘 虐
eOBJECT_TYPE m_KillerType;
DWORD m_dwKillerObjectKey;
};
#endif // !defined(AFX_CHARACTER_H__9D08E782_7B24_4FB5_AC78_160F70DED66D__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -