本文整理汇总了C++中CItemArmor::getQuantity方法的典型用法代码示例。如果您正苦于以下问题:C++ CItemArmor::getQuantity方法的具体用法?C++ CItemArmor::getQuantity怎么用?C++ CItemArmor::getQuantity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CItemArmor
的用法示例。
在下文中一共展示了CItemArmor::getQuantity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateAttacks
/************************************************************************
* *
* Creates up to many attacks for a particular hand. *
* *
************************************************************************/
void CAttackRound::CreateAttacks(CItemWeapon* PWeapon, PHYSICAL_ATTACK_DIRECTION direction)
{
uint8 num = 1;
bool isPC = m_attacker->objtype == TYPE_PC;
// Checking the players weapon hit count
if (PWeapon->getReqLvl() <= m_attacker->GetMLevel())
{
num = PWeapon->getHitCount();
}
// If the attacker is a mobentity or derived from mobentity, check to see if it has any special mutli-hit capabilties
if (dynamic_cast<CMobEntity*>(m_attacker))
{
auto multiHitMax = static_cast<CMobEntity*>(m_attacker)->getMobMod(MOBMOD_MULTI_HIT);
if (multiHitMax > 0)
num = 1 + battleutils::getHitCount(multiHitMax);
}
AddAttackSwing(PHYSICAL_ATTACK_TYPE::NORMAL, direction, num);
// Checking the players triple, double and quadruple attack
int16 tripleAttack = m_attacker->getMod(Mod::TRIPLE_ATTACK);
int16 doubleAttack = m_attacker->getMod(Mod::DOUBLE_ATTACK);
int16 quadAttack = m_attacker->getMod(Mod::QUAD_ATTACK);
//check for merit upgrades
if (isPC)
{
CCharEntity* PChar = (CCharEntity*)m_attacker;
//merit chance only applies if player has the job trait
if (charutils::hasTrait(PChar, TRAIT_TRIPLE_ATTACK)) tripleAttack += PChar->PMeritPoints->GetMeritValue(MERIT_TRIPLE_ATTACK_RATE, PChar);
if (charutils::hasTrait(PChar, TRAIT_DOUBLE_ATTACK)) doubleAttack += PChar->PMeritPoints->GetMeritValue(MERIT_DOUBLE_ATTACK_RATE, PChar);
// TODO: Quadruple attack merits when SE release them.
}
quadAttack = dsp_cap(quadAttack, 0, 100);
doubleAttack = dsp_cap(doubleAttack, 0, 100);
tripleAttack = dsp_cap(tripleAttack, 0, 100);
// Checking Mikage Effect - Hits Vary With Num of Utsusemi Shadows for Main Weapon
if (m_attacker->StatusEffectContainer->HasStatusEffect(EFFECT_MIKAGE) && m_attacker->m_Weapons[SLOT_MAIN]->getID() == PWeapon->getID())
{
int16 shadows = m_attacker->getMod(Mod::UTSUSEMI);
//ShowDebug(CL_CYAN"Create Attacks: Mikage Active, Rolling Attack Chance for %d Shadowss...\n" CL_RESET, shadows);
AddAttackSwing(PHYSICAL_ATTACK_TYPE::NORMAL, direction, shadows);
}
else if (num == 1 && dsprand::GetRandomNumber(100) < quadAttack)
AddAttackSwing(PHYSICAL_ATTACK_TYPE::QUAD, direction, 3);
else if (num == 1 && dsprand::GetRandomNumber(100) < tripleAttack)
AddAttackSwing(PHYSICAL_ATTACK_TYPE::TRIPLE, direction, 2);
else if (num == 1 && dsprand::GetRandomNumber(100) < doubleAttack)
AddAttackSwing(PHYSICAL_ATTACK_TYPE::DOUBLE, direction, 1);
// Ammo extra swing - players only
if (isPC && m_attacker->getMod(Mod::AMMO_SWING) > 0)
{
// Check for ammo
CCharEntity* PChar = (CCharEntity*)m_attacker;
CItemArmor* PAmmo = PChar->getEquip(SLOT_AMMO);
CItemArmor* PMain = PChar->getEquip(SLOT_MAIN);
CItemArmor* PSub = PChar->getEquip(SLOT_SUB);
uint8 slot = PChar->equip[SLOT_AMMO];
uint8 loc = PChar->equipLoc[SLOT_AMMO];
uint8 ammoCount = 0;
// Handedness check, checking mod of the weapon for the purposes of level scaling
if (battleutils::GetScaledItemModifier(PChar, PMain, Mod::AMMO_SWING_TYPE) == 2 &&
dsprand::GetRandomNumber(100) < m_attacker->getMod(Mod::AMMO_SWING) && PAmmo != nullptr && ammoCount < PAmmo->getQuantity())
{
AddAttackSwing(PHYSICAL_ATTACK_TYPE::NORMAL, direction, 1);
ammoCount += 1;
}
else
{
if (direction == RIGHTATTACK && battleutils::GetScaledItemModifier(PChar, PMain, Mod::AMMO_SWING_TYPE) == 1 &&
dsprand::GetRandomNumber(100) < m_attacker->getMod(Mod::AMMO_SWING) && PAmmo != nullptr && ammoCount < PAmmo->getQuantity())
{
AddAttackSwing(PHYSICAL_ATTACK_TYPE::NORMAL, RIGHTATTACK, 1);
ammoCount += 1;
}
if (direction == LEFTATTACK && PSub != nullptr && battleutils::GetScaledItemModifier(PChar, PSub, Mod::AMMO_SWING_TYPE) == 1 &&
dsprand::GetRandomNumber(100) < m_attacker->getMod(Mod::AMMO_SWING) && PAmmo != nullptr && ammoCount < PAmmo->getQuantity())
{
AddAttackSwing(PHYSICAL_ATTACK_TYPE::NORMAL, LEFTATTACK, 1);
ammoCount += 1;
}
}
if (PAmmo != nullptr)
//.........这里部分代码省略.........
示例2: CreateAttacks
/************************************************************************
* *
* Creates up to many attacks for a particular hand. *
* *
************************************************************************/
void CAttackRound::CreateAttacks(CItemWeapon* PWeapon, PHYSICAL_ATTACK_DIRECTION direction)
{
uint8 num = 1;
// Checking the players weapon hit count
if (PWeapon->getReqLvl() <= m_attacker->GetMLevel())
{
num = PWeapon->getHitCount();
}
AddAttackSwing(ATTACK_NORMAL, direction, num);
// Checking the players triple, double and quadruple attack
int16 tripleAttack = m_attacker->getMod(MOD_TRIPLE_ATTACK);
int16 doubleAttack = m_attacker->getMod(MOD_DOUBLE_ATTACK);
int16 quadAttack = m_attacker->getMod(MOD_QUAD_ATTACK);
//check for merit upgrades
if (m_attacker->objtype == TYPE_PC)
{
CCharEntity* PChar = (CCharEntity*)m_attacker;
//merit chance only applies if player has the job trait
if (charutils::hasTrait(PChar, TRAIT_TRIPLE_ATTACK)) tripleAttack += PChar->PMeritPoints->GetMeritValue(MERIT_TRIPLE_ATTACK_RATE, PChar);
if (charutils::hasTrait(PChar, TRAIT_DOUBLE_ATTACK)) doubleAttack += PChar->PMeritPoints->GetMeritValue(MERIT_DOUBLE_ATTACK_RATE, PChar);
// TODO: Quadruple attack merits when SE release them.
}
quadAttack = dsp_cap(quadAttack,0,100);
doubleAttack = dsp_cap(doubleAttack,0,100);
tripleAttack = dsp_cap(tripleAttack,0,100);
// Checking Mikage Effect - Hits Vary With Num of Utsusemi Shadows for Main Weapon
if (m_attacker->StatusEffectContainer->HasStatusEffect(EFFECT_MIKAGE) && m_attacker->m_Weapons[SLOT_MAIN]->getID() == PWeapon->getID())
{
int16 shadows = m_attacker->getMod(MOD_UTSUSEMI);
//ShowDebug(CL_CYAN"Create Attacks: Mikage Active, Rolling Attack Chance for %d Shadowss...\n" CL_RESET, shadows);
AddAttackSwing(ATTACK_NORMAL, direction, shadows);
}
else if (num == 1 && dsprand::GetRandomNumber(100) < quadAttack)
AddAttackSwing(QUAD_ATTACK, direction, 3);
else if (num == 1 && dsprand::GetRandomNumber(100) < tripleAttack)
AddAttackSwing(TRIPLE_ATTACK, direction, 2);
else if (num == 1 && dsprand::GetRandomNumber(100) < doubleAttack)
AddAttackSwing(DOUBLE_ATTACK, direction, 1);
// Ammo extra swing - players only
if (m_attacker->objtype == TYPE_PC && m_attacker->getMod(MOD_AMMO_SWING) > 0)
{
// Check for ammo
CCharEntity* PChar = (CCharEntity*)m_attacker;
CItemArmor* PAmmo = PChar->getEquip(SLOT_AMMO);
uint8 slot = PChar->equip[SLOT_AMMO];
uint8 loc = PChar->equipLoc[SLOT_AMMO];
if (dsprand::GetRandomNumber(100) < m_attacker->getMod(MOD_AMMO_SWING))
{
// Add swing, then subtract an ammo item, unequip if there's one left.
AddAttackSwing(ATTACK_NORMAL, direction, 1);
if (PAmmo->getQuantity() == 1)
{
charutils::UnequipItem(PChar, SLOT_AMMO);
charutils::SaveCharEquip(PChar);
}
charutils::UpdateItem(PChar, loc, slot, -1);
PChar->pushPacket(new CInventoryFinishPacket());
}
}
// TODO: Possible Lua function for the nitty gritty stuff below.
// Iga mod: Extra attack chance whilst dual wield is on.
if (direction == LEFTATTACK && dsprand::GetRandomNumber(100) < m_attacker->getMod(MOD_EXTRA_DUAL_WIELD_ATTACK))
AddAttackSwing(ATTACK_NORMAL, RIGHTATTACK, 1);
}