void EffectBlazeWalk::affect(Creature* pCreature) throw(Error) { __BEGIN_TRY Assert(pCreature != NULL); Zone* pZone = pCreature->getZone(); Assert(pZone != NULL); Creature* pAttacker = pZone->getCreature(m_UserObjectID); if (pAttacker == NULL ) { setDeadline(0); return; } if (!(pZone->getZoneLevel() & COMPLETE_SAFE_ZONE) && !pCreature->isDead() && !pCreature->isFlag(Effect::EFFECT_CLASS_COMA ) // 무적상태 체크. by sigi. 2002.9.5 && canAttack(pAttacker, pCreature ) ) { GCModifyInformation gcMI, gcAttackerMI; setDamage(pCreature, m_Point, pAttacker, m_SkillType, &gcMI, &gcAttackerMI); if (pAttacker->isPC() ) computeAlignmentChange(pCreature, m_Point, pAttacker, &gcMI, &gcAttackerMI); if (pCreature->isPC() ) pCreature->getPlayer()->sendPacket(&gcMI); if (pAttacker->isSlayer() && !pCreature->isSlayer() ) { Slayer* pSlayer = dynamic_cast<Slayer*>(pAttacker); if (pSlayer != NULL ) { GCModifyInformation gcMI; shareAttrExp(pSlayer, m_Point, 8, 1, 1, gcAttackerMI); } } if (pAttacker->isPC() ) pAttacker->getPlayer()->sendPacket(&gcAttackerMI); if (pCreature->isDead() ) setDeadline(0); } m_AttackNum--; if (m_AttackNum > 0 ) { setNextTime(5); } else setDeadline(0); //cout << "EffectBlazeWalk " << "begin" << endl; //cout << "EffectBlazeWalk " << "end" << endl; __END_CATCH }
////////////////////////////////////////////////////////////////////////////// // constructor ////////////////////////////////////////////////////////////////////////////// EventAuth::EventAuth (GamePlayer* pGamePlayer) throw(Error) : Event(pGamePlayer) { // 1분 setDeadline(600); }
Task::Task(time_t deadline, int priority, string description, int cronFreq, bool isFinished, int serialNumber, string group, time_t ft){ // cout<<"newing task"<<endl; setDeadline(deadline); setPriority(priority); setDescription(description); setIsFinished(isFinished); setSerialNumber(serialNumber); setGroup(group); setFinishTime(ft); }
void EffectArmageddon::decreaseHP(Damage_t damage ) throw() { //cout << "EffectArmageddon Damaged : " << (int)damage << endl; HP_t RemainHP = max(0, m_HP - damage); setHP(RemainHP); // 남은 HP가 0일 경우 다음 EffectManager::heartbeat() 에서 이펙트를 날려준다. if(RemainHP == 0 ) setDeadline(0); }
void EffectWithWarning::start() { setNextTime(m_SignDuration); setDeadline(m_SignDuration + m_MainDuration); GCAddEffectToTile gcAET; gcAET.setXY(m_X, m_Y); gcAET.setObjectID(getObjectID()); gcAET.setEffectID(m_SignEffect); gcAET.setDuration(m_SignDuration); m_pZone->broadcastPacket(m_X, m_Y, &gcAET); m_State = false; }
void EffectDestinies::affect() throw(Error) { __BEGIN_TRY setDeadline(0); Creature* pCaster = dynamic_cast<Creature*>(m_pTarget); int cx = pCaster->getX(); int cy = pCaster->getY(); Zone* pZone = pCaster->getZone(); for (int i=-8; i<=8; ++i ) for (int j=-8; j<=8; ++j ) { int tx = cx + i; int ty = cy + j; if (tx < 0 || ty < 0 ) continue; if (!isValidZoneCoord(pZone, tx, ty ) ) continue; list<Object*>& olist = pZone->getTile(tx, ty).getObjectList(); list<Object*>::iterator itr = olist.begin(); for (; itr != olist.end() ; ++itr ) { Object* pObject = *itr; if (pObject == NULL || pObject->getObjectClass() != Object::OBJECT_CLASS_CREATURE ) continue; Creature* pCreature = dynamic_cast<Creature*>(pObject); if (pCreature == NULL ) continue; bool isTarget = false; if (pCreature->getCreatureClass() == m_TargetClass ) { isTarget = true; if (m_TargetClass == Creature::CREATURE_CLASS_MONSTER ) { Monster* pTargetMonster = dynamic_cast<Monster*>(pCreature); if (pTargetMonster->getSpriteType() != m_TargetSpriteType ) isTarget = false; } } if (isTarget ) affect(pCreature); } } //cout << "EffectDestinies" << "affect BEGIN" << endl; __END_CATCH }
////////////////////////////////////////////////////////////////////////////// // constructor ////////////////////////////////////////////////////////////////////////////// Effect::Effect (Zone* pZone , ZoneCoord_t x , ZoneCoord_t y , Object* pTarget , Turn_t delay) throw() { __BEGIN_TRY m_pZone = pZone; m_X = x; m_Y = y; m_pTarget = pTarget; setNextTime(99999999); setDeadline(delay); __END_CATCH }
////////////////////////////////////////////////////////////////////////////// // constructor ////////////////////////////////////////////////////////////////////////////// Effect::Effect () throw() { __BEGIN_TRY m_pZone = NULL; m_X = 0; m_Y = 0; m_pTarget = NULL; m_bBroadcastingEffect = true; setNextTime(99999999); setDeadline(99999999); __END_CATCH }
//---------------------------------------------------------------------- // constructor //---------------------------------------------------------------------- EffectTransportCreature::EffectTransportCreature (Creature *pCreature, ZoneID_t zoneID , ZoneCoord_t x , ZoneCoord_t y , Turn_t delay) throw(Error) { __BEGIN_TRY Assert(pCreature!=NULL); Assert(pCreature->getZone()!=NULL); m_CreatureID = pCreature->getObjectID(); m_ZoneID = zoneID; m_pZone = pCreature->getZone(); // 그냥 다른 곳에서의 assert때문에 setTarget(pCreature); setDeadline(delay); setNextTime(0); // 서버 전용 Effect이다. by sigi. 2002.11.14 m_bBroadcastingEffect = false; __END_CATCH }
//---------------------------------------------------------------------- // constructor //---------------------------------------------------------------------- EffectContinualGroundAttack::EffectContinualGroundAttack (Zone* pZone , EffectClass attackEffect, Turn_t delay) throw(Error) { __BEGIN_TRY Assert(pZone!=NULL); m_pZone = pZone; m_AttackEffect = attackEffect; m_Delay = delay; setNextTime(10); // 1초 후 시작 setDeadline(delay); m_MinNumber = 1; m_MaxNumber = 1; // 서버 전용 Effect이다. by sigi. 2002.11.14 m_bBroadcastingEffect = false; __END_CATCH }
void EffectPlasmaRocketLauncher::affect(Creature* pCreature) throw(Error) { __BEGIN_TRY __BEGIN_DEBUG Assert(pCreature != NULL); Zone* pZone = pCreature->getZone(); Assert(pZone != NULL); Creature* pAttacker = pZone->getCreature(m_UserObjectID); VSRect rect(0, 0, pZone->getWidth()-1, pZone->getHeight()-1); int cX = pCreature->getX(); int cY = pCreature->getY(); for(int x = -1; x <= 1; x++) { for(int y= -1; y <= 1; y++) { int X = cX + x; int Y = cY + y; if(!rect.ptInRect(X, Y)) continue; Tile& tile = pZone->getTile(X, Y); const list<Object*>& oList = tile.getObjectList(); list<Object*>::const_iterator itr = oList.begin(); for(; itr != oList.end(); itr++) { Assert(*itr != NULL); Object* pObject = *itr; Assert(pObject != NULL); if(pObject->getObjectClass() == Object::OBJECT_CLASS_CREATURE) { Creature* pCreature2 = dynamic_cast<Creature*>(pObject); Assert(pCreature2 != NULL); if (pCreature2 != pCreature && pCreature2->isSlayer() ) continue; if (!(pZone->getZoneLevel() & COMPLETE_SAFE_ZONE) && !pCreature2->isDead() && !pCreature2->isFlag(Effect::EFFECT_CLASS_COMA) // 무적상태 체크. by sigi. 2002.9.5 && canAttack(pAttacker, pCreature2 ) ) { GCModifyInformation gcMI, gcAttackerMI; setDamage(pCreature2, m_Point, pAttacker, SKILL_PLASMA_ROCKET_LAUNCHER, &gcMI, &gcAttackerMI); if (pCreature2->isPC() ) pCreature2->getPlayer()->sendPacket(&gcMI); if (pAttacker!=NULL) { computeAlignmentChange(pCreature2, m_Point, pAttacker, &gcMI, &gcAttackerMI); if (pAttacker->isPC() ) { if (pAttacker->isSlayer() && !pCreature2->isSlayer() ) { Slayer* pSlayer = dynamic_cast<Slayer*>(pAttacker); if (pSlayer != NULL ) { GCModifyInformation gcMI; shareAttrExp(pSlayer, m_Point, 1, 8, 1, gcAttackerMI); } } if (pAttacker->isPC() ) pAttacker->getPlayer()->sendPacket(&gcAttackerMI); } } } } } } } setDeadline(0); __END_DEBUG __END_CATCH }
void EffectAlignmentRecovery::affect(Creature* pCreature) throw(Error) { __BEGIN_TRY Assert(pCreature != NULL); Assert(pCreature->isPC()); Timeval CurrentTime; getCurrentTime(CurrentTime); GCModifyInformation gcModifyInformation; Alignment_t CurrentAlignment = 0; Alignment_t NewAlignment = 0; if (pCreature->isSlayer()) { Slayer* pSlayer = dynamic_cast<Slayer*>(pCreature); Assert(pSlayer != NULL); if (m_Period != 0) { // 플레그 걸귀 pSlayer->setFlag(Effect::EFFECT_CLASS_ALIGNMENT_RECOVERY); // 한 턴에 얼마나 회복 시킬 것인가. CurrentAlignment = pSlayer->getAlignment(); NewAlignment = min(10000, (int)(CurrentAlignment + m_AlignmentQuantity)); pSlayer->setAlignment(NewAlignment); gcModifyInformation.addLongData(MODIFY_ALIGNMENT, NewAlignment); pSlayer->getPlayer()->sendPacket(&gcModifyInformation); WORD AlignmentSaveCount = pSlayer->getAlignmentSaveCount(); if (AlignmentSaveCount > ALIGNMENT_SAVE_PERIOD) { StringStream msg; msg << "Alignment = " << NewAlignment; pSlayer->tinysave(msg.toString()); AlignmentSaveCount = 0; } else AlignmentSaveCount++; pSlayer->setAlignmentSaveCount(AlignmentSaveCount); } else { // unaffect하면서 패킷이 날아갈 테니까.... setDeadline(0); } m_Period--; } else if (pCreature->isVampire()) { Vampire* pVampire = dynamic_cast<Vampire*>(pCreature); Assert(pVampire != NULL); if (m_Period != 0) { // 플레그 걸귀 pVampire->setFlag(Effect::EFFECT_CLASS_ALIGNMENT_RECOVERY); // 한 턴에 얼마나 회복 시킬 것인가. CurrentAlignment = pVampire->getAlignment(); NewAlignment = min(10000, CurrentAlignment + m_AlignmentQuantity); pVampire->setAlignment(NewAlignment); gcModifyInformation.addLongData(MODIFY_ALIGNMENT, NewAlignment); pVampire->getPlayer()->sendPacket(&gcModifyInformation); WORD AlignmentSaveCount = pVampire->getAlignmentSaveCount(); if (AlignmentSaveCount > ALIGNMENT_SAVE_PERIOD) { StringStream msg; msg << "Alignment = " << NewAlignment; pVampire->tinysave(msg.toString()); AlignmentSaveCount = 0; } else AlignmentSaveCount++; pVampire->setAlignmentSaveCount(AlignmentSaveCount); } else { // unaffect하면서 패킷이 날아갈 테니까.... setDeadline(0); } m_Period--; } else if (pCreature->isOusters()) { Ousters* pOusters = dynamic_cast<Ousters*>(pCreature); Assert(pOusters != NULL); if (m_Period != 0) { // 플레그 걸귀 pOusters->setFlag(Effect::EFFECT_CLASS_ALIGNMENT_RECOVERY); // 한 턴에 얼마나 회복 시킬 것인가. CurrentAlignment = pOusters->getAlignment(); NewAlignment = min(10000, CurrentAlignment + m_AlignmentQuantity); pOusters->setAlignment(NewAlignment); gcModifyInformation.addLongData(MODIFY_ALIGNMENT, NewAlignment); pOusters->getPlayer()->sendPacket(&gcModifyInformation); WORD AlignmentSaveCount = pOusters->getAlignmentSaveCount(); if (AlignmentSaveCount > ALIGNMENT_SAVE_PERIOD) { StringStream msg; msg << "Alignment = " << NewAlignment; pOusters->tinysave(msg.toString()); AlignmentSaveCount = 0; } else AlignmentSaveCount++; pOusters->setAlignmentSaveCount(AlignmentSaveCount); } else { // unaffect하면서 패킷이 날아갈 테니까.... setDeadline(0); } m_Period--; } else { return; // 큰 의미는 없지만.. } // 성향 단계가 바뀌면 다른 사람들에게도 알려줘야 한다. by sigi. 2002.12.28 Alignment beforeAlignment = g_pAlignmentManager->getAlignmentType(CurrentAlignment); Alignment afterAlignment = g_pAlignmentManager->getAlignmentType(NewAlignment); if (beforeAlignment!=afterAlignment) { GCOtherModifyInfo gcOtherModifyInfo; gcOtherModifyInfo.setObjectID(pCreature->getObjectID()); gcOtherModifyInfo.addShortData(MODIFY_ALIGNMENT, NewAlignment); Zone* pZone = pCreature->getZone(); // 2003.1.10 Assert(pZone!=NULL); pZone->broadcastPacket(pCreature->getX(), pCreature->getY(), &gcOtherModifyInfo, pCreature); } __END_CATCH }
void TaskDeadline::setTask(bool status, std::string taskDesc, DateTime deadline) { setCompleteStatus(status); setTaskDesc(taskDesc); setDeadline(deadline); }