本文整理汇总了C++中ItemType::isRune方法的典型用法代码示例。如果您正苦于以下问题:C++ ItemType::isRune方法的具体用法?C++ ItemType::isRune怎么用?C++ ItemType::isRune使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemType
的用法示例。
在下文中一共展示了ItemType::isRune方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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::ostringstream s;
s << getNameDescription(it, item, subType, addArticle);
if (item) {
subType = item->getSubType();
}
if (it.isRune()) {
if (!it.runeSpellName.empty()) {
s << " (\"" << it.runeSpellName << "\")";
}
if (it.runeLevel > 0 || it.runeMagLevel > 0) {
int32_t tmpSubType = subType;
if (item) {
tmpSubType = item->getSubType();
}
s << ". " << (it.stackable && tmpSubType > 1 ? "They" : "It") << " can only be used with";
if (it.runeLevel > 0) {
s << " level " << it.runeLevel;
}
if (it.runeMagLevel > 0) {
if (it.runeLevel > 0) {
s << " and";
}
s << " magic level " << it.runeMagLevel;
}
s << " or higher";
}
} else if (it.weaponType != WEAPON_NONE) {
if (it.weaponType == WEAPON_DIST && it.ammoType != AMMO_NONE) {
s << " (Range:" << it.shootRange;
if (it.attack != 0) {
s << ", Atk " << std::showpos << it.attack << std::noshowpos;
}
if (it.hitChance != 0) {
s << ", Hit% " << std::showpos << it.hitChance << std::noshowpos;
}
s << ")";
} else if (it.weaponType != WEAPON_AMMO) {
bool begin = true;
if (it.attack != 0) {
begin = false;
s << " (Atk:" << it.attack;
if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0) {
s << " physical + " << it.abilities->elementDamage << " " << getCombatName(it.abilities->elementType);
}
}
if (it.defense != 0 || it.extraDefense != 0) {
if (begin) {
begin = false;
s << " (";
} else {
s << ", ";
}
s << "Def:" << it.defense;
if (it.extraDefense != 0 || (item && item->getExtraDefense() != 0)) {
s << " " << std::showpos << it.extraDefense << std::noshowpos;
}
}
if (it.abilities) {
for (uint16_t i = SKILL_FIRST; i <= SKILL_LAST; i++) {
if (!it.abilities->skills[i]) {
continue;
}
if (begin) {
begin = false;
s << " (";
} else {
s << ", ";
}
s << getSkillName(i) << " " << std::showpos << it.abilities->skills[i] << std::noshowpos;
}
if (it.abilities->stats[STAT_MAGICPOINTS]) {
if (begin) {
begin = false;
s << " (";
} else {
s << ", ";
//.........这里部分代码省略.........
示例2: 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;
//.........这里部分代码省略.........
示例3: 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())
{
s << "(";
if(!it.runeSpellName.empty())
s << "\"" << it.runeSpellName << "\", ";
s << "Charges:" << subType << ")";
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(it.runeLevel > 0)
{
begin = false;
s << " with level " << it.runeLevel;
}
if(it.runeMagLevel > 0)
{
begin = false;
s << " " << (begin ? "with" : "and") << " magic level " << it.runeMagLevel;
}
if(!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;
}
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.abilities.elementType != COMBAT_NONE && it.decayTo < 1)
{
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;
}
}
for(uint16_t i = SKILL_FIRST; i <= SKILL_LAST; i++)
{
if(!it.abilities.skills[i])
continue;
if(begin)
//.........这里部分代码省略.........
示例4: getDescription
std::string Item::getDescription(const ItemType& it, const int32_t& lookDistance,
const Item* item /*= NULL*/, int32_t subType /*= -1*/, bool addArticle /*= true*/)
{
std::stringstream s;
if (item)
{
subType = item->getSubType();
}
s << getLongName(it, lookDistance, item, subType, addArticle);
if (it.isRune())
{
s << " (\"" << it.runeSpellName << "\").";
if (it.runeLevel > 0 || it.runeMagLevel > 0)
{
s << std::endl << "It can only be used with";
if (it.runeLevel > 0)
{
s << " level " << it.runeLevel;
}
if (it.runeMagLevel > 0)
{
if (it.runeLevel > 0)
{
s << " and";
}
s << " magic level " << it.runeMagLevel;
}
s << " or higher.";
}
}
else if (it.weaponType != WEAPON_NONE)
{
if (it.weaponType == WEAPON_DIST && it.amuType != AMMO_NONE)
{
s << " (Range:" << it.shootRange;
if (it.attack != 0)
{
s << ", Atk" << std::showpos << it.attack << std::noshowpos;
}
if (it.hitChance > 0) //excludes both cases it.hitchance 0 and -1
{
s << ", Hit%" << std::showpos << it.hitChance << std::noshowpos;
}
s << ")";
}
else if (it.weaponType != WEAPON_AMMO && it.weaponType != WEAPON_WAND) // Arrows and Bolts doesn't show atk
{
s << " (";
if (it.attack != 0)
{
s << "Atk:" << (int32_t)it.attack;
if (it.abilities.elementDamage != 0)
{
s << " " << "physical + ";
switch (it.abilities.elementType)
{
case COMBAT_ICEDAMAGE:
s << it.abilities.elementDamage << " Ice,";
break;
case COMBAT_EARTHDAMAGE:
s << it.abilities.elementDamage << " Earth,";
break;
case COMBAT_FIREDAMAGE:
s << it.abilities.elementDamage << " Fire,";
break;
case COMBAT_ENERGYDAMAGE:
s << it.abilities.elementDamage << " Energy,";
break;
default:
s << it.abilities.elementDamage << " Unknown,";
break;
}
}
}
if (it.defense != 0 || it.extraDef != 0)
{
if (it.attack != 0)
{
s << " ";
}
s << "Def:" << (int32_t)it.defense;
if (it.extraDef != 0)
{
//.........这里部分代码省略.........
示例5: 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;
if (item){
subType = item->getSubType();
}
if (it.name.length()){
if (it.stackable && item && item->getItemCount() > 1){
if (it.showCount){
s << (int)item->getItemCount() << " ";
}
s << it.pluralName;
}
else{
if (!it.article.empty()){
s << it.article << " ";
}
s << it.name;
}
}
else{
s << "an item of type " << it.id;
}
if (it.isRune()){
uint32_t charges = std::max((uint32_t)1, (uint32_t)(item == NULL ? it.charges : item->getCharges()));
if (it.runeLevel > 0 || it.runeMagLevel > 0){
if (it.runeLevel > 0){
s << " for level " << it.runeLevel;
}
if (it.runeMagLevel > 0){
if (it.runeLevel > 0){
s << " and";
}
s << " for magic level " << it.runeMagLevel;
}
}
s << ". It's an \"" << it.runeSpellName << "\"-spell (" << charges << "x). ";
}
else if ((it.id == ITEM_GATE_EXPERTISE_1 ||
it.id == ITEM_GATE_EXPERTISE_2 ||
it.id == ITEM_GATE_EXPERTISE_3 ||
it.id == ITEM_GATE_EXPERTISE_4 ||
it.id == ITEM_GATE_EXPERTISE_5 ||
it.id == ITEM_GATE_EXPERTISE_6 ||
it.id == ITEM_GATE_EXPERTISE_7 ||
it.id == ITEM_GATE_EXPERTISE_8) &&
(item->getActionId() >= 1000)) {
s << " for level " << item->getActionId() - 1000 << ".";
}
else if (it.weaponType != WEAPON_NONE){
if (it.weaponType == WEAPON_DIST && it.amuType != AMMO_NONE){
if (it.attack != 0){
s << ", Atk" << std::showpos << it.attack << std::noshowpos;
}
}
else if (it.weaponType != WEAPON_AMMO && it.weaponType != WEAPON_WAND){ // Arrows and Bolts doesn't show atk
if (it.attack != 0 || it.defense != 0 || it.abilities.stats[STAT_MAGICPOINTS] != 0) {
s << " (";
if (it.attack != 0){
s << "Atk:" << (int)it.attack;
}
if (it.defense != 0 || it.extraDef != 0){
if (it.attack != 0)
s << " ";
s << "Def:" << (int)it.defense;
}
if (it.abilities.stats[STAT_MAGICPOINTS] != 0){
if (it.attack != 0 || it.defense != 0 || it.extraDef != 0)
s << ", ";
s << "magic level " << std::showpos << (int)it.abilities.stats[STAT_MAGICPOINTS] << std::noshowpos;
}
s << ")";
}
}
s << ".";
}
else if (it.armor != 0 || it.abilities.absorb.any()){
if (it.showCharges){
if (subType > 1){
s << " that has " << (int32_t)subType << " charges left";
}
else{
s << " that has 1 charge left";
}
}
if (it.armor != 0){
s << " (Arm:" << it.armor << ")";
}
//.........这里部分代码省略.........
示例6: getDescription
std::string Item::getDescription(const ItemType& it, int32_t lookDistance,
const Item* item /*= NULL*/, int32_t subType /*= -1*/)
{
std::stringstream s;
if(item){
subType = item->getSubType();
}
if(it.name.length()){
if(it.stackable && subType > 1){
if(it.showCount){
s << subType << " ";
}
s << it.pluralName;
}
else{
if(!it.article.empty()){
s << it.article << " ";
}
s << it.name;
}
}
else{
s << "an item of type " << it.id;
}
if(it.isRune()){
s << "(\"" << it.runeSpellName << "\", Charges:" << subType <<").";
if(it.runeLevel > 0 || it.runeMagLevel > 0){
s << std::endl << "It can only be used with";
if(it.runeLevel > 0){
s << " level " << it.runeLevel;
}
if(it.runeMagLevel > 0){
if(it.runeLevel > 0){
s << " and";
}
s << " magic level " << it.runeMagLevel;
}
s << " or higher.";
}
}
else if(it.weaponType != WEAPON_NONE){
if(it.weaponType == WEAPON_DIST && it.amuType != AMMO_NONE){
s << " (Range:" << it.shootRange;
if(it.attack != 0){
s << ", Atk" << std::showpos << it.attack << std::noshowpos;
}
if(it.hitChance != 0){
s << ", Hit%" << std::showpos << it.hitChance << std::noshowpos;
}
s << ")";
}
else if(it.weaponType != WEAPON_AMMO && it.weaponType != WEAPON_WAND){ // Arrows and Bolts doesn't show atk
s << " (";
if(it.attack != 0){
s << "Atk:" << (int)it.attack;
}
if(it.defence != 0 || it.extraDef != 0){
if(it.attack != 0)
s << " ";
s << "Def:" << (int)it.defence;
if(it.extraDef != 0){
s << " " << std::showpos << (int)it.extraDef << std::noshowpos;
}
}
if(it.abilities.stats[STAT_MAGICPOINTS] != 0){
if(it.attack != 0 || it.defence != 0 || it.extraDef != 0)
s << ", ";
s << "magic level " << std::showpos << (int)it.abilities.stats[STAT_MAGICPOINTS] << std::noshowpos;
}
s << ")";
}
if(it.showCharges){
if(subType > 1){
s << " that has " << (int32_t)subType << " charges left";
}
else{
s << " that has 1 charge left";
}
}
s << ".";
}
else if(it.armor != 0){
s << " (Arm:" << it.armor;
if(it.abilities.absorbPercentAll != 0 || it.abilities.absorbPercentDeath != 0 ||
it.abilities.absorbPercentDrown != 0 || it.abilities.absorbPercentEarth != 0 ||
it.abilities.absorbPercentEnergy != 0 || it.abilities.absorbPercentFire != 0 ||
it.abilities.absorbPercentHoly != 0 || it.abilities.absorbPercentIce != 0 ||
it.abilities.absorbPercentLifeDrain != 0 || it.abilities.absorbPercentManaDrain != 0 ||
it.abilities.absorbPercentPhysical != 0)
//.........这里部分代码省略.........