本文整理汇总了C++中Slayer::getHP方法的典型用法代码示例。如果您正苦于以下问题:C++ Slayer::getHP方法的具体用法?C++ Slayer::getHP怎么用?C++ Slayer::getHP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Slayer
的用法示例。
在下文中一共展示了Slayer::getHP方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unaffect
void EffectExpansion::unaffect(Creature* pCreature)
throw(Error)
{
__BEGIN_TRY
__BEGIN_DEBUG
//cout << "EffectExpansion " << "unaffect BEGIN" << endl;
Assert(pCreature != NULL);
Assert(pCreature->isSlayer() == true);
Zone* pZone = pCreature->getZone();
Assert(pZone != NULL);
pCreature->removeFlag(Effect::EFFECT_CLASS_EXPANSION);
Slayer* pSlayer = dynamic_cast<Slayer*>(pCreature);
SLAYER_RECORD prev;
pSlayer->getSlayerRecord(prev);
pSlayer->initAllStat();
pSlayer->sendRealWearingInfo();
pSlayer->sendModifyInfo(prev);
// 이펙트가 사라졌다고 알려준다.
GCRemoveEffect gcRemoveEffect;
gcRemoveEffect.setObjectID(pSlayer->getObjectID());
gcRemoveEffect.addEffectList(Effect::EFFECT_CLASS_EXPANSION);
pZone->broadcastPacket(pSlayer->getX(), pSlayer->getY(), &gcRemoveEffect);
// 현재 남아있는 체력이 최대 체력보다 크다면, 줄여야 한다.
if (pSlayer->getHP(ATTR_CURRENT) > pSlayer->getHP(ATTR_MAX))
{
pSlayer->setHP(pSlayer->getHP(ATTR_MAX), ATTR_CURRENT);
}
GCOtherModifyInfo gcOtherModifyInfo;
makeGCOtherModifyInfo(&gcOtherModifyInfo, pSlayer, &prev);
pZone->broadcastPacket(pSlayer->getX(), pSlayer->getY(), &gcOtherModifyInfo, pSlayer);
//cout << "EffectExpansion " << "unaffect END" << endl;
__END_DEBUG
__END_CATCH
}
示例2: executeMonster
//.........这里部分代码省略.........
_GCBloodDrainOK3.setObjectID(pMonster->getObjectID());
_GCBloodDrainOK3.setTargetObjectID (pEnemy->getObjectID());
// 타겟이 뭐든 플래그는 건다.
// 마스터면 안건다.
if (!isMaster)
{
pEnemy->setFlag(Effect::EFFECT_CLASS_BLOOD_DRAIN);
}
if (pEnemy != NULL && pEnemy->isPC())
{
Player* pTargetPlayer = pEnemy->getPlayer();
if (pTargetPlayer != NULL)
{
_GCBloodDrainOK2.setObjectID(pMonster->getObjectID());
if (!isMaster)
{
// _GCBloodDrainOK2.addLongData(MODIFY_DURATION, BLOODDRAIN_DURATION);
}
pTargetPlayer->sendPacket(&_GCBloodDrainOK2);
}
}
// target
int targetLevel = 0;
int targetMaxHP = 0;
if (pEnemy->isSlayer())
{
Slayer* pTargetSlayer = dynamic_cast<Slayer*>(pEnemy);
targetLevel = pTargetSlayer->getHighestSkillDomainLevel();
targetMaxHP = pTargetSlayer->getHP(ATTR_MAX);
}
else if (pEnemy->isVampire())
{
Vampire* pTargetVampire = dynamic_cast<Vampire*>(pEnemy);
targetLevel = pTargetVampire->getLevel();
targetMaxHP = pTargetVampire->getHP(ATTR_MAX);
}
else if (pEnemy->isOusters())
{
Ousters* pTargetOusters = dynamic_cast<Ousters*>(pEnemy);
targetLevel = pTargetOusters->getLevel();
targetMaxHP = pTargetOusters->getHP(ATTR_MAX);
}
else if (pEnemy->isMonster())
{
Monster* pEnemyMonster = dynamic_cast<Monster*>(pEnemy);
// 흡혈당하는 몬스터한테 딜레이 걸어준다.
Timeval DelayTurn;
DelayTurn.tv_sec = 4;
DelayTurn.tv_usec = 500000;
pEnemyMonster->addAccuDelay(DelayTurn);
if ((pMonster->isMaster()
#ifdef __UNDERWORLD__
|| pMonster->isUnderworld() || pMonster->getMonsterType() == 599
#endif
)
&& pMonster->getClanType()==pEnemyMonster->getClanType())
{
// 같은 clan의 마스터이면 피 상납이라고 볼 수 있을까 -_-;
}
示例3: execute
//.........这里部分代码省略.........
// // 타겟이 뭐든 플래그는 건다.
// pTargetCreature->setFlag(Effect::EFFECT_CLASS_BLOOD_DRAIN);
//
// Sight_t oldSight = pTargetCreature->getSight();
// Sight_t newSight = pTargetCreature->getEffectedSight();
//
// if (oldSight != newSight )
// {
// pTargetCreature->setSight(newSight);
// pZone->updateScan(pTargetCreature, oldSight, pTargetCreature->getSight());
// _GCBloodDrainOK2.addShortData(MODIFY_VISION, pTargetCreature->getSight());
//
// GCChangeDarkLight gcChangeDarkLight;
// gcChangeDarkLight.setDarkLevel(15);
// gcChangeDarkLight.setLightLevel(newSight);
// pTargetCreature->getPlayer()->sendPacket(&gcChangeDarkLight);
// }
// }
// 타겟이 뭐든 플래그는 건다.
pTargetCreature->setFlag(Effect::EFFECT_CLASS_BLOOD_DRAIN);
// 올릴 경험치량을 계산한다.
Exp_t Exp = computeCreatureExp(pTargetCreature, BLOODDRAIN_EXP);
int targetLevel = 0;
int targetMaxHP = 0;
// 페임을 올려준다.
if (pTargetCreature->isSlayer())
{
//increaseFame(pVampire, Exp);
Slayer* pTargetSlayer = dynamic_cast<Slayer*>(pTargetCreature);
targetLevel = pTargetSlayer->getHighestSkillDomainLevel();
targetMaxHP = pTargetSlayer->getHP(ATTR_MAX);
}
else if (pTargetCreature->isVampire())
{
//increaseFame(pVampire, Exp);
Vampire* pTargetVampire = dynamic_cast<Vampire*>(pTargetCreature);
targetLevel = pTargetVampire->getLevel();
targetMaxHP = pTargetVampire->getHP(ATTR_MAX);
}
else if (pTargetCreature->isOusters())
{
//increaseFame(pOusters, Exp);
Ousters* pTargetOusters = dynamic_cast<Ousters*>(pTargetCreature);
targetLevel = pTargetOusters->getLevel();
targetMaxHP = pTargetOusters->getHP(ATTR_MAX);
}
else if (pTargetCreature->isMonster())
{
Monster* pMonster = dynamic_cast<Monster*>(pTargetCreature);
Timeval NextTurn = pMonster->getNextTurn();
Timeval DelayTurn;
DelayTurn.tv_sec = 4;
DelayTurn.tv_usec = 500000;
pMonster->addAccuDelay(DelayTurn);
pMonster->addEnemy(pVampire);
targetLevel = pMonster->getLevel();
targetMaxHP = pMonster->getHP(ATTR_MAX);
}
shareVampExp(pVampire, Exp, _GCBloodDrainOK1);
示例4: unaffect
void EffectDecreaseHP::unaffect(Creature* pCreature)
throw(Error)
{
__BEGIN_TRY
__BEGIN_DEBUG
Assert(pCreature != NULL);
Zone* pZone = pCreature->getZone();
Assert(pZone != NULL);
pCreature->removeFlag(Effect::EFFECT_CLASS_DECREASE_HP);
Damage_t decreaseHP = m_Point;
if (!(pZone->getZoneLevel() & COMPLETE_SAFE_ZONE)
&& !pCreature->isDead()
&& !pCreature->isFlag(Effect::EFFECT_CLASS_COMA)
// 무적상태 체크. by sigi. 2002.9.5
&& canAttack(NULL, pCreature )
)
{
if (pCreature->isSlayer())
{
Slayer* pSlayer = dynamic_cast<Slayer*>(pCreature);
HP_t CurrentHP = pSlayer->getHP(ATTR_CURRENT);
if (CurrentHP > 0)
{
HP_t RemainHP = max(0, CurrentHP -(int)decreaseHP);
pSlayer->setHP(RemainHP, ATTR_CURRENT);
GCModifyInformation gcMI;
gcMI.addShortData(MODIFY_CURRENT_HP, RemainHP);
pSlayer->getPlayer()->sendPacket(&gcMI);
// 변한 HP를 브로드캐스팅해준다.
GCStatusCurrentHP pkt;
pkt.setObjectID(pSlayer->getObjectID());
pkt.setCurrentHP(RemainHP);
pZone->broadcastPacket(pSlayer->getX(), pSlayer->getY(), &pkt);
}
}
else if (pCreature->isVampire())
{
Vampire* pVampire = dynamic_cast<Vampire*>(pCreature);
HP_t CurrentHP = pVampire->getHP(ATTR_CURRENT);
if (CurrentHP > 0)
{
HP_t RemainHP = max(0, CurrentHP -(int)decreaseHP);
pVampire->setHP(RemainHP, ATTR_CURRENT);
GCModifyInformation gcMI;
gcMI.addShortData(MODIFY_CURRENT_HP, RemainHP);
pVampire->getPlayer()->sendPacket(&gcMI);
// 공격(흡혈) 당하는 경우에는 공격자의 성향이 바뀜 by sigi. 2002.12.27
Creature* pAttacker = pZone->getCreature(m_UserObjectID);
if (pAttacker!=NULL && pAttacker->isVampire())
{
Vampire* pAttackVampire = dynamic_cast<Vampire*>(pAttacker);
GCModifyInformation gcAttackerMI;
computeAlignmentChange(pVampire, decreaseHP, pAttackVampire, NULL, &gcAttackerMI);
// 뭔가 변한 정보가 있다면 보내준다.
if (gcAttackerMI.getShortCount()+gcAttackerMI.getLongCount() > 0)
{
pAttackVampire->getPlayer()->sendPacket(&gcAttackerMI);
}
}
// 변한 HP를 브로드캐스팅해준다.
GCStatusCurrentHP pkt;
pkt.setObjectID(pVampire->getObjectID());
pkt.setCurrentHP(RemainHP);
pZone->broadcastPacket(pVampire->getX(), pVampire->getY(), &pkt);
}
}
else if (pCreature->isOusters())
{
Ousters* pOusters = dynamic_cast<Ousters*>(pCreature);
HP_t CurrentHP = pOusters->getHP(ATTR_CURRENT);
if (CurrentHP > 0)
{
HP_t RemainHP = max(0, CurrentHP -(int)decreaseHP);
pOusters->setHP(RemainHP, ATTR_CURRENT);
GCModifyInformation gcMI;
gcMI.addShortData(MODIFY_CURRENT_HP, RemainHP);
pOusters->getPlayer()->sendPacket(&gcMI);
//.........这里部分代码省略.........
示例5: affect
void EffectCureCriticalWounds::affect(Creature* pCreature)
throw(Error)
{
__BEGIN_TRY
Zone* pZone = pCreature->getZone();
Assert(pZone != NULL);
GCSkillToSelfOK1 _GCSkillToSelfOK1;
GCSkillToSelfOK2 _GCSkillToSelfOK2;
int X = pCreature->getX();
int Y = pCreature->getY();
Exp_t ExpUp = 0;
bool bCured = false;
for(int oY = -2; oY <= 2; oY++)
for(int oX = -2; oX <= 2; oX++)
{
int tileX = X+oX;
int tileY = Y+oY;
if (isValidZoneCoord(pZone, tileX, tileY))
{
Tile& tile = pZone->getTile(tileX, tileY);
if (tile.hasCreature(Creature::MOVE_MODE_WALKING ) )
{
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))->isSlayer())
{
Assert(pTargetCreature != NULL);
HP_t RemainHP = 0;
if (pTargetCreature->isSlayer() && !pTargetCreature->isFlag(Effect::EFFECT_CLASS_COMA) )
{
Slayer* pSlayer = dynamic_cast<Slayer*>(pTargetCreature);
HP_t CurrentHP = pSlayer->getHP(ATTR_CURRENT);
HP_t MaxHP = pSlayer->getHP(ATTR_MAX);
if (pTargetCreature->isFlag(Effect::EFFECT_CLASS_BLOOD_DRAIN))
{
ExpUp++;
Effect* pEffect = pSlayer->findEffect(Effect::EFFECT_CLASS_BLOOD_DRAIN);
EffectBloodDrain * pEffectBloodDrain = dynamic_cast<EffectBloodDrain*>(pEffect);
Assert(pEffectBloodDrain != NULL);
if (pEffectBloodDrain->getLevel() < CriticalBloodDrainLevel ) {
// 흡혈 아르바이트를 방지하기 위한 후유증 이펙트를 붙여준다.
if (pSlayer->isFlag(Effect::EFFECT_CLASS_AFTERMATH))
{
Effect* pEffect = pSlayer->findEffect(Effect::EFFECT_CLASS_AFTERMATH);
EffectAftermath* pEffectAftermath = dynamic_cast<EffectAftermath*>(pEffect);
pEffectAftermath->setDeadline(5*600); // 5분 동안 지속된다.
}
else
{
EffectAftermath* pEffectAftermath = new EffectAftermath(pSlayer);
pEffectAftermath->setDeadline(5*600); // 5분 동안 지속된다.
pSlayer->addEffect(pEffectAftermath);
pSlayer->setFlag(Effect::EFFECT_CLASS_AFTERMATH);
pEffectAftermath->create(pSlayer->getName());
}
pEffectBloodDrain->destroy(pSlayer->getName());
pSlayer->deleteEffect(Effect::EFFECT_CLASS_BLOOD_DRAIN);
bCured = true;
SLAYER_RECORD prev;
pSlayer->getSlayerRecord(prev);
pSlayer->initAllStat();
pSlayer->sendRealWearingInfo();
pSlayer->sendModifyInfo(prev);
GCRemoveEffect gcRemoveEffect;
gcRemoveEffect.setObjectID(pSlayer->getObjectID());
gcRemoveEffect.addEffectList((EffectID_t)Effect::EFFECT_CLASS_BLOOD_DRAIN);
pZone->broadcastPacket(pSlayer->getX(), pSlayer->getY(), &gcRemoveEffect);
}
}
if(CurrentHP < MaxHP ) {
ExpUp++;
bCured = true;
RemainHP = min(CurrentHP + m_Point,(int)MaxHP);
pSlayer->setHP(RemainHP, ATTR_CURRENT);
GCModifyInformation gcMI;
gcMI.addShortData(MODIFY_CURRENT_HP, RemainHP);
pSlayer->getPlayer()->sendPacket(&gcMI);
//.........这里部分代码省略.........
示例6: affect
void EffectBloodyWallBlocked::affect()
throw(Error)
{
__BEGIN_TRY
//cout << "EffectBloodyWallBlocked" << "affect BEGIN" << endl;
Assert(m_pZone != NULL);
// 현재 이펙트가 붙어있는 타일을 받아온다.
Tile& tile = m_pZone->getTile(m_X, m_Y);
HP_t CurrentHP = 0;
HP_t RemainHP = 0;
// 타일 안에 존재하는 오브젝트들을 검색한다.
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* pCreature = dynamic_cast<Creature*>(pObject);
Assert(pCreature != NULL);
// 무적상태 체크. by sigi. 2002.9.5
// 산 면역. by sigi. 2002.9.13
if (!canAttack(NULL, pCreature )
|| pCreature->isFlag(Effect::EFFECT_CLASS_IMMUNE_TO_BLOOD_DRAIN)
|| pCreature->isFlag(Effect::EFFECT_CLASS_COMA)
|| pCreature->isDead())
{
continue;
}
int AcidDamage = computeMagicDamage(pCreature, m_Damage, SKILL_BLOODY_WALL);
if (pCreature->getMoveMode() != Creature::MOVE_MODE_FLYING)
{
if (pCreature->isSlayer())
{
Slayer* pSlayer = dynamic_cast<Slayer*>(pCreature);
CurrentHP = pSlayer->getHP(ATTR_CURRENT);
RemainHP = max(0, CurrentHP -(int)AcidDamage);
pSlayer->setHP(RemainHP, ATTR_CURRENT);
GCModifyInformation gcMI;
gcMI.addShortData(MODIFY_CURRENT_HP, pSlayer->getHP(ATTR_CURRENT));
Player* pPlayer = pSlayer->getPlayer();
Assert(pPlayer != NULL);
pPlayer->sendPacket(&gcMI);
// 변한 HP를 브로드캐스팅해준다.
GCStatusCurrentHP pkt;
pkt.setObjectID(pSlayer->getObjectID());
pkt.setCurrentHP(RemainHP);
m_pZone->broadcastPacket(pSlayer->getX(), pSlayer->getY(), &pkt);
}
/* else if (pCreature->isVampire())
{
Vampire* pVampire = dynamic_cast<Vampire*>(pCreature);
CurrentHP = pVampire->getHP(ATTR_CURRENT);
RemainHP = max(0, CurrentHP -(int)AcidDamage);
pVampire->setHP(RemainHP, ATTR_CURRENT);
GCModifyInformation gcMI;
gcMI.addShortData(MODIFY_CURRENT_HP, pVampire->getHP(ATTR_CURRENT));
Player* pPlayer = pVampire->getPlayer();
Assert(pPlayer != NULL);
pPlayer->sendPacket(&gcMI);
// 변한 HP를 브로드캐스팅해준다.
GCStatusCurrentHP pkt;
pkt.setObjectID(pVampire->getObjectID());
pkt.setCurrentHP(RemainHP);
m_pZone->broadcastPacket(pVampire->getX(), pVampire->getY(), &pkt);
}
*/
else if (pCreature->isOusters())
{
Ousters* pOusters = dynamic_cast<Ousters*>(pCreature);
CurrentHP = pOusters->getHP(ATTR_CURRENT);
RemainHP = max(0, CurrentHP -(int)AcidDamage);
pOusters->setHP(RemainHP, ATTR_CURRENT);
GCModifyInformation gcMI;
gcMI.addShortData(MODIFY_CURRENT_HP, pOusters->getHP(ATTR_CURRENT));
//.........这里部分代码省略.........
示例7: execute
void ActionHeal::execute (Creature * pCreature1 , Creature * pCreature2)
throw(Error)
{
__BEGIN_TRY
Assert(pCreature1 != NULL);
Assert(pCreature2 != NULL);
Assert(pCreature1->isNPC());
Assert(pCreature2->isPC());
Player* pPlayer = pCreature2->getPlayer();
Zone* pZone = pCreature2->getZone();
Assert(pPlayer != NULL);
// 일단 클라이언트를 위해서 OK 패킷을 함 날린다.
GCNPCResponse okpkt;
okpkt.setCode(NPC_RESPONSE_HEAL);
pPlayer->sendPacket(&okpkt);
// 죽었거나 코마 걸려있으면 안 치료해준다.
if (pCreature2->isDead() || pCreature2->isFlag(Effect::EFFECT_CLASS_COMA ) )
{
return;
}
// 슬레이어라면...
if (pCreature2->isSlayer())
{
Slayer* pSlayer = dynamic_cast<Slayer*>(pCreature2);
EffectManager* pEffectManager = pSlayer->getEffectManager();
GCModifyInformation modifyPkt;
GCRemoveEffect removePkt;
GCStatusCurrentHP hpPkt;
// 먼저 HP랑 MP를 풀로 채워준다.
if (pSlayer->getHP(ATTR_CURRENT) < pSlayer->getHP(ATTR_MAX))
{
pSlayer->setHP(pSlayer->getHP(ATTR_MAX), ATTR_CURRENT);
modifyPkt.addShortData(MODIFY_CURRENT_HP, pSlayer->getHP(ATTR_CURRENT));
hpPkt.setObjectID(pSlayer->getObjectID());
hpPkt.setCurrentHP(pSlayer->getHP(ATTR_CURRENT));
}
if (pSlayer->getMP(ATTR_CURRENT) < pSlayer->getMP(ATTR_MAX))
{
pSlayer->setMP(pSlayer->getMP(ATTR_MAX), ATTR_CURRENT);
modifyPkt.addShortData(MODIFY_CURRENT_MP, pSlayer->getMP(ATTR_CURRENT));
}
// 흡혈 이펙트를 삭제한다.
Effect* pBloodDrainEffect = pEffectManager->findEffect(Effect::EFFECT_CLASS_BLOOD_DRAIN);
if (pBloodDrainEffect != NULL)
{
// DB에서 삭제하고, 이펙트 매니저에서 삭제한다.
pBloodDrainEffect->destroy(pSlayer->getName());
pEffectManager->deleteEffect(pSlayer, Effect::EFFECT_CLASS_BLOOD_DRAIN);
// 흡혈 아르바이트를 방지하기 위한 후유증 이펙트를 붙여준다.
if (pSlayer->isFlag(Effect::EFFECT_CLASS_AFTERMATH))
{
Effect* pEffect = pEffectManager->findEffect(Effect::EFFECT_CLASS_AFTERMATH);
EffectAftermath* pEffectAftermath = dynamic_cast<EffectAftermath*>(pEffect);
pEffectAftermath->setDeadline(5*600); // 5분 동안 지속된다.
}
else
{
EffectAftermath* pEffectAftermath = new EffectAftermath(pSlayer);
pEffectAftermath->setDeadline(5*600); // 5분 동안 지속된다.
pEffectManager->addEffect(pEffectAftermath);
pSlayer->setFlag(Effect::EFFECT_CLASS_AFTERMATH);
pEffectAftermath->create(pSlayer->getName());
}
// 패킷에다 정보를 더한다.
removePkt.addEffectList((EffectID_t)Effect::EFFECT_CLASS_BLOOD_DRAIN);
// 흡혈을 치료하면 능력치가 변화하게 된다.
SLAYER_RECORD prev;
pSlayer->getSlayerRecord(prev);
pSlayer->initAllStat();
pSlayer->sendModifyInfo(prev);
pSlayer->sendRealWearingInfo();
}
// 독 이펙트를 삭제한다.
Effect* pEffectPoison = pEffectManager->findEffect(Effect::EFFECT_CLASS_POISON);
if (pEffectPoison != NULL)
{
// 이펙트 매니저에서 삭제한다.
pEffectManager->deleteEffect(pSlayer, Effect::EFFECT_CLASS_POISON);
// 패킷에다 정보를 더한다.
removePkt.addEffectList((EffectID_t)Effect::EFFECT_CLASS_POISON);
}
// 다크블루 포이즌 이펙트를 삭제한다.
Effect* pEffectDarkBluePoison = pEffectManager->findEffect(Effect::EFFECT_CLASS_DARKBLUE_POISON);
if (pEffectDarkBluePoison != NULL)
{
//.........这里部分代码省略.........
示例8: activate
void EventResurrect::activate ()
throw(Error)
{
__BEGIN_TRY
__BEGIN_DEBUG
Assert(m_pGamePlayer != NULL);
Creature * pDeadPC = m_pGamePlayer->getCreature();
Assert(pDeadPC != NULL);
// 하이드한 상태에서 죽었다면, 하이드를 풀어준다.
pDeadPC->removeFlag(Effect::EFFECT_CLASS_HIDE);
// 무브모드를 바꿔준다.
if (pDeadPC->isVampire() && pDeadPC->isFlag(Effect::EFFECT_CLASS_TRANSFORM_TO_BAT))
{
pDeadPC->setMoveMode(Creature::MOVE_MODE_FLYING);
}
else
{
pDeadPC->setMoveMode(Creature::MOVE_MODE_WALKING);
}
// HP를 채워준다.
if (pDeadPC->isSlayer())
{
Slayer* pSlayer = dynamic_cast<Slayer*>(pDeadPC);
pSlayer->setHP(pSlayer->getHP(ATTR_MAX), ATTR_CURRENT);
}
else if (pDeadPC->isVampire())
{
Vampire* pVampire = dynamic_cast<Vampire*>(pDeadPC);
pVampire->setHP(pVampire->getHP(ATTR_MAX), ATTR_CURRENT);
}
else if (pDeadPC->isOusters())
{
Ousters* pOusters = dynamic_cast<Ousters*>(pDeadPC);
pOusters->setHP(pOusters->getHP(ATTR_MAX), ATTR_CURRENT);
}
// 새 zone을 설정하지 않는다. by sigi. 2002.5.11
Zone* pOldZone = pDeadPC->getZone();
Assert(pOldZone != NULL);
try
{
// 존그룹의 ZPM에서 플레이어를 삭제한다.
pOldZone->getZoneGroup()->getZonePlayerManager()->deletePlayer(m_pGamePlayer->getSocket()->getSOCKET());
// 여기서 설정해줘야지만 Save 이벤트가 IPM에서 동작하지 않는다.
m_pGamePlayer->setPlayerStatus(GPS_WAITING_FOR_CG_READY);
// IPM으로 플레이어를 옮긴다.
//g_pIncomingPlayerManager->pushPlayer(m_pGamePlayer);
pOldZone->getZoneGroup()->getZonePlayerManager()->pushOutPlayer(m_pGamePlayer);
}
catch (NoSuchElementException& t)
{
filelog("eventRessurect.txt", "%s-%s", t.toString().c_str(), pDeadPC->getName().c_str());
cerr << "EventResurrect::activate() : NoSuchElementException" << endl;
//throw Error("존에 플레이어가 존재하지 않습니다.");
// 어떻게 없어졌겠지.. -_-;
// 무시하고.. 그냥 진행한다.
// by sigi. 2002.11.25
}
// 죽었을 당시 killCreature에서 존을 셋팅 하기 때문에 그냥 할당 받으면 된다.
// 이거는 ZonePlayerManager의 heartbeat에서 처리한다.
// 주석처리 by sigi. 2002.5.14
//pDeadPC->registerObject();
/*
// GCUpdateInfo 패킷을 만들어둔다.
GCUpdateInfo gcUpdateInfo;
makeGCUpdateInfo(&gcUpdateInfo, pDeadPC);
m_pGamePlayer->sendPacket(&gcUpdateInfo);
*/
__END_DEBUG
__END_CATCH
}
示例9: execute
void SimpleCureSkill::execute(Slayer* pSlayer, ObjectID_t TargetObjectID, SkillSlot* pSkillSlot,
const SIMPLE_SKILL_INPUT& param, SIMPLE_SKILL_OUTPUT& result,
CEffectID_t CEffectID)
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);
Creature* pTargetCreature = pZone->getCreature(TargetObjectID);
//Assert(pTargetCreature != NULL);
// 슬레이어 외에는 치료할 수가 없다.
// NoSuch제거. by sigi. 2002.5.2
if (pTargetCreature==NULL
|| pTargetCreature->isSlayer() == false)
{
executeSkillFailException(pSlayer, param.SkillType);
return;
}
GCSkillToObjectOK1 _GCSkillToObjectOK1;
GCSkillToObjectOK2 _GCSkillToObjectOK2;
GCSkillToObjectOK3 _GCSkillToObjectOK3;
GCSkillToObjectOK4 _GCSkillToObjectOK4;
GCSkillToObjectOK5 _GCSkillToObjectOK5;
SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(param.SkillType);
SkillDomainType_t DomainType = pSkillInfo->getDomainType();
bool bHPCheck = false;
// 체력이 닳거나, 흡혈을 당한 상태여야 한다.
Slayer* pTargetSlayer = dynamic_cast<Slayer*>(pTargetCreature);
Assert(pTargetSlayer != NULL);
EffectBloodDrain* pEffectBloodDrain = NULL;
if (pTargetSlayer->getHP(ATTR_CURRENT) < pTargetSlayer->getHP(ATTR_MAX))
{
bHPCheck = true;
}
if (pTargetSlayer->isFlag(Effect::EFFECT_CLASS_BLOOD_DRAIN))
{
Effect* pEffect = pTargetSlayer->findEffect(Effect::EFFECT_CLASS_BLOOD_DRAIN);
pEffectBloodDrain = dynamic_cast<EffectBloodDrain*>(pEffect);
Assert(pEffectBloodDrain != NULL);
if (pEffectBloodDrain->getLevel() < param.Level) bHPCheck = true;
}
int RequiredMP = (int)pSkillInfo->getConsumeMP();
bool bManaCheck = hasEnoughMana(pSlayer, RequiredMP);
bool bTimeCheck = verifyRunTime(pSkillSlot);
bool bRangeCheck = verifyDistance(pSlayer, pTargetCreature, pSkillInfo->getRange());
bool bHitRoll = HitRoll::isSuccessMagic(pSlayer, pSkillInfo, pSkillSlot);
if (bHPCheck && bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && pTargetCreature->isAlive())
{
decreaseMana(pSlayer, RequiredMP, _GCSkillToObjectOK1);
uint HealPoint = param.SkillDamage;
// 흡혈당한 상태라면 흡혈 상태를 날려준다.
if (pEffectBloodDrain != NULL && pEffectBloodDrain->getLevel() < param.Level)
{
// 흡혈 아르바이트를 방지하기 위한 후유증 이펙트를 붙여준다.
if (pTargetSlayer->isFlag(Effect::EFFECT_CLASS_AFTERMATH))
{
Effect* pEffect = pTargetSlayer->findEffect(Effect::EFFECT_CLASS_AFTERMATH);
EffectAftermath* pEffectAftermath = dynamic_cast<EffectAftermath*>(pEffect);
pEffectAftermath->setDeadline(5*600); // 5분 동안 지속된다.
}
else
{
EffectAftermath* pEffectAftermath = new EffectAftermath(pTargetSlayer);
pEffectAftermath->setDeadline(5*600); // 5분 동안 지속된다.
pTargetSlayer->addEffect(pEffectAftermath);
pTargetSlayer->setFlag(Effect::EFFECT_CLASS_AFTERMATH);
pEffectAftermath->create(pTargetSlayer->getName());
}
pEffectBloodDrain->destroy(pTargetSlayer->getName());
pTargetSlayer->deleteEffect(Effect::EFFECT_CLASS_BLOOD_DRAIN);
SLAYER_RECORD prev;
pTargetSlayer->getSlayerRecord(prev);
pTargetSlayer->initAllStat();
pTargetSlayer->sendRealWearingInfo();
pTargetSlayer->addModifyInfo(prev, _GCSkillToObjectOK2);
//.........这里部分代码省略.........