本文整理汇总了C++中ItemType::hasAbilities方法的典型用法代码示例。如果您正苦于以下问题:C++ ItemType::hasAbilities方法的具体用法?C++ ItemType::hasAbilities怎么用?C++ ItemType::hasAbilities使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemType
的用法示例。
在下文中一共展示了ItemType::hasAbilities方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getDescription
std::string Item::getDescription(const ItemType& it, int32_t lookDistance, const Item* item/* = NULL*/,
int32_t subType/* = -1*/, bool addArticle/* = true*/)
{
std::stringstream s;
s << getNameDescription(it, item, subType, addArticle);
if(item)
subType = item->getSubType();
bool dot = true;
if(it.isRune())
{
if(!it.runeSpellName.empty())
s << "(\"" << it.runeSpellName << "\")";
if(it.runeLevel > 0 || it.runeMagLevel > 0 || (it.vocationString != "" && it.wieldInfo == 0))
{
s << "." << std::endl << "It can only be used";
if(it.vocationString != "" && it.wieldInfo == 0)
s << " by " << it.vocationString;
bool begin = true;
if(g_config.getBool(ConfigManager::USE_RUNE_REQUIREMENTS) && it.runeLevel > 0)
{
begin = false;
s << " with level " << it.runeLevel;
}
if(g_config.getBool(ConfigManager::USE_RUNE_REQUIREMENTS) && it.runeMagLevel > 0)
{
begin = false;
s << " " << (begin ? "with" : "and") << " magic level " << it.runeMagLevel;
}
if(g_config.getBool(ConfigManager::USE_RUNE_REQUIREMENTS) && !begin)
s << " or higher";
}
}
else if(it.weaponType != WEAPON_NONE)
{
bool begin = true;
if(it.weaponType == WEAPON_DIST && it.ammoType != AMMO_NONE)
{
begin = false;
s << " (Range:" << int32_t(item ? item->getShootRange() : it.shootRange);
if(it.attack || it.extraAttack || (item && (item->getAttack() || item->getExtraAttack())))
{
s << ", Atk " << std::showpos << int32_t(item ? item->getAttack() : it.attack);
if(it.extraAttack || (item && item->getExtraAttack()))
s << " " << std::showpos << int32_t(item ? item->getExtraAttack() : it.extraAttack) << std::noshowpos;
}
if(it.hitChance != -1 || (item && item->getHitChance() != -1))
s << ", Hit% " << std::showpos << (item ? item->getHitChance() : it.hitChance) << std::noshowpos;
if(it.attackSpeed || (item && item->getAttackSpeed()))
s << ", AS: " << (item ? item->getAttackSpeed() : it.attackSpeed);
}
else if(it.weaponType != WEAPON_AMMO && it.weaponType != WEAPON_WAND)
{
if(it.attack || it.extraAttack || (item && (item->getAttack() || item->getExtraAttack())))
{
begin = false;
s << " (Atk:";
if(it.hasAbilities() && it.abilities->elementType != COMBAT_NONE)
{
s << std::max((int32_t)0, int32_t((item ? item->getAttack() : it.attack) - it.abilities->elementDamage));
if(it.extraAttack || (item && item->getExtraAttack()))
s << " " << std::showpos << int32_t(item ? item->getExtraAttack() : it.extraAttack) << std::noshowpos;
s << " physical + " << it.abilities->elementDamage << " " << getCombatName(it.abilities->elementType);
}
else
{
s << int32_t(item ? item->getAttack() : it.attack);
if(it.extraAttack || (item && item->getExtraAttack()))
s << " " << std::showpos << int32_t(item ? item->getExtraAttack() : it.extraAttack) << std::noshowpos;
}
}
if(it.defense || it.extraDefense || (item && (item->getDefense() || item->getExtraDefense())))
{
if(begin)
{
begin = false;
s << " (";
}
else
s << ", ";
s << "Def:" << int32_t(item ? item->getDefense() : it.defense);
if(it.extraDefense || (item && item->getExtraDefense()))
s << " " << std::showpos << int32_t(item ? item->getExtraDefense() : it.extraDefense) << std::noshowpos;
}
}
if(it.attackSpeed || (item && item->getAttackSpeed()))
{
if(begin)
{
begin = false;
//.........这里部分代码省略.........