📄 gunshotguidance.cpp
字号:
//////////////////////////////////////////////////////////////////////////////// Filename : GunShotGuidance.cpp// Written by : excel96// Description : //////////////////////////////////////////////////////////////////////////////#include "GunShotGuidance.h"#include "EffectGunShotGuidanceAim.h"#include "EffectGunShotGuidancePoint.h"#include "ItemUtil.h"#include "Gpackets/GCSkillToTileOK1.h"#include "Gpackets/GCSkillToTileOK2.h"#include "Gpackets/GCSkillToTileOK3.h"#include "Gpackets/GCSkillToTileOK4.h"#include "Gpackets/GCSkillToTileOK5.h"#include "Gpackets/GCSkillToTileOK6.h"#include "Gpackets/GCAddEffect.h"#include "Gpackets/GCAddEffectToTile.h"//////////////////////////////////////////////////////////////////////////////// 浇饭捞绢 坷宏璃飘 勤甸矾//////////////////////////////////////////////////////////////////////////////void GunShotGuidance::execute(Slayer* pSlayer, ObjectID_t TargetObjectID, SkillSlot* pSkillSlot, CEffectID_t CEffectID) throw(Error){ __BEGIN_TRY Assert(pSlayer != NULL); Assert(pSkillSlot != NULL); try { Zone* pZone = pSlayer->getZone(); Assert(pZone != NULL); Creature* pTargetCreature = pZone->getCreature(TargetObjectID); //Assert(pTargetCreature != NULL); // NPC绰 傍拜且 荐啊 绝促. if (pTargetCreature==NULL // NoSuch力芭 锭巩俊.. by sigi. 2002.5.2 || pTargetCreature->isFlag(Effect::EFFECT_CLASS_NO_DAMAGE) // by sigi. 2002.10.30 || pTargetCreature->isNPC()) { executeSkillFailException(pSlayer, getSkillType()); return; } execute(pSlayer, pTargetCreature->getX(), pTargetCreature->getY(), pSkillSlot, CEffectID); } catch (Throwable & t) { executeSkillFailException(pSlayer, getSkillType()); //cout << t.toString() << endl; } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " end " << endl; __END_CATCH}//////////////////////////////////////////////////////////////////////////////// 浇饭捞绢 鸥老 勤甸矾//////////////////////////////////////////////////////////////////////////////void GunShotGuidance::execute(Slayer* pSlayer, ZoneCoord_t X, ZoneCoord_t Y, SkillSlot* pSkillSlot, CEffectID_t CEffectID) throw(Error){ __BEGIN_TRY try { Player* pPlayer = pSlayer->getPlayer(); Zone* pZone = pSlayer->getZone(); Assert(pPlayer != NULL); Assert(pZone != NULL); // 醚阑 甸绊 乐绰瘤 犬牢茄促. Item* pItem = pSlayer->getWearItem( Slayer::WEAR_RIGHTHAND ); if ( pItem == NULL || isArmsWeapon( pItem ) == false ) { executeSkillFailException( pSlayer, getSkillType() ); return; } GCSkillToTileOK1 _GCSkillToTileOK1; GCSkillToTileOK3 _GCSkillToTileOK3; GCSkillToTileOK4 _GCSkillToTileOK4; GCSkillToTileOK5 _GCSkillToTileOK5; GCSkillToTileOK6 _GCSkillToTileOK6; SkillType_t SkillType = pSkillSlot->getSkillType(); SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType); //SkillDomainType_t DomainType = pSkillInfo->getDomainType(); int RequiredMP = pSkillInfo->getConsumeMP(); bool bManaCheck = hasEnoughMana(pSlayer, RequiredMP); bool bTimeCheck = verifyRunTime(pSkillSlot); bool bRangeCheck = verifyDistance(pSlayer, X, Y, pSkillInfo->getRange()); bool bEffected = pSlayer->isFlag( Effect::EFFECT_CLASS_GUN_SHOT_GUIDANCE_AIM ); bool bTileCheck = false; VSRect rect( 0, 0, pZone->getWidth()-1, pZone->getHeight()-1 ); if ( rect.ptInRect( X, Y ) ) { Tile& tile = pZone->getTile(X,Y); if ( tile.canAddEffect() ) bTileCheck = true; } if (bManaCheck && bTimeCheck && bRangeCheck && !bEffected && bTileCheck ) { decreaseMana(pSlayer, RequiredMP, _GCSkillToTileOK1); // 单固瘤客 瘤加 矫埃阑 拌魂茄促. SkillInput input(pSlayer, pSkillSlot); // pSkillSlot 眠啊 by Sequoia 2002.12.28 SkillOutput output; computeOutput(input, output); Tile& tile = pZone->getTile( X, Y ); // 鞍篮 捞棋飘啊 捞固 粮犁茄促搁 昏力茄促. Effect* pOldEffect = tile.getEffect(Effect::EFFECT_CLASS_GUN_SHOT_GUIDANCE_POINT); if (pOldEffect != NULL) { ObjectID_t effectID = pOldEffect->getObjectID(); pZone->deleteEffect(effectID); } // 捞棋飘 坷宏璃飘甫 积己茄促. EffectGunShotGuidanceAim* pEffect = new EffectGunShotGuidanceAim(pSlayer, pZone, X, Y); pEffect->setDamage(output.Damage); pEffect->setDeadline(output.Duration); pSlayer->addEffect( pEffect ); pSlayer->setFlag( Effect::EFFECT_CLASS_GUN_SHOT_GUIDANCE_AIM ); ZoneCoord_t myX = pSlayer->getX(); ZoneCoord_t myY = pSlayer->getY(); _GCSkillToTileOK1.setSkillType(SkillType); _GCSkillToTileOK1.setCEffectID(CEffectID); _GCSkillToTileOK1.setX(X); _GCSkillToTileOK1.setY(Y); _GCSkillToTileOK1.setDuration(output.Duration); _GCSkillToTileOK1.setRange(output.Range); _GCSkillToTileOK3.setObjectID(pSlayer->getObjectID()); _GCSkillToTileOK3.setSkillType(SkillType); _GCSkillToTileOK3.setX(X); _GCSkillToTileOK3.setY(Y); _GCSkillToTileOK4.setSkillType(SkillType); _GCSkillToTileOK4.setX(X); _GCSkillToTileOK4.setY(Y); _GCSkillToTileOK4.setDuration(output.Duration); _GCSkillToTileOK4.setRange(output.Range); _GCSkillToTileOK5.setObjectID(pSlayer->getObjectID()); _GCSkillToTileOK5.setSkillType(SkillType); _GCSkillToTileOK5.setX(X); _GCSkillToTileOK5.setY(Y); _GCSkillToTileOK5.setDuration(output.Duration); _GCSkillToTileOK5.setRange(output.Range); pPlayer->sendPacket(&_GCSkillToTileOK1); list<Creature*> cList; cList.push_back(pSlayer); cList = pZone->broadcastSkillPacket(myX, myY, X, Y, &_GCSkillToTileOK5, cList); pZone->broadcastPacket(myX, myY, &_GCSkillToTileOK3 , cList); pZone->broadcastPacket(X, Y, &_GCSkillToTileOK4 , cList); // GunShotGuidanceAim 捞棋飘甫 宏肺靛某胶泼 茄促. GCAddEffect gcAddAimEffect; gcAddAimEffect.setObjectID( pSlayer->getObjectID() ); gcAddAimEffect.setEffectID( Effect::EFFECT_CLASS_GUN_SHOT_GUIDANCE_AIM ); gcAddAimEffect.setDuration( output.Duration ); pZone->broadcastPacket( myX, myY, &gcAddAimEffect ); /////////////////////////////////////////////////////////////////// // GunShotGuidancePoint 捞棋飘甫 父甸绢辑 嘿捞绊 宏肺靛某胶泼 茄促. /////////////////////////////////////////////////////////////////// EffectGunShotGuidancePoint* pPointEffect = new EffectGunShotGuidancePoint( pZone, X, Y ); pPointEffect->setDeadline( output.Duration ); ObjectRegistry & objectRegister = pZone->getObjectRegistry(); objectRegister.registerObject( pPointEffect ); pZone->addEffect( pPointEffect ); tile.addEffect( pPointEffect ); GCAddEffectToTile gcAddEffectToTile; gcAddEffectToTile.setObjectID( pPointEffect->getObjectID() ); gcAddEffectToTile.setEffectID( pPointEffect->getEffectClass() ); gcAddEffectToTile.setXY( X, Y ); gcAddEffectToTile.setDuration( output.Duration ); pZone->broadcastPacket( X, Y, &gcAddEffectToTile ); pSkillSlot->setRunTime(output.Delay); } else { executeSkillFailNormal(pSlayer, getSkillType(), NULL); } } catch (Throwable & t) { executeSkillFailException(pSlayer, getSkillType()); } __END_CATCH}GunShotGuidance g_GunShotGuidance;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -