本文整理汇总了C++中CItemWeapon::addModifier方法的典型用法代码示例。如果您正苦于以下问题:C++ CItemWeapon::addModifier方法的具体用法?C++ CItemWeapon::addModifier怎么用?C++ CItemWeapon::addModifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CItemWeapon
的用法示例。
在下文中一共展示了CItemWeapon::addModifier方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Deactivate
bool CLatentEffect::Deactivate()
{
if (IsActivated())
{
//remove the modifier from weapon, not player
if (GetModValue() == Mod::ADDITIONAL_EFFECT || GetModValue() == Mod::DMG)
{
CCharEntity* PChar = (CCharEntity*)m_POwner;
CItemWeapon* weapon = (CItemWeapon*)PChar->getEquip((SLOTTYPE)GetSlot());
int16 modPower = GetModPower();
if (weapon != nullptr && (weapon->isType(ITEM_ARMOR) || weapon->isType(ITEM_WEAPON)))
{
if (GetModValue() == Mod::ADDITIONAL_EFFECT)
{
for (uint8 i = 0; i < weapon->modList.size(); ++i)
{
//ensure the additional effect is fully removed from the weapon
if (weapon->modList.at(i).getModID() == Mod::ADDITIONAL_EFFECT)
{
weapon->modList.at(i).setModAmount(0);
}
}
}
else
{
weapon->addModifier(CModifier(GetModValue(), -modPower));
}
}
}
else
{
m_POwner->delModifier(m_ModValue, m_ModPower);
}
m_Activated = false;
//printf("LATENT DEACTIVATED: %d\n", m_ModValue);
return true;
}
return false;
}
示例2: Activate
void CLatentEffect::Activate()
{
if( !IsActivated() )
{
//additional effect/dmg latents add mod to weapon, not player
if (GetModValue() == MOD_ADDITIONAL_EFFECT || GetModValue() == MOD_DMG)
{
CCharEntity* PChar = (CCharEntity*)m_POwner;
CItemWeapon* weapon = (CItemWeapon*)PChar->getEquip((SLOTTYPE)GetSlot());
weapon->addModifier(new CModifier(GetModValue(), GetModPower()));
}
else
{
m_POwner->addModifier(m_ModValue, m_ModPower);
}
m_Activated = true;
//printf("LATENT ACTIVATED: %d, Current value: %d\n", m_ModValue, m_POwner->getMod(m_ModValue));
}
}