* Calculate the SH value used internally. * * Exactly twice the value displayed to players, for legacy reasons. * @param Whether to include temporary effects like TSO's divine shield. * @return The player's current SH value. */
| 2279 | * @return The player's current SH value. |
| 2280 | */ |
| 2281 | int player_shield_class(int scale, bool random, bool ignore_temporary) |
| 2282 | { |
| 2283 | int shield = 0; |
| 2284 | |
| 2285 | if (!ignore_temporary && you.incapacitated()) |
| 2286 | return 0; |
| 2287 | |
| 2288 | const item_def *shield_item = you.shield(); |
| 2289 | if (shield_item) |
| 2290 | shield += _sh_from_shield(*shield_item); |
| 2291 | |
| 2292 | // mutations |
| 2293 | // +4, +6, +8 (displayed values) |
| 2294 | shield += (you.get_mutation_level(MUT_LARGE_BONE_PLATES) > 0 |
| 2295 | ? you.get_mutation_level(MUT_LARGE_BONE_PLATES) * 400 + 400 |
| 2296 | : 0); |
| 2297 | |
| 2298 | // Icemail and Ephemeral Shield aren't active all of the time, so consider |
| 2299 | // them temporary; this behaviour is consistent with how icemail's AC |
| 2300 | // is dealt with. |
| 2301 | if (!ignore_temporary |
| 2302 | && you.get_mutation_level(MUT_CONDENSATION_SHIELD) > 0 |
| 2303 | && !you.duration[DUR_ICEMAIL_DEPLETED]) |
| 2304 | { |
| 2305 | shield += ICEMAIL_MAX * 100; |
| 2306 | } |
| 2307 | if (!ignore_temporary |
| 2308 | && you.get_mutation_level(MUT_EPHEMERAL_SHIELD) |
| 2309 | && you.duration[DUR_EPHEMERAL_SHIELD]) |
| 2310 | { |
| 2311 | shield += you.get_mutation_level(MUT_EPHEMERAL_SHIELD) * 1400; |
| 2312 | } |
| 2313 | |
| 2314 | shield += qazlal_sh_boost() * 100; |
| 2315 | shield += you.wearing_jewellery(AMU_REFLECTION) * AMU_REFLECT_SH * 100; |
| 2316 | shield += you.scan_artefacts(ARTP_SHIELDING) * 200; |
| 2317 | |
| 2318 | if (!ignore_temporary && you.duration[DUR_PARRYING]) |
| 2319 | shield += player_parrying() * 200; |
| 2320 | |
| 2321 | if (you.has_mutation(MUT_RECKLESS)) |
| 2322 | shield /= 2; |
| 2323 | |
| 2324 | return random ? div_rand_round(shield * scale, 100) : ((shield * scale) / 100); |
| 2325 | } |
| 2326 | |
| 2327 | /** |
| 2328 | * Calculate the SH value that should be displayed to players. |
no test coverage detected