📄 sniping.cpp
字号:
//////////////////////////////////////////////////////////////////////////////// Filename : Sniping.cpp// Written by : elca@ewestsoft.com// Description : //////////////////////////////////////////////////////////////////////////////#include "Sniping.h"#include "ItemUtil.h"#include "ZoneUtil.h"#include "EffectFadeOut.h"#include "EffectSnipingMode.h"#include "Gpackets/GCSkillToSelfOK1.h"#include "Gpackets/GCSkillToSelfOK2.h"#include "Gpackets/GCDeleteObject.h"//////////////////////////////////////////////////////////////////////////////// 浇饭捞绢 伎橇 勤甸矾//////////////////////////////////////////////////////////////////////////////void Sniping::execute(Slayer* pSlayer, SkillSlot* pSkillSlot, CEffectID_t CEffectID) throw(Error){ __BEGIN_TRY //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin" << endl; Assert(pSlayer != NULL); Assert(pSkillSlot != NULL); 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 || pSlayer->hasRelicItem() ) { executeSkillFailException(pSlayer, getSkillType()); //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; return; } GCSkillToSelfOK1 _GCSkillToSelfOK1; GCSkillToSelfOK2 _GCSkillToSelfOK2; SkillType_t SkillType = pSkillSlot->getSkillType(); SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType); SkillDomainType_t DomainType = pSkillInfo->getDomainType(); ZoneCoord_t x = pSlayer->getX(); ZoneCoord_t y = pSlayer->getY(); Tile& rTile = pZone->getTile( pSlayer->getX(), pSlayer->getY() ); int RequiredMP = pSkillInfo->getConsumeMP(); bool bManaCheck = hasEnoughMana(pSlayer, RequiredMP); bool bTimeCheck = verifyRunTime(pSkillSlot); bool bRangeCheck = checkZoneLevelToUseSkill(pSlayer); bool bHitRoll = HitRoll::isSuccessMagic(pSlayer, pSkillInfo, pSkillSlot); bool bEffected = pSlayer->isFlag(Effect::EFFECT_CLASS_SNIPING_MODE) || pSlayer->isFlag(Effect::EFFECT_CLASS_FADE_OUT) || pSlayer->isFlag(Effect::EFFECT_CLASS_HAS_FLAG) || pSlayer->isFlag(Effect::EFFECT_CLASS_HAS_SWEEPER) || rTile.getEffect(Effect::EFFECT_CLASS_TRYING_POSITION)!=NULL; if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && !bEffected) { decreaseMana(pSlayer, RequiredMP, _GCSkillToSelfOK1); SkillInput input(pSlayer, pSkillSlot); SkillOutput output; computeOutput(input, output); // 捞棋飘 努贰胶甫 父甸绢 嘿牢促. // 瓷仿摹 犁拌魂篮 EffectFadeOut捞 unaffect登搁辑, // 溜 EffectSnipingMode啊 嘿栏搁辑 捞风绢柳促. EffectFadeOut* pEffect= new EffectFadeOut(pSlayer); pEffect->setDuration(output.Duration); pEffect->setDeadline(40); pEffect->setSniping(); pSlayer->addEffect(pEffect); pSlayer->setFlag(Effect::EFFECT_CLASS_FADE_OUT); // 版氰摹甫 棵赴促. SkillGrade Grade = g_pSkillInfoManager->getGradeByDomainLevel(pSlayer->getSkillDomainLevel(DomainType)); Exp_t ExpUp = 10*(Grade+1); shareAttrExp(pSlayer, ExpUp, 1, 8, 1, _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); // Send Packet pPlayer->sendPacket(&_GCSkillToSelfOK1); pZone->broadcastPacket(x, y, &_GCSkillToSelfOK2, pSlayer); pSkillSlot->setRunTime(output.Delay); } else { executeSkillFailNormal(pSlayer, getSkillType(), NULL); } } catch(Throwable & t) { executeSkillFailException(pSlayer, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; __END_CATCH}void Sniping::checkRevealRatio(Creature* pCreature, int base, int divisor){ Assert(pCreature != NULL); Assert(pCreature->isSlayer()); Assert(pCreature->isFlag(Effect::EFFECT_CLASS_SNIPING_MODE)); Slayer* pSlayer = dynamic_cast<Slayer*>(pCreature); Assert(pSlayer != NULL); Zone* pZone = pSlayer->getZone(); Assert(pZone != NULL); SkillSlot* pSkillSlot = pSlayer->getSkill(SKILL_SNIPING); Assert(pSkillSlot != NULL); EffectSnipingMode* pEffectSM = dynamic_cast<EffectSnipingMode*>(pCreature->findEffect(Effect::EFFECT_CLASS_SNIPING_MODE)); Assert(pEffectSM != NULL); int penalty = base - (pSkillSlot->getExpLevel()/divisor); pEffectSM->setRevealRatio(pEffectSM->getRevealRatio() + penalty); if (rand()%100 < pEffectSM->getRevealRatio()) { //addUnSnipingModeCreature(pZone, pCreature, true); // 捞棋飘啊 波瘤档废 茄促. // 2003. 1. 17 by bezz pEffectSM->setDeadline(0); }}Sniping g_Sniping;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -