| 226 | } |
| 227 | |
| 228 | bool Game_Actor::IsSkillUsable(int skill_id) const { |
| 229 | const lcf::rpg::Skill* skill = lcf::ReaderUtil::GetElement(lcf::Data::skills, skill_id); |
| 230 | if (!skill) { |
| 231 | Output::Warning("IsSkillUsable: Invalid skill ID {}", skill_id); |
| 232 | return false; |
| 233 | } |
| 234 | |
| 235 | if (!skill->affect_attr_defence) { |
| 236 | // Actor must have all attributes of the skill equipped as weapons |
| 237 | const auto* w1 = GetWeapon(); |
| 238 | const auto* w2 = Get2ndWeapon(); |
| 239 | |
| 240 | for (size_t i = 0; i < skill->attribute_effects.size(); ++i) { |
| 241 | bool required = skill->attribute_effects[i] && lcf::Data::attributes[i].type == lcf::rpg::Attribute::Type_physical; |
| 242 | if (required) { |
| 243 | if (w1 && i < w1->attribute_set.size() && w1->attribute_set[i]) { |
| 244 | continue; |
| 245 | } |
| 246 | if (w2 && i < w2->attribute_set.size() && w2->attribute_set[i]) { |
| 247 | continue; |
| 248 | } |
| 249 | return false; |
| 250 | } |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | return Game_Battler::IsSkillUsable(skill_id); |
| 255 | } |
| 256 | |
| 257 | int Game_Actor::CalculateSkillCost(int skill_id) const { |
| 258 | const lcf::rpg::Skill* skill = lcf::ReaderUtil::GetElement(lcf::Data::skills, skill_id); |
no test coverage detected