MCPcopy Create free account
hub / github.com/crawl/crawl / hints_new_turn

Function hints_new_turn

crawl-ref/source/hints.cc:421–473  ·  view source on GitHub ↗

Called each turn from _input. Better name welcome.

Source from the content-addressed store, hash-verified

419
420// Called each turn from _input. Better name welcome.
421void 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.

Callers 1

_inputFunction · 0.85

Calls 6

learned_something_newFunction · 0.85
i_feel_safeFunction · 0.85
player_in_branchFunction · 0.85
_hints_healing_reminderFunction · 0.85
poison_is_lethalFunction · 0.85
game_is_hintsMethod · 0.80

Tested by

no test coverage detected