📄 duplicateself.cpp
字号:
//////////////////////////////////////////////////////////////////////////////// Filename : DuplicateSelf.cpp// Written by : elca@ewestsoft.com// Description : //////////////////////////////////////////////////////////////////////////////#include "DuplicateSelf.h"#include "MonsterSummonInfo.h"#include "ZoneUtil.h"#include "MasterLairManager.h"#include "MasterLairInfoManager.h"#include "MonsterManager.h"#include "Gpackets/GCSkillToTileOK5.h"#include "Gpackets/GCFakeMove.h"#include "Gpackets/GCSay.h"//////////////////////////////////////////////////////////////////////////////// 积己磊// 付胶农甫 檬扁拳茄促.//////////////////////////////////////////////////////////////////////////////DuplicateSelf::DuplicateSelf() throw(){ __BEGIN_TRY // 赣.. 翠翠窍谷 抛捞喉肺 哗电瘤.. -_-; m_DuplicateMonsterTypes[432] = 435; // 官配府 盒脚 m_DuplicateMonsterTypes[434] = 436; // 抛其令 盒脚 __END_CATCH}//////////////////////////////////////////////////////////////////////////////// 轨颇捞绢 伎橇 勤甸矾///////////////////////////////////////////////////////////////////////////////*void DuplicateSelf::execute(Vampire* pVampire, VampireSkillSlot* pSkillSlot, CEffectID_t CEffectID) throw(Error){ __BEGIN_TRY //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin" << endl; Assert(pVampire != NULL); Assert(pSkillSlot != NULL); try { Player* pPlayer = pVampire->getPlayer(); Zone* pZone = pVampire->getZone(); Assert(pPlayer != NULL); Assert(pZone != NULL); GCSkillToSelfOK1 _GCSkillToSelfOK1; GCSkillToSelfOK2 _GCSkillToSelfOK2; SkillType_t SkillType = pSkillSlot->getSkillType(); SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType); ZoneCoord_t x = pVampire->getX(); ZoneCoord_t y = pVampire->getY(); int RequiredMP = decreaseConsumeMP(pVampire, pSkillInfo); bool bManaCheck = hasEnoughMana(pVampire, RequiredMP); bool bTimeCheck = verifyRunTime(pSkillSlot); bool bRangeCheck = checkZoneLevelToUseSkill(pVampire); bool bHitRoll = HitRoll::isSuccessMagic(pVampire, pSkillInfo, pSkillSlot); bool bTileCheck = canBurrow(pZone, x, y); bool bMoveModeCheck = pVampire->isWalking(); bool bEffected = pVampire->isFlag(Effect::EFFECT_CLASS_HIDE); if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && bTileCheck && bMoveModeCheck && !bEffected) { decreaseMana(pVampire, RequiredMP, _GCSkillToSelfOK1); // 轨颇捞绢甫 顶 困俊辑 昏力窍扁 捞傈俊 扁贱 菩哦甸阑 朝赴促. _GCSkillToSelfOK1.setSkillType(SkillType); _GCSkillToSelfOK1.setCEffectID(CEffectID); _GCSkillToSelfOK1.setDuration(0); _GCSkillToSelfOK2.setXY(x, y); _GCSkillToSelfOK2.setSkillType(SkillType); _GCSkillToSelfOK2.setDuration(0); pPlayer->sendPacket(&_GCSkillToSelfOK1); pZone->broadcastPacket(x, y, &_GCSkillToSelfOK2, pVampire); // 顶 困俊 唱客乐绰 轨颇捞绢 昏力窍扼绊 舅赴促. GCDeleteObject gcDO; gcDO.setObjectID(pVampire->getObjectID()); pZone->broadcastPacket(x, y, &gcDO, pVampire); // 顶 加俊促啊 轨颇捞绢甫 眠啊茄促. addBurrowingCreature(pZone, pVampire, x, y); pSkillSlot->setRunTime(); } else { executeSkillFailNormal(pVampire, getSkillType(), NULL); } } catch(Throwable & t) { executeSkillFailException(pVampire, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; __END_CATCH}*///////////////////////////////////////////////////////////////////////////////// 阁胶磐 伎橇 勤甸矾//////////////////////////////////////////////////////////////////////////////void DuplicateSelf::execute(Monster* pMonster) throw(Error){ __BEGIN_TRY //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin" << endl; //cout << "DuplicateSelf" << endl; MonsterType_t MType = pMonster->getMonsterType(); hash_map<MonsterType_t, MonsterType_t>::const_iterator itr = m_DuplicateMonsterTypes.find( MType ); // 盒脚且 MonsterType捞 绝栏搁 盒脚 葛窍瘤.. if (itr==m_DuplicateMonsterTypes.end()) { //cout <<"DuplicateSelf::noMonsterType: " << (int)MType << endl; return; } MonsterType_t DuplicateMType = itr->second; Assert(pMonster != NULL); try { Zone* pZone = pMonster->getZone(); Assert(pZone != NULL); if (pMonster->isFlag(Effect::EFFECT_CLASS_HIDE)) { //cout << "DuplicateSelf: hide" << endl; return; } if (pMonster->isFlag(Effect::EFFECT_CLASS_INVISIBILITY)) { addVisibleCreature(pZone, pMonster, true); } //GCSkillToSelfOK2 _GCSkillToSelfOK2; ZoneCoord_t x = pMonster->getX(); ZoneCoord_t y = pMonster->getY(); bool bRangeCheck = checkZoneLevelToUseSkill(pMonster); //bool bMoveModeCheck = pMonster->isWalking(); if (bRangeCheck)// && bMoveModeCheck) { //cout << "DuplicateSelf OK" << endl; GCSkillToTileOK5 _GCSkillToTileOK5; _GCSkillToTileOK5.setObjectID(pMonster->getObjectID()); _GCSkillToTileOK5.setSkillType(getSkillType()); _GCSkillToTileOK5.setX(x); _GCSkillToTileOK5.setY(y); _GCSkillToTileOK5.setDuration( 0); pZone->broadcastPacket(x, y, &_GCSkillToTileOK5); //-------------------------------------------------------- // 林困俊 knockback登绰嘎绰 局甸阑 眉农秦霖促. //-------------------------------------------------------- //SkillInput input(pMonster); //SkillOutput output; //computeOutput(input, output); // 阁胶磐甫 粮俊 眠啊茄促. SUMMON_INFO summonInfo; summonInfo.scanEnemy = true; summonInfo.hasItem = false; summonInfo.initHPPercent = pMonster->getHP(ATTR_CURRENT)*100/pMonster->getHP(ATTR_MAX); int numFake = min((1+rand()%3), pMonster->getINT()/100); //cout << "numDuplicate = " << numFake<< endl; MonsterManager* pMonsterManager = pZone->getMonsterManager(); Assert(pMonsterManager != NULL); list<Monster*> summonedMonsters; for (int i=0; i<numFake; i++) { int X = max(0, min((int)pZone->getWidth()-1, (x - 5 + rand()%11))); int Y = max(0, min((int)pZone->getHeight()-1, (y - 5 + rand()%11))); try { pMonsterManager->addMonsters(X, Y, DuplicateMType, 1, summonInfo, &summonedMonsters); } catch (Throwable& t) { cerr << t.toString() << endl; } } // 儡惑阑 焊咯霖促. list<Monster*>::const_iterator iMonster = summonedMonsters.begin(); for (; iMonster!=summonedMonsters.end(); iMonster++) { Monster* pFakeMonster = *iMonster; GCFakeMove gcFakeMove; gcFakeMove.setObjectID( pMonster->getObjectID() ); gcFakeMove.setXY( pFakeMonster->getX(), pFakeMonster->getY() ); pZone->broadcastPacket( x, y, &gcFakeMove); } // 宝洒 阁胶磐档 绢凋啊肺 捞悼秦夯促. // 50锅 矫档.. for (int i=0; i<50; i++) { int X = max(0, min((int)pZone->getWidth()-1, (x - 8 + rand()%11))); int Y = max(0, min((int)pZone->getHeight()-1, (y - 8 + rand()%11))); if (pZone->moveFastMonster(pMonster, x,y, X,Y, getSkillType())) { break; } } } else { //cout << "RangeCheckFailed" << endl; executeSkillFailNormal(pMonster, getSkillType(), NULL); } } catch(Throwable & t) { executeSkillFailException(pMonster, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; __END_CATCH}DuplicateSelf g_DuplicateSelf;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -