/
player.h
1222 lines (980 loc) · 43.7 KB
/
player.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* @file
* @brief Player related functions.
**/
#pragma once
#include <chrono>
#include <list>
#include <memory>
#include <vector>
#include "actor.h"
#include "attribute-type.h"
#include "beam.h"
#include "bitary.h"
#include "book-type.h"
#include "caction-type.h"
#include "daction-type.h"
#include "duration-type.h"
#include "equipment-type.h"
#include "flush-reason-type.h"
#include "game-chapter.h"
#include "kill-method-type.h"
#include "kills.h"
#include "maybe-bool.h"
#include "mon-holy-type.h"
#include "mutation-type.h"
#include "place-info.h"
#include "quiver.h"
#include "skill-menu-state.h"
#include "species.h"
#include "stat-type.h"
#include "timed-effect-type.h"
#include "transformation.h"
#include "uncancellable-type.h"
#include "unique-creature-list-type.h"
#include "unique-item-status-type.h"
#define ICY_ARMOUR_KEY "ozocubu's_armour_pow"
#define BARBS_MOVE_KEY "moved_with_barbs_status"
#define HORROR_PENALTY_KEY "horror_penalty"
#define POWERED_BY_DEATH_KEY "powered_by_death_strength"
#define FUGUE_KEY "fugue_of_the_fallen_bonus"
#define FORCE_MAPPABLE_KEY "force_mappable"
#define TEMP_WATERWALK_KEY "temp_waterwalk"
#define EMERGENCY_FLIGHT_KEY "emergency_flight"
#define PARALYSED_BY_KEY "paralysed_by"
#define PETRIFIED_BY_KEY "petrified_by"
#define FROZEN_RAMPARTS_KEY "frozen_ramparts_position"
#define DREAMSHARD_KEY "dreamshard"
#define DESCENT_DEBT_KEY "descent_debt"
#define DESCENT_WATER_BRANCH_KEY "descent_water_branch"
#define DESCENT_POIS_BRANCH_KEY "descent_poison_branch"
#define RAMPAGE_HEAL_KEY "rampage_heal_strength"
#define RAMPAGE_HEAL_MAX 7
// display/messaging breakpoints for penalties from Ru's MUT_HORROR
#define HORROR_LVL_EXTREME 3
#define HORROR_LVL_OVERWHELMING 5
#define SEVERE_CONTAM_LEVEL 3
/// Maximum stat value
static const int MAX_STAT_VALUE = 125;
/// The standard unit of regen; one level in artifact inscriptions
static const int REGEN_PIP = 80;
/// The standard unit of WL; one level in %/@ screens
static const int WL_PIP = 40;
/// The cap for the player's Will, in units of WL\_PIP.
static const int MAX_WILL_PIPS = 5;
/// The standard unit of stealth; one level in %/@ screens
static const int STEALTH_PIP = 50;
/// The minimum aut cost for a player move (before haste)
static const int FASTEST_PLAYER_MOVE_SPEED = 6;
// relevant for swiftness, etc
// Min delay for thrown projectiles.
static const int FASTEST_PLAYER_THROWING_SPEED = 7;
/// At this percent rev, Coglins' attacks do full damage.
static const int FULL_REV_PERCENT = 66;
class targeter;
class Delay;
struct player_save_info;
int player_stealth();
enum class mutation_activity_type; // in mutation.h
/// used for you.train[] & for rendering skill tiles (tileidx_skill)
enum training_status
{
TRAINING_DISABLED = 0,
TRAINING_ENABLED,
TRAINING_FOCUSED,
NUM_TRAINING_STATUSES,
// the below are only used for display purposes, not training.
TRAINING_MASTERED,
TRAINING_INACTIVE, ///< enabled but not used (in auto mode)
};
// needed for assert in is_player()
#ifdef DEBUG_GLOBALS
#define you (*real_you)
#endif
extern player you;
typedef FixedVector<int, NUM_DURATIONS> durations_t;
class player : public actor
{
public:
// ---------------
// Character save chunk data:
// None of this is really necessary, except for some complicated
// hacks with player_save_info. Should only be used in tags.cc or
// player_save_info::operator=(player).
// ---------------
string chr_species_name;
string chr_class_name;
string chr_god_name;
// ---------------
// Permanent data:
// ---------------
string your_name;
species_type species;
job_type char_class;
// This field is here even in non-WIZARD compiles, since the
// player might have been playing previously under wiz mode.
bool wizard; // true if player has entered wiz mode.
bool explore; // true if player has entered explore mode.
bool suppress_wizard;
time_t birth_time; // start time of game
// ----------------
// Long-term state:
// ----------------
int elapsed_time; // total amount of elapsed time in the game
int elapsed_time_at_last_input; // used for elapsed_time delta display
int hp;
int hp_max;
int hp_max_adj_temp; // temporary max HP loss (draining)
int hp_max_adj_perm; // base HPs from background (and permanent loss)
int magic_points;
int max_magic_points;
int mp_max_adj; // max MP loss (ability costs, tutorial bonus)
FixedVector<int8_t, NUM_STATS> stat_loss;
FixedVector<int8_t, NUM_STATS> base_stats;
uint8_t max_level;
int hit_points_regeneration;
int magic_points_regeneration;
unsigned int experience;
unsigned int total_experience; // 10 * amount of xp put into skills, used
// only for skill_cost_level
int experience_level;
int gold;
int zigs_completed, zig_max;
FixedVector<int8_t, NUM_EQUIP> equip;
FixedBitVector<NUM_EQUIP> melded;
// Whether these are unrands that we should run the _*_world_reacts func for
FixedBitVector<NUM_EQUIP> unrand_reacts;
// True if the slot has an item that activates when worn with max hp (regen
// items, acrobat amulet) and max hp has been reached while wearing it;
// false otherwise.
FixedBitVector<NUM_EQUIP> activated;
FixedArray<int, NUM_OBJECT_CLASSES, MAX_SUBTYPES> force_autopickup;
// PC's symbol (usually @) and colour.
monster_type symbol;
transformation form;
transformation default_form;
item_def active_talisman;
// XXX: ENDOFPACK marks the total size of the player inventory, but we add
// a single extra slot after that for purposes of examining EV of
// non-inventory items, since implementation-wise the player can only
// ever equip items that are in this vector.
//
// Most other places should never know this slot exists.
FixedVector< item_def, ENDOFPACK + 1 > inv;
FixedBitVector<NUM_RUNE_TYPES> runes;
int obtainable_runes; // can be != 15 in Sprint
FixedBitVector<NUM_GEM_TYPES> gems_found;
FixedBitVector<NUM_GEM_TYPES> gems_shattered;
FixedVector<int, NUM_GEM_TYPES> gem_time_spent;
FixedBitVector<NUM_SPELLS> spell_library;
FixedBitVector<NUM_SPELLS> hidden_spells;
FixedVector<spell_type, MAX_KNOWN_SPELLS> spells;
set<spell_type> old_vehumet_gifts, vehumet_gifts;
uint8_t spell_no;
game_chapter chapter;
bool royal_jelly_dead;
bool transform_uncancellable;
bool fishtail; // Merfolk fishtail transformation
bool vampire_alive;
unsigned short pet_target;
durations_t duration;
bool apply_berserk_penalty; // Whether to apply the berserk penalty at
// end of the turn.
int berserk_penalty; // The penalty for moving while berserk
FixedVector<int, NUM_ATTRIBUTES> attribute;
FixedVector<int, NUM_TIMERS> last_timer_effect;
FixedVector<int, NUM_TIMERS> next_timer_effect;
bool pending_revival;
int lives;
int deaths;
FixedVector<uint8_t, NUM_SKILLS> skills; ///< skill level
FixedVector<training_status, NUM_SKILLS> train; ///< see enum def
FixedVector<training_status, NUM_SKILLS> train_alt; ///< config of other mode
FixedVector<unsigned int, NUM_SKILLS> training; ///< percentage of XP used
FixedBitVector<NUM_SKILLS> can_currently_train; ///< Is training this skill allowed?
FixedBitVector<NUM_SKILLS> should_show_skill; ///< Is this skill shown by default?
FixedVector<unsigned int, NUM_SKILLS> skill_points;
FixedVector<unsigned int, NUM_SKILLS> training_targets; ///< Training targets, scaled by 10 (so [0,270]). 0 means no target.
int experience_pool; ///< XP waiting to be applied.
FixedVector<uint8_t, NUM_SKILLS> skill_order;
/// manuals
FixedVector<unsigned int, NUM_SKILLS> skill_manual_points;
bool auto_training;
list<skill_type> exercises; ///< recent practise events
list<skill_type> exercises_all; ///< also include events for disabled skills
set<skill_type> skills_to_hide; ///< need to check if it should still be shown in the skill menu
set<skill_type> skills_to_show; ///< we can un-hide in the skill menu
// Skill menu states
skill_menu_state skill_menu_do;
skill_menu_state skill_menu_view;
int skill_cost_level;
int exp_available; // xp pool, scaled by 10 from you.experience
FixedVector<int, NUM_GODS> exp_docked;
FixedVector<int, NUM_GODS> exp_docked_total; // XP-based wrath
FixedArray<uint32_t, 6, MAX_SUBTYPES> item_description;
set<misc_item_type> generated_misc;
FixedVector<unique_item_status_type, MAX_UNRANDARTS> unique_items;
uint8_t octopus_king_rings;
unique_creature_list unique_creatures;
KillMaster kills;
branch_type where_are_you;
int depth;
god_type religion;
string jiyva_second_name; // Random second name of Jiyva
uint8_t piety;
uint8_t piety_hysteresis; // amount of stored-up docking
uint8_t gift_timeout;
uint8_t saved_good_god_piety; // for if you "switch" between E/Z/1 by abandoning one first
god_type previous_good_god;
FixedVector<uint8_t, NUM_GODS> penance;
FixedVector<uint8_t, NUM_GODS> worshipped;
FixedVector<short, NUM_GODS> num_current_gifts;
FixedVector<short, NUM_GODS> num_total_gifts;
FixedBitVector< NUM_GODS> one_time_ability_used;
FixedVector<uint8_t, NUM_GODS> piety_max;
FixedVector<uint8_t, NUM_MUTATIONS> mutation;
FixedVector<uint8_t, NUM_MUTATIONS> innate_mutation;
FixedVector<uint8_t, NUM_MUTATIONS> temp_mutation;
FixedVector<uint8_t, NUM_MUTATIONS> sacrifices;
FixedVector<uint8_t, NUM_ABILITIES> sacrifice_piety;
struct demon_trait
{
int level_gained;
mutation_type mutation;
};
vector<demon_trait> demonic_traits;
int magic_contamination;
FixedVector<uint32_t, NUM_WEAPONS> seen_weapon;
FixedVector<uint32_t, NUM_ARMOURS> seen_armour;
FixedBitVector<NUM_MISCELLANY> seen_misc;
FixedBitVector<NUM_TALISMANS> seen_talisman;
uint8_t normal_vision; // how far the species gets to see
uint8_t current_vision; // current sight radius (cells)
set<coord_def> rampage_hints; // TODO: move this somewhere else
int real_time() { return real_time_ms.count() / 1000; }
chrono::milliseconds real_time_ms; // real time played
chrono::milliseconds real_time_delta; // real time since last command
int num_turns; // number of turns taken
int exploration; // levels explored (16.16 bit real number)
int last_view_update; // what turn was the view last updated?
// Warning: these two are quite different.
//
// The spell table is an index to a specific spell slot (you.spells).
// The ability table lists the ability (ABIL_*) which prefers that letter.
//
// In other words, the spell table contains hard links and the ability
// table contains soft links.
FixedVector<int, 52> spell_letter_table; // ref to spell by slot
FixedVector<ability_type, 52> ability_letter_table; // ref to abil by enum
// Maps without allow_dup that have been already used.
set<string> uniq_map_tags;
set<string> uniq_map_names;
set<string> uniq_map_tags_abyss;
set<string> uniq_map_names_abyss;
// All maps, by level.
map<level_id, vector<string> > vault_list;
PlaceInfo global_info;
LevelXPInfo global_xp_info;
quiver::ammo_history m_quiver_history;
quiver::action_cycler quiver_action;
// monsters mesmerising player; should be protected, but needs to be saved
// and restored.
vector<mid_t> beholders;
// monsters causing fear to the player; see above
vector<mid_t> fearmongers;
// Delayed level actions. This array is never trimmed, as usually D:1 won't
// be loaded again until the very end.
vector<daction_type> dactions;
// Path back from portal levels.
vector<level_pos> level_stack;
// The player's knowledge about item types.
id_arr type_ids;
// The version the save was last played with.
string prev_save_version;
// The biggest assigned monster id so far.
mid_t last_mid;
// Count of various types of actions made.
map<pair<caction_type, int>, FixedVector<int, 27> > action_count;
// Which branches have been noted to have been left during this game.
FixedBitVector<NUM_BRANCHES> branches_left;
// For now, only control the speed of abyss morphing.
int abyss_speed;
// Prompts or actions the player must answer before continuing.
// A stack -- back() is the first to go.
vector<pair<uncancellable_type, int> > uncancel;
// Hash seed for deterministic stuff.
uint64_t game_seed;
bool fully_seeded; // true on all games started since 0.23 seeding changes
bool deterministic_levelgen; // true if a game was started with incremental
// or full pregen.
// -------------------
// Non-saved UI state:
// -------------------
unsigned short prev_targ;
coord_def prev_grd_targ;
// Examining spell library spells for Sif Muna's ability
bool divine_exegesis;
// Coordinates of last travel target; note that this is never used by
// travel itself, only by the level-map to remember the last travel target.
short travel_x, travel_y;
level_id travel_z;
runrest running; // Nonzero if running/traveling.
bool received_weapon_warning;
bool received_noskill_warning;
bool wizmode_teleported_into_rock;
// This should really be unique_ptr, but that causes issues since files.cc
// uses the default constructor of `player`.
vector<shared_ptr<Delay>> delay_queue; // pending actions
chrono::time_point<chrono::system_clock> last_keypress_time;
bool wizard_vision;
map<skill_type, int8_t> skill_boost; // Skill bonuses.
bool digging;
// The last spell cast by the player.
spell_type last_cast_spell;
map<int,int> last_pickup;
int last_unequip;
// ---------------------------
// Volatile (same-turn) state:
// ---------------------------
bool turn_is_over; // player has performed a timed action
// If true, player is headed to the Abyss.
bool banished;
string banished_by;
int banished_power;
// If true, player has triggered a trap effect by exploring.
bool trapped;
// TODO burn this API with fire
bool wield_change; // redraw weapon
bool gear_change; // redraw equip bar
bool redraw_quiver; // redraw quiver
bool redraw_noise;
bool redraw_title;
bool redraw_hit_points;
bool redraw_magic_points;
FixedVector<bool, NUM_STATS> redraw_stats;
bool redraw_experience;
bool redraw_armour_class;
bool redraw_evasion;
bool redraw_status_lights;
colour_t flash_colour;
targeter *flash_where;
int time_taken;
// the loudest noise level the player has experienced in los this turn
int los_noise_level;
int los_noise_last_turn;
// Set when the character is going to a new level, to guard against levgen
// failures
dungeon_feature_type transit_stair;
bool entering_level;
int escaped_death_cause;
string escaped_death_aux;
int turn_damage; // cumulative damage per turn
mid_t damage_source; // death source of last damage done to player
int source_damage; // cumulative damage for you.damage_source
// When other levels are loaded (e.g. viewing), is the player on this level?
bool on_current_level;
// View code clears and needs new data in places where we can't announce
// the portal right away; delay the announcements then.
int seen_portals;
// Number of viewport refreshes.
unsigned int frame_no;
// ---------------------
// The save file itself.
// ---------------------
package *save;
protected:
FixedVector<PlaceInfo, NUM_BRANCHES> branch_info;
map<level_id, LevelXPInfo> level_xp_info;
public:
player();
virtual ~player();
void init_from_save_info(const player_save_info &s);
void init_skills();
// Set player position without updating view geometry.
void set_position(const coord_def &c) override;
// Low-level move the player. Use this instead of changing pos directly.
void moveto(const coord_def &c, bool clear_net = true) override;
bool move_to_pos(const coord_def &c, bool clear_net = true,
bool /*force*/ = false) override;
// Move the player during an abyss shift.
void shiftto(const coord_def &c);
bool blink_to(const coord_def& c, bool quiet = false) override;
void set_level_visited(const level_id &level);
bool level_visited(const level_id &level);
int stat(stat_type stat, bool nonneg = true) const;
int strength(bool nonneg = true) const;
int intel(bool nonneg = true) const;
int dex(bool nonneg = true) const;
int max_stat(stat_type stat, bool base = false) const;
int max_strength() const;
int max_intel() const;
int max_dex() const;
bool in_water() const;
bool in_liquid() const;
bool can_swim(bool permanently = false) const;
bool can_water_walk() const;
int visible_igrd(const coord_def&) const;
bool rampaging() const override;
bool is_banished() const override;
bool is_sufficiently_rested(bool starting=false) const; // Up to rest_wait_percent HP and MP.
bool is_web_immune() const override;
bool is_binding_sigil_immune() const override;
bool cannot_speak() const;
bool invisible() const override;
bool can_see_invisible() const override;
bool innate_sinv() const;
bool visible_to(const actor *looker) const override;
bool can_see(const actor& a) const override;
undead_state_type undead_state(bool temp = true) const;
bool nightvision() const override;
bool may_pruneify() const;
reach_type reach_range() const override;
bool see_cell(const coord_def& p) const override;
// Is c in view but behind a transparent wall?
bool trans_wall_blocking(const coord_def &c) const;
bool is_icy() const override;
bool is_fiery() const override;
bool is_skeletal() const override;
int heads() const override { return 1; }
bool spellcasting_unholy() const;
// Dealing with beholders. Implemented in behold.cc.
void add_beholder(const monster& mon, bool axe = false);
bool beheld() const;
bool beheld_by(const monster& mon) const;
monster* get_beholder(const coord_def &pos) const;
monster* get_any_beholder() const;
void remove_beholder(const monster& mon);
void clear_beholders();
void update_beholders();
void update_beholder(const monster* mon);
bool possible_beholder(const monster* mon) const;
// Dealing with fearmongers. Implemented in fearmonger.cc.
bool add_fearmonger(const monster* mon);
bool afraid() const;
bool afraid_of(const monster* mon) const;
monster* get_fearmonger(const coord_def &pos) const;
monster* get_any_fearmonger() const;
void remove_fearmonger(const monster* mon);
void clear_fearmongers();
void update_fearmongers();
void update_fearmonger(const monster* mon);
bool made_nervous_by(const monster *mons);
bool is_nervous();
kill_category kill_alignment() const override;
bool has_spell(spell_type spell) const override;
string shout_verb(bool directed = false) const;
int shout_volume() const;
item_def *slot_item(equipment_type eq, bool include_melded=false) const
override;
int base_ac_from(const item_def &armour, int scale = 1) const;
int corrosion_amount() const;
int inaccuracy() const override;
// actor
int mindex() const override;
int get_hit_dice() const override;
int get_experience_level() const override;
int get_max_xl() const;
bool is_player() const override
{
#ifndef DEBUG_GLOBALS
ASSERT(this == (actor*)&you); // there can be only one
#endif
return true;
}
monster* as_monster() override { return nullptr; }
player* as_player() override { return this; }
const monster* as_monster() const override { return nullptr; }
const player* as_player() const override { return this; }
god_type deity() const override;
bool alive() const override;
bool is_summoned(int* duration = nullptr,
int* summon_type = nullptr) const override;
bool is_perm_summoned() const override { return false; };
bool swimming() const override;
bool floundering() const override;
bool extra_balanced() const override;
bool slow_in_water() const;
bool shove(const char* feat_name = "") override;
bool can_pass_through_feat(dungeon_feature_type grid) const override;
bool can_burrow() const override;
bool is_habitable_feat(dungeon_feature_type actual_grid) const
override;
size_type body_size(size_part_type psize = PSIZE_TORSO,
bool base = false) const override;
brand_type damage_brand(int which_attack = -1) override;
vorpal_damage_type damage_type(int which_attack = -1) override;
random_var attack_delay(const item_def *projectile = nullptr,
bool rescale = true) const override;
random_var attack_delay_with(const item_def *projectile, bool rescale,
const item_def *weapon) const;
int constriction_damage(constrict_type typ) const override;
int has_claws(bool allow_tran = true) const override;
bool has_usable_claws(bool allow_tran = true) const;
int has_talons(bool allow_tran = true) const;
bool has_usable_talons(bool allow_tran = true) const;
int has_hooves(bool allow_tran = true) const;
bool has_usable_hooves(bool allow_tran = true) const;
int has_fangs(bool allow_tran = true) const;
int has_usable_fangs(bool allow_tran = true) const;
bool has_tail(bool allow_tran = true) const;
bool has_usable_offhand() const;
int has_pseudopods(bool allow_tran = true) const;
int has_usable_pseudopods(bool allow_tran = true) const;
int has_tentacles(bool allow_tran = true) const;
int has_usable_tentacles(bool allow_tran = true) const;
// Information about player mutations. Implemented in mutation.cc
int get_base_mutation_level(mutation_type mut, bool innate=true, bool temp=true, bool normal=true) const;
int get_mutation_level(mutation_type mut, bool check_form=true) const;
int get_mutation_level(mutation_type mut, mutation_activity_type minact) const;
int get_innate_mutation_level(mutation_type mut) const;
int get_temp_mutation_level(mutation_type mut) const;
int get_training_target(const skill_type sk) const;
bool set_training_target(const skill_type sk, const double target, bool announce=false);
bool set_training_target(const skill_type sk, const int target, bool announce=false);
void clear_training_targets();
bool has_temporary_mutation(mutation_type mut) const;
bool has_innate_mutation(mutation_type mut) const;
bool has_mutation(mutation_type mut, bool check_form=true) const;
int how_mutated(bool innate=false, bool levels=false, bool temp=true) const;
int wearing(equipment_type slot, int sub_type) const
override;
int wearing_ego(equipment_type slot, int type) const
override;
int scan_artefacts(artefact_prop_type which_property,
vector<const item_def *> *matches = nullptr) const override;
int infusion_amount() const;
item_def *weapon(int which_attack = -1) const override;
item_def *shield() const override;
item_def *offhand_weapon() const override;
hands_reqd_type hands_reqd(const item_def &item,
bool base = false) const override;
bool can_wield(const item_def &item,
bool ignore_curse = false,
bool ignore_brand = false,
bool ignore_shield = false,
bool ignore_transform = false) const override;
bool could_wield(const item_def &item,
bool ignore_brand = false,
bool ignore_transform = false,
bool quiet = true) const override;
bool wear_barding() const;
string name(description_level_type type, bool force_visible = false,
bool force_article = false) const override;
string pronoun(pronoun_type pro, bool force_visible = false) const override;
string conj_verb(const string &verb) const override;
string base_hand_name(bool plural, bool temp, bool *can_plural=nullptr) const;
string hand_name(bool plural, bool *can_plural = nullptr) const override;
string hands_verb(const string &plural_verb) const;
string hands_act(const string &plural_verb, const string &object) const;
string foot_name(bool plural, bool *can_plural = nullptr) const override;
string arm_name(bool plural, bool *can_plural = nullptr) const override;
int arm_count() const;
string unarmed_attack_name(string default_name="Nothing wielded") const;
bool fumbles_attack() override;
void attacking(actor *other) override;
bool can_go_berserk() const override;
bool can_go_berserk(bool intentional, bool potion = false,
bool quiet = false, string *reason = nullptr,
bool temp = true) const;
bool go_berserk(bool intentional, bool potion = false) override;
bool berserk() const override;
bool can_mutate() const override;
bool can_safely_mutate(bool temp = true) const override;
bool is_lifeless_undead(bool temp = true) const;
bool can_polymorph() const override;
bool can_bleed(bool allow_tran = true) const override;
bool can_drink(bool temp = true) const;
bool is_stationary() const override;
bool is_motile() const;
bool malmutate(const string &reason) override;
bool polymorph(int pow, bool allow_immobile = true) override;
void backlight();
void banish(const actor* /*agent*/, const string &who = "", const int power = 0,
bool force = false) override;
void blink() override;
void teleport(bool right_now = false,
bool wizard_tele = false) override;
void drain_stat(stat_type stat, int amount) override;
void expose_to_element(beam_type element, int strength = 0,
bool slow_cold_blood = true) override;
void god_conduct(conduct_type thing_done, int level) override;
bool poison(actor *agent, int amount = 1, bool force = false) override;
bool sicken(int amount) override;
void paralyse(const actor *, int str, string source = "") override;
void petrify(const actor *, bool force = false) override;
bool fully_petrify(bool quiet = false) override;
void slow_down(actor *, int str) override;
void confuse(actor *, int strength) override;
void weaken(actor *attacker, int pow) override;
bool strip_willpower(actor *attacker, int dur, bool quiet = false) override;
bool heal(int amount) override;
bool drain(const actor *, bool quiet = false, int pow = 3) override;
void splash_with_acid(actor *evildoer) override;
void acid_corrode(int acid_strength) override;
bool corrode_equipment(const char* corrosion_source = "the acid",
int degree = 1) override;
void sentinel_mark(bool trap = false);
int hurt(const actor *attacker, int amount,
beam_type flavour = BEAM_MISSILE,
kill_method_type kill_type = KILLED_BY_MONSTER,
string source = "",
string aux = "",
bool cleanup_dead = true,
bool attacker_effects = true) override;
bool wont_attack() const override { return true; };
mon_attitude_type temp_attitude() const override { return ATT_FRIENDLY; };
mon_attitude_type real_attitude() const override { return ATT_FRIENDLY; };
monster_type mons_species(bool zombie_base = false) const override;
mon_holy_type holiness(bool temp = true, bool incl_form = true) const override;
bool undead_or_demonic(bool temp = true) const override;
bool evil() const override;
bool is_holy() const override;
bool is_nonliving(bool temp = true, bool incl_form = true) const override;
int how_chaotic(bool check_spells_god) const override;
bool is_unbreathing() const override;
bool is_insubstantial() const override;
int res_acid() const override;
bool res_damnation() const override { return false; };
int res_fire() const override;
int res_steam() const override;
int res_cold() const override;
int res_elec() const override;
int res_poison(bool temp = true) const override;
bool res_miasma(bool temp = true) const override;
bool res_water_drowning() const override;
bool res_sticky_flame() const override;
int res_holy_energy() const override;
int res_foul_flame() const override;
int res_negative_energy(bool intrinsic_only = false) const override;
bool res_torment() const override;
bool res_polar_vortex() const override;
bool res_petrify(bool temp = true) const override;
bool res_constrict() const override;
int willpower() const override;
bool no_tele(bool blink = false, bool temp = true) const override;
string no_tele_reason(bool blink = false, bool temp = true) const;
bool antimagic_susceptible() const override;
bool res_corr(bool allow_random = true, bool temp = true) const override;
bool clarity(bool items = true) const override;
bool faith(bool items = true) const override;
bool stasis() const override;
bool cloud_immune(bool items = true) const override;
bool airborne() const override;
bool permanent_flight(bool include_equip = true) const;
bool racial_permanent_flight() const;
int get_noise_perception(bool adjusted = true) const;
bool is_dragonkind() const override;
bool paralysed() const override;
bool cannot_act() const override;
bool confused() const override;
bool caught() const override;
bool backlit(bool self_halo = true, bool temp = true) const override;
bool umbra() const override;
int halo_radius() const override;
int silence_radius() const override;
int demon_silence_radius() const override;
int liquefying_radius() const override;
int umbra_radius() const override;
bool petrifying() const override;
bool petrified() const override;
bool liquefied_ground() const override;
bool incapacitated() const override
{
return actor::incapacitated() || duration[DUR_CLUMSY];
}
bool immune_to_hex(const spell_type hex) const;
bool asleep() const override;
void put_to_sleep(actor *, int power = 0, bool hibernate = false) override;
void awaken();
void check_awaken(int disturbance) override;
int beam_resists(bolt &beam, int hurted, bool doEffects, string source)
override;
bool can_feel_fear(bool include_unknown) const override;
bool resists_dislodge(string event = "") const override;
bool can_throw_large_rocks() const override;
bool can_smell() const;
bool can_sleep(bool holi_only = false) const override;
int racial_ac(bool temp) const;
int base_ac(int scale) const;
int armour_class() const override;
int gdr_perc() const override;
int evasion(bool ignore_temporary = false,
const actor *attacker = nullptr) const override;
int evasion_scaled(int scale, bool ignore_temporary = false,
const actor *attacker = nullptr) const;
int stat_hp() const override { return hp; }
int stat_maxhp() const override { return hp_max; }
int stealth() const override { return player_stealth(); }
bool shielded() const override;
int shield_bonus() const override;
int shield_bypass_ability(int tohit) const override;
void shield_block_succeeded(actor *attacker) override;
bool missile_repulsion() const override;
// Combat-related adjusted penalty calculation methods
int unadjusted_body_armour_penalty() const;
int adjusted_body_armour_penalty(int scale = 1) const;
int adjusted_shield_penalty(int scale = 1) const;
// Calculates total permanent EV/SH if the player was/wasn't wearing a given item
void ac_ev_sh_with_specific_item(int scale, const item_def& new_item,
int *ac, int *ev, int *sh);
void ac_ev_sh_without_specific_item(int scale, const item_def& item_to_remove,
int *ac, int *ev, int *sh);
bool wearing_light_armour(bool with_skill = false) const;
int skill(skill_type skill, int scale = 1, bool real = false,
bool temp = true) const override;
bool using_talisman(const item_def &talisman) const;
bool do_shaft() override;
bool shaftable() const;
bool can_do_shaft_ability(bool quiet = false) const;
bool do_shaft_ability();
bool can_potion_heal(bool temp=true);
int scale_potion_healing(int healing_amount);
int scale_potion_mp_healing(int healing_amount);
void apply_location_effects(const coord_def &oldpos,
killer_type killer = KILL_NONE,
int killernum = -1) override;
void did_deliberate_movement() override;
void be_agile(int pow);
int rev_percent() const;
int rev_tier() const;
void rev_up(int time_taken);
void rev_down(int time_taken);
bool allies_forbidden();
// TODO: move this somewhere else
void refresh_rampage_hints();
////////////////////////////////////////////////////////////////
PlaceInfo& get_place_info() const ; // Current place info
PlaceInfo& get_place_info(branch_type branch) const;
void clear_place_info();
LevelXPInfo& get_level_xp_info();
LevelXPInfo& get_level_xp_info(const level_id &lev);
void goto_place(const level_id &level);
void set_place_info(PlaceInfo info);
// Returns copies of the PlaceInfo; modifying the vector won't
// modify the player object.
vector<PlaceInfo> get_all_place_info(bool visited_only = false,
bool dungeon_only = false) const;
void set_level_xp_info(LevelXPInfo &xp_info);
vector<LevelXPInfo> get_all_xp_info(bool must_have_kills = false) const;
bool did_escape_death() const;
void reset_escaped_death();
void add_gold(int delta);
void del_gold(int delta);
void set_gold(int amount);
void increase_duration(duration_type dur, int turns, int cap = 0,
const char* msg = nullptr);
void set_duration(duration_type dur, int turns, int cap = 0,
const char *msg = nullptr);
bool attempt_escape() override;
int usable_tentacles() const;
bool has_usable_tentacle() const override;
bool form_uses_xl() const;
bool clear_far_engulf(bool force = false, bool moved = false) override;
int armour_class_scaled(int scale) const;
int ac_changes_from_mutations() const;
vector<const item_def *> get_armour_items() const;
vector<const item_def *> get_armour_items_one_sub(const item_def& sub) const;
vector<const item_def *> get_armour_items_one_removal(const item_def& sub) const;
int base_ac_with_specific_items(int scale,
vector<const item_def *> armour_items) const;
int armour_class_with_specific_items(int scale,
vector<const item_def *> items) const;
protected:
void _removed_beholder(bool quiet = false);
bool _possible_beholder(const monster* mon) const;
void _removed_fearmonger(bool quiet = false);
bool _possible_fearmonger(const monster* mon) const;
};
class monster;
struct item_def;
class player_vanishes
{
coord_def source;
bool movement;
public:
player_vanishes(bool _movement=false);
~player_vanishes();
};
// Helper. Use move_player_to_grid or player::apply_location_effects instead.
void moveto_location_effects(dungeon_feature_type old_feat,
bool stepped=false, const coord_def& old_pos=coord_def());
bool check_moveto(const coord_def& p, const string &move_verb = "step",
bool physically = true);
bool check_moveto_terrain(const coord_def& p, const string &move_verb,
const string &msg = "", bool *prompted = nullptr);
bool check_moveto_cloud(const coord_def& p, const string &move_verb = "step",
bool *prompted = nullptr);
bool check_moveto_exclusions(const vector<coord_def> &areas,
const string &move_verb = "step",
bool *prompted = nullptr);
bool check_moveto_exclusion(const coord_def& p,
const string &move_verb = "step",
bool *prompted = nullptr);
bool check_moveto_trap(const coord_def& p, const string &move_verb = "step",
bool *prompted = nullptr);
bool swap_check(monster* mons, coord_def &loc, bool quiet = false);