📄 effectdecaycorpse.cpp
字号:
//////////////////////////////////////////////////////////////////////////////// Filename : EffectDecayCorpse.cpp// Written by : Reiot// Description : //////////////////////////////////////////////////////////////////////////////#include "Assert.h"#include "EffectDecayCorpse.h"#include "Gpackets/GCDeleteObject.h"#include "Tile.h"#include "Zone.h"#include "Corpse.h"#include "SlayerCorpse.h"#include "VampireCorpse.h"#include "MonsterCorpse.h"#include "ZoneUtil.h"EffectDecayCorpse::EffectDecayCorpse (Zone* pZone , ZoneCoord_t x , ZoneCoord_t y , Corpse* pCorpse , Turn_t delay) throw (Error): Effect(pZone,x,y,pCorpse,delay) { __BEGIN_TRY Assert(getZone() != NULL); Assert(getTarget() != NULL); m_ObjectID = pCorpse->getObjectID(); // 辑滚 傈侩 Effect捞促. by sigi. 2002.11.14 m_bBroadcastingEffect = false; __END_CATCH}EffectDecayCorpse::~EffectDecayCorpse () throw (Error){ __BEGIN_TRY unaffect(m_pZone , m_X , m_Y , m_pTarget); __END_CATCH} void EffectDecayCorpse::affect (Zone* pZone , ZoneCoord_t x , ZoneCoord_t y , Object* pTarget) throw (Error){ __BEGIN_TRY throw UnsupportedError(); __END_CATCH}void EffectDecayCorpse::unaffect (Zone* pZone , ZoneCoord_t x , ZoneCoord_t y , Object* pTarget) throw (Error){ __BEGIN_TRY // 棵官弗 谅钎捞绢具 茄促. Assert(isValidZoneCoord(pZone, x, y)); // 矫眉俊 立辟茄促. if (pZone->getTile(x,y).hasItem()) { Item* pItem = pZone->getTile(x,y).getItem(); if (pItem != NULL) { // 鸥老困俊 酒捞袍捞 乐绊 弊 酒捞袍狼 坷宏璃飘 酒捞叼啊 度鞍酒具父 度 鞍篮 矫眉捞促. if (pItem->getObjectID() == m_ObjectID) { Corpse* pCorpse = dynamic_cast<Corpse*>(pTarget); try { // 矫眉甫 粮俊辑 昏力茄促. Assert(pZone->getTile(x,y).getItem() == pCorpse); pZone->deleteItem(pCorpse , x, y); } catch (NoSuchElementException & nsee) { cerr << "EffectDecayCorpse::unaffect() : NoSuchElementException" << endl; throw Error(nsee.toString()); } GCDeleteObject gcDeleteObject; gcDeleteObject.setObjectID(pCorpse->getObjectID()); pZone->broadcastPacket(x, y , &gcDeleteObject); // 矫眉 磊眉甫 昏力茄促. SAFE_DELETE(pCorpse); } } } pTarget = NULL; __END_CATCH}void EffectDecayCorpse::unaffect () throw (Error){ __BEGIN_TRY __END_CATCH}void EffectDecayCorpse::unaffect (Creature* pCreature) throw (Error){ __BEGIN_TRY __END_CATCH}string EffectDecayCorpse::toString () const throw (){ StringStream msg; msg << "EffectDecayCorpse(" << "ZoneID:" << (int)m_pZone->getZoneID() << ",X:" << (int)getX() << ",Y:" << (int)getY(); if (m_pTarget) msg << ",Target:" << m_pTarget->toString(); else msg << ",Target:NULL"; msg << ",Deadline:" << (int)m_Deadline.tv_sec << "." << (int)m_Deadline.tv_usec; msg << ")"; return msg.toString();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -