// Object.h: interface for the CObject class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_OBJECT_H__A8AFB488_5BB5_45E5_8482_EE4EE2A55DDD__INCLUDED_)
#define AFX_OBJECT_H__A8AFB488_5BB5_45E5_8482_EE4EE2A55DDD__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "GridUnit.h"
#include "Status.h"
#include "PtrList.h"
class CBattle;
class CStunState;
class CAmplifiedPower;
enum EObjectKind
{
eObjectKind_Player = 1,
eObjectKind_Npc = 2,
eObjectKind_Item = 4,
eObjectKind_Tactic = 8,
eObjectKind_SkillObject=16,
eObjectKind_Monster = 32,
eObjectKind_BossMonster=33,
eObjectKind_SpecialMonster=34,
};
enum eSpecialState
{
eSpecialState_Stun,
eSpecialState_AmplifiedPowerPhy,
eSpecialState_AmplifiedPowerAtt,
eSpecialState_Max
};
class CAction;
class CSpecialState;
class CObject : public CGridUnit
{
CSpecialState* m_pSpecialState[eSpecialState_Max];
TILEINDEX m_dwPreoccupiedTileIndex; // ¼±Á¡ÇÏ°í Àִ ŸÀÏÀÇ À妽º
BOOL m_bInited;
friend class CObjectFactory;
friend class CCharMove;
friend class CObjectStateManager;
DWORD m_dwSkillDelayStartTime; // speedhack check;
protected:
CObject();
virtual ~CObject();
DWORD m_AgentNum;
BYTE m_ObjectKind;
BASEOBJECT_INFO m_BaseObjectInfo;
MOVE_INFO m_MoveInfo;
STATE_INFO m_ObjectState;
RECOVER_TIME m_LifeRecoverTime;
YYRECOVER_TIME m_YYLifeRecoverTime;
RECOVER_TIME m_ShieldRecoverTime;
cPtrList m_StatusList;
DWORD m_KyungGongNaeRyuk_LastCheckTime;
CBattle* m_pBattle;
virtual void DoSetInited() {}
virtual void DoDamage(CObject* pAttacker,RESULTINFO* pDamageInfo,DWORD beforeLife) {}
friend class CCharacterCalcManager;
virtual void SetState(BYTE state);
public:
DWORD GetSkillDelayStartTime() { return m_dwSkillDelayStartTime; }
void SetSkillDelayStartTime(DWORD val){ m_dwSkillDelayStartTime = val; }
BYTE GetBattleTeam() { return m_BaseObjectInfo.BattleTeam; }
DWORD GetBattleID() { return m_BaseObjectInfo.BattleID; }
void SetBattleID(DWORD BattleID){ m_BaseObjectInfo.BattleID = BattleID; }
CBattle* GetBattle() { return m_pBattle; }
void SetBattle(DWORD BattleID,BYTE Team);
virtual void SendMsg(MSGBASE* pMsg,int MsgLen);
inline DWORD GetAgentNum()
{
return m_AgentNum;
}
virtual BOOL Init(EObjectKind kind,DWORD AgentNum, BASEOBJECT_INFO* pBaseObjectInfo);
virtual void Release();
inline BYTE GetObjectKind() { return m_ObjectKind; }
inline void SetObjectKind(EObjectKind kind) { m_ObjectKind = kind; }
inline char* GetObjectName() {return m_BaseObjectInfo.ObjectName; }
inline BYTE GetState() {return m_BaseObjectInfo.ObjectState; }
void GetPosition(VECTOR3* pos);
BASEMOVE_INFO * GetMoveInfo() { return &m_MoveInfo; }
//VECTOR3 * GetCurTargetPosition();
void SetInited();
void SetNotInited();
BOOL GetInited() { return m_bInited; }
inline DWORD GetID() { return m_BaseObjectInfo.dwObjectID; }
inline DWORD GetUserID() { return m_BaseObjectInfo.dwUserID; }
void GetBaseObjectInfo(BASEOBJECT_INFO* pRtInfo);
virtual void GetSendMoveInfo(SEND_MOVEINFO* pRtInfo,CAddableInfoList* pAddInfoList);
virtual void SetAddMsg(char* pAddMsg,WORD* pMsgLen,DWORD dwReceiverID,BOOL bLogin) = 0;
virtual void SetRemoveMsg(char* pRemoveMsg,WORD* pMsgLen,DWORD dwReceiverID);
virtual float GetRadius() { return 0; }
//////////////////////////////////////////////////////////////////////////
// »óÅÂ(State) °ü·Ã
virtual void OnStartObjectState(BYTE State,DWORD dwParam) {}
virtual void OnEndObjectState(BYTE State) {}
virtual void StateProcess() {};
//////////////////////////////////////////////////////////////////////////
// ŸÀÏ °ü·Ã
TILEINDEX GetPreoccupiedTileIndex() { return m_dwPreoccupiedTileIndex; }
void SetPreoccupiedTileIndex(TILEINDEX tileindex) { m_dwPreoccupiedTileIndex = tileindex; }
virtual int GetObjectTileSize();
//////////////////////////////////////////////////////////////////////////
// µ¥¹ÌÁö Á×À½ °ü·Ã
void Die(CObject* pAttacker);
virtual void DoDie(CObject* pAttacker) {}
virtual void CalcRealDamage(CObject* pOperator,WORD PhyDamage,WORD AttrDamage,RESULTINFO* pDamageInfo);
virtual DWORD CalcShieldDamage(DWORD ShieldDamage);
virtual void CalcCounterDamage(WORD Attrib,WORD AttrDamage,WORD PhyDamage,RESULTINFO* pDamageInfo);
virtual void CalcVampiric(RESULTINFO* pDamageInfo);
virtual DWORD Damage(CObject* pAttacker,RESULTINFO* pDamageInfo);
//////////////////////////////////////////////////////////////////////////
// Status
virtual void AddStatus(CStatus* pStatus);
virtual void RemoveStatus(CStatus* pStatus);
//////////////////////////////////////////////////////////////////////////
// Á¤º¸ ¾ò¾î¿À´Â ÇÔ¼öµé
virtual LEVELTYPE GetLevel() { return 0; };
virtual void SetLevel(LEVELTYPE level) {};
virtual DWORD GetLife() { return 0; }
virtual void SetLife(DWORD Life,BOOL bSendMsg = TRUE) {};
virtual DWORD GetShield() { return 0; }
virtual void SetShield(DWORD Life,BOOL bSendMsg = TRUE) {};
virtual DWORD GetNaeRyuk(){ return 0; }
virtual void SetNaeRyuk(DWORD val,BOOL bSendMsg = TRUE) {};
//////////////////////////////////////////////////////////////////////////
//
#define GET_STATUS(var_type,func) \
var_type func ## () \
{ \
var_type Ori = Do ## func(); \
var_type Up = 0,Down = 0; \
PTRLISTSEARCHSTART(m_StatusList,CStatus*,pSL) \
pSL->func(Ori,Up,Down); \
PTRLISTSEARCHEND; \
return STATUSCALC(Ori,Up,Down); \
}; \
virtual var_type Do ## func ## () { return 0; }
//
GET_STATUS(DWORD,GetMaxLife);
GET_STATUS(DWORD,GetMaxShield);
GET_STATUS(DWORD,GetMaxNaeRyuk);
GET_STATUS(DWORD,GetPhyDefense);
GET_STATUS(DWORD,GetPhyAttackPowerMin);
GET_STATUS(DWORD,GetPhyAttackPowerMax);
GET_STATUS(DWORD,GetCritical);
GET_STATUS(float,GetMoveSpeed);
GET_STATUS(float,GetUngiPlusRate);
GET_STATUS(float,GetAddAttackRange);
GET_STATUS(float,GetDodgeRate);
float GetAttDefense(WORD Attrib);
virtual float DoGetAttDefense(WORD Attrib) {return 0;}
//////////////////////////////////////////////////////////////////////////
virtual void SetMaxLife(WORD life) {};
virtual void SetMaxNaeRyuk(WORD val) {};
virtual float GetAttribPlusPercent(WORD Attrib) { return 0; }
void AddLife(DWORD val,DWORD* realAddLife,BOOL bSendMsg = TRUE);
void AddNaeRyuk(DWORD val,DWORD* realAddNaeRyuk);
void ReduceNaeRyuk(DWORD val);
void CheckLifeValid();
void CheckNaeRyukValid();
void CheckShieldValid();
virtual DWORD GetGravity(){ return 0; }
virtual void SetGravity(DWORD gravity){ }
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// Special State
void StartSpecialState(DWORD SpecialStateKind,DWORD Time,
WORD wParam1,WORD wParam2,float fParam3,
WORD EffectNum,WORD StateIcon);
void EndSpecialState(DWORD SpecialStateKind);
BOOL IsInSpecialState(DWORD SpecialStateKind);
void SpecialStateProcess(DWORD TickTime);
WORD GetSpecialStateParam1(DWORD SpecialStateKind);
WORD GetSpecialStateParam2(DWORD SpecialStateKind);
float GetSpecialStateParam3(DWORD SpecialStateKind);
//////////////////////////////////////////////////////////////////////////
};
#endif // !defined(AFX_OBJECT_H__A8AFB488_5BB5_45E5_8482_EE4EE2A55DDD__INCLUDED_)