本文整理汇总了C++中item_t::weapon方法的典型用法代码示例。如果您正苦于以下问题:C++ item_t::weapon方法的具体用法?C++ item_t::weapon怎么用?C++ item_t::weapon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类item_t
的用法示例。
在下文中一共展示了item_t::weapon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: random_suffix_type
int item_database_t::random_suffix_type( const item_t& item )
{
if ( weapon_t* w = item.weapon() )
{
switch ( w -> type )
{
// Two-hand weapons use the first point allocation budget
case WEAPON_AXE_2H:
case WEAPON_MACE_2H:
case WEAPON_POLEARM:
case WEAPON_SWORD_2H:
case WEAPON_STAFF:
return 0;
// Various ranged types use the fifth point allocation budget
case WEAPON_BOW:
case WEAPON_CROSSBOW:
case WEAPON_GUN:
case WEAPON_THROWN:
case WEAPON_WAND:
return 4;
// One-hand/Off-hand/Main-hand weapons use the fourth point allocation budget
default:
return 3;
}
}
// Armor handling goes by slot
switch ( item.slot )
{
case SLOT_HEAD:
case SLOT_CHEST:
case SLOT_LEGS:
return 0;
case SLOT_SHOULDERS:
case SLOT_WAIST:
case SLOT_FEET:
case SLOT_HANDS:
case SLOT_TRINKET_1:
case SLOT_TRINKET_2:
return 1;
case SLOT_NECK:
case SLOT_WRISTS:
case SLOT_FINGER_1:
case SLOT_FINGER_2:
case SLOT_OFF_HAND: // Shields, off hand items
case SLOT_BACK:
return 2;
// Ranged non-weapons are relics, which do not have a point allocation
case SLOT_RANGED:
case SLOT_TABARD:
default:
return -1;
}
}