📄 rebuke.cpp
字号:
//////////////////////////////////////////////////////////////////////////////// Filename : Rebuke.cpp// Written by : // Description : //////////////////////////////////////////////////////////////////////////////#include "Rebuke.h"#include "EffectSleep.h"#include "Gpackets/GCSkillToSelfOK1.h"#include "Gpackets/GCSkillToSelfOK2.h"#include "Gpackets/GCAddEffect.h"#include "Gpackets/GCStatusCurrentHP.h"//////////////////////////////////////////////////////////////////////////////// 浇饭捞绢 伎橇 勤甸矾//////////////////////////////////////////////////////////////////////////////void Rebuke::execute(Slayer* pSlayer, SkillSlot* pSkillSlot, CEffectID_t CEffectID) throw(Error){ __BEGIN_TRY //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin(slayer)" << endl; Assert(pSlayer != NULL); Assert(pSkillSlot != NULL); try { Player* pPlayer = pSlayer->getPlayer(); Zone* pZone = pSlayer->getZone(); Assert(pPlayer != NULL); Assert(pZone != NULL); GCSkillToSelfOK1 _GCSkillToSelfOK1; GCSkillToSelfOK2 _GCSkillToSelfOK2; SkillType_t SkillType = pSkillSlot->getSkillType(); SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType); SkillDomainType_t DomainType = pSkillInfo->getDomainType(); int RequiredMP = (int)pSkillInfo->getConsumeMP(); bool bManaCheck = hasEnoughMana(pSlayer, RequiredMP); bool bTimeCheck = verifyRunTime(pSkillSlot); bool bRangeCheck = checkZoneLevelToUseSkill(pSlayer); ZoneCoord_t X = pSlayer->getX(); ZoneCoord_t Y = pSlayer->getY(); VSRect rect(0, 0, pZone->getWidth()-1, pZone->getHeight()-1); if (bManaCheck && bTimeCheck && bRangeCheck) { decreaseMana(pSlayer, RequiredMP, _GCSkillToSelfOK1); // 瘤加 矫埃阑 拌魂茄促. SkillInput input(pSlayer, pSkillSlot); SkillOutput output; computeOutput(input, output); bool bHit = false; for( int ox = -2 ; ox <= 2 ; ox++ ) for( int oy = -2 ; oy <= 2 ; oy++ ) { int tileX = X+ox; int tileY = Y+oy; if( !rect.ptInRect(tileX,tileY) ) continue; Tile& tile = pZone->getTile( tileX, tileY ); if ( tile.getEffect( Effect::EFFECT_CLASS_TRYING_POSITION ) ) continue; list<Creature*> targetList; if (tile.hasCreature(Creature::MOVE_MODE_WALKING)) { Creature* pCreature = tile.getCreature(Creature::MOVE_MODE_WALKING); targetList.push_back(pCreature); } if (tile.hasCreature(Creature::MOVE_MODE_FLYING)) { Creature* pCreature = tile.getCreature(Creature::MOVE_MODE_FLYING); targetList.push_back(pCreature); } if (tile.hasCreature(Creature::MOVE_MODE_BURROWING)) { Creature* pCreature = tile.getCreature(Creature::MOVE_MODE_BURROWING); targetList.push_back(pCreature); } list<Creature*>::iterator itr = targetList.begin(); for ( ; itr != targetList.end() ; itr++ ) { Creature* pTargetCreature = (*itr); Assert( pTargetCreature != NULL ); // 救傈瘤措 眉农 // 2003.1.10 by bezz, Sequoia // NPC档 眉农 // 2003.3.14 by Sequoia if ( pTargetCreature->isNPC() || !checkZoneLevelToHitTarget(pTargetCreature) || pTargetCreature->isFlag( Effect::EFFECT_CLASS_NO_DAMAGE ) || pTargetCreature->isFlag( Effect::EFFECT_CLASS_COMA ) ) continue; if( HitRoll::isSuccessRebuke( pSlayer, pSkillSlot, pTargetCreature ) ) { HP_t RemainHP = 0; // 嘎绰 逞茄抛 单固瘤甫 林绊 巢篮 HP 甫 备茄促. if ( pTargetCreature->isVampire() ) { GCModifyInformation gcMI; setDamage( pTargetCreature, output.Damage, pSlayer, SkillType, &gcMI ); pTargetCreature->getPlayer()->sendPacket( &gcMI ); Vampire* pVampire = dynamic_cast<Vampire*>(pTargetCreature); RemainHP = pVampire->getHP(ATTR_CURRENT); } else if ( pTargetCreature->isMonster() ) { setDamage( pTargetCreature, output.Damage, pSlayer, SkillType ); Monster* pMonster = dynamic_cast<Monster*>(pTargetCreature); RemainHP = pMonster->getHP(ATTR_CURRENT); } // 捞固 SLEEP 捞棋飘啊 吧妨乐栏搁 刚历 吧妨乐带 捞棋飘甫 昏力茄促. if ( pTargetCreature->isFlag( Effect::EFFECT_CLASS_SLEEP ) ) { pTargetCreature->deleteEffect( Effect::EFFECT_CLASS_SLEEP ); } EffectSleep* pEffect = new EffectSleep( pTargetCreature ); // 嘎绰 逞茄抛 SLEEP 捞棋飘甫 吧绢霖促. pEffect->setDeadline( output.Duration ); pTargetCreature->addEffect( pEffect ); pTargetCreature->setFlag( Effect::EFFECT_CLASS_SLEEP ); GCAddEffect gcAddEffect; gcAddEffect.setObjectID( pTargetCreature->getObjectID() ); gcAddEffect.setEffectID( Effect::EFFECT_CLASS_SLEEP ); gcAddEffect.setDuration( output.Duration ); pZone->broadcastPacket( tileX, tileY, &gcAddEffect ); bHit = true; // 己氢阑 棵赴促. // 鸥百捞 浇饭捞绢捞搁 刚啊 巩力啊 乐促. if ( !pTargetCreature->isSlayer() ) { // increaseAlignment( pSlayer, pTargetCreature, &_GCSkillToSelfOK1 ); } } } } // 版氰摹甫 棵赴促. if( bHit ) { SkillGrade Grade = g_pSkillInfoManager->getGradeByDomainLevel(pSlayer->getSkillDomainLevel(DomainType)); Exp_t ExpUp = 10* (Grade + 1); shareAttrExp(pSlayer, ExpUp, 1, 1, 8, _GCSkillToSelfOK1); increaseDomainExp(pSlayer, DomainType, pSkillInfo->getPoint(), _GCSkillToSelfOK1); increaseSkillExp(pSlayer, DomainType, pSkillSlot, pSkillInfo, _GCSkillToSelfOK1); } _GCSkillToSelfOK1.setSkillType(SkillType); _GCSkillToSelfOK1.setCEffectID(CEffectID); _GCSkillToSelfOK1.setDuration(0); _GCSkillToSelfOK2.setObjectID(pSlayer->getObjectID()); _GCSkillToSelfOK2.setSkillType(SkillType); _GCSkillToSelfOK2.setDuration(0); pPlayer->sendPacket(&_GCSkillToSelfOK1); pZone->broadcastPacket(pSlayer->getX(), pSlayer->getY(), &_GCSkillToSelfOK2, pSlayer); pSkillSlot->setRunTime(output.Delay); } else { executeSkillFailNormal(pSlayer, getSkillType(), NULL); } } catch (Throwable & t) { executeSkillFailException(pSlayer, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End(slayer)" << endl; __END_CATCH}Rebuke g_Rebuke;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -