本文整理汇总了C++中CCharEntity::UpdateHealth方法的典型用法代码示例。如果您正苦于以下问题:C++ CCharEntity::UpdateHealth方法的具体用法?C++ CCharEntity::UpdateHealth怎么用?C++ CCharEntity::UpdateHealth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCharEntity
的用法示例。
在下文中一共展示了CCharEntity::UpdateHealth方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddStatusEffect
/************************************************************************
* *
* ????????? ??????-?????? ? ????????? *
* ???? ?? ????????, ?? ???????????-????????? ?????????? ???????? 32 *
* *
************************************************************************/
bool CStatusEffectContainer::AddStatusEffect(CStatusEffect* PStatusEffect, bool silent)
{
if(PStatusEffect == NULL){
ShowWarning("status_effect_container::AddStatusEffect Status effect given was NULL!\n");
return false;
}
uint16 statusId = PStatusEffect->GetStatusID();
if(statusId >= MAX_EFFECTID){
ShowWarning("status_effect_container::AddStatusEffect statusId given is OVER limit %d\n", statusId);
return false;
}
if(CanGainStatusEffect((EFFECT)statusId, PStatusEffect->GetPower()))
{
// remove clean up other effects
OverwriteStatusEffect(PStatusEffect);
PStatusEffect->SetOwner(m_POwner);
SetEffectParams(PStatusEffect);
// remove effects with same type
DelStatusEffectsByType(PStatusEffect->GetType());
PStatusEffect->SetStartTime(gettick());
m_StatusEffectList.push_back(PStatusEffect);
luautils::OnEffectGain(m_POwner, PStatusEffect);
m_POwner->addModifiers(&PStatusEffect->modList);
if( m_POwner->health.maxhp != 0) //make sure we're not in the middle of logging in
{
m_POwner->UpdateHealth();
}
if (m_POwner->objtype == TYPE_PC)
{
CCharEntity* PChar = (CCharEntity*)m_POwner;
if (PStatusEffect->GetIcon() != 0)
{
UpdateStatusIcons();
}
if (PChar->status == STATUS_NORMAL) PChar->status = STATUS_UPDATE;
if( m_POwner->health.maxhp != 0) //make sure we're not in the middle of logging in
{
//check for latents
CLatentEffectContainer* PLatentEffectContainer;
PChar->PLatentEffectContainer->CheckLatentsFoodEffect();
PChar->PLatentEffectContainer->CheckLatentsStatusEffect();
PChar->UpdateHealth();
PChar->pushPacket(new CCharHealthPacket(PChar));
}
PChar->pushPacket(new CCharSyncPacket(PChar));
}
return true;
}
return false;
}
示例2: RemoveStatusEffect
void CStatusEffectContainer::RemoveStatusEffect(uint32 id, bool silent)
{
CStatusEffect* PStatusEffect = m_StatusEffectList.at(id);
if (PStatusEffect->GetStatusID() >= EFFECT_FIRE_MANEUVER &&
PStatusEffect->GetStatusID() <= EFFECT_DARK_MANEUVER &&
m_POwner->objtype == TYPE_PC)
{
puppetutils::CheckAttachmentsForManeuver((CCharEntity*)m_POwner, PStatusEffect->GetStatusID(), false);
}
m_StatusEffectList.erase(m_StatusEffectList.begin() + id);
luautils::OnEffectLose(m_POwner, PStatusEffect);
m_POwner->delModifiers(&PStatusEffect->modList);
m_POwner->UpdateHealth();
if (m_POwner->objtype == TYPE_PC)
{
CCharEntity* PChar = (CCharEntity*)m_POwner;
if (PStatusEffect->GetIcon() != 0)
{
UpdateStatusIcons();
if (silent == false)
{
PChar->pushPacket(new CMessageBasicPacket(PChar, PChar, PStatusEffect->GetIcon(), 0, 206));
}
}
//check for latents
PChar->PLatentEffectContainer->CheckLatentsFoodEffect();
PChar->PLatentEffectContainer->CheckLatentsStatusEffect();
PChar->PLatentEffectContainer->CheckLatentsRollSong(HasStatusEffectByFlag(EFFECTFLAG_SONG | EFFECTFLAG_ROLL));
PChar->UpdateHealth();
PChar->pushPacket(new CCharHealthPacket(PChar));
PChar->pushPacket(new CCharSyncPacket(PChar));
}
else
{
if (silent == false && PStatusEffect->GetIcon() != 0 && ((PStatusEffect->GetFlag() & EFFECTFLAG_NO_LOSS_MESSAGE) == 0) && !m_POwner->isDead())
{
m_POwner->loc.zone->PushPacket(m_POwner, CHAR_INRANGE, new CMessageBasicPacket(m_POwner, m_POwner, PStatusEffect->GetIcon(), 0, 206));
}
}
delete PStatusEffect;
}
示例3: RemoveStatusEffect
void CStatusEffectContainer::RemoveStatusEffect(uint32 id, bool silent)
{
CStatusEffect* PStatusEffect = m_StatusEffectList.at(id);
m_StatusEffectList.erase(m_StatusEffectList.begin() + id);
luautils::OnEffectLose(m_POwner, PStatusEffect);
m_POwner->delModifiers(&PStatusEffect->modList);
m_POwner->UpdateHealth();
if (m_POwner->objtype == TYPE_PC)
{
CCharEntity* PChar = (CCharEntity*)m_POwner;
if (PStatusEffect->GetIcon() != 0)
{
UpdateStatusIcons();
if (silent == false)
{
PChar->pushPacket(new CMessageBasicPacket(PChar, PChar, PStatusEffect->GetIcon(), 0, 206));
}
}
//check for latents
CLatentEffectContainer* PLatentEffectContainer;
PChar->PLatentEffectContainer->CheckLatentsFoodEffect();
PChar->PLatentEffectContainer->CheckLatentsStatusEffect();
PChar->UpdateHealth();
if (PChar->status == STATUS_NORMAL) PChar->status = STATUS_UPDATE;
PChar->pushPacket(new CCharHealthPacket(PChar));
PChar->pushPacket(new CCharSyncPacket(PChar));
}
else
{
if (silent == false && PStatusEffect->GetIcon() != 0 && ((PStatusEffect->GetFlag() & EFFECTFLAG_NO_LOSS_MESSAGE) == 0) && !m_POwner->isDead())
{
m_POwner->loc.zone->PushPacket(m_POwner, CHAR_INRANGE, new CMessageBasicPacket(m_POwner, m_POwner, PStatusEffect->GetIcon(), 0, 206));
}
}
delete PStatusEffect;
}
示例4: AddStatusEffect
bool CStatusEffectContainer::AddStatusEffect(CStatusEffect* PStatusEffect, bool silent)
{
if(PStatusEffect == nullptr){
ShowWarning("status_effect_container::AddStatusEffect Status effect given was nullptr!\n");
return false;
}
uint16 statusId = PStatusEffect->GetStatusID();
if(statusId >= MAX_EFFECTID){
ShowWarning("status_effect_container::AddStatusEffect statusId given is OVER limit %d\n", statusId);
return false;
}
if(CanGainStatusEffect((EFFECT)statusId, PStatusEffect->GetPower()))
{
// check for minimum duration
if(PStatusEffect->GetDuration() < effects::EffectsParams[statusId].MinDuration){
PStatusEffect->SetDuration(effects::EffectsParams[statusId].MinDuration);
}
// remove clean up other effects
OverwriteStatusEffect(PStatusEffect);
PStatusEffect->SetOwner(m_POwner);
SetEffectParams(PStatusEffect);
// remove effects with same type
DelStatusEffectsByType(PStatusEffect->GetType());
PStatusEffect->SetStartTime(gettick());
m_StatusEffectList.push_back(PStatusEffect);
luautils::OnEffectGain(m_POwner, PStatusEffect);
m_POwner->addModifiers(&PStatusEffect->modList);
if (PStatusEffect->GetStatusID() >= EFFECT_FIRE_MANEUVER &&
PStatusEffect->GetStatusID() <= EFFECT_DARK_MANEUVER &&
m_POwner->objtype == TYPE_PC)
{
puppetutils::CheckAttachmentsForManeuver((CCharEntity*)m_POwner, PStatusEffect->GetStatusID(), true);
}
if( m_POwner->health.maxhp != 0) //make sure we're not in the middle of logging in
{
m_POwner->UpdateHealth();
}
if (m_POwner->objtype == TYPE_PC)
{
CCharEntity* PChar = (CCharEntity*)m_POwner;
if (PStatusEffect->GetIcon() != 0)
{
UpdateStatusIcons();
}
if( m_POwner->health.maxhp != 0) //make sure we're not in the middle of logging in
{
//check for latents
PChar->PLatentEffectContainer->CheckLatentsFoodEffect();
PChar->PLatentEffectContainer->CheckLatentsStatusEffect();
PChar->PLatentEffectContainer->CheckLatentsRollSong(PStatusEffect->GetFlag() & (EFFECTFLAG_SONG | EFFECTFLAG_ROLL));
PChar->UpdateHealth();
PChar->pushPacket(new CCharHealthPacket(PChar));
}
PChar->pushPacket(new CCharSyncPacket(PChar));
}
m_POwner->updatemask |= UPDATE_HP;
return true;
}
return false;
}