本文整理汇总了C++中Slayer::getObjectID方法的典型用法代码示例。如果您正苦于以下问题:C++ Slayer::getObjectID方法的具体用法?C++ Slayer::getObjectID怎么用?C++ Slayer::getObjectID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Slayer
的用法示例。
在下文中一共展示了Slayer::getObjectID方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unaffect
void EffectChargingPower::unaffect(Creature* pCreature)
throw(Error)
{
__BEGIN_TRY
__BEGIN_DEBUG
//cout << "EffectChargingPower" << "unaffect BEGIN" << endl;
Assert(pCreature != NULL);
Assert(pCreature->isSlayer());
pCreature->removeFlag(Effect::EFFECT_CLASS_CHARGING_POWER);
Slayer* pSlayer = dynamic_cast<Slayer*>(pCreature);
SLAYER_RECORD prev;
pSlayer->getSlayerRecord(prev);
pSlayer->initAllStat();
pSlayer->sendRealWearingInfo();
pSlayer->sendModifyInfo(prev);
Zone* pZone = pSlayer->getZone();
Assert(pZone != NULL);
// 이펙트가 사라졌다고 알려준다.
GCRemoveEffect gcRemoveEffect;
gcRemoveEffect.setObjectID(pSlayer->getObjectID());
gcRemoveEffect.addEffectList(Effect::EFFECT_CLASS_CHARGING_POWER);
pZone->broadcastPacket(pSlayer->getX(), pSlayer->getY(), &gcRemoveEffect);
//cout << "EffectChargingPower" << "unaffect END" << endl;
__END_DEBUG
__END_CATCH
}
示例2: 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
}
示例3: unaffect
void EffectPotentialExplosion::unaffect(Creature* pCreature)
throw(Error)
{
__BEGIN_TRY
__BEGIN_DEBUG
//cout << "EffectPotentialExplosion " << "unaffect BEGIN" << endl;
Assert(pCreature != NULL);
Assert(pCreature->isSlayer());
pCreature->removeFlag(Effect::EFFECT_CLASS_POTENTIAL_EXPLOSION);
Slayer* pSlayer = dynamic_cast<Slayer*>(pCreature);
SLAYER_RECORD prev;
pSlayer->getSlayerRecord(prev);
pSlayer->initAllStat();
pSlayer->sendRealWearingInfo();
pSlayer->sendModifyInfo(prev);
Zone* pZone = pSlayer->getZone();
Assert(pZone != NULL);
GCRemoveEffect gcRemoveEffect;
gcRemoveEffect.setObjectID(pSlayer->getObjectID());
gcRemoveEffect.addEffectList(Effect::EFFECT_CLASS_POTENTIAL_EXPLOSION);
pZone->broadcastPacket(pSlayer->getX(), pSlayer->getY(), &gcRemoveEffect);
GCOtherModifyInfo gcOtherModifyInfo;
makeGCOtherModifyInfo(&gcOtherModifyInfo, pSlayer, &prev);
pZone->broadcastPacket(pSlayer->getX(), pSlayer->getY(), &gcOtherModifyInfo, pSlayer);
//cout << "EffectPotentialExplosion " << "unaffect END" << endl;
__END_DEBUG
__END_CATCH
}
示例4: executeSlayer
void CGTradeAddItemHandler::executeSlayer (CGTradeAddItem* pPacket , Player* pPlayer)
throw(ProtocolException , Error)
{
__BEGIN_TRY __BEGIN_DEBUG_EX
#ifdef __GAME_SERVER__
// 상위 함수에서 에러를 검사했기 때문에,
// 여기서는 포인터가 널인지를 검사하지 않는다.
ObjectID_t TargetOID = pPacket->getTargetObjectID();
ObjectID_t ItemOID = pPacket->getItemObjectID();
GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
Creature* pPC = pGamePlayer->getCreature();
Zone* pZone = pPC->getZone();
PlayerCreature* pTargetPC = dynamic_cast<PlayerCreature*>(pZone->getCreature(TargetOID));
// NoSuch제거. by sigi. 2002.5.2
if (pTargetPC==NULL) return;
Slayer* pSender = dynamic_cast<Slayer*>(pPC);
TradeManager* pTradeManager = pZone->getTradeManager();
Assert(pTradeManager != NULL);
// 교환 대상에 추가할 아이템의 포인터를 얻어낸다.
CoordInven_t X, Y;
Inventory* pInventory = pSender->getInventory();
Item* pItem = pInventory->findItemOID(ItemOID, X, Y);
// 추가할 아이템이 없다면 당연히 더 이상 처리가 불가능
// 추가할 아이템이 Relic이면 추가할 수 없다.
if (pItem == NULL
|| !canTrade(pItem )
|| pSender->getStore()->hasItem(pItem)
|| (pItem->getItemClass() == Item::ITEM_CLASS_SUB_INVENTORY && hasItemWithItemClass(pTargetPC, Item::ITEM_CLASS_SUB_INVENTORY ) )
)
{
pTradeManager->cancelTrade(pPC);
executeError(pPacket, pPlayer, GC_TRADE_ERROR_CODE_ADD_ITEM);
return;
}
///*
//#ifdef __XMAS_EVENT_CODE__
// 녹색 선물 상자인 경우에는, 상대방에게 적색 선물 상자가 없는지 검사한 후,
// 인증 패킷을 보내줘야 한다.
if (pItem->getItemClass() == Item::ITEM_CLASS_EVENT_GIFT_BOX)
{
PlayerCreature* pReceiver = dynamic_cast<PlayerCreature*>(pTargetPC);
Item* pExtraSlotItem = pReceiver->getExtraInventorySlotItem();
// 녹색 선물 상자
if (pItem->getItemType() == 0)
{
// 교환 받을 사람이 이미 녹색 선물 상자를 받은 적이 있는지 체크한다. by sigi. 2002.12.16
FlagSet* pFlagSet = pReceiver->getFlagSet();
if (pFlagSet->isOn(FLAGSET_RECEIVE_GREEN_GIFT_BOX))
{
// 적색 선물 상자는 교환 품목의 대상이 될 수 없다.
GCTradeVerify gcTradeVerify;
gcTradeVerify.setCode(GC_TRADE_VERIFY_CODE_ADD_ITEM_FAIL);
pPlayer->sendPacket(&gcTradeVerify);
return;
}
Inventory* pTargetInventory = pReceiver->getInventory();
if (pTargetInventory->hasRedGiftBox())
{
// 적색 선물 상자를 가지고 있다면 더할 수 없다. 리턴시킨다.
GCTradeVerify gcTradeVerify;
gcTradeVerify.setCode(GC_TRADE_VERIFY_CODE_ADD_ITEM_FAIL);
pPlayer->sendPacket(&gcTradeVerify);
return;
}
else if (pExtraSlotItem != NULL)
{
if (pExtraSlotItem->getItemClass() == Item::ITEM_CLASS_EVENT_GIFT_BOX && pExtraSlotItem->getItemType() == 1)
{
GCTradeVerify gcTradeVerify;
gcTradeVerify.setCode(GC_TRADE_VERIFY_CODE_ADD_ITEM_FAIL);
pPlayer->sendPacket(&gcTradeVerify);
return;
}
}
else
{
// 적색 선물 상자를 가지고 있지 않다면, 걍 넘어간다.
GCTradeVerify gcTradeVerify;
gcTradeVerify.setCode(GC_TRADE_VERIFY_CODE_ADD_ITEM_OK);
pPlayer->sendPacket(&gcTradeVerify);
}
}
// 빨간 선물 상자
else if (pItem->getItemType() == 1)
{
// 적색 선물 상자는 교환 품목의 대상이 될 수 없다.
GCTradeVerify gcTradeVerify;
gcTradeVerify.setCode(GC_TRADE_VERIFY_CODE_ADD_ITEM_FAIL);
pPlayer->sendPacket(&gcTradeVerify);
return;
//.........这里部分代码省略.........
示例5: executeSlayer
void CGTradeMoneyHandler::executeSlayer (CGTradeMoney* pPacket , Player* pPlayer)
throw(ProtocolException , Error)
{
__BEGIN_TRY __BEGIN_DEBUG_EX
#ifdef __GAME_SERVER__
// 상위 함수에서 검사를 했기 때문에,
// 여기서는 포인터가 널인지를 검사하지 않는다.
ObjectID_t TargetOID = pPacket->getTargetObjectID();
Gold_t Amount = pPacket->getAmount();
BYTE Code = pPacket->getCode();
GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
Creature* pPC = pGamePlayer->getCreature();
Zone* pZone = pPC->getZone();
Creature* pTargetPC = pZone->getCreature(TargetOID);
// NoSuch제거. by sigi. 2002.5.2
if (pTargetPC==NULL) return;
Slayer* pSender = dynamic_cast<Slayer*>(pPC);
Slayer* pReceiver = dynamic_cast<Slayer*>(pTargetPC);
Player* pTargetPlayer = pTargetPC->getPlayer();
Gold_t finalAmount = Amount;
Gold_t margin = 0;
GCTradeMoney gcTradeMoney;
GCTradeVerify gcTradeVerify;
TradeManager* pTradeManager = pZone->getTradeManager();
Assert(pTradeManager != NULL);
// 교환 상태가 맞는지 체크를 해봐야한다.
TradeInfo* pInfo1 = pTradeManager->getTradeInfo(pSender->getName());
TradeInfo* pInfo2 = pTradeManager->getTradeInfo(pReceiver->getName());
// 인벤토리에서 돈을 덜어, 교환창에다 더한다.
if (Code == CG_TRADE_MONEY_INCREASE)
{
// 교환창에다 더할 액수보다 많은 돈을 가지고 있어야 한다.
if (pSender->getGold() >= Amount)
{
// 돈을 받는 쪽이 맥스를 초과하게 된다면, 일부만 넣어줘야 한다.
// 현재 교환 예정인 돈도 더해서 계산. by sigi. 2003.1.8
Gold_t receiverGold = pReceiver->getGold() + pInfo1->getGold();
if (receiverGold + Amount > MAX_MONEY)
{
margin = receiverGold + Amount - MAX_MONEY;
finalAmount = finalAmount - margin;
}
// 인벤토리에서 돈을 빼고, 교환창에다 더한다.
pSender->setGold(pSender->getGold() - finalAmount);
pInfo1->setGold(pInfo1->getGold() + finalAmount);
// 현재 OK를 누른 상태라면, 클라이언트에게 인증 패킷을 보내줘야 한다.
if (pInfo1->getStatus() == TRADE_FINISH)
{
// 인증 패킷을 날려준다.
gcTradeVerify.setCode(GC_TRADE_VERIFY_CODE_MONEY_INCREASE);
pPlayer->sendPacket(&gcTradeVerify);
}
// 아이템을 더하거나 뺄 경우, 상태를 변환해줘야 한다.
pInfo1->setStatus(TRADE_TRADING);
pInfo2->setStatus(TRADE_TRADING);
// 돈을 올린 당사자에게 실제로 인벤토리에서
// 빠진 금액이 얼마인지 보내준다.
gcTradeMoney.setTargetObjectID(TargetOID);
gcTradeMoney.setCode(GC_TRADE_MONEY_INCREASE_RESULT);
gcTradeMoney.setAmount(finalAmount);
pPlayer->sendPacket(&gcTradeMoney);
// 상대방에게 바뀐 정보를 보내준다.
gcTradeMoney.setTargetObjectID(pSender->getObjectID());
gcTradeMoney.setCode(GC_TRADE_MONEY_INCREASE);
gcTradeMoney.setAmount(finalAmount);
pTargetPlayer->sendPacket(&gcTradeMoney);
}
else
{
pTradeManager->cancelTrade(pPC);
executeError(pPacket, pPlayer, GC_TRADE_ERROR_CODE_INCREASE_MONEY);
return;
}
}
// 교환창에서 돈을 덜어, 인벤토리에다가 더한다.
else if (Code == CG_TRADE_MONEY_DECREASE)
{
// 인벤토리에다 더할 액수보다 교환창에 있는 돈이 많아야 한다.
if (pInfo1->getGold() >= Amount)
{
// 돈이 맥스를 초과하게 된다면, 일부만 뺄 수 있다.
Gold_t senderGold = pSender->getGold() + pInfo2->getGold();
if (senderGold + Amount > MAX_MONEY)
{
margin = senderGold + Amount - MAX_MONEY;
finalAmount = finalAmount - margin;
}
//.........这里部分代码省略.........
示例6: 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);
//.........这里部分代码省略.........
示例7: 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);
//.........这里部分代码省略.........
示例8: 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));
//.........这里部分代码省略.........
示例9: 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)
{
//.........这里部分代码省略.........
示例10: 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);
//.........这里部分代码省略.........