📄 effectgreenpoison.cpp
字号:
//////////////////////////////////////////////////////////////////////////////// Filename : EffectGreenPoison.cpp// Written by : elca// Description : //////////////////////////////////////////////////////////////////////////////#include "EffectGreenPoison.h"#include "EffectPoison.h"#include "Vampire.h"#include "DB.h"#include "SkillHandler.h"#include "Gpackets/GCAddEffect.h"#include "Gpackets/GCRemoveEffect.h"////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////EffectGreenPoison::EffectGreenPoison(Zone* pZone, ZoneCoord_t zoneX, ZoneCoord_t zoneY) throw(Error){ __BEGIN_TRY m_UserObjectID = 0; m_pZone = pZone; m_X = zoneX; m_Y = zoneY; m_bVampire = false; __END_CATCH}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////bool EffectGreenPoison::affectCreature(Creature* pTargetCreature, bool bAffectByMove) throw(Error){ __BEGIN_TRY //cout << "EffectGreenPoison " << "affectCreature Begin " << endl; Assert(pTargetCreature != NULL); // 惑措俊霸 捞固 poison 捞棋飘啊 吧妨廉 乐绰 版快俊绰 吧府瘤 臼绰促. if (pTargetCreature->isFlag(Effect::EFFECT_CLASS_POISON)) { //cout << "EffectGreenPoison " << "affectCreature End " << endl; return false; } // 救傈瘤措牢瘤 眉农茄促. // 2003.1.10 by bezz.Sequoia if ( !checkZoneLevelToHitTarget( pTargetCreature ) ) { return false; } Zone* pZone = pTargetCreature->getZone(); // 惑措规俊霸 固磨 刀 单固瘤甫 拌魂茄促. int PoisonDamage = computeMagicDamage(pTargetCreature, m_Damage, SKILL_GREEN_POISON, m_bVampire); if (PoisonDamage > 0) { // 器捞琉 捞棋飘甫 积己秦辑, 鸥百 农府媚俊 嘿捞绊, 敲贰弊甫 难霖促. EffectPoison* pEffectPoison = new EffectPoison(pTargetCreature); pEffectPoison->setLevel(m_Level); pEffectPoison->setPoint(PoisonDamage); pEffectPoison->setDeadline(m_Duration); // 捞何盒 官层具 茄促. pEffectPoison->setTick(50); // 捞何盒档 官层具 茄促. pEffectPoison->setUserObjectID( m_UserObjectID ); pEffectPoison->affect(pTargetCreature); pTargetCreature->addEffect(pEffectPoison); pTargetCreature->setFlag(Effect::EFFECT_CLASS_POISON); // 捞棋飘啊 嘿菌促绊 林函俊 舅妨霖促. GCAddEffect gcAddEffect; gcAddEffect.setObjectID(pTargetCreature->getObjectID()); gcAddEffect.setEffectID(Effect::EFFECT_CLASS_POISON); gcAddEffect.setDuration(m_Duration); pZone->broadcastPacket(pTargetCreature->getX(), pTargetCreature->getY(), &gcAddEffect); } //cout << "EffectGreenPoison " << "affectCreature End " << endl; return true; __END_CATCH}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////void EffectGreenPoison::affect(Creature* pTargetCreature) throw(Error){ __BEGIN_TRY __END_CATCH}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////void EffectGreenPoison::affect(Zone* pZone , ZoneCoord_t x , ZoneCoord_t y , Object* pObject) throw(Error){ __BEGIN_TRY __END_CATCH}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////void EffectGreenPoison::unaffect() throw(Error){ __BEGIN_TRY //cout << "EffectGreenPoison " << "unaffect BEGIN" << endl; Tile& tile = m_pZone->getTile(m_X, m_Y); tile.deleteEffect(m_ObjectID); //cout << "EffectGreenPoison " << "unaffect END" << endl; __END_CATCH}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////void EffectGreenPoison::unaffect(Zone* pZone , ZoneCoord_t x , ZoneCoord_t y , Object* pObject) throw(Error){ __BEGIN_TRY __END_CATCH}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////string EffectGreenPoison::toString() const throw(){ __BEGIN_TRY StringStream msg; msg << "EffectGreenPoison(" << "DayTime:" << m_Deadline.tv_sec << ")"; return msg.toString(); __END_CATCH}void EffectGreenPoisonLoader::load(Zone* pZone) throw(Error){ __BEGIN_TRY Statement* pStmt = NULL; Result* pResult = NULL; BEGIN_DB { pStmt = g_pDatabaseManager->getConnection("DARKEDEN")->createStatement(); pResult = pStmt->executeQuery( "SELECT LeftX, TopY, RightX, BottomY, Value1, Value2, Value3 FROM ZoneEffectInfo WHERE ZoneID = %d AND EffectID = %d", pZone->getZoneID(), (int)Effect::EFFECT_CLASS_GREEN_POISON); while (pResult->next()) { int count = 0; ZoneCoord_t left = pResult->getInt( ++count ); ZoneCoord_t top = pResult->getInt( ++count ); ZoneCoord_t right = pResult->getInt( ++count ); ZoneCoord_t bottom = pResult->getInt( ++count ); int value1 = pResult->getInt( ++count ); int value2 = pResult->getInt( ++count ); int value3 = pResult->getInt( ++count ); VSRect rect(0, 0, pZone->getWidth()-1, pZone->getHeight()-1); for ( int X = left ; X <= right ; X++ ) for ( int Y = top ; Y <= bottom ; Y++ ) { if ( rect.ptInRect(X, Y) ) { Tile& tile = pZone->getTile(X,Y); if ( tile.canAddEffect() ) { EffectGreenPoison* pEffect = new EffectGreenPoison(pZone, X, Y); pEffect->setDuration( value1 ); pEffect->setNextTime( value2 ); pEffect->setDamage( value3 ); // 粮 棺 鸥老俊促啊 捞棋飘甫 眠啊茄促. pZone->registerObject(pEffect); pZone->addEffect(pEffect); tile.addEffect(pEffect); } } } } } END_DB(pStmt) __END_CATCH}EffectGreenPoisonLoader* g_pEffectGreenPoisonLoader = NULL;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -