1 #include "player/player-status-flags.h"
2 #include "art-definition/art-sword-types.h"
4 #include "inventory/inventory-slot-types.h"
5 #include "monster-race/monster-race.h"
6 #include "monster-race/race-flags2.h"
7 #include "monster-race/race-flags7.h"
8 #include "mutation/mutation-flag-types.h"
9 #include "object-enchant/object-ego.h"
10 #include "object-enchant/tr-types.h"
11 #include "object-enchant/trc-types.h"
12 #include "object-hook/hook-checker.h"
13 #include "object-hook/hook-weapon.h"
14 #include "object/object-flags.h"
15 #include "player/player-class.h"
16 #include "player/player-race-types.h"
17 #include "player/player-race.h"
18 #include "player/player-skill.h"
19 #include "player/player-status.h"
20 #include "player/special-defense-types.h"
21 #include "realm/realm-hex-numbers.h"
22 #include "realm/realm-song-numbers.h"
23 #include "realm/realm-types.h"
24 #include "spell-realm/spells-hex.h"
25 #include "sv-definition/sv-weapon-types.h"
26 #include "system/floor-type-definition.h"
27 #include "system/monster-type-definition.h"
28 #include "system/object-type-definition.h"
29 #include "util/bit-flags-calculator.h"
30 #include "util/quarks.h"
31 #include "util/string-processor.h"
33 bool have_kill_wall(player_type *creature_ptr)
35 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD || music_singing(creature_ptr, MUSIC_WALL)) {
39 if (creature_ptr->riding) {
40 monster_type *riding_m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
41 monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
42 if (riding_r_ptr->flags2 & RF2_KILL_WALL)
49 bool have_pass_wall(player_type *creature_ptr)
53 if (creature_ptr->wraith_form || creature_ptr->tim_pass_wall || (!creature_ptr->mimic_form && creature_ptr->prace == RACE_SPECTRE)) {
57 if (creature_ptr->riding) {
58 monster_type *riding_m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
59 monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
60 if (!(riding_r_ptr->flags2 & RF2_PASS_WALL))
67 void have_xtra_might(player_type *creature_ptr)
70 BIT_FLAGS flgs[TR_FLAG_SIZE];
72 creature_ptr->xtra_might = FALSE;
74 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
75 o_ptr = &creature_ptr->inventory_list[i];
79 object_flags(creature_ptr, o_ptr, flgs);
81 if (have_flag(flgs, TR_XTRA_MIGHT))
82 creature_ptr->xtra_might = TRUE;
86 void have_esp_evil(player_type *creature_ptr)
89 BIT_FLAGS flgs[TR_FLAG_SIZE];
91 creature_ptr->esp_evil = FALSE;
93 if (creature_ptr->realm1 == REALM_HEX) {
94 if (hex_spelling(creature_ptr, HEX_DETECT_EVIL))
95 creature_ptr->esp_evil = TRUE;
98 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
99 o_ptr = &creature_ptr->inventory_list[i];
103 object_flags(creature_ptr, o_ptr, flgs);
105 if (have_flag(flgs, TR_ESP_EVIL))
106 creature_ptr->esp_evil = TRUE;
110 void have_esp_animal(player_type *creature_ptr)
113 BIT_FLAGS flgs[TR_FLAG_SIZE];
115 creature_ptr->esp_animal = FALSE;
117 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
118 o_ptr = &creature_ptr->inventory_list[i];
122 object_flags(creature_ptr, o_ptr, flgs);
124 if (have_flag(flgs, TR_ESP_ANIMAL))
125 creature_ptr->esp_animal = TRUE;
129 void have_esp_undead(player_type *creature_ptr)
132 BIT_FLAGS flgs[TR_FLAG_SIZE];
134 creature_ptr->esp_undead = FALSE;
136 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
137 o_ptr = &creature_ptr->inventory_list[i];
141 object_flags(creature_ptr, o_ptr, flgs);
143 if (have_flag(flgs, TR_ESP_UNDEAD))
144 creature_ptr->esp_undead = TRUE;
148 void have_esp_demon(player_type *creature_ptr)
151 BIT_FLAGS flgs[TR_FLAG_SIZE];
153 creature_ptr->esp_demon = FALSE;
155 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
156 o_ptr = &creature_ptr->inventory_list[i];
160 object_flags(creature_ptr, o_ptr, flgs);
162 if (have_flag(flgs, TR_ESP_DEMON))
163 creature_ptr->esp_demon = TRUE;
167 void have_esp_orc(player_type *creature_ptr)
170 BIT_FLAGS flgs[TR_FLAG_SIZE];
172 creature_ptr->esp_orc = FALSE;
174 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
175 o_ptr = &creature_ptr->inventory_list[i];
179 object_flags(creature_ptr, o_ptr, flgs);
181 if (have_flag(flgs, TR_ESP_ORC))
182 creature_ptr->esp_orc = TRUE;
186 void have_esp_troll(player_type *creature_ptr)
189 BIT_FLAGS flgs[TR_FLAG_SIZE];
191 creature_ptr->esp_troll = FALSE;
193 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
194 o_ptr = &creature_ptr->inventory_list[i];
198 object_flags(creature_ptr, o_ptr, flgs);
200 if (have_flag(flgs, TR_ESP_TROLL))
201 creature_ptr->esp_troll = TRUE;
205 void have_esp_giant(player_type *creature_ptr)
208 BIT_FLAGS flgs[TR_FLAG_SIZE];
210 creature_ptr->esp_giant = FALSE;
212 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
213 o_ptr = &creature_ptr->inventory_list[i];
217 object_flags(creature_ptr, o_ptr, flgs);
219 if (have_flag(flgs, TR_ESP_GIANT))
220 creature_ptr->esp_giant = TRUE;
224 void have_esp_dragon(player_type *creature_ptr)
227 BIT_FLAGS flgs[TR_FLAG_SIZE];
229 creature_ptr->esp_dragon = FALSE;
231 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
232 o_ptr = &creature_ptr->inventory_list[i];
236 object_flags(creature_ptr, o_ptr, flgs);
238 if (have_flag(flgs, TR_ESP_DRAGON))
239 creature_ptr->esp_dragon = TRUE;
243 void have_esp_human(player_type *creature_ptr)
246 BIT_FLAGS flgs[TR_FLAG_SIZE];
248 creature_ptr->esp_human = FALSE;
250 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
251 o_ptr = &creature_ptr->inventory_list[i];
255 object_flags(creature_ptr, o_ptr, flgs);
257 if (have_flag(flgs, TR_ESP_HUMAN))
258 creature_ptr->esp_human = TRUE;
262 void have_esp_good(player_type *creature_ptr)
265 BIT_FLAGS flgs[TR_FLAG_SIZE];
267 creature_ptr->esp_good = FALSE;
269 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
270 o_ptr = &creature_ptr->inventory_list[i];
274 object_flags(creature_ptr, o_ptr, flgs);
276 if (have_flag(flgs, TR_ESP_GOOD))
277 creature_ptr->esp_good = TRUE;
281 void have_esp_nonliving(player_type *creature_ptr)
284 BIT_FLAGS flgs[TR_FLAG_SIZE];
286 creature_ptr->esp_nonliving = FALSE;
288 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
289 o_ptr = &creature_ptr->inventory_list[i];
293 object_flags(creature_ptr, o_ptr, flgs);
295 if (have_flag(flgs, TR_ESP_NONLIVING))
296 creature_ptr->esp_nonliving = TRUE;
300 void have_esp_unique(player_type *creature_ptr)
303 BIT_FLAGS flgs[TR_FLAG_SIZE];
305 creature_ptr->esp_unique = FALSE;
307 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
308 o_ptr = &creature_ptr->inventory_list[i];
312 object_flags(creature_ptr, o_ptr, flgs);
314 if (have_flag(flgs, TR_ESP_UNIQUE))
315 creature_ptr->esp_unique = TRUE;
319 void have_esp_telepathy(player_type *creature_ptr)
322 BIT_FLAGS flgs[TR_FLAG_SIZE];
324 creature_ptr->telepathy = FALSE;
326 if (is_time_limit_esp(creature_ptr)) {
327 creature_ptr->telepathy = TRUE;
330 if (creature_ptr->muta3 & MUT3_ESP) {
331 creature_ptr->telepathy = TRUE;
334 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_MIND_FLAYER && creature_ptr->lev > 29)
335 creature_ptr->telepathy = TRUE;
337 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_SPECTRE && creature_ptr->lev > 34)
338 creature_ptr->telepathy = TRUE;
340 if (creature_ptr->pclass == CLASS_MINDCRAFTER && creature_ptr->lev > 39)
341 creature_ptr->telepathy = TRUE;
343 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
344 creature_ptr->telepathy = TRUE;
347 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
348 creature_ptr->telepathy = TRUE;
351 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
352 o_ptr = &creature_ptr->inventory_list[i];
356 object_flags(creature_ptr, o_ptr, flgs);
358 if (have_flag(flgs, TR_TELEPATHY))
359 creature_ptr->telepathy = TRUE;
363 void have_bless_blade(player_type *creature_ptr)
366 BIT_FLAGS flgs[TR_FLAG_SIZE];
368 creature_ptr->bless_blade = FALSE;
370 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
371 o_ptr = &creature_ptr->inventory_list[i];
375 object_flags(creature_ptr, o_ptr, flgs);
377 if (have_flag(flgs, TR_BLESSED))
378 creature_ptr->bless_blade = TRUE;
382 void have_easy2_weapon(player_type *creature_ptr)
385 BIT_FLAGS flgs[TR_FLAG_SIZE];
387 creature_ptr->easy_2weapon = FALSE;
389 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
390 o_ptr = &creature_ptr->inventory_list[i];
394 object_flags(creature_ptr, o_ptr, flgs);
396 if (o_ptr->name2 == EGO_2WEAPON)
397 creature_ptr->easy_2weapon = TRUE;
401 void have_down_saving(player_type *creature_ptr)
404 BIT_FLAGS flgs[TR_FLAG_SIZE];
406 creature_ptr->down_saving = FALSE;
408 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
409 o_ptr = &creature_ptr->inventory_list[i];
413 object_flags(creature_ptr, o_ptr, flgs);
415 if (o_ptr->name2 == EGO_AMU_NAIVETY)
416 creature_ptr->down_saving = TRUE;
420 void have_no_ac(player_type *creature_ptr)
423 BIT_FLAGS flgs[TR_FLAG_SIZE];
425 creature_ptr->yoiyami = FALSE;
427 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
428 o_ptr = &creature_ptr->inventory_list[i];
432 object_flags(creature_ptr, o_ptr, flgs);
434 if (o_ptr->name2 == EGO_YOIYAMI)
435 creature_ptr->yoiyami = TRUE;
439 void have_no_flowed(player_type *creature_ptr)
442 bool have_sw = FALSE, have_kabe = FALSE;
443 OBJECT_IDX this_o_idx, next_o_idx = 0;
445 creature_ptr->no_flowed = FALSE;
447 if (creature_ptr->pass_wall && !creature_ptr->kill_wall)
448 creature_ptr->no_flowed = TRUE;
450 for (int i = 0; i < INVEN_PACK; i++) {
451 if ((creature_ptr->inventory_list[i].tval == TV_NATURE_BOOK) && (creature_ptr->inventory_list[i].sval == 2))
453 if ((creature_ptr->inventory_list[i].tval == TV_CRAFT_BOOK) && (creature_ptr->inventory_list[i].sval == 2))
457 for (this_o_idx = creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx) {
458 o_ptr = &creature_ptr->current_floor_ptr->o_list[this_o_idx];
459 next_o_idx = o_ptr->next_o_idx;
461 if ((o_ptr->tval == TV_NATURE_BOOK) && (o_ptr->sval == 2))
463 if ((o_ptr->tval == TV_CRAFT_BOOK) && (o_ptr->sval == 2))
467 if (have_sw && ((creature_ptr->realm1 == REALM_NATURE) || (creature_ptr->realm2 == REALM_NATURE) || (creature_ptr->pclass == CLASS_SORCERER))) {
468 const magic_type *s_ptr = &mp_ptr->info[REALM_NATURE - 1][SPELL_SW];
469 if (creature_ptr->lev >= s_ptr->slevel)
470 creature_ptr->no_flowed = TRUE;
473 if (have_kabe && ((creature_ptr->realm1 == REALM_CRAFT) || (creature_ptr->realm2 == REALM_CRAFT) || (creature_ptr->pclass == CLASS_SORCERER))) {
474 const magic_type *s_ptr = &mp_ptr->info[REALM_CRAFT - 1][SPELL_WALL];
475 if (creature_ptr->lev >= s_ptr->slevel)
476 creature_ptr->no_flowed = TRUE;
480 void have_mighty_throw(player_type *creature_ptr)
484 creature_ptr->mighty_throw = FALSE;
486 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
487 o_ptr = &creature_ptr->inventory_list[i];
491 if (o_ptr->name2 == EGO_RING_THROW)
492 creature_ptr->mighty_throw = TRUE;
496 void have_dec_mana(player_type *creature_ptr)
499 BIT_FLAGS flgs[TR_FLAG_SIZE];
501 creature_ptr->xtra_might = FALSE;
503 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
504 o_ptr = &creature_ptr->inventory_list[i];
508 object_flags(creature_ptr, o_ptr, flgs);
510 if (have_flag(flgs, TR_DEC_MANA))
511 creature_ptr->dec_mana = TRUE;
515 void have_reflect(player_type *creature_ptr)
518 BIT_FLAGS flgs[TR_FLAG_SIZE];
520 creature_ptr->reflect = FALSE;
522 if (creature_ptr->pclass == CLASS_BERSERKER && creature_ptr->lev > 39)
523 creature_ptr->reflect = TRUE;
525 if (creature_ptr->pclass == CLASS_MIRROR_MASTER && creature_ptr->lev > 39)
526 creature_ptr->reflect = TRUE;
528 if (creature_ptr->special_defense & KAMAE_GENBU) {
529 creature_ptr->reflect = TRUE;
532 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
533 creature_ptr->reflect = TRUE;
536 if (creature_ptr->wraith_form) {
537 creature_ptr->reflect = TRUE;
540 if (creature_ptr->magicdef) {
541 creature_ptr->reflect = TRUE;
544 if (creature_ptr->tim_reflect) {
545 creature_ptr->reflect = TRUE;
548 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
549 o_ptr = &creature_ptr->inventory_list[i];
553 object_flags(creature_ptr, o_ptr, flgs);
555 if (have_flag(flgs, TR_REFLECT))
556 creature_ptr->reflect = TRUE;
560 void have_see_nocto(player_type *creature_ptr)
562 creature_ptr->see_nocto = FALSE;
564 if (creature_ptr->pclass == CLASS_NINJA)
565 creature_ptr->see_nocto = TRUE;
568 void have_warning(player_type *creature_ptr)
571 BIT_FLAGS flgs[TR_FLAG_SIZE];
573 creature_ptr->warning = FALSE;
575 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
576 o_ptr = &creature_ptr->inventory_list[i];
580 object_flags(creature_ptr, o_ptr, flgs);
582 if (have_flag(flgs, TR_WARNING)) {
583 if (!o_ptr->inscription || !(angband_strchr(quark_str(o_ptr->inscription), '$')))
584 creature_ptr->warning = TRUE;
589 void have_anti_magic(player_type *creature_ptr)
592 BIT_FLAGS flgs[TR_FLAG_SIZE];
594 creature_ptr->anti_magic = FALSE;
596 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
597 o_ptr = &creature_ptr->inventory_list[i];
601 object_flags(creature_ptr, o_ptr, flgs);
603 if (have_flag(flgs, TR_NO_MAGIC))
604 creature_ptr->anti_magic = TRUE;
608 void have_anti_tele(player_type *creature_ptr)
611 BIT_FLAGS flgs[TR_FLAG_SIZE];
613 creature_ptr->anti_tele = FALSE;
615 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
616 o_ptr = &creature_ptr->inventory_list[i];
620 object_flags(creature_ptr, o_ptr, flgs);
622 if (have_flag(flgs, TR_NO_TELE))
623 creature_ptr->anti_tele = TRUE;
627 void have_sh_fire(player_type *creature_ptr)
630 BIT_FLAGS flgs[TR_FLAG_SIZE];
631 creature_ptr->sh_fire = FALSE;
633 if (creature_ptr->muta3 & MUT3_FIRE_BODY) {
634 creature_ptr->sh_fire = TRUE;
637 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
638 creature_ptr->sh_fire = TRUE;
641 if (creature_ptr->realm1 == REALM_HEX) {
642 if (hex_spelling(creature_ptr, HEX_DEMON_AURA)) {
643 creature_ptr->sh_fire = TRUE;
647 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
648 creature_ptr->sh_fire = TRUE;
651 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
652 creature_ptr->sh_fire = TRUE;
655 if (creature_ptr->tim_sh_fire) {
656 creature_ptr->sh_fire = TRUE;
659 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
660 o_ptr = &creature_ptr->inventory_list[i];
664 object_flags(creature_ptr, o_ptr, flgs);
665 if (have_flag(flgs, TR_SH_FIRE))
666 creature_ptr->sh_fire = TRUE;
670 void have_sh_elec(player_type *creature_ptr)
673 BIT_FLAGS flgs[TR_FLAG_SIZE];
674 creature_ptr->sh_elec = FALSE;
676 if (creature_ptr->muta3 & MUT3_ELEC_TOUC)
677 creature_ptr->sh_elec = TRUE;
679 if (creature_ptr->realm1 == REALM_HEX) {
680 if (hex_spelling(creature_ptr, HEX_SHOCK_CLOAK)) {
681 creature_ptr->sh_elec = TRUE;
685 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
686 creature_ptr->sh_elec = TRUE;
689 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
690 creature_ptr->sh_elec = TRUE;
693 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
694 o_ptr = &creature_ptr->inventory_list[i];
698 object_flags(creature_ptr, o_ptr, flgs);
699 if (have_flag(flgs, TR_SH_ELEC))
700 creature_ptr->sh_elec = TRUE;
704 void have_sh_cold(player_type *creature_ptr)
707 BIT_FLAGS flgs[TR_FLAG_SIZE];
708 creature_ptr->sh_cold = FALSE;
710 if (creature_ptr->realm1 == REALM_HEX) {
711 if (hex_spelling(creature_ptr, HEX_ICE_ARMOR)) {
712 creature_ptr->sh_cold = TRUE;
716 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
717 creature_ptr->sh_cold = TRUE;
720 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
721 creature_ptr->sh_cold = TRUE;
724 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
725 o_ptr = &creature_ptr->inventory_list[i];
729 object_flags(creature_ptr, o_ptr, flgs);
730 if (have_flag(flgs, TR_SH_COLD))
731 creature_ptr->sh_cold = TRUE;
735 void have_easy_spell(player_type *creature_ptr)
738 BIT_FLAGS flgs[TR_FLAG_SIZE];
739 creature_ptr->easy_spell = FALSE;
740 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
741 o_ptr = &creature_ptr->inventory_list[i];
745 object_flags(creature_ptr, o_ptr, flgs);
746 if (have_flag(flgs, TR_EASY_SPELL))
747 creature_ptr->easy_spell = TRUE;
751 void have_heavy_spell(player_type *creature_ptr)
754 BIT_FLAGS flgs[TR_FLAG_SIZE];
755 creature_ptr->heavy_spell = FALSE;
756 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
757 o_ptr = &creature_ptr->inventory_list[i];
761 object_flags(creature_ptr, o_ptr, flgs);
762 if (o_ptr->name2 == EGO_AMU_FOOL)
763 creature_ptr->heavy_spell = TRUE;
767 void have_hold_exp(player_type *creature_ptr)
770 BIT_FLAGS flgs[TR_FLAG_SIZE];
772 creature_ptr->hold_exp = FALSE;
774 if (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN) {
775 creature_ptr->hold_exp = TRUE;
778 if (creature_ptr->mimic_form == MIMIC_DEMON || creature_ptr->mimic_form == MIMIC_DEMON_LORD || creature_ptr->mimic_form == MIMIC_VAMPIRE) {
779 creature_ptr->hold_exp = TRUE;
782 if (is_specific_player_race(creature_ptr, RACE_HOBBIT) || is_specific_player_race(creature_ptr, RACE_SKELETON) ||
783 is_specific_player_race(creature_ptr, RACE_ZOMBIE) || is_specific_player_race(creature_ptr, RACE_VAMPIRE) ||
784 is_specific_player_race(creature_ptr, RACE_SPECTRE) || is_specific_player_race(creature_ptr, RACE_BALROG) ||
785 is_specific_player_race(creature_ptr, RACE_ANDROID)) {
786 creature_ptr->hold_exp = TRUE;
789 if (is_specific_player_race(creature_ptr, RACE_GOLEM)) {
790 if (creature_ptr->lev > 34)
791 creature_ptr->hold_exp = TRUE;
794 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
795 creature_ptr->hold_exp = TRUE;
798 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
799 o_ptr = &creature_ptr->inventory_list[i];
803 object_flags(creature_ptr, o_ptr, flgs);
804 if (have_flag(flgs, TR_HOLD_EXP))
805 creature_ptr->hold_exp = TRUE;
809 void have_see_inv(player_type *creature_ptr)
812 BIT_FLAGS flgs[TR_FLAG_SIZE];
813 creature_ptr->see_inv = FALSE;
815 if (creature_ptr->pclass == CLASS_NINJA || creature_ptr->lev > 29)
816 creature_ptr->see_inv = TRUE;
818 if (creature_ptr->mimic_form == MIMIC_DEMON || creature_ptr->mimic_form == MIMIC_DEMON_LORD || creature_ptr->mimic_form == MIMIC_VAMPIRE) {
819 creature_ptr->see_inv = TRUE;
822 if (!creature_ptr->mimic_form
823 && (creature_ptr->prace == RACE_HIGH_ELF || creature_ptr->prace == RACE_GOLEM || creature_ptr->prace == RACE_SKELETON
824 || creature_ptr->prace == RACE_ZOMBIE || creature_ptr->prace == RACE_SPECTRE || creature_ptr->prace == RACE_ARCHON)) {
825 creature_ptr->see_inv = TRUE;
828 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_DARK_ELF) {
829 if (creature_ptr->lev > 19)
830 creature_ptr->see_inv = TRUE;
833 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_MIND_FLAYER) {
834 if (creature_ptr->lev > 14)
835 creature_ptr->see_inv = TRUE;
838 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_IMP || creature_ptr->prace == RACE_BALROG)) {
839 if (creature_ptr->lev > 9)
840 creature_ptr->see_inv = TRUE;
843 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
844 creature_ptr->see_inv = TRUE;
847 if (creature_ptr->tim_invis) {
848 creature_ptr->see_inv = TRUE;
851 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
852 o_ptr = &creature_ptr->inventory_list[i];
856 object_flags(creature_ptr, o_ptr, flgs);
857 if (have_flag(flgs, TR_SEE_INVIS))
858 creature_ptr->see_inv = TRUE;
862 void have_free_act(player_type *creature_ptr)
865 BIT_FLAGS flgs[TR_FLAG_SIZE];
866 creature_ptr->free_act = FALSE;
868 if (creature_ptr->muta3 & MUT3_MOTION)
869 creature_ptr->free_act = TRUE;
871 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_GNOME) {
872 creature_ptr->free_act = TRUE;
875 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_GOLEM) {
876 creature_ptr->free_act = TRUE;
879 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_SPECTRE) {
880 creature_ptr->free_act = TRUE;
883 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_ANDROID) {
884 creature_ptr->free_act = TRUE;
887 if (heavy_armor(creature_ptr) && (!creature_ptr->inventory_list[INVEN_RARM].k_idx || have_right_hand_weapon(creature_ptr))
888 && (!creature_ptr->inventory_list[INVEN_LARM].k_idx || have_left_hand_weapon(creature_ptr))) {
889 if (creature_ptr->lev > 24)
890 creature_ptr->free_act = TRUE;
893 if (creature_ptr->pclass == CLASS_MONK || creature_ptr->pclass == CLASS_FORCETRAINER) {
894 if (!(heavy_armor(creature_ptr))) {
895 if (creature_ptr->lev > 24)
896 creature_ptr->free_act = TRUE;
900 if (creature_ptr->pclass == CLASS_BERSERKER) {
901 creature_ptr->free_act = TRUE;
904 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
905 creature_ptr->free_act = TRUE;
908 if (creature_ptr->magicdef) {
909 creature_ptr->free_act = TRUE;
912 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
913 o_ptr = &creature_ptr->inventory_list[i];
917 object_flags(creature_ptr, o_ptr, flgs);
918 if (have_flag(flgs, TR_FREE_ACT))
919 creature_ptr->free_act = TRUE;
923 void have_sustain_str(player_type *creature_ptr)
926 BIT_FLAGS flgs[TR_FLAG_SIZE];
927 creature_ptr->sustain_str = FALSE;
928 if (creature_ptr->pclass == CLASS_BERSERKER) {
929 creature_ptr->sustain_str = TRUE;
931 if (!creature_ptr->mimic_form
932 && (creature_ptr->prace == RACE_HALF_TROLL || creature_ptr->prace == RACE_HALF_OGRE || creature_ptr->prace == RACE_HALF_GIANT)) {
933 creature_ptr->sustain_str = TRUE;
935 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
936 creature_ptr->sustain_str = TRUE;
939 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
940 o_ptr = &creature_ptr->inventory_list[i];
944 object_flags(creature_ptr, o_ptr, flgs);
945 if (have_flag(flgs, TR_SUST_STR))
946 creature_ptr->sustain_str = TRUE;
950 void have_sustain_int(player_type *creature_ptr)
953 BIT_FLAGS flgs[TR_FLAG_SIZE];
954 creature_ptr->sustain_int = FALSE;
955 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_MIND_FLAYER)) {
956 creature_ptr->sustain_int = TRUE;
959 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
960 creature_ptr->sustain_int = TRUE;
963 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
964 o_ptr = &creature_ptr->inventory_list[i];
968 object_flags(creature_ptr, o_ptr, flgs);
969 if (have_flag(flgs, TR_SUST_INT))
970 creature_ptr->sustain_int = TRUE;
974 void have_sustain_wis(player_type *creature_ptr)
977 BIT_FLAGS flgs[TR_FLAG_SIZE];
978 creature_ptr->sustain_wis = FALSE;
979 if (creature_ptr->pclass == CLASS_MINDCRAFTER && creature_ptr->lev > 19)
980 creature_ptr->sustain_wis = TRUE;
982 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_MIND_FLAYER)) {
983 creature_ptr->sustain_wis = TRUE;
986 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
987 creature_ptr->sustain_wis = TRUE;
990 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
991 o_ptr = &creature_ptr->inventory_list[i];
995 object_flags(creature_ptr, o_ptr, flgs);
996 if (have_flag(flgs, TR_SUST_WIS))
997 creature_ptr->sustain_wis = TRUE;
1001 void have_sustain_dex(player_type *creature_ptr)
1004 BIT_FLAGS flgs[TR_FLAG_SIZE];
1005 creature_ptr->sustain_dex = FALSE;
1006 if (creature_ptr->pclass == CLASS_BERSERKER) {
1007 creature_ptr->sustain_dex = TRUE;
1010 if (creature_ptr->pclass == CLASS_NINJA && creature_ptr->lev > 24)
1011 creature_ptr->sustain_dex = TRUE;
1013 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1014 creature_ptr->sustain_dex = TRUE;
1017 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1018 o_ptr = &creature_ptr->inventory_list[i];
1022 object_flags(creature_ptr, o_ptr, flgs);
1023 if (have_flag(flgs, TR_SUST_DEX))
1024 creature_ptr->sustain_dex = TRUE;
1028 void have_sustain_con(player_type *creature_ptr)
1031 BIT_FLAGS flgs[TR_FLAG_SIZE];
1032 creature_ptr->sustain_con = FALSE;
1033 if (creature_ptr->pclass == CLASS_BERSERKER) {
1034 creature_ptr->sustain_con = TRUE;
1037 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_AMBERITE || creature_ptr->prace == RACE_DUNADAN)) {
1038 creature_ptr->sustain_con = TRUE;
1041 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1042 creature_ptr->sustain_con = TRUE;
1045 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1046 o_ptr = &creature_ptr->inventory_list[i];
1050 object_flags(creature_ptr, o_ptr, flgs);
1051 if (have_flag(flgs, TR_SUST_CON))
1052 creature_ptr->sustain_con = TRUE;
1056 void have_sustain_chr(player_type *creature_ptr)
1059 BIT_FLAGS flgs[TR_FLAG_SIZE];
1060 creature_ptr->sustain_chr = FALSE;
1062 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1063 creature_ptr->sustain_chr = TRUE;
1066 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1067 o_ptr = &creature_ptr->inventory_list[i];
1071 object_flags(creature_ptr, o_ptr, flgs);
1072 if (have_flag(flgs, TR_SUST_CHR))
1073 creature_ptr->sustain_chr = TRUE;
1077 void have_levitation(player_type *creature_ptr)
1080 BIT_FLAGS flgs[TR_FLAG_SIZE];
1081 creature_ptr->levitation = FALSE;
1083 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1084 creature_ptr->levitation = TRUE;
1087 if (creature_ptr->muta3 & MUT3_WINGS)
1088 creature_ptr->levitation = TRUE;
1090 if (!creature_ptr->mimic_form
1091 && (creature_ptr->prace == RACE_DRACONIAN || creature_ptr->prace == RACE_SPECTRE || creature_ptr->prace == RACE_SPRITE
1092 || creature_ptr->prace == RACE_ARCHON || creature_ptr->prace == RACE_S_FAIRY)) {
1093 creature_ptr->levitation = TRUE;
1096 if (creature_ptr->special_defense & KAMAE_SEIRYU || creature_ptr->special_defense & KAMAE_SUZAKU) {
1097 creature_ptr->levitation = TRUE;
1100 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1101 creature_ptr->levitation = TRUE;
1104 if (creature_ptr->magicdef) {
1107 if (creature_ptr->riding) {
1108 monster_type *riding_m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
1109 monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
1110 creature_ptr->levitation = (riding_r_ptr->flags7 & RF7_CAN_FLY) ? TRUE : FALSE;
1113 if (creature_ptr->tim_levitation) {
1114 creature_ptr->levitation = TRUE;
1117 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1118 o_ptr = &creature_ptr->inventory_list[i];
1121 object_flags(creature_ptr, o_ptr, flgs);
1122 if (have_flag(flgs, TR_LEVITATION))
1123 creature_ptr->levitation = TRUE;
1127 void have_can_swim(player_type *creature_ptr)
1129 creature_ptr->can_swim = FALSE;
1130 if (creature_ptr->riding) {
1131 monster_type *riding_m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
1132 monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
1133 if (riding_r_ptr->flags7 & (RF7_CAN_SWIM | RF7_AQUATIC))
1134 creature_ptr->can_swim = TRUE;
1138 void have_slow_digest(player_type *creature_ptr)
1141 BIT_FLAGS flgs[TR_FLAG_SIZE];
1142 creature_ptr->slow_digest = FALSE;
1144 if (creature_ptr->pclass == CLASS_NINJA) {
1145 creature_ptr->slow_digest = TRUE;
1148 if (creature_ptr->lev > 14 && !creature_ptr->mimic_form && creature_ptr->prace == RACE_HALF_TROLL) {
1149 if (creature_ptr->pclass == CLASS_WARRIOR || creature_ptr->pclass == CLASS_BERSERKER) {
1150 creature_ptr->slow_digest = TRUE;
1151 /* Let's not make Regeneration
1152 * a disadvantage for the poor warriors who can
1153 * never learn a spell that satisfies hunger (actually
1154 * neither can rogues, but half-trolls are not
1155 * supposed to play rogues) */
1159 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1160 creature_ptr->slow_digest = TRUE;
1163 if (!creature_ptr->mimic_form
1164 && (creature_ptr->prace == RACE_GOLEM || creature_ptr->prace == RACE_ZOMBIE || creature_ptr->prace == RACE_SPECTRE
1165 || creature_ptr->prace == RACE_ANDROID)) {
1166 creature_ptr->slow_digest = TRUE;
1169 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1170 o_ptr = &creature_ptr->inventory_list[i];
1173 object_flags(creature_ptr, o_ptr, flgs);
1174 if (have_flag(flgs, TR_SLOW_DIGEST))
1175 creature_ptr->slow_digest = TRUE;
1179 void have_regenerate(player_type *creature_ptr)
1182 BIT_FLAGS flgs[TR_FLAG_SIZE];
1183 creature_ptr->regenerate = FALSE;
1185 if (!creature_ptr->mimic_form) {
1186 switch (creature_ptr->prace) {
1187 case RACE_HALF_TROLL:
1188 if (creature_ptr->lev > 14) {
1189 creature_ptr->regenerate = TRUE;
1193 creature_ptr->regenerate = TRUE;
1198 switch (creature_ptr->pclass) {
1200 if (creature_ptr->lev > 44)
1201 creature_ptr->regenerate = TRUE;
1203 case CLASS_BERSERKER:
1204 creature_ptr->regenerate = TRUE;
1208 if (creature_ptr->muta3 & MUT3_FLESH_ROT)
1209 creature_ptr->regenerate = FALSE;
1211 if (creature_ptr->muta3 & MUT3_REGEN)
1212 creature_ptr->regenerate = TRUE;
1214 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1215 creature_ptr->regenerate = TRUE;
1218 if (creature_ptr->realm1 == REALM_HEX) {
1219 if (hex_spelling(creature_ptr, HEX_DEMON_AURA)) {
1220 creature_ptr->regenerate = TRUE;
1224 if (creature_ptr->tim_regen) {
1225 creature_ptr->regenerate = TRUE;
1228 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1229 o_ptr = &creature_ptr->inventory_list[i];
1232 object_flags(creature_ptr, o_ptr, flgs);
1233 if (have_flag(flgs, TR_REGEN))
1234 creature_ptr->regenerate = TRUE;
1238 void have_curses(player_type *creature_ptr)
1241 BIT_FLAGS flgs[TR_FLAG_SIZE];
1242 creature_ptr->cursed = 0L;
1244 if (creature_ptr->pseikaku == PERSONALITY_SEXY)
1245 creature_ptr->cursed |= (TRC_AGGRAVATE);
1247 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1248 o_ptr = &creature_ptr->inventory_list[i];
1251 object_flags(creature_ptr, o_ptr, flgs);
1252 if (have_flag(flgs, TR_AGGRAVATE))
1253 creature_ptr->cursed |= TRC_AGGRAVATE;
1254 if (have_flag(flgs, TR_DRAIN_EXP))
1255 creature_ptr->cursed |= TRC_DRAIN_EXP;
1256 if (have_flag(flgs, TR_TY_CURSE))
1257 creature_ptr->cursed |= TRC_TY_CURSE;
1258 if (have_flag(flgs, TR_ADD_L_CURSE))
1259 creature_ptr->cursed |= TRC_ADD_L_CURSE;
1260 if (have_flag(flgs, TR_ADD_H_CURSE))
1261 creature_ptr->cursed |= TRC_ADD_H_CURSE;
1262 if (have_flag(flgs, TR_DRAIN_HP))
1263 creature_ptr->cursed |= TRC_DRAIN_HP;
1264 if (have_flag(flgs, TR_DRAIN_MANA))
1265 creature_ptr->cursed |= TRC_DRAIN_MANA;
1266 if (have_flag(flgs, TR_CALL_ANIMAL))
1267 creature_ptr->cursed |= TRC_CALL_ANIMAL;
1268 if (have_flag(flgs, TR_CALL_DEMON))
1269 creature_ptr->cursed |= TRC_CALL_DEMON;
1270 if (have_flag(flgs, TR_CALL_DRAGON))
1271 creature_ptr->cursed |= TRC_CALL_DRAGON;
1272 if (have_flag(flgs, TR_CALL_UNDEAD))
1273 creature_ptr->cursed |= TRC_CALL_UNDEAD;
1274 if (have_flag(flgs, TR_COWARDICE))
1275 creature_ptr->cursed |= TRC_COWARDICE;
1276 if (have_flag(flgs, TR_LOW_MELEE))
1277 creature_ptr->cursed |= TRC_LOW_MELEE;
1278 if (have_flag(flgs, TR_LOW_AC))
1279 creature_ptr->cursed |= TRC_LOW_AC;
1280 if (have_flag(flgs, TR_LOW_MAGIC))
1281 creature_ptr->cursed |= TRC_LOW_MAGIC;
1282 if (have_flag(flgs, TR_FAST_DIGEST))
1283 creature_ptr->cursed |= TRC_FAST_DIGEST;
1284 if (have_flag(flgs, TR_SLOW_REGEN))
1285 creature_ptr->cursed |= TRC_SLOW_REGEN;
1287 creature_ptr->cursed |= (o_ptr->curse_flags & (0xFFFFFFF0L));
1288 if (o_ptr->name1 == ART_CHAINSWORD)
1289 creature_ptr->cursed |= TRC_CHAINSWORD;
1291 if (have_flag(flgs, TR_TELEPORT)) {
1292 if (object_is_cursed(o_ptr))
1293 creature_ptr->cursed |= TRC_TELEPORT;
1295 concptr insc = quark_str(o_ptr->inscription);
1297 /* {.} will stop random teleportation. */
1298 if (o_ptr->inscription && angband_strchr(insc, '.')) {
1300 creature_ptr->cursed |= TRC_TELEPORT_SELF;
1306 if (creature_ptr->cursed & TRC_TELEPORT)
1307 creature_ptr->cursed &= ~(TRC_TELEPORT_SELF);
1309 if ((is_specific_player_race(creature_ptr, RACE_S_FAIRY)) && (creature_ptr->pseikaku != PERSONALITY_SEXY) && (creature_ptr->cursed & TRC_AGGRAVATE)) {
1310 creature_ptr->cursed &= ~(TRC_AGGRAVATE);
1314 void have_impact(player_type *creature_ptr)
1317 BIT_FLAGS flgs[TR_FLAG_SIZE];
1318 creature_ptr->impact[0] = FALSE;
1319 creature_ptr->impact[1] = FALSE;
1321 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1322 o_ptr = &creature_ptr->inventory_list[i];
1325 object_flags(creature_ptr, o_ptr, flgs);
1326 if (have_flag(flgs, TR_IMPACT))
1327 creature_ptr->impact[(i == INVEN_RARM) ? 0 : 1] = TRUE;
1331 void have_extra_blow(player_type *creature_ptr)
1334 BIT_FLAGS flgs[TR_FLAG_SIZE];
1335 creature_ptr->extra_blows[0] = creature_ptr->extra_blows[1] = 0;
1337 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1338 o_ptr = &creature_ptr->inventory_list[i];
1342 object_flags(creature_ptr, o_ptr, flgs);
1344 if (have_flag(flgs, TR_INFRA))
1345 creature_ptr->see_infra += o_ptr->pval;
1346 if (have_flag(flgs, TR_BLOWS)) {
1347 if ((i == INVEN_RARM || i == INVEN_RIGHT) && !have_two_handed_weapons(creature_ptr))
1348 creature_ptr->extra_blows[0] += o_ptr->pval;
1349 else if ((i == INVEN_LARM || i == INVEN_LEFT) && !have_two_handed_weapons(creature_ptr))
1350 creature_ptr->extra_blows[1] += o_ptr->pval;
1352 creature_ptr->extra_blows[0] += o_ptr->pval;
1353 creature_ptr->extra_blows[1] += o_ptr->pval;
1359 void have_resist_acid(player_type *creature_ptr)
1362 BIT_FLAGS flgs[TR_FLAG_SIZE];
1363 creature_ptr->resist_acid = FALSE;
1365 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1366 creature_ptr->resist_acid = TRUE;
1369 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_YEEK || creature_ptr->prace == RACE_KLACKON)) {
1370 creature_ptr->resist_acid = TRUE;
1373 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_DRACONIAN && creature_ptr->lev > 14) {
1374 creature_ptr->resist_acid = TRUE;
1377 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
1378 creature_ptr->resist_acid = TRUE;
1381 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1382 creature_ptr->resist_acid = TRUE;
1385 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1386 o_ptr = &creature_ptr->inventory_list[i];
1390 object_flags(creature_ptr, o_ptr, flgs);
1391 if (have_flag(flgs, TR_RES_ACID))
1392 creature_ptr->resist_acid = TRUE;
1395 if (creature_ptr->immune_acid)
1396 creature_ptr->resist_acid = TRUE;
1399 void have_resist_elec(player_type *creature_ptr)
1402 BIT_FLAGS flgs[TR_FLAG_SIZE];
1403 creature_ptr->resist_elec = FALSE;
1405 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1406 creature_ptr->resist_elec = TRUE;
1409 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_DRACONIAN && creature_ptr->lev > 19) {
1410 creature_ptr->resist_elec = TRUE;
1413 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
1414 creature_ptr->resist_elec = TRUE;
1417 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1418 creature_ptr->resist_elec = TRUE;
1421 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1422 o_ptr = &creature_ptr->inventory_list[i];
1426 object_flags(creature_ptr, o_ptr, flgs);
1427 if (have_flag(flgs, TR_RES_ELEC))
1428 creature_ptr->resist_elec = TRUE;
1431 if (creature_ptr->immune_elec)
1432 creature_ptr->resist_elec = TRUE;
1435 void have_resist_fire(player_type *creature_ptr)
1438 BIT_FLAGS flgs[TR_FLAG_SIZE];
1439 creature_ptr->resist_fire = FALSE;
1441 if (creature_ptr->mimic_form == MIMIC_DEMON || creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1442 creature_ptr->resist_fire = TRUE;
1445 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_DRACONIAN && creature_ptr->lev > 4) {
1446 creature_ptr->resist_fire = TRUE;
1449 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_IMP || creature_ptr->prace == RACE_BALROG)) {
1450 creature_ptr->resist_fire = TRUE;
1453 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
1454 creature_ptr->resist_fire = TRUE;
1457 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1458 creature_ptr->resist_fire = TRUE;
1461 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1462 o_ptr = &creature_ptr->inventory_list[i];
1466 object_flags(creature_ptr, o_ptr, flgs);
1468 if (have_flag(flgs, TR_RES_FIRE))
1469 creature_ptr->resist_fire = TRUE;
1472 if (creature_ptr->immune_fire)
1473 creature_ptr->resist_fire = TRUE;
1476 void have_resist_cold(player_type *creature_ptr)
1479 BIT_FLAGS flgs[TR_FLAG_SIZE];
1480 creature_ptr->resist_cold = FALSE;
1482 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD || creature_ptr->mimic_form == MIMIC_VAMPIRE) {
1483 creature_ptr->resist_cold = TRUE;
1486 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_ZOMBIE) && creature_ptr->lev > 4) {
1487 creature_ptr->resist_cold = TRUE;
1490 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_DRACONIAN || creature_ptr->prace == RACE_SKELETON) && creature_ptr->lev > 9) {
1491 creature_ptr->resist_cold = TRUE;
1494 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_VAMPIRE || creature_ptr->prace == RACE_SPECTRE)) {
1495 creature_ptr->resist_fire = TRUE;
1498 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
1499 creature_ptr->resist_cold = TRUE;
1502 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1503 creature_ptr->resist_cold = TRUE;
1506 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1507 o_ptr = &creature_ptr->inventory_list[i];
1511 object_flags(creature_ptr, o_ptr, flgs);
1513 if (have_flag(flgs, TR_RES_COLD))
1514 creature_ptr->resist_cold = TRUE;
1517 if (creature_ptr->immune_cold)
1518 creature_ptr->resist_cold = TRUE;
1521 void have_resist_pois(player_type *creature_ptr)
1524 BIT_FLAGS flgs[TR_FLAG_SIZE];
1525 creature_ptr->resist_pois = FALSE;
1527 if (creature_ptr->pclass == CLASS_NINJA && creature_ptr->lev > 19)
1528 creature_ptr->resist_pois = TRUE;
1530 if (creature_ptr->mimic_form == MIMIC_VAMPIRE || creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1531 creature_ptr->resist_pois = TRUE;
1534 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_DRACONIAN && creature_ptr->lev > 34) {
1535 creature_ptr->resist_pois = TRUE;
1538 if (!creature_ptr->mimic_form
1539 && (creature_ptr->prace == RACE_KOBOLD || creature_ptr->prace == RACE_GOLEM || creature_ptr->prace == RACE_SKELETON
1540 || creature_ptr->prace == RACE_VAMPIRE || creature_ptr->prace == RACE_SPECTRE || creature_ptr->prace == RACE_ANDROID)) {
1541 creature_ptr->resist_pois = TRUE;
1544 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
1545 creature_ptr->resist_pois = TRUE;
1548 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1549 creature_ptr->resist_pois = TRUE;
1552 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1553 o_ptr = &creature_ptr->inventory_list[i];
1557 object_flags(creature_ptr, o_ptr, flgs);
1559 if (have_flag(flgs, TR_RES_POIS))
1560 creature_ptr->resist_pois = TRUE;
1564 void have_resist_conf(player_type *creature_ptr)
1567 BIT_FLAGS flgs[TR_FLAG_SIZE];
1568 creature_ptr->resist_conf = FALSE;
1570 if (creature_ptr->pclass == CLASS_MINDCRAFTER && creature_ptr->lev > 29)
1571 creature_ptr->resist_conf = TRUE;
1573 if (creature_ptr->pseikaku == PERSONALITY_CHARGEMAN || creature_ptr->pseikaku == PERSONALITY_MUNCHKIN) {
1574 creature_ptr->resist_conf = TRUE;
1577 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_KLACKON || creature_ptr->prace == RACE_BEASTMAN || creature_ptr->prace == RACE_KUTAR)) {
1578 creature_ptr->resist_conf = TRUE;
1581 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1582 creature_ptr->resist_conf = TRUE;
1585 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1586 creature_ptr->resist_conf = TRUE;
1589 if (creature_ptr->magicdef) {
1590 creature_ptr->resist_conf = TRUE;
1593 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1594 o_ptr = &creature_ptr->inventory_list[i];
1598 object_flags(creature_ptr, o_ptr, flgs);
1600 if (have_flag(flgs, TR_RES_CONF))
1601 creature_ptr->resist_conf = TRUE;
1605 void have_resist_sound(player_type *creature_ptr)
1608 BIT_FLAGS flgs[TR_FLAG_SIZE];
1609 creature_ptr->resist_sound = FALSE;
1611 if (creature_ptr->pclass == CLASS_BARD) {
1612 creature_ptr->resist_sound = TRUE;
1615 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_CYCLOPS || creature_ptr->prace == RACE_BEASTMAN)) {
1616 creature_ptr->resist_sound = TRUE;
1619 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1620 creature_ptr->resist_sound = TRUE;
1623 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1624 o_ptr = &creature_ptr->inventory_list[i];
1628 object_flags(creature_ptr, o_ptr, flgs);
1630 if (have_flag(flgs, TR_RES_SOUND))
1631 creature_ptr->resist_sound = TRUE;
1635 void have_resist_lite(player_type *creature_ptr)
1638 BIT_FLAGS flgs[TR_FLAG_SIZE];
1639 creature_ptr->resist_lite = FALSE;
1641 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_ELF || creature_ptr->prace == RACE_HIGH_ELF || creature_ptr->prace == RACE_SPRITE)) {
1642 creature_ptr->resist_lite = TRUE;
1645 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1646 creature_ptr->resist_lite = TRUE;
1649 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1650 o_ptr = &creature_ptr->inventory_list[i];
1654 object_flags(creature_ptr, o_ptr, flgs);
1656 if (have_flag(flgs, TR_RES_LITE))
1657 creature_ptr->resist_lite = TRUE;
1661 void have_resist_dark(player_type *creature_ptr)
1664 BIT_FLAGS flgs[TR_FLAG_SIZE];
1665 creature_ptr->resist_dark = FALSE;
1667 if (creature_ptr->mimic_form == MIMIC_VAMPIRE) {
1668 creature_ptr->resist_dark = TRUE;
1671 if (!creature_ptr->mimic_form
1672 && (creature_ptr->prace == RACE_HALF_ORC || creature_ptr->prace == RACE_HALF_OGRE || creature_ptr->prace == RACE_NIBELUNG
1673 || creature_ptr->prace == RACE_DARK_ELF || creature_ptr->prace == RACE_VAMPIRE)) {
1674 creature_ptr->resist_lite = TRUE;
1677 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1678 creature_ptr->resist_dark = TRUE;
1681 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1682 o_ptr = &creature_ptr->inventory_list[i];
1686 object_flags(creature_ptr, o_ptr, flgs);
1688 if (have_flag(flgs, TR_RES_DARK))
1689 creature_ptr->resist_dark = TRUE;
1693 void have_resist_chaos(player_type *creature_ptr)
1696 BIT_FLAGS flgs[TR_FLAG_SIZE];
1697 creature_ptr->resist_chaos = FALSE;
1699 if (creature_ptr->pclass == CLASS_CHAOS_WARRIOR && creature_ptr->lev > 29)
1700 creature_ptr->resist_chaos = TRUE;
1702 if (creature_ptr->mimic_form == MIMIC_DEMON || creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1703 creature_ptr->resist_chaos = TRUE;
1706 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_HALF_TITAN)
1707 creature_ptr->resist_chaos = TRUE;
1709 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1710 creature_ptr->resist_chaos = TRUE;
1713 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1714 o_ptr = &creature_ptr->inventory_list[i];
1718 object_flags(creature_ptr, o_ptr, flgs);
1720 if (have_flag(flgs, TR_RES_CHAOS))
1721 creature_ptr->resist_chaos = TRUE;
1725 void have_resist_disen(player_type *creature_ptr)
1728 BIT_FLAGS flgs[TR_FLAG_SIZE];
1729 creature_ptr->resist_disen = FALSE;
1731 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1732 creature_ptr->resist_disen = TRUE;
1735 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_NIBELUNG)
1736 creature_ptr->resist_disen = TRUE;
1738 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1739 creature_ptr->resist_disen = TRUE;
1742 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1743 o_ptr = &creature_ptr->inventory_list[i];
1747 object_flags(creature_ptr, o_ptr, flgs);
1749 if (have_flag(flgs, TR_RES_DISEN))
1750 creature_ptr->resist_disen = TRUE;
1754 void have_resist_shard(player_type *creature_ptr)
1757 BIT_FLAGS flgs[TR_FLAG_SIZE];
1758 creature_ptr->resist_shard = FALSE;
1760 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_HALF_TITAN || creature_ptr->prace == RACE_SKELETON))
1761 creature_ptr->resist_shard = TRUE;
1763 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1764 creature_ptr->resist_shard = TRUE;
1767 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1768 o_ptr = &creature_ptr->inventory_list[i];
1772 object_flags(creature_ptr, o_ptr, flgs);
1774 if (have_flag(flgs, TR_RES_DISEN))
1775 creature_ptr->resist_shard = TRUE;
1779 void have_resist_nexus(player_type *creature_ptr)
1782 BIT_FLAGS flgs[TR_FLAG_SIZE];
1783 creature_ptr->resist_nexus = FALSE;
1785 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1786 creature_ptr->resist_nexus = TRUE;
1789 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1790 creature_ptr->resist_nexus = TRUE;
1793 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1794 o_ptr = &creature_ptr->inventory_list[i];
1798 object_flags(creature_ptr, o_ptr, flgs);
1800 if (have_flag(flgs, TR_RES_NEXUS))
1801 creature_ptr->resist_nexus = TRUE;
1805 void have_resist_blind(player_type *creature_ptr)
1808 BIT_FLAGS flgs[TR_FLAG_SIZE];
1809 creature_ptr->resist_blind = FALSE;
1811 if (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN) {
1812 creature_ptr->resist_blind = TRUE;
1815 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_DWARF)
1816 creature_ptr->resist_blind = TRUE;
1818 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1819 creature_ptr->resist_blind = TRUE;
1822 if (creature_ptr->magicdef) {
1823 creature_ptr->resist_blind = TRUE;
1826 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1827 o_ptr = &creature_ptr->inventory_list[i];
1831 object_flags(creature_ptr, o_ptr, flgs);
1833 if (have_flag(flgs, TR_RES_BLIND))
1834 creature_ptr->resist_blind = TRUE;
1838 void have_resist_neth(player_type *creature_ptr)
1841 BIT_FLAGS flgs[TR_FLAG_SIZE];
1843 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD || creature_ptr->mimic_form == MIMIC_DEMON || creature_ptr->mimic_form == MIMIC_VAMPIRE) {
1844 creature_ptr->resist_neth = TRUE;
1847 if (!creature_ptr->mimic_form
1848 && (creature_ptr->prace == RACE_ZOMBIE || creature_ptr->prace == RACE_VAMPIRE || creature_ptr->prace == RACE_SPECTRE
1849 || creature_ptr->prace == RACE_BALROG))
1850 creature_ptr->resist_neth = TRUE;
1852 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1853 creature_ptr->resist_neth = TRUE;
1856 if (creature_ptr->tim_res_nether) {
1857 creature_ptr->resist_neth = TRUE;
1860 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1861 o_ptr = &creature_ptr->inventory_list[i];
1865 object_flags(creature_ptr, o_ptr, flgs);
1867 if (have_flag(flgs, TR_RES_NETHER))
1868 creature_ptr->resist_neth = TRUE;
1872 void have_resist_time(player_type *creature_ptr)
1875 BIT_FLAGS flgs[TR_FLAG_SIZE];
1876 creature_ptr->resist_time = FALSE;
1878 if (creature_ptr->tim_res_time) {
1879 creature_ptr->resist_time = TRUE;
1882 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1883 o_ptr = &creature_ptr->inventory_list[i];
1887 object_flags(creature_ptr, o_ptr, flgs);
1888 if (o_ptr->name2 == EGO_RING_RES_TIME)
1889 creature_ptr->resist_time = TRUE;
1893 void have_resist_water(player_type *creature_ptr)
1895 creature_ptr->resist_water = FALSE;
1897 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_MERFOLK)
1898 creature_ptr->resist_water = TRUE;
1901 void have_resist_fear(player_type *creature_ptr)
1904 BIT_FLAGS flgs[TR_FLAG_SIZE];
1905 creature_ptr->resist_fear = FALSE;
1907 if (creature_ptr->muta3 & MUT3_FEARLESS)
1908 creature_ptr->resist_fear = TRUE;
1910 switch (creature_ptr->pclass) {
1912 if (creature_ptr->lev > 29)
1913 creature_ptr->resist_fear = TRUE;
1916 if (creature_ptr->lev > 39)
1917 creature_ptr->resist_fear = TRUE;
1919 case CLASS_CHAOS_WARRIOR:
1920 if (creature_ptr->lev > 39)
1921 creature_ptr->resist_fear = TRUE;
1923 case CLASS_MINDCRAFTER:
1924 if (creature_ptr->lev > 9)
1925 creature_ptr->resist_fear = TRUE;
1928 if (creature_ptr->lev > 29)
1929 creature_ptr->resist_fear = TRUE;
1932 creature_ptr->resist_fear = TRUE;
1936 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1937 creature_ptr->resist_fear = TRUE;
1940 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_BARBARIAN)
1941 creature_ptr->resist_fear = TRUE;
1943 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1944 creature_ptr->resist_fear = TRUE;
1947 if (is_hero(creature_ptr) || creature_ptr->shero) {
1948 creature_ptr->resist_fear = TRUE;
1951 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1952 o_ptr = &creature_ptr->inventory_list[i];
1956 object_flags(creature_ptr, o_ptr, flgs);
1957 if (have_flag(flgs, TR_RES_FEAR))
1958 creature_ptr->resist_fear = TRUE;
1962 void have_immune_acid(player_type *creature_ptr)
1965 BIT_FLAGS flgs[TR_FLAG_SIZE];
1966 creature_ptr->immune_acid = FALSE;
1968 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_YEEK && creature_ptr->lev > 19)
1969 creature_ptr->immune_acid = TRUE;
1971 if (creature_ptr->ele_immune) {
1972 if (creature_ptr->special_defense & DEFENSE_ACID)
1973 creature_ptr->immune_acid = TRUE;
1976 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1977 o_ptr = &creature_ptr->inventory_list[i];
1981 object_flags(creature_ptr, o_ptr, flgs);
1982 if (have_flag(flgs, TR_IM_ACID))
1983 creature_ptr->immune_acid = TRUE;
1987 void have_immune_elec(player_type *creature_ptr)
1990 BIT_FLAGS flgs[TR_FLAG_SIZE];
1991 creature_ptr->immune_elec = FALSE;
1992 if (creature_ptr->ele_immune) {
1993 if (creature_ptr->special_defense & DEFENSE_ELEC)
1994 creature_ptr->immune_elec = TRUE;
1997 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1998 o_ptr = &creature_ptr->inventory_list[i];
2002 object_flags(creature_ptr, o_ptr, flgs);
2003 if (have_flag(flgs, TR_IM_ELEC))
2004 creature_ptr->immune_elec = TRUE;
2008 void have_immune_fire(player_type *creature_ptr)
2011 BIT_FLAGS flgs[TR_FLAG_SIZE];
2012 creature_ptr->immune_fire = FALSE;
2013 if (creature_ptr->ele_immune) {
2014 if (creature_ptr->special_defense & DEFENSE_FIRE)
2015 creature_ptr->immune_fire = TRUE;
2018 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2019 o_ptr = &creature_ptr->inventory_list[i];
2023 object_flags(creature_ptr, o_ptr, flgs);
2024 if (have_flag(flgs, TR_IM_FIRE))
2025 creature_ptr->immune_fire = TRUE;
2029 void have_immune_cold(player_type *creature_ptr)
2032 BIT_FLAGS flgs[TR_FLAG_SIZE];
2033 creature_ptr->immune_cold = FALSE;
2034 if (creature_ptr->ele_immune) {
2035 if (creature_ptr->special_defense & DEFENSE_COLD)
2036 creature_ptr->immune_cold = TRUE;
2039 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2040 o_ptr = &creature_ptr->inventory_list[i];
2044 object_flags(creature_ptr, o_ptr, flgs);
2045 if (have_flag(flgs, TR_IM_COLD))
2046 creature_ptr->immune_cold = TRUE;
2050 bool have_right_hand_weapon(player_type *creature_ptr)
2052 if (has_melee_weapon(creature_ptr, INVEN_RARM))
2055 if (can_two_hands_wielding(creature_ptr)) {
2056 switch (creature_ptr->pclass) {
2058 case CLASS_FORCETRAINER:
2059 case CLASS_BERSERKER:
2060 if (empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM)) {
2070 bool have_left_hand_weapon(player_type *creature_ptr)
2072 return has_melee_weapon(creature_ptr, INVEN_LARM);
2075 bool have_two_handed_weapons(player_type *creature_ptr)
2077 if (can_two_hands_wielding(creature_ptr)) {
2078 if (have_right_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_LARM)
2079 && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_RARM])) {
2081 } else if (have_left_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_RARM)
2082 && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_LARM])) {
2089 void have_lite(player_type *creature_ptr)
2091 creature_ptr->lite = FALSE;
2092 if (creature_ptr->pclass == CLASS_NINJA)
2095 if (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN) {
2096 creature_ptr->lite = TRUE;
2099 if (creature_ptr->mimic_form == MIMIC_VAMPIRE) {
2100 creature_ptr->lite = TRUE;
2103 if (creature_ptr->muta3 & MUT3_FIRE_BODY) {
2104 creature_ptr->lite = TRUE;
2107 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_VAMPIRE)
2108 creature_ptr->lite = TRUE;
2110 if (creature_ptr->sh_fire)
2111 creature_ptr->lite = TRUE;
2113 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
2114 creature_ptr->lite = TRUE;
2118 bool is_disable_two_handed_bonus(player_type *creature_ptr, int i)
2121 o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
2122 if (has_melee_weapon(creature_ptr, INVEN_RARM + i)) {
2123 if (calc_weapon_weight_limit(creature_ptr) * 2 >= o_ptr->weight / 10 && have_two_handed_weapons(creature_ptr) && (calc_weapon_weight_limit(creature_ptr) * 2 < o_ptr->weight / 5))
2129 bool is_icky_wield_weapon(player_type *creature_ptr, int i)
2132 BIT_FLAGS flgs[TR_FLAG_SIZE];
2133 o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
2134 object_flags(creature_ptr, o_ptr, flgs);
2136 if ((creature_ptr->pclass == CLASS_PRIEST) && (!(have_flag(flgs, TR_BLESSED))) && ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM))) {
2138 } else if (creature_ptr->pclass == CLASS_SORCERER) {
2139 if (!((o_ptr->tval == TV_HAFTED) && ((o_ptr->sval == SV_WIZSTAFF) || (o_ptr->sval == SV_NAMAKE_HAMMER)))) {
2143 if (is_not_monk_weapon(creature_ptr, i) || is_not_ninja_weapon(creature_ptr, i)) {
2149 bool is_riding_wield_weapon(player_type *creature_ptr, int i)
2152 BIT_FLAGS flgs[TR_FLAG_SIZE];
2153 o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
2154 object_flags(creature_ptr, o_ptr, flgs);
2155 if (creature_ptr->riding != 0 && !(o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE))
2156 && !have_flag(flgs, TR_RIDING)) {
2162 bool is_not_ninja_weapon(player_type *creature_ptr, int i)
2164 tval_type tval = creature_ptr->inventory_list[INVEN_RARM + i].tval - TV_WEAPON_BEGIN;
2165 OBJECT_SUBTYPE_VALUE sval = creature_ptr->inventory_list[INVEN_RARM + i].sval;
2166 return creature_ptr->pclass == CLASS_NINJA
2167 && !((s_info[CLASS_NINJA].w_max[tval][sval] > WEAPON_EXP_BEGINNER) && (creature_ptr->inventory_list[INVEN_LARM - i].tval != TV_SHIELD));
2170 bool is_not_monk_weapon(player_type *creature_ptr, int i)
2172 tval_type tval = creature_ptr->inventory_list[INVEN_RARM + i].tval - TV_WEAPON_BEGIN;
2173 OBJECT_SUBTYPE_VALUE sval = creature_ptr->inventory_list[INVEN_RARM + i].sval;
2174 return (creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) && (!s_info[creature_ptr->pclass].w_max[tval][sval]);
2177 bool have_good_luck(player_type *creature_ptr) { return (creature_ptr->pseikaku == PERSONALITY_LUCKY) || (creature_ptr->muta3 |= MUT3_GOOD_LUCK); };