////////////////////////////////////////////////////////////////////////////// // 슬레이어 타일 핸들러 ////////////////////////////////////////////////////////////////////////////// void Sanctuary::execute(Slayer* pSlayer, ZoneCoord_t X, ZoneCoord_t Y, 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); GCSkillToTileOK1 _GCSkillToTileOK1; GCSkillToTileOK2 _GCSkillToTileOK2; GCSkillToTileOK3 _GCSkillToTileOK3; GCSkillToTileOK4 _GCSkillToTileOK4; GCSkillToTileOK5 _GCSkillToTileOK5; GCSkillToTileOK6 _GCSkillToTileOK6; SkillType_t SkillType = pSkillSlot->getSkillType(); SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType); ZoneCoord_t myX = pSlayer->getX(); ZoneCoord_t myY = pSlayer->getY(); int RequiredMP = (int)pSkillInfo->getConsumeMP(); bool bManaCheck = hasEnoughMana(pSlayer, RequiredMP); bool bTimeCheck = verifyRunTime(pSkillSlot); bool bRangeCheck = verifyDistance(pSlayer, X, Y, pSkillInfo->getRange()) && checkZoneLevelToUseSkill(pSlayer); bool bHitRoll = HitRoll::isSuccessMagic(pSlayer, pSkillInfo, pSkillSlot); bool bTileCheck = false; VSRect rect(0, 0, pZone->getWidth()-1, pZone->getHeight()-1); if (rect.ptInRect(X, Y)) bTileCheck = true; if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && bTileCheck) { // 이펙트의 지속시간을 계산한다. SkillInput input(pSlayer, pSkillSlot); SkillOutput output; computeOutput(input, output); Range_t Range = 3; int oX, oY; list<Creature*> cList; // denier list ObjectRegistry & objectregister = pZone->getObjectRegistry(); // 일단 이미 sanctuary가 있는지 검색한다. for(oY = -1; oY <= 1; oY++) for(oX = -1; oX <= 1; oX++) { int tileX = X+oX; int tileY = Y+oY; if (rect.ptInRect(tileX, tileY)) { Tile& tile = pZone->getTile(tileX, tileY); if (tile.canAddEffect()) { Effect* pOldEffect = tile.getEffect(Effect::EFFECT_CLASS_SANCTUARY); // 이미 있다면 // 기술 실패다. if (pOldEffect != NULL) { executeSkillFailNormal(pSlayer, getSkillType(), NULL); return; } } else { executeSkillFailNormal(pSlayer, getSkillType(), NULL); return; } } } // 실패하면 마나가 줄면 안 되므로 여기서 줄여준다. decreaseMana(pSlayer, RequiredMP, _GCSkillToTileOK1); for(oY = -1; oY <= 1; oY++) for(oX = -1; oX <= 1; oX++) { int tileX = X+oX; int tileY = Y+oY; if (rect.ptInRect(tileX, tileY)) { Tile& tile = pZone->getTile(tileX, tileY); // 현재 타일에다 이펙트를 추가할 수 있다면... //if (tile.canAddEffect()) // 위에서 체크했다. { // 같은 effect가 있으면 지운다. // 위에서 체크했다. /* Effect* pOldEffect = tile.getEffect(Effect::EFFECT_CLASS_SANCTUARY); if (pOldEffect != NULL) { ObjectID_t effectID = pOldEffect->getObjectID(); pZone->deleteEffect(effectID);// fix me } */ // 이펙트 클래스를 생성한다. EffectSanctuary* pEffect = new EffectSanctuary(pZone , tileX, tileY, X, Y); pEffect->setDeadline(output.Duration); pEffect->setLevel(pSlayer->getINT()); pEffect->setDuration(output.Duration); pEffect->setStartTime(); // Tile에 붙이는 Effect는 ObjectID를 등록받아야 한다. objectregister.registerObject(pEffect); pZone->addEffect(pEffect); tile.addEffect(pEffect); if (oX==0 && oY==0) { GCAddEffectToTile gcAddEffectToTile; gcAddEffectToTile.setEffectID(pEffect->getEffectClass()); gcAddEffectToTile.setObjectID(pEffect->getObjectID()); gcAddEffectToTile.setXY(X, Y); gcAddEffectToTile.setDuration(output.Duration); pZone->broadcastPacket(X, Y, &gcAddEffectToTile, pSlayer); } const list<Object*>& oList = tile.getObjectList(); for(list<Object*>::const_iterator itr = oList.begin(); itr != oList.end(); itr++) { Object* pTarget = *itr; //Creature* pTargetCreature = NULL; //if (pTarget->getObjectClass() == Object::OBJECT_CLASS_CREATURE) { // pTargetCreature = dynamic_cast<Creature*>(pTarget); // 이펙트 클래스를 생성한다. /* EffectSanctuary* pEffect = new EffectSanctuary(pZone , tileX, tileY, X, Y); pEffect->setDeadline(output.Duration); pEffect->setLevel(pSlayer->getINT()); pEffect->setDuration(output.Duration); pEffect->setStartTime(); // 캐릭터에 붙는다. 못 움직이게 할려고.. objectregister.registerObject(pEffect); pTargetCreature->getEffectManager()->addEffect(pEffect); pZone->addEffect(pEffect); */ } /* && (pTargetCreature = dynamic_cast<Creature*>(pTarget))->isSlayer()) { cList.push_back(pTargetCreature); _GCSkillToTileOK2.addCListElement(pTargetCreature->getObjectID()); _GCSkillToTileOK4.addCListElement(pTargetCreature->getObjectID()); _GCSkillToTileOK5.addCListElement(pTargetCreature->getObjectID()); } */ pEffect->affectObject(pTarget, false); } } } } // client에서는 effect생성되는 시간이 있어서 // 타이밍 맞출려면.. 시간을 좀 빼줘야 한다. -_-; output.Duration -= 20; // 2초 뺀다. _GCSkillToTileOK1.setSkillType(SkillType); _GCSkillToTileOK1.setCEffectID(CEffectID); _GCSkillToTileOK1.setX(X); _GCSkillToTileOK1.setY(Y); _GCSkillToTileOK1.setDuration(output.Duration); _GCSkillToTileOK1.setRange(Range); _GCSkillToTileOK2.setObjectID(pSlayer->getObjectID()); _GCSkillToTileOK2.setSkillType(SkillType); _GCSkillToTileOK2.setX(X); _GCSkillToTileOK2.setY(Y); _GCSkillToTileOK2.setDuration(output.Duration); _GCSkillToTileOK2.setRange(Range); //_GCSkillToTileOK2.addShortData(MODIFY_VISION, SANCTUARY_SIGHT); _GCSkillToTileOK3.setObjectID(pSlayer->getObjectID()); _GCSkillToTileOK3.setSkillType(SkillType); _GCSkillToTileOK3.setX(X); _GCSkillToTileOK3.setY(Y); _GCSkillToTileOK4.setSkillType(SkillType); _GCSkillToTileOK4.setX(X); _GCSkillToTileOK4.setY(Y); _GCSkillToTileOK4.setRange(Range); _GCSkillToTileOK4.setDuration(output.Duration); _GCSkillToTileOK5.setObjectID(pSlayer->getObjectID()); _GCSkillToTileOK5.setSkillType(SkillType); _GCSkillToTileOK5.setX(X); _GCSkillToTileOK5.setY(Y); _GCSkillToTileOK5.setRange(Range); _GCSkillToTileOK5.setDuration(output.Duration); _GCSkillToTileOK6.setOrgXY(myX, myY); _GCSkillToTileOK6.setSkillType(SkillType); _GCSkillToTileOK6.setX(X); _GCSkillToTileOK6.setY(Y); _GCSkillToTileOK6.setDuration(output.Duration); _GCSkillToTileOK6.setRange(Range); //_GCSkillToTileOK6.addShortData(MODIFY_VISION, SANCTUARY_SIGHT); // EXP UP! SkillDomainType_t DomainType = pSkillInfo->getDomainType(); SkillGrade Grade = g_pSkillInfoManager->getGradeByDomainLevel(pSlayer->getSkillDomainLevel(DomainType)); Exp_t ExpUp = 10* (Grade + 1); shareAttrExp(pSlayer, ExpUp, 1, 1, 8, _GCSkillToTileOK1); increaseDomainExp(pSlayer, DomainType, pSkillInfo->getPoint(), _GCSkillToTileOK1); increaseSkillExp(pSlayer, DomainType, pSkillSlot, pSkillInfo, _GCSkillToTileOK1); for(list<Creature*>::const_iterator itr = cList.begin(); itr != cList.end(); itr++) { Creature* pTargetCreature = *itr; if (canSee(pTargetCreature, pSlayer)) pTargetCreature->getPlayer()->sendPacket(&_GCSkillToTileOK2); else pTargetCreature->getPlayer()->sendPacket(&_GCSkillToTileOK6); } pPlayer->sendPacket(&_GCSkillToTileOK1); cList.push_back(pSlayer); list<Creature*> watcherList = pZone->getWatcherList(myX, myY, pSlayer); // watcherList에서 cList에 속하지 않고, caster(pSlayer)를 볼 수 없는 경우는 // OK4를 보내고.. cList에 추가한다. for(list<Creature*>::const_iterator itr = watcherList.begin(); itr != watcherList.end(); itr++) { bool bBelong = false; for(list<Creature*>::const_iterator tItr = cList.begin(); tItr != cList.end(); tItr++) if (*itr == *tItr) bBelong = true; Creature* pWatcher = (*itr); if (bBelong == false && canSee(pWatcher, pSlayer) == false) { //Assert(pWatcher->isPC()); // 당연 PC다.. Zone::getWatcherList는 PC만 return한다 if (!pWatcher->isPC()) { //cout << "Sanctuary : 왓처 리스트가 PC가 아닙니다." << endl; GCSkillFailed1 _GCSkillFailed1; _GCSkillFailed1.setSkillType(getSkillType()); pSlayer->getPlayer()->sendPacket(&_GCSkillFailed1); //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; return; } pWatcher->getPlayer()->sendPacket(&_GCSkillToTileOK4); cList.push_back(*itr); } } cList = pZone->broadcastSkillPacket(myX, myY, X, Y, &_GCSkillToTileOK5, cList, false); pZone->broadcastPacket(myX, myY, &_GCSkillToTileOK3 , cList); pZone->broadcastPacket(X, Y, &_GCSkillToTileOK4 , cList); 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 AirShield::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); // 무장하고 있는 무기가 널이거나, 도가 아니라면 사용할 수 없다. Item* pItem = pSlayer->getWearItem(Slayer::WEAR_RIGHTHAND); if (pItem == NULL || pItem->getItemClass() != Item::ITEM_CLASS_BLADE) { executeSkillFailException(pSlayer, getSkillType()); return; } bool bIncreaseDomainExp = pSlayer->isRealWearingEx(Slayer::WEAR_RIGHTHAND); GCSkillToSelfOK1 _GCSkillToSelfOK1; GCSkillToSelfOK2 _GCSkillToSelfOK2; SkillType_t SkillType = pSkillSlot->getSkillType(); SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType); SkillDomainType_t DomainType = pSkillInfo->getDomainType(); SkillLevel_t SkillLevel = pSkillSlot->getExpLevel(); int RequiredMP = (int)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_AIR_SHIELD_1); if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && !bEffected) { decreaseMana(pSlayer, RequiredMP, _GCSkillToSelfOK1); // 지속 시간을 계산한다. SkillInput input(pSlayer, pSkillSlot); SkillOutput output; computeOutput(input, output); // 이팩트 클래스를 만들어 붙인다. EffectAirShield* pEffect = new EffectAirShield(pSlayer); pEffect->setDeadline(output.Duration); pEffect->setLevel(SkillLevel); pEffect->setDamage(output.Damage); pSlayer->addEffect(pEffect); pSlayer->setFlag(Effect::EFFECT_CLASS_AIR_SHIELD_1); // 경험치를 올린다. SkillGrade Grade = g_pSkillInfoManager->getGradeByDomainLevel(pSlayer->getSkillDomainLevel(DomainType)); Exp_t ExpUp = 10* (Grade + 1); if (bIncreaseDomainExp ) { shareAttrExp(pSlayer, ExpUp, 8, 1, 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); pPlayer->sendPacket(&_GCSkillToSelfOK1); pZone->broadcastPacket(pSlayer->getX(), pSlayer->getY(), &_GCSkillToSelfOK2, pSlayer); GCAddEffect gcAddEffect; gcAddEffect.setObjectID(pSlayer->getObjectID()); gcAddEffect.setEffectID(pEffect->getClientEffectClass()); gcAddEffect.setDuration(output.Duration); pZone->broadcastPacket(pSlayer->getX(), pSlayer->getY(), &gcAddEffect); 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 }
////////////////////////////////////////////////////////////////////////////// // 몬스터 셀프 핸들러 ////////////////////////////////////////////////////////////////////////////// void Invisibility::execute(Monster* pMonster) throw(Error) { __BEGIN_TRY //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin(monster)" << endl; Assert(pMonster != NULL); try { Zone* pZone = pMonster->getZone(); Assert(pZone != NULL); GCSkillToSelfOK2 _GCSkillToSelfOK2; if (pMonster->isFlag(Effect::EFFECT_CLASS_HIDE)) { //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End(monster)" << endl; return; } SkillType_t SkillType = SKILL_INVISIBILITY; SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType); ZoneCoord_t x = pMonster->getX(); ZoneCoord_t y = pMonster->getY(); bool bRangeCheck = checkZoneLevelToUseSkill(pMonster); bool bHitRoll = HitRoll::isSuccessMagic(pMonster, pSkillInfo); bool bEffected = (pMonster->isFlag(Effect::EFFECT_CLASS_INVISIBILITY) || pMonster->isFlag(Effect::EFFECT_CLASS_FADE_OUT)); if (bRangeCheck && bHitRoll && !bEffected) { SkillInput input(pMonster); SkillOutput output; computeOutput(input, output); // 점점 사라지는 이펙트를 생성해서 붙인다. // 실제로 사라지는 것은 이 이펙트 내부에서다. // (한번에 '팍'하고 사라지는 게 아니라서 붙이는 이펙트다.) EffectFadeOut* pEffect= new EffectFadeOut(pMonster); pEffect->setDuration(output.Duration); pEffect->setDeadline(40); pEffect->setInvisibility(); pMonster->addEffect(pEffect); pMonster->setFlag(Effect::EFFECT_CLASS_FADE_OUT); _GCSkillToSelfOK2.setObjectID(pMonster->getObjectID()); _GCSkillToSelfOK2.setDuration(0); _GCSkillToSelfOK2.setSkillType(SkillType); pZone->broadcastPacket(x, y, &_GCSkillToSelfOK2); } else { executeSkillFailNormal(pMonster, getSkillType(), NULL); } } catch(Throwable & t) { executeSkillFailException(pMonster, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End(monster)" << endl; __END_CATCH }
////////////////////////////////////////////////////////////////////////////// // 슬레이어 셀프 ////////////////////////////////////////////////////////////////////////////// void HolyArmor::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* pWeapon = pSlayer->getWearItem(Slayer::WEAR_RIGHTHAND); if (pWeapon == NULL || pWeapon->getItemClass() != Item::ITEM_CLASS_SWORD) { 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(); int RequiredMP = (int)pSkillInfo->getConsumeMP(); bool bManaCheck = hasEnoughMana(pSlayer, RequiredMP) && pSlayer->getHP() > 100; bool bTimeCheck = verifyRunTime(pSkillSlot); bool bRangeCheck = checkZoneLevelToUseSkill(pSlayer); bool bHitRoll = HitRoll::isSuccessMagic(pSlayer, pSkillInfo, pSkillSlot); bool bEffected = pSlayer->isFlag(Effect::EFFECT_CLASS_HOLY_ARMOR); if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && !bEffected) { decreaseMana(pSlayer, RequiredMP, _GCSkillToSelfOK1); pSlayer->setHP(pSlayer->getHP()-100); _GCSkillToSelfOK1.addShortData(MODIFY_CURRENT_HP, pSlayer->getHP()); SkillInput input(pSlayer, pSkillSlot); SkillOutput output; computeOutput(input, output); // 이펙트 클래스를 만들어 붙인다. EffectHolyArmor* pEffect = new EffectHolyArmor(pSlayer); pEffect->setDeadline(output.Duration); pEffect->setDefBonus(output.Damage); pSlayer->addEffect(pEffect); pSlayer->setFlag(Effect::EFFECT_CLASS_HOLY_ARMOR); // 이로 인하여 바뀌는 능력치를 보낸다. SLAYER_RECORD prev; pSlayer->getSlayerRecord(prev); pSlayer->initAllStat(); pSlayer->sendRealWearingInfo(); pSlayer->sendModifyInfo(prev); // 경험치를 올린다. 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(output.Duration); _GCSkillToSelfOK2.setObjectID(pSlayer->getObjectID()); _GCSkillToSelfOK2.setSkillType(SkillType); _GCSkillToSelfOK2.setDuration(output.Duration); GCAddEffect gcAddEffect; gcAddEffect.setObjectID(pSlayer->getObjectID()); gcAddEffect.setEffectID(Effect::EFFECT_CLASS_HOLY_ARMOR); gcAddEffect.setDuration(output.Duration); pZone->broadcastPacket(X, Y, &gcAddEffect); // Send Packet pPlayer->sendPacket(&_GCSkillToSelfOK1); pZone->broadcastPacket(X, Y, &_GCSkillToSelfOK2, pSlayer); pSkillSlot->setRunTime(output.Delay); uint PartyID = pSlayer->getPartyID(); if (PartyID != 0) { LocalPartyManager* pLPM = pZone->getLocalPartyManager(); pLPM->shareHolyArmor(PartyID, pSlayer, output.Damage, input.SkillLevel); } } else { executeSkillFailNormal(pSlayer, getSkillType(), NULL); } } catch (Throwable & t) { executeSkillFailException(pSlayer, getSkillType()); //cout << t.toString() << endl; } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; __END_CATCH }
////////////////////////////////////////////////////////////////////////////// // 슬레이어 셀프 ////////////////////////////////////////////////////////////////////////////// void Eternity::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); 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 = (int)pSkillInfo->getConsumeMP(); bool bManaCheck = hasEnoughMana(pSlayer, RequiredMP); bool bTimeCheck = verifyRunTime(pSkillSlot); bool bRangeCheck = checkZoneLevelToUseSkill(pSlayer); bool bHitRoll = pSlayer->isFlag(Effect::EFFECT_CLASS_COMA ) && HitRoll::isSuccessMagic(pSlayer, pSkillInfo, pSkillSlot); bool bEffected = pSlayer->isFlag(Effect::EFFECT_CLASS_ETERNITY) || rTile.getEffect(Effect::EFFECT_CLASS_TRYING_POSITION)!=NULL; if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && !bEffected) { Effect* pComa = pSlayer->findEffect(Effect::EFFECT_CLASS_COMA); if (pComa == NULL ) { executeSkillFailException(pSlayer, getSkillType()); return; } SkillInput input(pSlayer, pSkillSlot); SkillOutput output; computeOutput(input, output); decreaseMana(pSlayer, RequiredMP, _GCSkillToSelfOK1); // 이펙트 클래스를 만들어 붙인다. EffectEternity* pEffect = new EffectEternity(pSlayer); pEffect->setDeadline(output.Duration); pEffect->setHPPenalty(output.Damage); pEffect->setBroadcastingEffect(false); // pSlayer->addEffect(pEffect); pSlayer->setFlag(Effect::EFFECT_CLASS_ETERNITY); pZone->registerObject(pEffect); pZone->addEffect(pEffect); pComa->setDeadline(output.Duration + 10); //11초. 스킬 발동 전에 부활위치로 튕기는거 방지 // 경험치를 올린다. 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(output.Duration); _GCSkillToSelfOK2.setObjectID(pSlayer->getObjectID()); _GCSkillToSelfOK2.setSkillType(SkillType); _GCSkillToSelfOK2.setDuration(output.Duration); // Send Packet pPlayer->sendPacket(&_GCSkillToSelfOK1); pZone->broadcastPacket(X, Y, &_GCSkillToSelfOK2, pSlayer); } else { executeSkillFailNormal(pSlayer, getSkillType(), NULL); } pSkillSlot->setRunTime(20); //2초 } catch (Throwable & t) { executeSkillFailException(pSlayer, getSkillType()); //cout << t.toString() << endl; } //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(); 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 }
////////////////////////////////////////////////////////////////////////////// // 슬레이어 셀프 ////////////////////////////////////////////////////////////////////////////// void InstallTurret::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* pWeapon = pSlayer->getWearItem(Slayer::WEAR_RIGHTHAND); if (pWeapon == NULL || !isArmsWeapon(pWeapon) || pSlayer->hasRelicItem()) { executeSkillFailException(pSlayer, getSkillType()); //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; return; } bool bIncreaseDomainExp = pSlayer->isRealWearingEx(Slayer::WEAR_RIGHTHAND); 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(X,Y); int RequiredMP = (int)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_INSTALL_TURRET); if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && !bEffected) { decreaseMana(pSlayer, RequiredMP, _GCSkillToSelfOK1); SkillInput input(pSlayer, pSkillSlot); SkillOutput output; computeOutput(input, output); EffectInstallTurret* pEffect = new EffectInstallTurret(pSlayer); pEffect->setDeadline(output.Duration); pEffect->setDamage(output.Damage); pEffect->setDefense(output.ToHit); //cout << "Turret Duration : " << output.Duration << endl; //cout << "Turret Delay : " << output.Delay << endl; pSlayer->setFlag(pEffect->getEffectClass()); pSlayer->addEffect(pEffect); GCAddEffect gcAE; gcAE.setObjectID(pSlayer->getObjectID()); gcAE.setDuration(output.Duration); gcAE.setEffectID(pEffect->getSendEffectClass()); pZone->broadcastPacket(pSlayer->getX(), pSlayer->getY(), &gcAE); SLAYER_RECORD prev; pSlayer->getSlayerRecord(prev); pSlayer->initAllStat(); pSlayer->sendRealWearingInfo(); pSlayer->addModifyInfo(prev, _GCSkillToSelfOK1); // 패킷을 만들어 보낸다. _GCSkillToSelfOK1.setSkillType(SkillType); _GCSkillToSelfOK1.setCEffectID(CEffectID); _GCSkillToSelfOK1.setDuration(output.Duration); _GCSkillToSelfOK2.setObjectID(pSlayer->getObjectID()); _GCSkillToSelfOK2.setSkillType(SkillType); _GCSkillToSelfOK2.setDuration(output.Duration); // 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 << t.toString() << endl; } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; __END_CATCH }
////////////////////////////////////////////////////////////////////////////// // 몬스터 셀프 핸들러 ////////////////////////////////////////////////////////////////////////////// void TransformToWolf::execute(Monster* pMonster) throw(Error) { __BEGIN_TRY //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin" << endl; Assert(pMonster != NULL); try { Zone* pZone = pMonster->getZone(); Assert(pZone != NULL); SkillType_t SkillType = SKILL_TRANSFORM_TO_WOLF; SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType); ZoneCoord_t x = pMonster->getX(); ZoneCoord_t y = pMonster->getY(); bool bRangeCheck = checkZoneLevelToUseSkill(pMonster); bool bHitRoll = HitRoll::isSuccessMagic(pMonster, pSkillInfo); bool bMoveModeCheck = pMonster->isWalking(); bool bEffected = pMonster->isFlag(Effect::EFFECT_CLASS_TRANSFORM_TO_WOLF); if (bRangeCheck && bHitRoll && bMoveModeCheck && !bEffected) { SkillInput input(pMonster); SkillOutput output; computeOutput(input, output); // 이펙트 클래스를 만들어 붙인다. EffectTransformToWolf* pEffectTTW = new EffectTransformToWolf(pMonster); pEffectTTW->setDeadline(999999999); pMonster->addEffect(pEffectTTW); pMonster->setFlag(Effect::EFFECT_CLASS_TRANSFORM_TO_WOLF); // 이로 인해서 변하는 능력치들을 보내준다. pMonster->initAllStat(); // 뱀파이어 대신 늑대를 더하라고 알려준다. GCAddWolf gcAddWolf; gcAddWolf.setObjectID(pMonster->getObjectID()); gcAddWolf.setName(pMonster->getName()); gcAddWolf.setXYDir(x, y, pMonster->getDir()); gcAddWolf.setItemType(0); gcAddWolf.setCurrentHP(pMonster->getHP()); gcAddWolf.setMaxHP(pMonster->getHP(ATTR_MAX)); gcAddWolf.setGuildID(1); pZone->broadcastPacket(x, y, &gcAddWolf, pMonster); } else { executeSkillFailNormal(pMonster, getSkillType(), NULL); } } catch(Throwable & t) { executeSkillFailException(pMonster, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; __END_CATCH }
////////////////////////////////////////////////////////////////////////////// // 뱀파이어 인벤토리 핸들러 ////////////////////////////////////////////////////////////////////////////// void TransformToWolf::execute(Vampire* pVampire, ObjectID_t InvenObjectID, ObjectID_t InventoryItemObjectID, CoordInven_t X, CoordInven_t Y, CoordInven_t TargetX, CoordInven_t TargetY, VampireSkillSlot* pSkillSlot) 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(); Inventory* pInventory = pVampire->getInventory(); Assert(pPlayer != NULL); Assert(pZone != NULL); Assert(pInventory!= NULL); SubInventory* pInventoryItem = NULL; int invenID = 0; if (InventoryItemObjectID != 0 ) { //cout << "서브 인벤토리에서 사용 : " << InventoryItemObjectID << endl; CoordInven_t X, Y; pInventoryItem = dynamic_cast<SubInventory*>(pInventory->findItemOID(InventoryItemObjectID, X, Y )); TradeManager* pTradeManager = pZone->getTradeManager(); Assert(pTradeManager != NULL); if (pInventoryItem == NULL || pTradeManager->hasTradeInfo(pVampire->getName()) ) { //cout << "근데 서브 인벤토리가 없다." <<endl; executeSkillFailException(pVampire, getSkillType()); return; } pInventory = pInventoryItem->getInventory(); invenID = pInventoryItem->getItemID(); } Item* pItem = pInventory->getItem(X, Y); Assert(pItem != NULL); // 적당한 아이템이 아니라면 당연히 변신할 수 없다. // PK존에서는 변신할 수 없다. if (pItem->getItemClass() != Item::ITEM_CLASS_VAMPIRE_ETC || pItem->getItemType() != 0 || pVampire->hasRelicItem() || g_pPKZoneInfoManager->isPKZone(pZone->getZoneID() ) || pVampire->isFlag(Effect::EFFECT_CLASS_REFINIUM_TICKET ) || GDRLairManager::Instance().isGDRLairZone(pZone->getZoneID()) ) { executeSkillFailException(pVampire, getSkillType()); //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; return; } GCSkillToInventoryOK1 _GCSkillToInventoryOK1; SkillType_t SkillType = pSkillSlot->getSkillType(); SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType); ZoneCoord_t x = pVampire->getX(); ZoneCoord_t y = pVampire->getY(); // Knowledge of Innate 가 있다면 hit bonus 10 int HitBonus = 0; if (pVampire->hasRankBonus(RankBonus::RANK_BONUS_KNOWLEDGE_OF_INNATE ) ) { RankBonus* pRankBonus = pVampire->getRankBonus(RankBonus::RANK_BONUS_KNOWLEDGE_OF_INNATE); Assert(pRankBonus != NULL); HitBonus = pRankBonus->getPoint(); } 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, HitBonus); bool bMoveModeCheck = pVampire->isWalking(); bool bEffected = pVampire->isFlag(Effect::EFFECT_CLASS_TRANSFORM_TO_WOLF) || pVampire->isFlag(Effect::EFFECT_CLASS_HAS_FLAG) || pVampire->isFlag(Effect::EFFECT_CLASS_HAS_SWEEPER); if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && bMoveModeCheck && !bEffected) { decreaseMana(pVampire, RequiredMP, _GCSkillToInventoryOK1); SkillInput input(pVampire); SkillOutput output; computeOutput(input, output); // 이펙트 클래스를 만들어 붙인다. EffectTransformToWolf* pEffectTTW = new EffectTransformToWolf(pVampire); pEffectTTW->setDeadline(999999999); pVampire->addEffect(pEffectTTW); pVampire->setFlag(Effect::EFFECT_CLASS_TRANSFORM_TO_WOLF); // 이로 인해서 변하는 능력치들을 보내준다. VAMPIRE_RECORD prev; pVampire->getVampireRecord(prev); pVampire->initAllStat(); pVampire->addModifyInfo(prev, _GCSkillToInventoryOK1); _GCSkillToInventoryOK1.setSkillType(SkillType); _GCSkillToInventoryOK1.setCEffectID(0); _GCSkillToInventoryOK1.setDuration(0); pPlayer->sendPacket(&_GCSkillToInventoryOK1); // 뱀파이어 대신 늑대를 더하라고 알려준다. GCAddWolf gcAddWolf; gcAddWolf.setObjectID(pVampire->getObjectID()); gcAddWolf.setName(pVampire->getName()); gcAddWolf.setXYDir(x, y, pVampire->getDir()); gcAddWolf.setItemType(pItem->getItemType()); gcAddWolf.setCurrentHP(pVampire->getHP()); gcAddWolf.setMaxHP(pVampire->getHP(ATTR_MAX)); gcAddWolf.setGuildID(pVampire->getGuildID()); pZone->broadcastPacket(x, y, &gcAddWolf, pVampire); decreaseItemNum(pItem, pInventory, pVampire->getName(), STORAGE_INVENTORY, invenID, X, Y); if (pVampire->getPetInfo() != NULL ) { pVampire->setPetInfo(NULL); sendPetInfo(dynamic_cast<GamePlayer*>(pVampire->getPlayer()), true); } pSkillSlot->setRunTime(output.Delay); } else { executeSkillFailNormal(pVampire, getSkillType(), NULL); } } catch(Throwable & t) { executeSkillFailException(pVampire, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; __END_CATCH }
////////////////////////////////////////////////////////////////////////////// // 슬레이어 셀프 핸들러 ////////////////////////////////////////////////////////////////////////////// void Revealer::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); 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); bool bHitRoll = HitRoll::isSuccessMagic(pSlayer, pSkillInfo, pSkillSlot); bool bEffected = pSlayer->isFlag(Effect::EFFECT_CLASS_REVEALER); if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && !bEffected) { decreaseMana(pSlayer, RequiredMP, _GCSkillToSelfOK1); // 기술이 유지되는 시간은 숙련도에 따라서 달라진다. SkillInput input(pSlayer, pSkillSlot); SkillOutput output; computeOutput(input, output); // 이펙트 오브젝트를 생성해서 붙인다. EffectRevealer* pEffectRevealer = new EffectRevealer (pSlayer); pEffectRevealer->setSkillLevel(pSkillSlot->getExpLevel()); pEffectRevealer->setDeadline(output.Duration); pSlayer->addEffect(pEffectRevealer); pSlayer->setFlag(Effect::EFFECT_CLASS_REVEALER); // 이 이펙트가 붙음으로써, 안 보이던 것이 보인다. pZone->updateMineScan(pSlayer); //pZone->updateInvisibleScan(pSlayer); pZone->updateHiddenScan(pSlayer); // 경험치를 올린다. SkillGrade Grade = g_pSkillInfoManager->getGradeByDomainLevel(pSlayer->getSkillDomainLevel(DomainType)); Exp_t ExpUp = 10* (Grade + 1)* 2; 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(output.Duration); _GCSkillToSelfOK2.setObjectID(pSlayer->getObjectID()); _GCSkillToSelfOK2.setSkillType(SkillType); _GCSkillToSelfOK2.setDuration(output.Duration); pPlayer->sendPacket(&_GCSkillToSelfOK1); pZone->broadcastPacket(pSlayer->getX(), pSlayer->getY(), &_GCSkillToSelfOK2, pSlayer); // 이펙트가 붙었다고 알려준다. GCAddEffect gcAddEffect; gcAddEffect.setObjectID(pSlayer->getObjectID()); gcAddEffect.setEffectID(Effect::EFFECT_CLASS_REVEALER); gcAddEffect.setDuration(output.Duration); pZone->broadcastPacket(pSlayer->getX(), pSlayer->getY(), &gcAddEffect); pSkillSlot->setRunTime(output.Delay); uint PartyID = pSlayer->getPartyID(); if (PartyID != 0) { LocalPartyManager* pLPM = pZone->getLocalPartyManager(); pLPM->shareRevealer(PartyID, pSlayer, output.Duration); } } else { executeSkillFailNormal(pSlayer, getSkillType(), NULL); } } catch(Throwable & t) { executeSkillFailException(pSlayer, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; __END_CATCH }
////////////////////////////////////////////////////////////////////////////// // 슬레이어 타일 핸들러 ////////////////////////////////////////////////////////////////////////////// void MagicElusion::execute(Slayer* pSlayer, ZoneCoord_t X, ZoneCoord_t Y, 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); GCSkillToTileOK1 _GCSkillToTileOK1; GCSkillToTileOK2 _GCSkillToTileOK2; GCSkillToTileOK3 _GCSkillToTileOK3; GCSkillToTileOK4 _GCSkillToTileOK4; GCSkillToTileOK5 _GCSkillToTileOK5; GCSkillToTileOK6 _GCSkillToTileOK6; SkillType_t SkillType = pSkillSlot->getSkillType(); SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType); ZoneCoord_t myX = pSlayer->getX(); ZoneCoord_t myY = pSlayer->getY(); int RequiredMP = (int)pSkillInfo->getConsumeMP(); bool bManaCheck = hasEnoughMana(pSlayer, RequiredMP); bool bTimeCheck = verifyRunTime(pSkillSlot); bool bRangeCheck = verifyDistance(pSlayer, X, Y, pSkillInfo->getRange()) && checkZoneLevelToUseSkill(pSlayer); bool bHitRoll = HitRoll::isSuccessMagicElusion(pSlayer); bool bTileCheck = false; VSRect rect(0, 0, pZone->getWidth()-1, pZone->getHeight()-1); if (rect.ptInRect(X, Y)) bTileCheck = true; // 이펙트의 지속시간을 계산한다. SkillInput input(pSlayer, pSkillSlot); SkillOutput output; computeOutput(input, output); if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && bTileCheck) { decreaseMana(pSlayer, RequiredMP, _GCSkillToTileOK1); Range_t Range = 2; int oX, oY; list<Creature*> cList; // denier list ObjectRegistry & objectregister = pZone->getObjectRegistry(); // 일단 이미 sanctuary가 있는지 검색한다. for(oY = -1; oY <= 1; oY++) for(oX = -1; oX <= 1; oX++) { int tileX = X+oX; int tileY = Y+oY; if (rect.ptInRect(tileX, tileY)) { Tile& tile = pZone->getTile(tileX, tileY); if (tile.canAddEffect()) { Effect* pOldEffect = tile.getEffect(Effect::EFFECT_CLASS_MAGIC_ELUSION); // 이미 있다면 // 기술 실패다. if (pOldEffect != NULL) { executeSkillFailNormal(pSlayer, getSkillType(), NULL); return; } } else { executeSkillFailNormal(pSlayer, getSkillType(), NULL); return; } } } for(oY = -1; oY <= 1; oY++) for(oX = -1; oX <= 1; oX++) { int tileX = X+oX; int tileY = Y+oY; if (rect.ptInRect(tileX, tileY)) { Tile& tile = pZone->getTile(tileX, tileY); // 이펙트 클래스를 생성한다. EffectMagicElusion* pEffect = new EffectMagicElusion(pZone , tileX, tileY); pEffect->setDeadline(output.Duration); // Tile에 붙이는 Effect는 ObjectID를 등록받아야 한다. objectregister.registerObject(pEffect); pZone->addEffect(pEffect); tile.addEffect(pEffect); if (oX==0 && oY==0) { pEffect->setBroadcastingEffect(true); GCAddEffectToTile gcAddEffectToTile; gcAddEffectToTile.setEffectID(pEffect->getEffectClass()); gcAddEffectToTile.setObjectID(pEffect->getObjectID()); gcAddEffectToTile.setXY(X, Y); gcAddEffectToTile.setDuration(output.Duration); pZone->broadcastPacket(X, Y, &gcAddEffectToTile, pSlayer); } else { // 가운데 이펙트가 아니면 브로드캐스팅해주지 않는다. pEffect->setBroadcastingEffect(false); } const list<Object*>& oList = tile.getObjectList(); for(list<Object*>::const_iterator itr = oList.begin(); itr != oList.end(); itr++) { Object* pTarget = *itr; if (pTarget->getObjectClass() == Object::OBJECT_CLASS_CREATURE ) { Creature* pCreature = dynamic_cast<Creature*>(pTarget); Assert(pCreature != NULL); if (pCreature->isVampire() ) { Vampire* pVampire = dynamic_cast<Vampire*>(pCreature); Assert(pVampire != NULL); GCModifyInformation gcMI; ::setDamage(pVampire, output.Damage, pSlayer, pSkillSlot->getSkillType(), &gcMI); pVampire->getPlayer()->sendPacket(&gcMI); cList.push_back(pCreature); } else if (pCreature->isMonster() ) { ::setDamage(pCreature, output.Damage, pSlayer, pSkillSlot->getSkillType()); } } } } } _GCSkillToTileOK1.setSkillType(SkillType); _GCSkillToTileOK1.setCEffectID(CEffectID); _GCSkillToTileOK1.setX(X); _GCSkillToTileOK1.setY(Y); _GCSkillToTileOK1.setDuration(output.Duration); _GCSkillToTileOK1.setRange(Range); _GCSkillToTileOK2.setObjectID(pSlayer->getObjectID()); _GCSkillToTileOK2.setSkillType(SkillType); _GCSkillToTileOK2.setX(X); _GCSkillToTileOK2.setY(Y); _GCSkillToTileOK2.setDuration(output.Duration); _GCSkillToTileOK2.setRange(Range); _GCSkillToTileOK3.setObjectID(pSlayer->getObjectID()); _GCSkillToTileOK3.setSkillType(SkillType); _GCSkillToTileOK3.setX(X); _GCSkillToTileOK3.setY(Y); _GCSkillToTileOK4.setSkillType(SkillType); _GCSkillToTileOK4.setX(X); _GCSkillToTileOK4.setY(Y); _GCSkillToTileOK4.setRange(Range); _GCSkillToTileOK4.setDuration(output.Duration); _GCSkillToTileOK5.setObjectID(pSlayer->getObjectID()); _GCSkillToTileOK5.setSkillType(SkillType); _GCSkillToTileOK5.setX(X); _GCSkillToTileOK5.setY(Y); _GCSkillToTileOK5.setRange(Range); _GCSkillToTileOK5.setDuration(output.Duration); _GCSkillToTileOK6.setOrgXY(myX, myY); _GCSkillToTileOK6.setSkillType(SkillType); _GCSkillToTileOK6.setX(X); _GCSkillToTileOK6.setY(Y); _GCSkillToTileOK6.setDuration(output.Duration); _GCSkillToTileOK6.setRange(Range); for(list<Creature*>::const_iterator itr = cList.begin(); itr != cList.end(); itr++) { Creature* pTargetCreature = *itr; if (canSee(pTargetCreature, pSlayer)) pTargetCreature->getPlayer()->sendPacket(&_GCSkillToTileOK2); else pTargetCreature->getPlayer()->sendPacket(&_GCSkillToTileOK6); } pPlayer->sendPacket(&_GCSkillToTileOK1); cList.push_back(pSlayer); list<Creature*> watcherList = pZone->getWatcherList(myX, myY, pSlayer); // watcherList에서 cList에 속하지 않고, caster(pSlayer)를 볼 수 없는 경우는 // OK4를 보내고.. cList에 추가한다. for(list<Creature*>::const_iterator itr = watcherList.begin(); itr != watcherList.end(); itr++) { bool bBelong = false; for(list<Creature*>::const_iterator tItr = cList.begin(); tItr != cList.end(); tItr++) if (*itr == *tItr) bBelong = true; Creature* pWatcher = (*itr); if (bBelong == false && canSee(pWatcher, pSlayer) == false) { //Assert(pWatcher->isPC()); // 당연 PC다.. Zone::getWatcherList는 PC만 return한다 if (pWatcher->isPC()) { pWatcher->getPlayer()->sendPacket(&_GCSkillToTileOK4); cList.push_back(*itr); } } } cList = pZone->broadcastSkillPacket(myX, myY, X, Y, &_GCSkillToTileOK5, cList, false); pZone->broadcastPacket(myX, myY, &_GCSkillToTileOK3 , cList); pZone->broadcastPacket(X, Y, &_GCSkillToTileOK4 , cList); } else { executeSkillFailNormal(pSlayer, getSkillType(), NULL); } if (bTimeCheck ) pSkillSlot->setRunTime(output.Delay); } catch (Throwable & t) { executeSkillFailException(pSlayer, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; __END_CATCH }
////////////////////////////////////////////////////////////////////////////// // 슬레이어 셀프 핸들러 ////////////////////////////////////////////////////////////////////////////// void Light::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); GCSkillToSelfOK1 _GCSkillToSelfOK1; GCSkillToSelfOK2 _GCSkillToSelfOK2; SkillType_t SkillType = pSkillSlot->getSkillType(); SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType); SkillLevel_t SkillLevel = pSkillSlot->getExpLevel(); int RequiredMP = (int)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_LIGHT); if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && !bEffected) { decreaseMana(pSlayer, RequiredMP, _GCSkillToSelfOK1); // 기술이 유지되는 시간은 숙련도에 따라서 달라진다. SkillInput input(pSlayer, pSkillSlot); SkillOutput output; computeOutput(input, output); Sight_t CurrentSight = pSlayer->getSight(); Sight_t oldSight = CurrentSight; // 혹시라도 옛날 이펙트가 남아있다면 삭제한다. if (pSlayer->isEffect(Effect::EFFECT_CLASS_LIGHT)) { EffectLight* pOldEffectLight = (EffectLight*)pSlayer->findEffect(Effect::EFFECT_CLASS_LIGHT); CurrentSight = pOldEffectLight->getOldSight(); pSlayer->deleteEffect(Effect::EFFECT_CLASS_LIGHT); } // 이펙트를 만들어 붙인다. EffectLight* pEffectLight = new EffectLight (pSlayer); pEffectLight->setDeadline(output.Duration); pEffectLight->setOldSight(CurrentSight); pSlayer->setFlag(Effect::EFFECT_CLASS_LIGHT); pSlayer->addEffect(pEffectLight); //pEffectLight->create(pSlayer->getName()); // 시야처리.. Sight_t MinSight = pSkillInfo->getMinDamage(); Sight_t MaxSight = pSkillInfo->getMaxDamage(); Sight_t NewSight = MinSight + (MaxSight - MinSight)* SkillLevel / 100; // 시야 변경에 따른 오브젝트 가감 패킷을 보낸다. pZone->updateScan(pSlayer, oldSight, NewSight); pSlayer->setSight(NewSight); if (NewSight != oldSight) _GCSkillToSelfOK1.addShortData(MODIFY_VISION, NewSight); _GCSkillToSelfOK1.setSkillType(SkillType); _GCSkillToSelfOK1.setCEffectID(CEffectID); _GCSkillToSelfOK1.setDuration(output.Duration); _GCSkillToSelfOK2.setObjectID(pSlayer->getObjectID()); _GCSkillToSelfOK2.setSkillType(SkillType); _GCSkillToSelfOK2.setDuration(output.Duration); // EXP UP! SkillDomainType_t DomainType = pSkillInfo->getDomainType(); SkillGrade Grade = g_pSkillInfoManager->getGradeByDomainLevel(pSlayer->getSkillDomainLevel(DomainType)); Exp_t ExpUp = 10* (Grade + 1)* 2; shareAttrExp(pSlayer, ExpUp, 1, 1, 8, _GCSkillToSelfOK1); increaseDomainExp(pSlayer, DomainType, pSkillInfo->getPoint(), _GCSkillToSelfOK1); increaseSkillExp(pSlayer, DomainType, pSkillSlot, pSkillInfo, _GCSkillToSelfOK1); // Send Packet pPlayer->sendPacket(&_GCSkillToSelfOK1); pZone->broadcastPacket(pSlayer->getX(), pSlayer->getY(), &_GCSkillToSelfOK2 , pSlayer); // 이펙트가 붙었다고 알려준다. GCAddEffect gcAddEffect; gcAddEffect.setObjectID(pSlayer->getObjectID()); gcAddEffect.setEffectID(Effect::EFFECT_CLASS_LIGHT); gcAddEffect.setDuration(output.Duration); pZone->broadcastPacket(pSlayer->getX(), pSlayer->getY(), &gcAddEffect); 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 Mephisto::execute(Vampire* pVampire, VampireSkillSlot* pVampireSkillSlot, CEffectID_t CEffectID) throw(Error) { __BEGIN_TRY //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin(slayerself)" << endl; Assert(pVampire != NULL); Assert(pVampireSkillSlot != NULL); try { Player* pPlayer = pVampire->getPlayer(); Zone* pZone = pVampire->getZone(); Assert(pPlayer != NULL); Assert(pZone != NULL); GCSkillToSelfOK1 _GCSkillToSelfOK1; GCSkillToSelfOK2 _GCSkillToSelfOK2; SkillType_t SkillType = pVampireSkillSlot->getSkillType(); SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType); // Knowledge of Curse 가 있다면 hit bonus 10 int HitBonus = 0; if (pVampire->hasRankBonus(RankBonus::RANK_BONUS_KNOWLEDGE_OF_CURSE ) ) { RankBonus* pRankBonus = pVampire->getRankBonus(RankBonus::RANK_BONUS_KNOWLEDGE_OF_CURSE); Assert(pRankBonus != NULL); HitBonus = pRankBonus->getPoint(); } int RequiredMP = (int)pSkillInfo->getConsumeMP(); bool bManaCheck = hasEnoughMana(pVampire, RequiredMP); bool bTimeCheck = verifyRunTime(pVampireSkillSlot); bool bRangeCheck = checkZoneLevelToUseSkill(pVampire); bool bHitRoll = HitRoll::isSuccessMagic(pVampire, pSkillInfo, pVampireSkillSlot, HitBonus); bool bEffected = pVampire->isFlag(Effect::EFFECT_CLASS_MEPHISTO); if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && !bEffected) { decreaseMana(pVampire, RequiredMP, _GCSkillToSelfOK1); // 스킬 레벨에 따라 데미지 보너스가 달라진다. SkillInput input(pVampire); SkillOutput output; input.SkillLevel = pVampire->getSTR()+pVampire->getDEX()+pVampire->getINT(); input.DomainLevel = pVampire->getLevel(); computeOutput(input, output); // 이펙트 클래스를 만들어 붙인다. EffectMephisto* pEffect = new EffectMephisto(pVampire); pEffect->setDeadline(output.Duration); pEffect->setBonus(output.Damage); pVampire->addEffect(pEffect); pVampire->setFlag(Effect::EFFECT_CLASS_MEPHISTO); // 이로 인하여 바뀌는 능력치를 보낸다. VAMPIRE_RECORD prev; pVampire->getVampireRecord(prev); pVampire->initAllStat(); pVampire->sendRealWearingInfo(); pVampire->sendModifyInfo(prev); // 패킷을 만들어 보낸다. _GCSkillToSelfOK1.setSkillType(SkillType); _GCSkillToSelfOK1.setCEffectID(CEffectID); _GCSkillToSelfOK1.setDuration(output.Duration); _GCSkillToSelfOK2.setObjectID(pVampire->getObjectID()); _GCSkillToSelfOK2.setSkillType(SkillType); _GCSkillToSelfOK2.setDuration(output.Duration); pPlayer->sendPacket(&_GCSkillToSelfOK1); pZone->broadcastPacket(pVampire->getX(), pVampire->getY(), &_GCSkillToSelfOK2, pVampire); // 이펙트가 붙었다고 알려준다. GCAddEffect gcAddEffect; gcAddEffect.setObjectID(pVampire->getObjectID()); gcAddEffect.setEffectID(Effect::EFFECT_CLASS_MEPHISTO); gcAddEffect.setDuration(output.Duration); pZone->broadcastPacket(pVampire->getX(), pVampire->getY(), &gcAddEffect); // set Next Run Time pVampireSkillSlot->setRunTime(output.Delay); } else { executeSkillFailNormal(pVampire, getSkillType(), NULL); } } catch (Throwable & t) { executeSkillFailException(pVampire, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End(slayerself)" << endl; __END_CATCH }
void Mephisto::execute(Vampire* pVampire, ObjectID_t TargetObjectID, VampireSkillSlot* pVampireSkillSlot, CEffectID_t CEffectID) throw(Error) { __BEGIN_TRY //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin(slayerself)" << endl; Assert(pVampire != NULL); Assert(pVampireSkillSlot != NULL); try { Player* pPlayer = pVampire->getPlayer(); Zone* pZone = pVampire->getZone(); Assert(pPlayer != NULL); Assert(pZone != NULL); Creature* pTargetCreature = pZone->getCreature(TargetObjectID); //Assert(pTargetCreature != NULL); // NoSuch제거. by sigi. 2002.5.2 if (pTargetCreature==NULL) { executeSkillFailException(pVampire, getSkillType()); return; } GCSkillToObjectOK1 _GCSkillToObjectOK1; GCSkillToObjectOK2 _GCSkillToObjectOK2; GCSkillToObjectOK3 _GCSkillToObjectOK3; SkillType_t SkillType = pVampireSkillSlot->getSkillType(); SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType); int RequiredMP = (int)pSkillInfo->getConsumeMP(); bool bManaCheck = hasEnoughMana(pVampire, RequiredMP); bool bTimeCheck = verifyRunTime(pVampireSkillSlot); bool bRangeCheck = checkZoneLevelToUseSkill(pVampire); bool bHitRoll = HitRoll::isSuccessMagic(pVampire, pSkillInfo, pVampireSkillSlot); bool bEffected = pTargetCreature->isFlag(Effect::EFFECT_CLASS_MEPHISTO); ZoneCoord_t myX = pVampire->getX(); ZoneCoord_t myY = pVampire->getY(); if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && !bEffected && pTargetCreature->isVampire() ) { Vampire* pTargetVampire= dynamic_cast<Vampire*>(pTargetCreature); ZoneCoord_t X = pTargetVampire->getX(); ZoneCoord_t Y = pTargetVampire->getY(); decreaseMana(pVampire, RequiredMP, _GCSkillToObjectOK1); // 스킬 레벨에 따라 데미지 보너스가 달라진다. SkillInput input(pVampire); SkillOutput output; input.SkillLevel = pVampire->getSTR()+pVampire->getDEX()+pVampire->getINT(); input.DomainLevel = pVampire->getLevel(); computeOutput(input, output); // 이펙트 클래스를 만들어 붙인다. EffectMephisto* pEffect = new EffectMephisto(pTargetVampire); pEffect->setDeadline(output.Duration); pEffect->setBonus(output.Damage); pTargetVampire->addEffect(pEffect); pTargetVampire->setFlag(Effect::EFFECT_CLASS_MEPHISTO); // 이로 인하여 바뀌는 능력치를 보낸다. VAMPIRE_RECORD prev; pTargetVampire->getVampireRecord(prev); pTargetVampire->initAllStat(); pTargetVampire->sendRealWearingInfo(); pTargetVampire->sendModifyInfo(prev); // 패킷을 만들어 보낸다. _GCSkillToObjectOK1.setSkillType(SkillType); _GCSkillToObjectOK1.setCEffectID(CEffectID); _GCSkillToObjectOK1.setDuration(output.Duration); _GCSkillToObjectOK2.setObjectID(pVampire->getObjectID()); _GCSkillToObjectOK2.setSkillType(SkillType); _GCSkillToObjectOK2.setDuration(output.Duration); _GCSkillToObjectOK3.setObjectID(pVampire->getObjectID()); _GCSkillToObjectOK3.setSkillType(SkillType); _GCSkillToObjectOK3.setTargetXY (X, Y); pPlayer->sendPacket(&_GCSkillToObjectOK1); if (pTargetCreature->isPC()) { Player* pTargetPlayer = pTargetCreature->getPlayer(); Assert(pTargetPlayer != NULL); _GCSkillToObjectOK2.setObjectID(pVampire->getObjectID()); pTargetPlayer->sendPacket(&_GCSkillToObjectOK2); } else { Assert(false); } list<Creature *> cList; cList.push_back(pTargetCreature); cList.push_back(pVampire); pZone->broadcastPacket(myX, myY, &_GCSkillToObjectOK3, cList); // 이펙트가 붙었다고 알려준다. GCAddEffect gcAddEffect; gcAddEffect.setObjectID(pTargetVampire->getObjectID()); gcAddEffect.setEffectID(Effect::EFFECT_CLASS_MEPHISTO); gcAddEffect.setDuration(output.Duration); pZone->broadcastPacket(pTargetVampire->getX(), pTargetVampire->getY(), &gcAddEffect); // set Next Run Time pVampireSkillSlot->setRunTime(output.Delay); } else { executeSkillFailNormal(pVampire, getSkillType(), NULL); } } catch (Throwable & t) { executeSkillFailException(pVampire, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End(slayerself)" << endl; __END_CATCH }
////////////////////////////////////////////////////////////////////////////// // 몬스터 셀프 핸들러 ////////////////////////////////////////////////////////////////////////////// void IceWave::execute(Monster* pMonster, ZoneCoord_t X, ZoneCoord_t Y) throw(Error) { __BEGIN_TRY //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin" << endl; Assert(pMonster != NULL); try { Zone* pZone = pMonster->getZone(); Assert(pZone != NULL); if (pMonster->isFlag(Effect::EFFECT_CLASS_HIDE)) { //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; return; } if (pMonster->isFlag(Effect::EFFECT_CLASS_INVISIBILITY)) { addVisibleCreature(pZone, pMonster, true); } int dx = (rand()%7)-3; int dy = (rand()%7)-3; X -= min((int)X, dx); Y -= min((int)Y, dy); if (X > pZone->getWidth() ) X = pZone->getWidth()-1; if (Y > pZone->getHeight() ) Y = pZone->getHeight()-1; pZone->moveFastMonster(pMonster, pMonster->getX(), pMonster->getY(), X, Y, getSkillType()); ZoneCoord_t x = pMonster->getX(); ZoneCoord_t y = pMonster->getY(); bool bRangeCheck = checkZoneLevelToUseSkill(pMonster); bool bMoveModeCheck = pMonster->isWalking(); if (bRangeCheck && bMoveModeCheck) { //-------------------------------------------------------- // 주위에 knockback되는맞는 애들을 체크해준다. //-------------------------------------------------------- SkillInput input(pMonster); SkillOutput output; computeOutput(input, output); SIMPLE_SKILL_INPUT param; param.SkillType = getSkillType(); param.SkillDamage = output.Damage; param.Delay = output.Delay; param.ItemClass = Item::ITEM_CLASS_MAX; param.STRMultiplier = 0; param.DEXMultiplier = 0; param.INTMultiplier = 0; param.bMagicHitRoll = true; param.bMagicDamage = true; param.bAdd = false; SIMPLE_SKILL_OUTPUT result; for (int i=0; i<8; ++i ) { for (int j=0; j<3; ++j ) { int ox = pMonster->getX() + dirMoveMask[i].x * j * 3 + dirMoveMask[i].x * 2; int oy = pMonster->getY() + dirMoveMask[i].y * j * 3 + dirMoveMask[i].y * 2; GCAddEffectToTile gcAE; gcAE.setXY(ox, oy); gcAE.setEffectID(Effect::EFFECT_CLASS_ICICLE_AUGER_LARGE); gcAE.setDuration(15); pMonster->getZone()->broadcastPacket(ox, oy, &gcAE); } } for (int i=0; i<193; i++) { if ((abs((int)x - (int)m_pIceWaveMask[i].x) <= 2) && (abs((int)y - (int)m_pIceWaveMask[i].y) <= 2)) param.addMask(m_pIceWaveMask[i].x, m_pIceWaveMask[i].y, 80); else param.addMask(m_pIceWaveMask[i].x, m_pIceWaveMask[i].y, 100); } // 강제로 맞는 애들을 knockback 시킨다. bool bForceKnockback = false; g_SimpleTileMeleeSkill.execute(pMonster, x, y, param, result, 0, bForceKnockback); } else { executeSkillFailNormal(pMonster, getSkillType(), NULL); } } catch(Throwable & t) { executeSkillFailException(pMonster, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; __END_CATCH }
////////////////////////////////////////////////////////////////////////////// // 슬레이어 셀프 핸들러 ////////////////////////////////////////////////////////////////////////////// void WillOfLife::execute(Vampire* pVampire, VampireSkillSlot* pVampireSkillSlot, CEffectID_t CEffectID) throw(Error) { __BEGIN_TRY //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin(slayerself)" << endl; Assert(pVampire != NULL); Assert(pVampireSkillSlot != NULL); try { Player* pPlayer = pVampire->getPlayer(); Zone* pZone = pVampire->getZone(); Assert(pPlayer != NULL); Assert(pZone != NULL); GCSkillToSelfOK1 _GCSkillToSelfOK1; GCSkillToSelfOK2 _GCSkillToSelfOK2; SkillType_t SkillType = pVampireSkillSlot->getSkillType(); //SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType); // 스킬 레벨에 따라 데미지 보너스가 달라진다. SkillInput input(pVampire); SkillOutput output; computeOutput(input, output); int RequiredMP = output.Damage; bool bManaCheck = hasEnoughMana(pVampire, RequiredMP); bool bTimeCheck = verifyRunTime(pVampireSkillSlot); bool bRangeCheck = checkZoneLevelToUseSkill(pVampire); bool bHitRoll = HitRoll::isSuccessWillOfLife(pVampire); bool bEffected = pVampire->isFlag(Effect::EFFECT_CLASS_WILL_OF_LIFE); if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && !bEffected) { decreaseMana(pVampire, RequiredMP, _GCSkillToSelfOK1); // 이펙트 클래스를 만들어 붙인다. EffectWillOfLife* pEffect = new EffectWillOfLife(pVampire); pEffect->setDeadline(output.Duration); pEffect->setBonus(output.Damage); pEffect->setNextTime(0); pVampire->addEffect(pEffect); pVampire->setFlag(Effect::EFFECT_CLASS_WILL_OF_LIFE); // 패킷을 만들어 보낸다. _GCSkillToSelfOK1.setSkillType(SkillType); _GCSkillToSelfOK1.setCEffectID(CEffectID); _GCSkillToSelfOK1.setDuration(output.Duration); _GCSkillToSelfOK2.setObjectID(pVampire->getObjectID()); _GCSkillToSelfOK2.setSkillType(SkillType); _GCSkillToSelfOK2.setDuration(output.Duration); pPlayer->sendPacket(&_GCSkillToSelfOK1); GCStatusCurrentHP gcStatusCurrentHP; gcStatusCurrentHP.setObjectID(pVampire->getObjectID()); gcStatusCurrentHP.setCurrentHP(pVampire->getHP()); pZone->broadcastPacket(pVampire->getX(), pVampire->getY(), &_GCSkillToSelfOK2, pVampire); pZone->broadcastPacket(pVampire->getX(), pVampire->getY(), &gcStatusCurrentHP); // 이펙트가 붙었다고 알려준다. GCAddEffect gcAddEffect; gcAddEffect.setObjectID(pVampire->getObjectID()); gcAddEffect.setEffectID(Effect::EFFECT_CLASS_WILL_OF_LIFE); gcAddEffect.setDuration(output.Duration); pZone->broadcastPacket(pVampire->getX(), pVampire->getY(), &gcAddEffect); } else { executeSkillFailNormal(pVampire, getSkillType(), NULL); } // set Next Run Time if (bTimeCheck ) pVampireSkillSlot->setRunTime(output.Delay); } catch (Throwable & t) { executeSkillFailException(pVampire, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End(slayerself)" << endl; __END_CATCH }
////////////////////////////////////////////////////////////////////////////// // 슬레이어 셀프 핸들러 ////////////////////////////////////////////////////////////////////////////// void GroundBless::execute(Ousters* pOusters, OustersSkillSlot* pOustersSkillSlot, CEffectID_t CEffectID) throw(Error) { __BEGIN_TRY //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin(slayer)" << endl; Assert(pOusters != NULL); Assert(pOustersSkillSlot != NULL); try { Player* pPlayer = pOusters->getPlayer(); Zone* pZone = pOusters->getZone(); Assert(pPlayer != NULL); Assert(pZone != NULL); Item* pWeapon = pOusters->getWearItem(Ousters::WEAR_RIGHTHAND); if (pWeapon == NULL || pWeapon->getItemClass() != Item::ITEM_CLASS_OUSTERS_WRISTLET || !pOusters->isRealWearingEx(Ousters::WEAR_RIGHTHAND)) { executeSkillFailException(pOusters, pOustersSkillSlot->getSkillType()); return; } GCSkillToSelfOK1 _GCSkillToSelfOK1; GCSkillToSelfOK2 _GCSkillToSelfOK2; SkillType_t SkillType = pOustersSkillSlot->getSkillType(); SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType); //SkillDomainType_t DomainType = pSkillInfo->getDomainType(); //SkillLevel_t SkillLevel = pOustersSkillSlot->getExpLevel(); int RequiredMP = (int)pSkillInfo->getConsumeMP() + pOustersSkillSlot->getExpLevel()/2; bool bManaCheck = hasEnoughMana(pOusters, RequiredMP); bool bTimeCheck = verifyRunTime(pOustersSkillSlot); bool bRangeCheck = checkZoneLevelToUseSkill(pOusters); bool bHitRoll = HitRoll::isSuccessMagic(pOusters, pSkillInfo, pOustersSkillSlot); bool bEffected = pOusters->isFlag(Effect::EFFECT_CLASS_GROUND_BLESS); bool bSatisfyRequire = pOusters->satisfySkillRequire(pSkillInfo); if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && !bEffected && bSatisfyRequire) { decreaseMana(pOusters, RequiredMP, _GCSkillToSelfOK1); // 지속 시간을 계산한다. SkillInput input(pOusters, pOustersSkillSlot); SkillOutput output; input.STR = pOusters->getSTR(ATTR_BASIC); input.DEX = pOusters->getDEX(ATTR_BASIC); input.INTE = pOusters->getINT(ATTR_BASIC); computeOutput(input, output); // 이팩트 클래스를 만들어 붙인다. EffectGroundBless* pEffect = new EffectGroundBless(pOusters); pEffect->setDeadline(output.Duration); pEffect->setBonus(output.Damage); pOusters->addEffect(pEffect); pOusters->setFlag(Effect::EFFECT_CLASS_GROUND_BLESS); pOusters->initAllStatAndSend(); _GCSkillToSelfOK1.setSkillType(SkillType); _GCSkillToSelfOK1.setCEffectID(CEffectID); _GCSkillToSelfOK1.setDuration(output.Duration); _GCSkillToSelfOK2.setObjectID(pOusters->getObjectID()); _GCSkillToSelfOK2.setSkillType(SkillType); _GCSkillToSelfOK2.setDuration(output.Duration); pPlayer->sendPacket(&_GCSkillToSelfOK1); pZone->broadcastPacket(pOusters->getX(), pOusters->getY(), &_GCSkillToSelfOK2, pOusters); GCAddEffect gcAddEffect; gcAddEffect.setObjectID(pOusters->getObjectID()); gcAddEffect.setEffectID(pEffect->getEffectClass()); gcAddEffect.setDuration(output.Duration); pZone->broadcastPacket(pOusters->getX(), pOusters->getY(), &gcAddEffect); pOustersSkillSlot->setRunTime(output.Delay); } else { executeSkillFailNormal(pOusters, getSkillType(), NULL); } } catch (Throwable & t) { executeSkillFailException(pOusters, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End(slayer)" << endl; __END_CATCH }
////////////////////////////////////////////////////////////////////////////// // 슬레이어 셀프 핸들러 ////////////////////////////////////////////////////////////////////////////// void MindControl::execute(Slayer* pSlayer, SkillSlot* pSkillSlot, CEffectID_t CEffectID) throw(Error) { __BEGIN_TRY //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin(slayerself)" << 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(); ZoneCoord_t myX = pSlayer->getX(); ZoneCoord_t myY = pSlayer->getY(); int RequiredMP = (int)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_MIND_CONTROL); if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && !bEffected) { decreaseMana(pSlayer, RequiredMP, _GCSkillToSelfOK1); SkillInput input(pSlayer, pSkillSlot); SkillOutput output; computeOutput(input, output); // 이펙트를 만들어 붙인다. EffectMindControl* pEffect = new EffectMindControl(pSlayer); pEffect->setDeadline(output.Duration); pEffect->setDefenseBonus(output.Damage); pEffect->setToHitBonus(output.Damage); pSlayer->setFlag(Effect::EFFECT_CLASS_MIND_CONTROL); pSlayer->addEffect(pEffect); // 이펙트를 붙였으니, 능력치를 재계산한다. SLAYER_RECORD prev; pSlayer->getSlayerRecord(prev); pSlayer->initAllStat(); pSlayer->sendRealWearingInfo(); pSlayer->addModifyInfo(prev, _GCSkillToSelfOK1); // 경험치를 올려준다. 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(output.Duration); _GCSkillToSelfOK2.setObjectID(pSlayer->getObjectID()); _GCSkillToSelfOK2.setSkillType(SkillType); _GCSkillToSelfOK2.setDuration(output.Duration); pPlayer->sendPacket(&_GCSkillToSelfOK1); pZone->broadcastPacket(myX, myY, &_GCSkillToSelfOK2, pSlayer); GCAddEffect gcAddEffect; gcAddEffect.setObjectID(pSlayer->getObjectID()); gcAddEffect.setEffectID(Effect::EFFECT_CLASS_MIND_CONTROL); gcAddEffect.setDuration(output.Duration); pZone->broadcastPacket(myX, myY, &gcAddEffect); pSkillSlot->setRunTime(output.Delay); } else { executeSkillFailNormal(pSlayer, getSkillType(), NULL); } } catch (Throwable & t) { executeSkillFailException(pSlayer, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End(slayerself)" << endl; __END_CATCH }
////////////////////////////////////////////////////////////////////////////// // 슬레이어 셀프 핸들러 ////////////////////////////////////////////////////////////////////////////// void RemoveCurse::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); GCSkillToSelfOK1 _GCSkillToSelfOK1; GCSkillToSelfOK2 _GCSkillToSelfOK2; SkillType_t SkillType = pSkillSlot->getSkillType(); SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType); SkillDomainType_t DomainType = pSkillInfo->getDomainType(); // by sigi. 2002.12.3 SkillLevel_t SkillLevel = pSlayer->getINT()/2; //pSkillSlot->getExpLevel(); bool bDoom = false; bool bParalyze = false; bool bSeduction = false; // by sigi. 2002.12.3 //bool bHallucination = false; bool bDeath = false; bool bEffected = false; // 아무 독이나 걸려있으면 켠다. EffectDoom* pEffectDoom = NULL; EffectParalyze* pEffectParalyze = NULL; EffectSeduction* pEffectSeduction = NULL; // by sigi. 2002.12.3 //EffectHallucination* pEffectHallucination = NULL; EffectDeath* pEffectDeath = NULL; if (pSlayer->isEffect(Effect::EFFECT_CLASS_DOOM)) { pEffectDoom = (EffectDoom*)pSlayer->findEffect(Effect::EFFECT_CLASS_DOOM); Assert(pEffectDoom != NULL); bDoom = HitRoll::isSuccessRemoveCurse(70, SkillLevel, 20, pEffectDoom->getLevel()/4); bEffected = true; } if (pSlayer->isEffect(Effect::EFFECT_CLASS_PARALYZE)) { pEffectParalyze = (EffectParalyze*)pSlayer->findEffect(Effect::EFFECT_CLASS_PARALYZE); Assert(pEffectParalyze != NULL); bParalyze = HitRoll::isSuccessRemoveCurse(70, SkillLevel, 10, pEffectParalyze->getLevel()/4); bEffected = true; } if (pSlayer->isEffect(Effect::EFFECT_CLASS_SEDUCTION)) { pEffectSeduction = (EffectSeduction*)pSlayer->findEffect(Effect::EFFECT_CLASS_SEDUCTION); Assert(pEffectSeduction != NULL); bSeduction = HitRoll::isSuccessRemoveCurse(70, SkillLevel, 30, pEffectSeduction->getLevel()/4); bEffected = true; } // by sigi. 2002.12.3 // if (pSlayer->isEffect(Effect::EFFECT_CLASS_HALLUCINATION)) // { // pEffectHallucination = (EffectHallucination*)pSlayer->findEffect(Effect::EFFECT_CLASS_HALLUCINATION); // Assert(pEffectHallucination != NULL); // // bHallucination = HitRoll::isSuccessRemoveCurse(70, SkillLevel, 40, pEffectHallucination->getLevel()/4); // bEffected = true; // } if (pSlayer->isEffect(Effect::EFFECT_CLASS_DEATH)) { pEffectDeath = (EffectDeath*)pSlayer->findEffect(Effect::EFFECT_CLASS_DEATH); Assert(pEffectDeath != NULL); bDeath = HitRoll::isSuccessRemoveCurse(70, SkillLevel, 50, pEffectDeath->getLevel()/4); bEffected = true; } int RequiredMP = (int)pSkillInfo->getConsumeMP(); bool bManaCheck = hasEnoughMana(pSlayer, RequiredMP); bool bTimeCheck = verifyRunTime(pSkillSlot); bool bRangeCheck = checkZoneLevelToUseSkill(pSlayer); // 마나가 있고, 시간이 됐고, 거리가 적당하며, // 저주가 하나라도 걸려있어야 한다. if (bManaCheck && bTimeCheck && bRangeCheck && bEffected) { decreaseMana(pSlayer, RequiredMP, _GCSkillToSelfOK1); SkillInput input(pSlayer, pSkillSlot); SkillOutput output; computeOutput(input, output); // 각각의 저주를 제거하고, // 패킷에다 이펙트 삭제하라고 더한다. GCRemoveEffect gcRemoveEffect; gcRemoveEffect.setObjectID(pSlayer->getObjectID()); if (bDoom) { pEffectDoom->setDeadline(0); pSlayer->removeFlag(Effect::EFFECT_CLASS_DOOM); gcRemoveEffect.addEffectList(Effect::EFFECT_CLASS_DOOM); } if (bParalyze) { pEffectParalyze->setDeadline(0); pSlayer->removeFlag(Effect::EFFECT_CLASS_PARALYZE); gcRemoveEffect.addEffectList(Effect::EFFECT_CLASS_PARALYZE); } if (bSeduction) { pEffectSeduction->setDeadline(0); pSlayer->removeFlag(Effect::EFFECT_CLASS_SEDUCTION); gcRemoveEffect.addEffectList(Effect::EFFECT_CLASS_SEDUCTION); } // by sigi. 2002.12.3 // if (bHallucination) // { // pEffectHallucination->setDeadline(0); // pSlayer->removeFlag(Effect::EFFECT_CLASS_HALLUCINATION); // gcRemoveEffect.addEffectList(Effect::EFFECT_CLASS_HALLUCINATION); // } if (bDeath) { pEffectDeath->setDeadline(0); pSlayer->removeFlag(Effect::EFFECT_CLASS_DEATH); gcRemoveEffect.addEffectList(Effect::EFFECT_CLASS_DEATH); } // 경험치를 올린다. 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); ZoneCoord_t myX = pSlayer->getX(); ZoneCoord_t myY = pSlayer->getY(); _GCSkillToSelfOK1.setSkillType(SkillType); _GCSkillToSelfOK1.setCEffectID(CEffectID); _GCSkillToSelfOK1.setDuration(0); _GCSkillToSelfOK2.setObjectID(pSlayer->getObjectID()); _GCSkillToSelfOK2.setSkillType(SkillType); _GCSkillToSelfOK2.setDuration (0); pPlayer->sendPacket(&_GCSkillToSelfOK1); pZone->broadcastPacket(myX, myY, &_GCSkillToSelfOK2 , pSlayer); // 기술이 풀렸다는 것을 알려준다아. pZone->broadcastPacket(myX, myY, &gcRemoveEffect); 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 SummonCasket::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); //cout << "SummonCasket try.." << endl; try { Player* pPlayer = pVampire->getPlayer(); Zone* pZone = pVampire->getZone(); Assert(pPlayer != NULL); Assert(pZone != NULL); if (!pVampire->isVampire() && !pVampire->isMonster()) { executeSkillFailNormal(pVampire, getSkillType(), NULL); return; } GCSkillToSelfOK1 _GCSkillToSelfOK1; GCSkillToSelfOK3 _GCSkillToSelfOK3; SkillType_t SkillType = pSkillSlot->getSkillType(); SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType); ZoneCoord_t x = pVampire->getX(); ZoneCoord_t y = pVampire->getY(); // Knowledge of Summon 이 있다면 hit bonus 10 int HitBonus = 0; if (pVampire->hasRankBonus(RankBonus::RANK_BONUS_KNOWLEDGE_OF_SUMMON ) ) { RankBonus* pRankBonus = pVampire->getRankBonus(RankBonus::RANK_BONUS_KNOWLEDGE_OF_SUMMON); Assert(pRankBonus != NULL); HitBonus = pRankBonus->getPoint(); } 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, HitBonus); bool bTileCheck = canBurrow(pZone, x, y); bool bMoveModeCheck = pVampire->isWalking(); bool bEffected = pVampire->isFlag(Effect::EFFECT_CLASS_CASKET); if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && bTileCheck && bMoveModeCheck && !bEffected) { //cout << "SummonCasket Success" << endl; decreaseMana(pVampire, RequiredMP, _GCSkillToSelfOK1); SkillInput input(pVampire); SkillOutput output; computeOutput(input, output); // 뱀파이어를 땅 위에서 삭제하기 이전에 기술 패킷들을 날린다. _GCSkillToSelfOK1.setSkillType(SkillType); _GCSkillToSelfOK1.setCEffectID(CEffectID); _GCSkillToSelfOK1.setDuration(output.Duration); _GCSkillToSelfOK3.setXY(x, y); _GCSkillToSelfOK3.setSkillType(SkillType); _GCSkillToSelfOK3.setDuration(output.Duration); pPlayer->sendPacket(&_GCSkillToSelfOK1); pZone->broadcastPacket(x, y, &_GCSkillToSelfOK3, pVampire); //--------------------------------------------------------------- // 기존의 지속 마법 효과를 제거한다. //--------------------------------------------------------------- EffectManager* pEffectManager = pVampire->getEffectManager(); Assert(pEffectManager!=NULL); Effect* pCheckEffect = NULL; // 사용자의 level을 구한다. int userLevel = pVampire->getLevel(); Effect::EffectClass effectClass; // EFFECT_CLASS_FLARE effectClass = Effect::EFFECT_CLASS_FLARE; pCheckEffect = pEffectManager->findEffect(effectClass); if (pCheckEffect!=NULL) { int level = (dynamic_cast<EffectFlare*>(pCheckEffect))->getLevel(); if (level < userLevel) { pEffectManager->deleteEffect(effectClass); pVampire->removeFlag(effectClass); } } // EFFECT_CLASS_DOOM effectClass = Effect::EFFECT_CLASS_DOOM; pCheckEffect = pEffectManager->findEffect(effectClass); if (pCheckEffect!=NULL) { int level = (dynamic_cast<EffectDoom*>(pCheckEffect))->getLevel(); if (level < userLevel) { pEffectManager->deleteEffect(effectClass); pVampire->removeFlag(effectClass); } } // EFFECT_CLASS_SEDUCTION effectClass = Effect::EFFECT_CLASS_SEDUCTION; pCheckEffect = pEffectManager->findEffect(effectClass); if (pCheckEffect!=NULL) { int level = (dynamic_cast<EffectSeduction*>(pCheckEffect))->getLevel(); if (level < userLevel) pEffectManager->deleteEffect(effectClass); pVampire->removeFlag(effectClass); } //--------------------------------------------------------------- // 이펙트 오브젝트를 생성해 붙인다. //--------------------------------------------------------------- EffectSummonCasket* pEffect = new EffectSummonCasket(pVampire); pEffect->setDeadline(99999999); pEffect->setType(0); pVampire->addEffect(pEffect); pVampire->setFlag(Effect::EFFECT_CLASS_CASKET); // SUMMON CASKET 에 의해 변하는 능력치가 변한다.. 2002.12.13 by bezz. VAMPIRE_RECORD prev; pVampire->getVampireRecord(prev); pVampire->initAllStat(); pVampire->sendRealWearingInfo(); pVampire->sendModifyInfo(prev); GCAddEffect gcAddEffect; gcAddEffect.setObjectID(pVampire->getObjectID()); gcAddEffect.setEffectID(Effect::EFFECT_CLASS_CASKET); gcAddEffect.setDuration(output.Duration); pZone->broadcastPacket(pVampire->getX(), pVampire->getY(), &gcAddEffect, pVampire); pSkillSlot->setRunTime(); } else { //cout << "SummonCasket Failed" << endl; executeSkillFailNormal(pVampire, getSkillType(), NULL); } } catch(Throwable & t) { //cout << "SummonCasket Failed2" << endl; executeSkillFailException(pVampire, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; __END_CATCH }
////////////////////////////////////////////////////////////////////////////// // 뱀파이어 인벤토리 핸들러 ////////////////////////////////////////////////////////////////////////////// void BloodyTunnel::execute(Vampire* pVampire, ObjectID_t InvenObjectID, ObjectID_t InventoryItemObjectID, CoordInven_t X, CoordInven_t Y, CoordInven_t TargetX, CoordInven_t TargetY, VampireSkillSlot* pSkillSlot) 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(); Inventory* pInventory = pVampire->getInventory(); Assert(pPlayer != NULL); Assert(pZone != NULL); Assert(pInventory!= NULL); // 전쟁 존이라면 BloodyTunnel를 사용할 수 없다. // 일단은 ZoneID로 가는데.. ZoneInfo에 넣도록 해야한다. ///* //if (pZone->getZoneID()==1122 || pZone->getZoneID()==1123) // 이벤트 경기장/OX 막기. by sigi. 2002.8.31 //int zoneID = pZone->getZoneID(); //if (zoneID==1005 || zoneID==1006) if (pZone->isNoPortalZone() || pZone->isMasterLair() || pZone->isCastle() || pZone->isHolyLand()) { executeSkillFailException(pVampire, getSkillType()); //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; return; } //*/ SubInventory* pInventoryItem = NULL; int invenID = 0; if (InventoryItemObjectID != 0 ) { //cout << "서브 인벤토리에서 사용 : " << InventoryItemObjectID << endl; CoordInven_t X, Y; pInventoryItem = dynamic_cast<SubInventory*>(pInventory->findItemOID(InventoryItemObjectID, X, Y )); TradeManager* pTradeManager = pZone->getTradeManager(); Assert(pTradeManager != NULL); if (pInventoryItem == NULL || pTradeManager->hasTradeInfo(pVampire->getName()) ) { //cout << "근데 서브 인벤토리가 없다." <<endl; executeSkillFailException(pVampire, getSkillType()); return; } pInventory = pInventoryItem->getInventory(); invenID = pInventoryItem->getItemID(); } Item* pItem = pInventory->getItem(X, Y); // 아이템이 없거나, 뱀파이어 포탈 아이템이 아니거나, OID가 틀리다면 기술 사용 불가 if (pItem == NULL || pItem->getItemClass() != Item::ITEM_CLASS_VAMPIRE_PORTAL_ITEM || pItem->getObjectID() != InvenObjectID) { executeSkillFailException(pVampire, getSkillType()); //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; return; } VampirePortalItem* pVampirePortalItem = dynamic_cast<VampirePortalItem*>(pItem); Assert(pVampirePortalItem != NULL); // 뱀파이어 포탈 아이템에 기록된 위치가 없을 경우에는 실패다. ZoneID_t zoneid = pVampirePortalItem->getZoneID(); ZoneCoord_t tx = pVampirePortalItem->getX(); ZoneCoord_t ty = pVampirePortalItem->getY(); if (zoneid == 0) { executeSkillFailException(pVampire, getSkillType()); //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; return; } // 얻어온 목표 존과 좌표를 검증한다. Zone* pTargetZone = getZoneByZoneID(zoneid); // 아담의 성지와 다른 존과는 연결되지 않는다. if (pZone->isHolyLand() != pTargetZone->isHolyLand()) { executeSkillFailException(pVampire, getSkillType()); return; } //cout << "타겟 존 포인터 획득 성공" << endl; VSRect* pRect = pTargetZone->getOuterRect(); if (!pRect->ptInRect(tx, ty)) { executeSkillFailException(pVampire, getSkillType()); //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; return; } //cout << "좌표 검증 성공" << endl; GCSkillToInventoryOK1 _GCSkillToInventoryOK1; SkillType_t SkillType = pSkillSlot->getSkillType(); SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType); 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 bHitRoll = true; if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll) { decreaseMana(pVampire, RequiredMP, _GCSkillToInventoryOK1); SkillInput input(pVampire); SkillOutput output; computeOutput(input, output); // 각각의 존에다가 포탈을 더한다. ZONE_COORD s_coord; ZONE_COORD t_coord; s_coord.id = pZone->getZoneID(); s_coord.x = pVampire->getX(); s_coord.y = pVampire->getY(); t_coord.id = pTargetZone->getZoneID(); t_coord.x = tx; t_coord.y = ty; pZone->addVampirePortal(s_coord.x, s_coord.y, pVampire, t_coord); pTargetZone->addVampirePortal(t_coord.x, t_coord.y, pVampire, s_coord); _GCSkillToInventoryOK1.setSkillType(SkillType); _GCSkillToInventoryOK1.setObjectID(InvenObjectID); _GCSkillToInventoryOK1.setCEffectID(0); _GCSkillToInventoryOK1.setDuration(0); pPlayer->sendPacket(&_GCSkillToInventoryOK1); // 차지 수를 줄인다. pVampirePortalItem->setCharge(pVampirePortalItem->getCharge()-1); if (pVampirePortalItem->getCharge() > 0) { // 아직 차지가 남았다면 살려둔다. pVampirePortalItem->save(pVampire->getName(), STORAGE_INVENTORY, invenID, X, Y); } else { // 포탈 아이템의 차지가 다 소모되었다면 삭제시킨다. pInventory->deleteItem(X, Y); pVampirePortalItem->destroy(); // 아이템 포인터 자체가 지워지고, NULL이 되면, // 이펙트 내부에서의 아이템 포인터도 NULL이 되겠지... SAFE_DELETE(pVampirePortalItem); } pSkillSlot->setRunTime(output.Delay); } else { executeSkillFailNormal(pVampire, getSkillType(), NULL); } } catch(Throwable & t) { executeSkillFailException(pVampire, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; __END_CATCH }
void InstallMine::execute(Slayer* pSlayer, ObjectID_t, CoordInven_t X, CoordInven_t Y, CoordInven_t TargetX, CoordInven_t TargetY, SkillSlot* pSkillSlot) throw(Error) { __BEGIN_TRY Assert(pSlayer != NULL); Assert(pSkillSlot != NULL); try { Player* pPlayer = pSlayer->getPlayer(); Zone* pZone = pSlayer->getZone(); Assert(pPlayer != NULL); Assert(pZone != NULL); GCSkillToInventoryOK1 _GCSkillToInventoryOK1; // GCSkillToTileOK1 _GCSkillToTileOK1; // GCSkillToTileOK5 _GCSkillToTileOK5; SkillType_t SkillType = pSkillSlot->getSkillType(); SkillInfo * pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType); SkillLevel_t SkillLevel = pSkillSlot->getExpLevel(); // 명중률. //ToHit_t ToHit = pSlayer->getToHit(); int RequiredMP = (int)pSkillInfo->getConsumeMP(); bool bManaCheck = hasEnoughMana(pSlayer, RequiredMP); bool bTimeCheck = verifyRunTime(pSkillSlot); bool bRangeCheck = checkZoneLevelToUseSkill(pSlayer); ZoneCoord_t slayerX = pSlayer->getX(), slayerY = pSlayer->getY(); bool bInstallAction = false; Mine* pMine = NULL; Inventory * pInventory = pSlayer->getInventory(); Assert(pInventory != NULL); if(bManaCheck && bTimeCheck &&bRangeCheck ) { // mine을 찾는다. Item* pItem = pInventory->getItem(X, Y); if(pItem != NULL && pItem->getItemClass() == Item::ITEM_CLASS_MINE) { bInstallAction = true; pMine = dynamic_cast<Mine*>(pItem); } } // 기술의 성패를 따진다. if (bInstallAction ) { //Range_t Range = 1; GCSkillToInventoryOK1 _GCSkillToInventoryOK1; // GCSkillToInventoryOK5 _GCSkillToInventoryOK5; ItemInfo* pItemInfo = g_pItemInfoManager->getItemInfo(Item::ITEM_CLASS_MINE, pMine->getItemType()); Damage_t MinDamage = pItemInfo->getMinDamage(); Damage_t MaxDamage = pItemInfo->getMaxDamage(); Damage_t RealDamage = MinDamage + (max (0, ((int)MaxDamage * (int)SkillLevel / 100 ) - MinDamage )); Mine * pInstallMine = new Mine(); ObjectRegistry& OR = pZone->getObjectRegistry(); OR.registerObject(pInstallMine); Assert(pInstallMine != NULL); pInstallMine->setItemType(pMine->getItemType()); pInstallMine->setDir(TargetX); pInstallMine->setDamage(RealDamage); pInstallMine->setInstallerName(pSlayer->getName()); pInstallMine->setInstallerPartyID(pSlayer->getPartyID()); pInstallMine->setFlag(Effect::EFFECT_CLASS_INSTALL); // 아이템 사라지는게 3분인거 때문에 지뢰도 사라졌는데.. // 10분으로 고정. by sigi. 2002.11.3 TPOINT pt = pZone->addItem(pInstallMine, slayerX, slayerY, true, 6000); // EXP up Exp_t Point = pSkillInfo->getPoint(); shareAttrExp(pSlayer, 100, 1, 8, 1, _GCSkillToInventoryOK1); increaseDomainExp(pSlayer, SKILL_DOMAIN_GUN, Point, _GCSkillToInventoryOK1); increaseSkillExp(pSlayer, SKILL_DOMAIN_GUN, pSkillSlot, pSkillInfo, _GCSkillToInventoryOK1); decreaseMana(pSlayer, RequiredMP, _GCSkillToInventoryOK1); decreaseItemNum(pMine, pInventory, pSlayer->getName(), STORAGE_INVENTORY, 0, X, Y); _GCSkillToInventoryOK1.setObjectID(pInstallMine->getObjectID()); _GCSkillToInventoryOK1.setSkillType(SkillType); _GCSkillToInventoryOK1.setCEffectID(0); _GCSkillToInventoryOK1.setX(X); _GCSkillToInventoryOK1.setY(Y); _GCSkillToInventoryOK1.setDuration(0); /* _GCSkillToInventoryOK5.setObjectID(pSlayer->getObjectID()); _GCSkillToInventoryOK5.setSkillType(SkillType); _GCSkillToInventoryOK5.setX(X); _GCSkillToInventoryOK5.setY(Y); _GCSkillToInventoryOK5.setRange(Range); _GCSkillToInventoryOK5.setDuration(0); */ pPlayer->sendPacket(&_GCSkillToInventoryOK1); // mine을 볼 수 없게 된 자들에게는 삭제 addInstalledMine(pZone, pInstallMine, pt.x, pt.y); // pZone->broadcastPacket(slayerX, slayerY, &_GCSkillToInventoryOK5, pSlayer); // cout << "Run Skill : " << (int)SkillType << endl; // Set NextTime pSkillSlot->setRunTime(); } else { GCSkillFailed1 _GCSkillFailed1; GCSkillFailed2 _GCSkillFailed2; executeSkillFailException(pSlayer, getSkillType()); } } catch(Throwable & t) { executeSkillFailException(pSlayer, getSkillType()); } __END_CATCH }
////////////////////////////////////////////////////////////////////////////// // 슬레이어 셀프 핸들러 ////////////////////////////////////////////////////////////////////////////// void DivineSpirits::execute(Ousters* pOusters, OustersSkillSlot* pOustersSkillSlot, CEffectID_t CEffectID) throw(Error) { __BEGIN_TRY //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin(slayer)" << endl; Assert(pOusters != NULL); Assert(pOustersSkillSlot != NULL); try { Player* pPlayer = pOusters->getPlayer(); Zone* pZone = pOusters->getZone(); Assert(pPlayer != NULL); Assert(pZone != NULL); GCSkillToSelfOK1 _GCSkillToSelfOK1; GCSkillToSelfOK2 _GCSkillToSelfOK2; SkillType_t SkillType = pOustersSkillSlot->getSkillType(); SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType); //SkillDomainType_t DomainType = pSkillInfo->getDomainType(); //SkillLevel_t SkillLevel = pOustersSkillSlot->getExpLevel(); int RequiredMP = pSkillInfo->getConsumeMP(); bool bManaCheck = hasEnoughMana(pOusters, RequiredMP); bool bTimeCheck = verifyRunTime(pOustersSkillSlot); bool bRangeCheck = checkZoneLevelToUseSkill(pOusters); bool bHitRoll = HitRoll::isSuccessMagic(pOusters, pSkillInfo, pOustersSkillSlot); bool bEffected = pOusters->isFlag(Effect::EFFECT_CLASS_DIVINE_SPIRITS); bool bSatisfyRequire = pOusters->satisfySkillRequire(pSkillInfo); if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && !bEffected && bSatisfyRequire) { decreaseMana(pOusters, RequiredMP, _GCSkillToSelfOK1); // 지속 시간을 계산한다. SkillInput input(pOusters, pOustersSkillSlot); SkillOutput output; computeOutput(input, output); // 이팩트 클래스를 만들어 붙인다. EffectDivineSpirits* pEffect = new EffectDivineSpirits(pOusters); pEffect->setDeadline(output.Duration); pEffect->setBonus(output.Damage); pOusters->addEffect(pEffect); pOusters->setFlag(Effect::EFFECT_CLASS_DIVINE_SPIRITS); // OUSTERS_RECORD prev; // pOusters->getOustersRecord(prev); // pOusters->initAllStat(); // pOusters->addModifyInfo(prev, _GCSkillToSelfOK1); _GCSkillToSelfOK1.setSkillType(SkillType); _GCSkillToSelfOK1.setCEffectID(CEffectID); _GCSkillToSelfOK1.setDuration(output.Duration); _GCSkillToSelfOK2.setObjectID(pOusters->getObjectID()); _GCSkillToSelfOK2.setSkillType(SkillType); _GCSkillToSelfOK2.setDuration(output.Duration); pPlayer->sendPacket(&_GCSkillToSelfOK1); pZone->broadcastPacket(pOusters->getX(), pOusters->getY(), &_GCSkillToSelfOK2, pOusters); GCAddEffect gcAddEffect; gcAddEffect.setObjectID(pOusters->getObjectID()); gcAddEffect.setEffectID(pEffect->getEffectClass()); gcAddEffect.setDuration(output.Duration); pZone->broadcastPacket(pOusters->getX(), pOusters->getY(), &gcAddEffect, pOusters); pOustersSkillSlot->setRunTime(output.Delay); } else { executeSkillFailNormal(pOusters, getSkillType(), NULL); } } catch (Throwable & t) { executeSkillFailException(pOusters, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End(slayer)" << endl; __END_CATCH }
////////////////////////////////////////////////////////////////////////////// // 슬레이어 오브젝트 핸들러 ////////////////////////////////////////////////////////////////////////////// void TurnUndead::execute(Slayer * pSlayer, SkillSlot * pSkillSlot, CEffectID_t CEffectID) throw(Error) { __BEGIN_TRY //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << "begin " << endl; // Slayer Object Assertion Assert(pSlayer != NULL); Assert(pSkillSlot != NULL); try { Zone* pZone = pSlayer->getZone(); Assert(pZone != NULL); Player* pPlayer = pSlayer->getPlayer(); Assert(pPlayer != NULL); 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(); int RequiredMP = (int)pSkillInfo->getConsumeMP(); bool bManaCheck = hasEnoughMana(pSlayer, RequiredMP); bool bTimeCheck = verifyRunTime(pSkillSlot); bool bRangeCheck = verifyDistance(pSlayer, X, Y, pSkillInfo->getRange()) && checkZoneLevelToUseSkill(pSlayer); bool bHitRoll = HitRoll::isSuccessMagic(pSlayer, pSkillInfo, pSkillSlot); VSRect rect(0, 0, pZone->getWidth()-1, pZone->getHeight()-1); if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll) { decreaseMana(pSlayer, RequiredMP, _GCSkillToSelfOK1); // calculate damage and duration time SkillInput input(pSlayer, pSkillSlot); SkillOutput output; computeOutput(input, output); bool bHit = false; Level_t maxEnemyLevel = 0; uint EnemyNum = 0; int oX, oY; for(oX = -2; oX <= 2; oX++) for(oY = -2; oY <= 2; oY++) { int tileX = X+oX; int tileY = Y+oY; if (oX == 0 && oY == 0 ) continue; if (!rect.ptInRect(tileX, tileY)) continue; Tile& tile = pZone->getTile(tileX, tileY); // 타일에 있는 크리처들을 리스트로 만든다. 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); if(checkZoneLevelToHitTarget(pTargetCreature ) && !pTargetCreature->isSlayer() && !pTargetCreature->isFlag(Effect::EFFECT_CLASS_COMA) && canAttack(pSlayer, pTargetCreature ) ) { if(pTargetCreature->isVampire() || pTargetCreature->isOusters()) { Player* pTargetPlayer = pTargetCreature->getPlayer(); bHit = true; // 데미지를 적용시킨다. GCModifyInformation gcMI; ::setDamage(pTargetCreature, output.Damage, pSlayer, pSkillSlot->getSkillType(), &gcMI); // HP 가 변했다고 당사자에게 보낸다. pTargetPlayer->sendPacket(&gcMI); GCSkillToObjectOK2 gcSkillToObjectOK2; gcSkillToObjectOK2.setObjectID(1); // 의미 없다. gcSkillToObjectOK2.setSkillType(SKILL_ATTACK_MELEE); gcSkillToObjectOK2.setDuration(0); } else if(pTargetCreature->isMonster()) { Monster* pMonster = dynamic_cast<Monster*>(pTargetCreature); bHit = true; ::setDamage(pMonster, output.Damage, pSlayer, pSkillSlot->getSkillType()); pMonster->addEnemy(pSlayer); } else { continue; } if (maxEnemyLevel < pTargetCreature->getLevel() ) maxEnemyLevel = pTargetCreature->getLevel(); EnemyNum++; GCSkillToObjectOK4 gcSkillToObjectOK4; gcSkillToObjectOK4.setTargetObjectID(pTargetCreature->getObjectID()); gcSkillToObjectOK4.setSkillType(SKILL_ATTACK_MELEE); gcSkillToObjectOK4.setDuration(0); pZone->broadcastPacket(pTargetCreature->getX(), pTargetCreature->getY(), &gcSkillToObjectOK4); // 성향을 올린다. increaseAlignment(pSlayer, pTargetCreature, _GCSkillToSelfOK1); } } } if(bHit) { //cout << "Skill Succesfully Attacked(" << output.Damage << ")" << endl; shareAttrExp(pSlayer, output.Damage, 1, 1, 8, _GCSkillToSelfOK1); increaseDomainExp(pSlayer, DomainType, pSkillInfo->getPoint(), _GCSkillToSelfOK1, maxEnemyLevel, EnemyNum); 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); // 기술을 사용한 사람에게 packet 전달 pPlayer->sendPacket(&_GCSkillToSelfOK1); pZone->broadcastPacket(X, Y, &_GCSkillToSelfOK2, pSlayer); // 기술 delay setting 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 Sacrifice::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); 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(); int RequiredMP = (int)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_SACRIFICE); if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && !bEffected) { decreaseMana(pSlayer, RequiredMP, _GCSkillToSelfOK1); SkillInput input(pSlayer, pSkillSlot); SkillOutput output; computeOutput(input, output); // 이펙트 클래스를 만들어 붙인다. EffectSacrifice* pEffect = new EffectSacrifice(pSlayer); pEffect->setDeadline(output.Duration); pSlayer->addEffect(pEffect); pSlayer->setFlag(Effect::EFFECT_CLASS_SACRIFICE); // 경험치를 올린다. 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(X, Y, &_GCSkillToSelfOK2, pSlayer); GCAddEffect gcAddEffect; gcAddEffect.setObjectID(pSlayer->getObjectID()); gcAddEffect.setEffectID(Effect::EFFECT_CLASS_SACRIFICE); gcAddEffect.setDuration(output.Duration); pZone->broadcastPacket(pSlayer->getX(), pSlayer->getY(), &gcAddEffect); 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 SummonMonsters::execute(Monster* pMonster) throw(Error) { __BEGIN_TRY //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin" << endl; //cout << "SummonMonsters" << endl; Assert(pMonster != NULL); Zone* pZone = pMonster->getZone(); Assert(pZone != NULL); try { if (pMonster->isFlag(Effect::EFFECT_CLASS_HIDE)) { //cout << "SummonMonsters: 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) { //-------------------------------------------------------- // 주위에 knockback되는맞는 애들을 체크해준다. //-------------------------------------------------------- //SkillInput input(pMonster); //SkillOutput output; //computeOutput(input, output); SUMMON_INFO2 summonInfo; bool hasInfo = pMonster->getMonsterSummonInfo(summonInfo); if (!hasInfo || summonInfo.pMonsters==NULL) { //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; // 소환할 몹이 없는 경우다. -_-; executeSkillFailNormal(pMonster, getSkillType(), NULL); // 마스터 레어에서 마스터가 몹을 소환할려고 한 경우 if (pZone->isMasterLair() && pMonster->isMaster()) { MasterLairManager* pMasterLairManager = pZone->getMasterLairManager(); Assert(pMasterLairManager!=NULL); // 더 이상 소환할게 없다면.. // 마스터가 직접 나서서 싸워야겠지.. pMasterLairManager->setMasterReady(); //cout << "no more SummonMonsters: set MasterReady" << endl; } } if (pMonster->isMaster() && pZone->isMasterLair()) { MasterLairManager* pMasterLairManager = pZone->getMasterLairManager(); Assert(pMasterLairManager!=NULL); // minion combat에서는 지정된 좌표에 소환한다. MasterLairInfo* pInfo = g_pMasterLairInfoManager->getMasterLairInfo(pZone->getZoneID()); Assert(pInfo!=NULL); if (!pMasterLairManager->isMasterReady()) { x = pInfo->getSummonX(); y = pInfo->getSummonY(); GCSay gcSay; gcSay.setObjectID(pMonster->getObjectID()); gcSay.setColor(MASTER_SAY_COLOR); gcSay.setMessage(pInfo->getRandomMasterSummonSay()); if (!gcSay.getMessage().empty()) pZone->broadcastPacket(pMonster->getX(), pMonster->getY(), &gcSay); } // 마스터 레어에서는 소환된 몬스터들이 아템 안 준다. // by sigi. 2002.11.21 summonInfo.hasItem = false; } summonInfo.scanEnemy = true; summonInfo.clanType = SUMMON_INFO::CLAN_TYPE_GROUP; summonInfo.clanID = pMonster->getClanType(); // 주인의 clan을 따른다. summonInfo.X = x; summonInfo.Y = y; summonInfo.regenType = REGENTYPE_PORTAL; // 몬스터를 존에 추가한다. addMonstersToZone(pZone, summonInfo); //cout << "SummonMonsters 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); } else { executeSkillFailNormal(pMonster, getSkillType(), NULL); } } catch(Throwable & t) { executeSkillFailException(pMonster, getSkillType()); } __END_CATCH }
void Howl::execute(Vampire* pVampire, VampireSkillSlot* pVampireSkillSlot, 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; SkillInput input(pVampire); SkillOutput output; computeOutput(input, output); int RequiredMP = 10; bool bManaCheck = hasEnoughMana(pVampire, RequiredMP); bool bTimeCheck = verifyRunTime(pVampireSkillSlot); bool bRangeCheck = checkZoneLevelToUseSkill(pVampire); bool bHitRoll = (rand()%100)<output.Range; bool bEffected = pVampire->isFlag(Effect::EFFECT_CLASS_HOWL); if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && !bEffected) { decreaseMana(pVampire, RequiredMP, _GCSkillToSelfOK1); ZoneCoord_t x = pVampire->getX(); ZoneCoord_t y = pVampire->getY(); ObjectID_t objectID = pVampire->getObjectID(); EffectHowl* pEffect = new EffectHowl(pVampire); pEffect->setDeadline(output.Duration); pVampire->setFlag(Effect::EFFECT_CLASS_HOWL); pVampire->addEffect(pEffect); VAMPIRE_RECORD prev; pVampire->getVampireRecord(prev); pVampire->initAllStat(); pVampire->sendModifyInfo(prev); _GCSkillToSelfOK1.setSkillType(SKILL_HOWL); _GCSkillToSelfOK1.setCEffectID(CEffectID); _GCSkillToSelfOK1.setDuration(0); _GCSkillToSelfOK2.setObjectID(objectID); _GCSkillToSelfOK2.setSkillType(SKILL_HOWL); _GCSkillToSelfOK2.setDuration(0); pPlayer->sendPacket(&_GCSkillToSelfOK1); pZone->broadcastPacket(x, y, &_GCSkillToSelfOK2, pVampire); GCAddEffect gcAddEffect; gcAddEffect.setObjectID(pVampire->getObjectID()); gcAddEffect.setEffectID(Effect::EFFECT_CLASS_HOWL); gcAddEffect.setDuration(output.Duration); pPlayer->sendPacket(&gcAddEffect); } else { executeSkillFailNormal(pVampire, getSkillType(), NULL); } } catch(Throwable & t) { executeSkillFailException(pVampire, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; __END_CATCH }
////////////////////////////////////////////////////////////////////////////// // 슬레이어 셀프 핸들러 ////////////////////////////////////////////////////////////////////////////// void ChargingPower::execute(Slayer* pSlayer, SkillSlot* pSkillSlot, CEffectID_t CEffectID) throw(Error) { __BEGIN_TRY //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin(slayerself)" << 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 || pItem->getItemClass() != Item::ITEM_CLASS_BLADE) { executeSkillFailException(pSlayer, getSkillType()); //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End(slayerself)" << endl; return; } bool bIncreaseExp = pSlayer->isRealWearingEx(Slayer::WEAR_RIGHTHAND); 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); bool bHitRoll = HitRoll::isSuccessMagic(pSlayer, pSkillInfo, pSkillSlot); // 버서커랑 동시에 사용할 수 없다. bool bEffected = pSlayer->isFlag(Effect::EFFECT_CLASS_CHARGING_POWER) || pSlayer->isFlag(Effect::EFFECT_CLASS_BERSERKER); if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && !bEffected) { decreaseMana(pSlayer, RequiredMP, _GCSkillToSelfOK1); // 스킬 레벨에 따라 데미지 보너스가 달라진다. SkillInput input(pSlayer, pSkillSlot); SkillOutput output; computeOutput(input, output); // 이펙트 클래스를 만들어 붙인다. EffectChargingPower* pEffect = new EffectChargingPower(pSlayer); pEffect->setDeadline(output.Duration); pEffect->setDamageBonus(output.Damage); pSlayer->addEffect(pEffect); pSlayer->setFlag(Effect::EFFECT_CLASS_CHARGING_POWER); // 이로 인하여 바뀌는 능력치를 보낸다. SLAYER_RECORD prev; pSlayer->getSlayerRecord(prev); pSlayer->initAllStat(); pSlayer->sendRealWearingInfo(); pSlayer->sendModifyInfo(prev); // 경험치를 올린다. SkillGrade Grade = g_pSkillInfoManager->getGradeByDomainLevel(pSlayer->getSkillDomainLevel(DomainType)); Exp_t ExpUp = 10*(Grade+1); if (bIncreaseExp ) { shareAttrExp(pSlayer, ExpUp, 8, 1, 1, _GCSkillToSelfOK1); increaseDomainExp(pSlayer, DomainType, pSkillInfo->getPoint(), _GCSkillToSelfOK1); // increaseSkillExp(pSlayer, DomainType, pSkillSlot, pSkillInfo, _GCSkillToSelfOK1); } // 패킷을 만들어 보낸다. _GCSkillToSelfOK1.setSkillType(SkillType); _GCSkillToSelfOK1.setCEffectID(CEffectID); _GCSkillToSelfOK1.setDuration(output.Duration); _GCSkillToSelfOK2.setObjectID(pSlayer->getObjectID()); _GCSkillToSelfOK2.setSkillType(SkillType); _GCSkillToSelfOK2.setDuration(output.Duration); pPlayer->sendPacket(&_GCSkillToSelfOK1); pZone->broadcastPacket(pSlayer->getX(), pSlayer->getY(), &_GCSkillToSelfOK2, pSlayer); // 이펙트가 붙었다고 알려준다. GCAddEffect gcAddEffect; gcAddEffect.setObjectID(pSlayer->getObjectID()); gcAddEffect.setEffectID(Effect::EFFECT_CLASS_CHARGING_POWER); gcAddEffect.setDuration(output.Duration); pZone->broadcastPacket(pSlayer->getX(), pSlayer->getY(), &gcAddEffect); // set Next Run Time pSkillSlot->setRunTime(output.Delay); } else { executeSkillFailNormal(pSlayer, getSkillType(), NULL); } } catch (Throwable & t) { executeSkillFailException(pSlayer, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End(slayerself)" << endl; __END_CATCH }
////////////////////////////////////////////////////////////////////////////// // 뱀파이어 셀프 ////////////////////////////////////////////////////////////////////////////// void Invisibility::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(); // Knowledge of Innate 가 있다면 hit bonus 10 int HitBonus = 0; if (pVampire->hasRankBonus(RankBonus::RANK_BONUS_KNOWLEDGE_OF_INNATE ) ) { RankBonus* pRankBonus = pVampire->getRankBonus(RankBonus::RANK_BONUS_KNOWLEDGE_OF_INNATE); Assert(pRankBonus != NULL); HitBonus = pRankBonus->getPoint(); } Tile& rTile = pZone->getTile(pVampire->getX(), 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, HitBonus); bool bEffected = pVampire->isFlag(Effect::EFFECT_CLASS_INVISIBILITY) || pVampire->isFlag(Effect::EFFECT_CLASS_FADE_OUT) || pVampire->hasRelicItem() || pVampire->isFlag(Effect::EFFECT_CLASS_HAS_FLAG) || pVampire->isFlag(Effect::EFFECT_CLASS_HAS_SWEEPER) || rTile.getEffect(Effect::EFFECT_CLASS_TRYING_POSITION) != NULL; if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && !bEffected) { decreaseMana(pVampire, RequiredMP, _GCSkillToSelfOK1); SkillInput input(pVampire); SkillOutput output; computeOutput(input, output); // 점점 사라지는 이펙트를 생성해서 붙인다. // 실제로 사라지는 것은 이 이펙트 내부에서다. // (한번에 '팍'하고 사라지는 게 아니라서 붙이는 이펙트다.) EffectFadeOut* pEffect= new EffectFadeOut(pVampire); pEffect->setDuration(output.Duration); pEffect->setDeadline(40); pEffect->setInvisibility(); pVampire->addEffect(pEffect); pVampire->setFlag(Effect::EFFECT_CLASS_FADE_OUT); _GCSkillToSelfOK1.setSkillType(SkillType); _GCSkillToSelfOK1.setCEffectID(CEffectID); _GCSkillToSelfOK1.setDuration(0); _GCSkillToSelfOK2.setObjectID(pVampire->getObjectID()); _GCSkillToSelfOK2.setSkillType(SkillType); _GCSkillToSelfOK2.setDuration(0); // Send Packet pPlayer->sendPacket(&_GCSkillToSelfOK1); pZone->broadcastPacket(x, y, &_GCSkillToSelfOK2, pVampire); pSkillSlot->setRunTime(output.Delay); } else { executeSkillFailNormal(pVampire, getSkillType(), NULL); } } catch(Throwable & t) { executeSkillFailException(pVampire, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; __END_CATCH }
////////////////////////////////////////////////////////////////////////////// // 몬스터 셀프 핸들러 ////////////////////////////////////////////////////////////////////////////// void LandMineExplosion::execute(Monster* pMonster) throw(Error) { __BEGIN_TRY //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin" << endl; Assert(pMonster != NULL); try { Zone* pZone = pMonster->getZone(); Assert(pZone != NULL); //GCSkillToSelfOK2 _GCSkillToSelfOK2; ZoneCoord_t x = pMonster->getX(); ZoneCoord_t y = pMonster->getY(); bool bRangeCheck = checkZoneLevelToUseSkill(pMonster); if (bRangeCheck) { //-------------------------------------------------------- // 주위에 knockback되는맞는 애들을 체크해준다. //-------------------------------------------------------- SkillInput input(pMonster); SkillOutput output; computeOutput(input, output); SIMPLE_SKILL_INPUT param; param.SkillType = getSkillType(); param.SkillDamage = output.Damage; param.Delay = output.Delay; param.ItemClass = Item::ITEM_CLASS_MAX; param.STRMultiplier = 0; param.DEXMultiplier = 0; param.INTMultiplier = 0; param.bMagicHitRoll = true; param.bMagicDamage = true; param.bAdd = false; SIMPLE_SKILL_OUTPUT result; for (int i=0; i<48; i++) { param.addMask(m_pLandMineExplosionMask[i].x, m_pLandMineExplosionMask[i].y, 100); } // 강제로 맞는 애들을 knockback 시킨다. // bool bForceKnockback = true; g_SimpleTileMeleeSkill.execute(pMonster, x, y, param, result, 0, false); GCAddEffectToTile gcAE; gcAE.setXY(x, y); gcAE.setEffectID(Effect::EFFECT_CLASS_LAND_MINE_EXPLOSION); gcAE.setObjectID(0); gcAE.setDuration(0); pZone->broadcastPacket(x, y, &gcAE); } else { executeSkillFailNormal(pMonster, getSkillType(), NULL); } } catch(Throwable & t) { executeSkillFailException(pMonster, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; __END_CATCH }