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; }
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; }
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; }