本文整理汇总了C++中player::has_mabuff方法的典型用法代码示例。如果您正苦于以下问题:C++ player::has_mabuff方法的具体用法?C++ player::has_mabuff怎么用?C++ player::has_mabuff使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类player
的用法示例。
在下文中一共展示了player::has_mabuff方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: is_valid_player
bool ma_requirements::is_valid_player( const player &u ) const
{
for( const auto &buff_id : req_buffs ) {
if (!u.has_mabuff(buff_id)) {
return false;
}
}
//A technique is valid if it applies to unarmed strikes, if it applies generally
//to all weapons (such as Ninjutsu sneak attacks or innate weapon techniques like RAPID)
//or if the weapon is flagged as being compatible with the style. Some techniques have
//further restrictions on required weapon properties (is_valid_weapon).
bool cqb = u.has_active_bionic( bionic_id( "bio_cqb" ) );
// There are 4 different cases of "armedness":
// Truly unarmed, unarmed weapon, style-allowed weapon, generic weapon
bool valid_weapon =
( unarmed_allowed && u.unarmed_attack() &&
( !strictly_unarmed || !u.is_armed() ) ) ||
( is_valid_weapon( u.weapon ) &&
( melee_allowed || u.style_selected.obj().has_weapon( u.weapon.typeId() ) ) );
if( !valid_weapon ) {
return false;
}
for( const auto &pr : min_skill ) {
if( ( cqb ? 5 : (int)u.get_skill_level( pr.first ) ) < pr.second ) {
return false;
}
}
return true;
}
示例2: is_valid_player
bool ma_requirements::is_valid_player(player &u)
{
for( auto buff_id : req_buffs ) {
if (!u.has_mabuff(buff_id)) {
return false;
}
}
//A technique is valid if it applies to unarmed strikes, if it applies generally
//to all weapons (such as Ninjutsu sneak attacks or innate weapon techniques like RAPID)
//or if the weapon is flagged as being compatible with the style. Some techniques have
//further restrictions on required weapon properties (is_valid_weapon).
bool cqb = u.has_active_bionic("bio_cqb");
bool valid = ((unarmed_allowed && u.unarmed_attack()) ||
(melee_allowed && !u.unarmed_attack() && is_valid_weapon(u.weapon)) ||
(u.has_weapon() && martialarts[u.style_selected].has_weapon(u.weapon.type->id) &&
is_valid_weapon(u.weapon))) &&
((u.skillLevel("melee") >= min_melee &&
u.skillLevel("unarmed") >= min_unarmed &&
u.skillLevel("bashing") >= min_bashing &&
u.skillLevel("cutting") >= min_cutting &&
u.skillLevel("stabbing") >= min_stabbing) || cqb);
return valid;
}
示例3: is_valid_player
bool ma_requirements::is_valid_player(player& u) {
for (std::set<mabuff_id>::iterator it = req_buffs.begin();
it != req_buffs.end(); ++it) {
mabuff_id buff_id = *it;
if (!u.has_mabuff(*it)) return false;
}
bool valid = ((unarmed_allowed && u.unarmed_attack()) || (melee_allowed && !u.unarmed_attack()))
&& u.skillLevel("melee") >= min_melee
&& u.skillLevel("unarmed") >= min_unarmed
&& u.skillLevel("bashing") >= min_bashing
&& u.skillLevel("cutting") >= min_cutting
&& u.skillLevel("stabbing") >= min_stabbing;
return valid;
}