Called each turn from _input. Better name welcome.
| 419 | |
| 420 | // Called each turn from _input. Better name welcome. |
| 421 | void hints_new_turn() |
| 422 | { |
| 423 | if (!crawl_state.game_is_hints()) |
| 424 | return; |
| 425 | |
| 426 | Hints.hints_just_triggered = false; |
| 427 | |
| 428 | if (you.attribute[ATTR_HELD]) |
| 429 | { |
| 430 | learned_something_new(HINT_CAUGHT_IN_NET); |
| 431 | return; |
| 432 | } |
| 433 | |
| 434 | if (i_feel_safe() && !player_in_branch(BRANCH_ABYSS)) |
| 435 | { |
| 436 | // We don't want those "Whew, it's safe to rest now" messages |
| 437 | // if you were just cast into the Abyss. Right? |
| 438 | |
| 439 | if (2 * you.hp < you.hp_max |
| 440 | || 2 * you.magic_points < you.max_magic_points) |
| 441 | { |
| 442 | _hints_healing_reminder(); |
| 443 | return; |
| 444 | } |
| 445 | |
| 446 | if (you.running |
| 447 | || you.hp != you.hp_max |
| 448 | || you.magic_points != you.max_magic_points) |
| 449 | { |
| 450 | return; |
| 451 | } |
| 452 | |
| 453 | if (Hints.hints_events[HINT_SHIFT_RUN] && you.num_turns >= 200) |
| 454 | learned_something_new(HINT_SHIFT_RUN); |
| 455 | else if (Hints.hints_events[HINT_MAP_VIEW] && you.num_turns >= 500) |
| 456 | learned_something_new(HINT_MAP_VIEW); |
| 457 | else if (Hints.hints_events[HINT_AUTO_EXPLORE] && you.num_turns >= 700) |
| 458 | learned_something_new(HINT_AUTO_EXPLORE); |
| 459 | |
| 460 | return; |
| 461 | } |
| 462 | |
| 463 | if (poison_is_lethal()) |
| 464 | { |
| 465 | if (Hints.hints_events[HINT_NEED_POISON_HEALING]) |
| 466 | learned_something_new(HINT_NEED_POISON_HEALING); |
| 467 | } |
| 468 | else if (2*you.hp < you.hp_max) |
| 469 | learned_something_new(HINT_RUN_AWAY); |
| 470 | |
| 471 | if (Hints.hints_type == HINT_MAGIC_CHAR && you.magic_points < 1) |
| 472 | learned_something_new(HINT_RETREAT_CASTER); |
| 473 | } |
| 474 | |
| 475 | /** |
| 476 | * Look up and return a hint message from the database. |
no test coverage detected