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 BIT_FLAGS have_xtra_might(player_type *creature_ptr)
70 BIT_FLAGS flgs[TR_FLAG_SIZE];
71 BIT_FLAGS result = 0L;
73 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
74 o_ptr = &creature_ptr->inventory_list[i];
78 object_flags(creature_ptr, o_ptr, flgs);
80 if (have_flag(flgs, TR_XTRA_MIGHT))
81 result |= 0x01 << (i - INVEN_RARM);
87 BIT_FLAGS have_esp_evil(player_type *creature_ptr)
90 BIT_FLAGS flgs[TR_FLAG_SIZE];
91 BIT_FLAGS result = 0L;
93 if (creature_ptr->realm1 == REALM_HEX) {
94 if (hex_spelling(creature_ptr, HEX_DETECT_EVIL))
95 result |= 0x01 << FLAG_CAUSE_MAGIC_TIME_EFFECT;
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 result |= 0x01 << (i - INVEN_RARM);
112 BIT_FLAGS have_esp_animal(player_type *creature_ptr)
115 BIT_FLAGS flgs[TR_FLAG_SIZE];
116 BIT_FLAGS result = 0L;
118 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
119 o_ptr = &creature_ptr->inventory_list[i];
123 object_flags(creature_ptr, o_ptr, flgs);
125 if (have_flag(flgs, TR_ESP_ANIMAL))
126 result |= 0x01 << (i - INVEN_RARM);
132 void have_esp_undead(player_type *creature_ptr)
135 BIT_FLAGS flgs[TR_FLAG_SIZE];
137 creature_ptr->esp_undead = FALSE;
139 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
140 o_ptr = &creature_ptr->inventory_list[i];
144 object_flags(creature_ptr, o_ptr, flgs);
146 if (have_flag(flgs, TR_ESP_UNDEAD))
147 creature_ptr->esp_undead = TRUE;
151 void have_esp_demon(player_type *creature_ptr)
154 BIT_FLAGS flgs[TR_FLAG_SIZE];
156 creature_ptr->esp_demon = FALSE;
158 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
159 o_ptr = &creature_ptr->inventory_list[i];
163 object_flags(creature_ptr, o_ptr, flgs);
165 if (have_flag(flgs, TR_ESP_DEMON))
166 creature_ptr->esp_demon = TRUE;
170 void have_esp_orc(player_type *creature_ptr)
173 BIT_FLAGS flgs[TR_FLAG_SIZE];
175 creature_ptr->esp_orc = FALSE;
177 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
178 o_ptr = &creature_ptr->inventory_list[i];
182 object_flags(creature_ptr, o_ptr, flgs);
184 if (have_flag(flgs, TR_ESP_ORC))
185 creature_ptr->esp_orc = TRUE;
189 void have_esp_troll(player_type *creature_ptr)
192 BIT_FLAGS flgs[TR_FLAG_SIZE];
194 creature_ptr->esp_troll = FALSE;
196 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
197 o_ptr = &creature_ptr->inventory_list[i];
201 object_flags(creature_ptr, o_ptr, flgs);
203 if (have_flag(flgs, TR_ESP_TROLL))
204 creature_ptr->esp_troll = TRUE;
208 void have_esp_giant(player_type *creature_ptr)
211 BIT_FLAGS flgs[TR_FLAG_SIZE];
213 creature_ptr->esp_giant = FALSE;
215 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
216 o_ptr = &creature_ptr->inventory_list[i];
220 object_flags(creature_ptr, o_ptr, flgs);
222 if (have_flag(flgs, TR_ESP_GIANT))
223 creature_ptr->esp_giant = TRUE;
227 void have_esp_dragon(player_type *creature_ptr)
230 BIT_FLAGS flgs[TR_FLAG_SIZE];
232 creature_ptr->esp_dragon = FALSE;
234 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
235 o_ptr = &creature_ptr->inventory_list[i];
239 object_flags(creature_ptr, o_ptr, flgs);
241 if (have_flag(flgs, TR_ESP_DRAGON))
242 creature_ptr->esp_dragon = TRUE;
246 void have_esp_human(player_type *creature_ptr)
249 BIT_FLAGS flgs[TR_FLAG_SIZE];
251 creature_ptr->esp_human = FALSE;
253 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
254 o_ptr = &creature_ptr->inventory_list[i];
258 object_flags(creature_ptr, o_ptr, flgs);
260 if (have_flag(flgs, TR_ESP_HUMAN))
261 creature_ptr->esp_human = TRUE;
265 void have_esp_good(player_type *creature_ptr)
268 BIT_FLAGS flgs[TR_FLAG_SIZE];
270 creature_ptr->esp_good = FALSE;
272 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
273 o_ptr = &creature_ptr->inventory_list[i];
277 object_flags(creature_ptr, o_ptr, flgs);
279 if (have_flag(flgs, TR_ESP_GOOD))
280 creature_ptr->esp_good = TRUE;
284 void have_esp_nonliving(player_type *creature_ptr)
287 BIT_FLAGS flgs[TR_FLAG_SIZE];
289 creature_ptr->esp_nonliving = FALSE;
291 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
292 o_ptr = &creature_ptr->inventory_list[i];
296 object_flags(creature_ptr, o_ptr, flgs);
298 if (have_flag(flgs, TR_ESP_NONLIVING))
299 creature_ptr->esp_nonliving = TRUE;
303 void have_esp_unique(player_type *creature_ptr)
306 BIT_FLAGS flgs[TR_FLAG_SIZE];
308 creature_ptr->esp_unique = FALSE;
310 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
311 o_ptr = &creature_ptr->inventory_list[i];
315 object_flags(creature_ptr, o_ptr, flgs);
317 if (have_flag(flgs, TR_ESP_UNIQUE))
318 creature_ptr->esp_unique = TRUE;
322 void have_esp_telepathy(player_type *creature_ptr)
325 BIT_FLAGS flgs[TR_FLAG_SIZE];
327 creature_ptr->telepathy = FALSE;
329 if (is_time_limit_esp(creature_ptr)) {
330 creature_ptr->telepathy = TRUE;
333 if (creature_ptr->muta3 & MUT3_ESP) {
334 creature_ptr->telepathy = TRUE;
337 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_MIND_FLAYER && creature_ptr->lev > 29)
338 creature_ptr->telepathy = TRUE;
340 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_SPECTRE && creature_ptr->lev > 34)
341 creature_ptr->telepathy = TRUE;
343 if (creature_ptr->pclass == CLASS_MINDCRAFTER && creature_ptr->lev > 39)
344 creature_ptr->telepathy = TRUE;
346 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
347 creature_ptr->telepathy = TRUE;
350 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
351 creature_ptr->telepathy = TRUE;
354 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
355 o_ptr = &creature_ptr->inventory_list[i];
359 object_flags(creature_ptr, o_ptr, flgs);
361 if (have_flag(flgs, TR_TELEPATHY))
362 creature_ptr->telepathy = TRUE;
366 void have_bless_blade(player_type *creature_ptr)
369 BIT_FLAGS flgs[TR_FLAG_SIZE];
371 creature_ptr->bless_blade = FALSE;
373 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
374 o_ptr = &creature_ptr->inventory_list[i];
378 object_flags(creature_ptr, o_ptr, flgs);
380 if (have_flag(flgs, TR_BLESSED))
381 creature_ptr->bless_blade = TRUE;
385 void have_easy2_weapon(player_type *creature_ptr)
388 BIT_FLAGS flgs[TR_FLAG_SIZE];
390 creature_ptr->easy_2weapon = FALSE;
392 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
393 o_ptr = &creature_ptr->inventory_list[i];
397 object_flags(creature_ptr, o_ptr, flgs);
399 if (o_ptr->name2 == EGO_2WEAPON)
400 creature_ptr->easy_2weapon = TRUE;
404 void have_down_saving(player_type *creature_ptr)
407 BIT_FLAGS flgs[TR_FLAG_SIZE];
409 creature_ptr->down_saving = FALSE;
411 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
412 o_ptr = &creature_ptr->inventory_list[i];
416 object_flags(creature_ptr, o_ptr, flgs);
418 if (o_ptr->name2 == EGO_AMU_NAIVETY)
419 creature_ptr->down_saving = TRUE;
423 void have_no_ac(player_type *creature_ptr)
426 BIT_FLAGS flgs[TR_FLAG_SIZE];
428 creature_ptr->yoiyami = FALSE;
430 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
431 o_ptr = &creature_ptr->inventory_list[i];
435 object_flags(creature_ptr, o_ptr, flgs);
437 if (o_ptr->name2 == EGO_YOIYAMI)
438 creature_ptr->yoiyami = TRUE;
442 void have_no_flowed(player_type *creature_ptr)
445 bool have_sw = FALSE, have_kabe = FALSE;
446 OBJECT_IDX this_o_idx, next_o_idx = 0;
448 creature_ptr->no_flowed = FALSE;
450 if (creature_ptr->pass_wall && !creature_ptr->kill_wall)
451 creature_ptr->no_flowed = TRUE;
453 for (int i = 0; i < INVEN_PACK; i++) {
454 if ((creature_ptr->inventory_list[i].tval == TV_NATURE_BOOK) && (creature_ptr->inventory_list[i].sval == 2))
456 if ((creature_ptr->inventory_list[i].tval == TV_CRAFT_BOOK) && (creature_ptr->inventory_list[i].sval == 2))
460 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) {
461 o_ptr = &creature_ptr->current_floor_ptr->o_list[this_o_idx];
462 next_o_idx = o_ptr->next_o_idx;
464 if ((o_ptr->tval == TV_NATURE_BOOK) && (o_ptr->sval == 2))
466 if ((o_ptr->tval == TV_CRAFT_BOOK) && (o_ptr->sval == 2))
470 if (have_sw && ((creature_ptr->realm1 == REALM_NATURE) || (creature_ptr->realm2 == REALM_NATURE) || (creature_ptr->pclass == CLASS_SORCERER))) {
471 const magic_type *s_ptr = &mp_ptr->info[REALM_NATURE - 1][SPELL_SW];
472 if (creature_ptr->lev >= s_ptr->slevel)
473 creature_ptr->no_flowed = TRUE;
476 if (have_kabe && ((creature_ptr->realm1 == REALM_CRAFT) || (creature_ptr->realm2 == REALM_CRAFT) || (creature_ptr->pclass == CLASS_SORCERER))) {
477 const magic_type *s_ptr = &mp_ptr->info[REALM_CRAFT - 1][SPELL_WALL];
478 if (creature_ptr->lev >= s_ptr->slevel)
479 creature_ptr->no_flowed = TRUE;
483 void have_mighty_throw(player_type *creature_ptr)
487 creature_ptr->mighty_throw = FALSE;
489 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
490 o_ptr = &creature_ptr->inventory_list[i];
494 if (o_ptr->name2 == EGO_RING_THROW)
495 creature_ptr->mighty_throw = TRUE;
499 void have_dec_mana(player_type *creature_ptr)
502 BIT_FLAGS flgs[TR_FLAG_SIZE];
504 creature_ptr->xtra_might = FALSE;
506 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
507 o_ptr = &creature_ptr->inventory_list[i];
511 object_flags(creature_ptr, o_ptr, flgs);
513 if (have_flag(flgs, TR_DEC_MANA))
514 creature_ptr->dec_mana = TRUE;
518 void have_reflect(player_type *creature_ptr)
521 BIT_FLAGS flgs[TR_FLAG_SIZE];
523 creature_ptr->reflect = FALSE;
525 if (creature_ptr->pclass == CLASS_BERSERKER && creature_ptr->lev > 39)
526 creature_ptr->reflect = TRUE;
528 if (creature_ptr->pclass == CLASS_MIRROR_MASTER && creature_ptr->lev > 39)
529 creature_ptr->reflect = TRUE;
531 if (creature_ptr->special_defense & KAMAE_GENBU) {
532 creature_ptr->reflect = TRUE;
535 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
536 creature_ptr->reflect = TRUE;
539 if (creature_ptr->wraith_form) {
540 creature_ptr->reflect = TRUE;
543 if (creature_ptr->magicdef) {
544 creature_ptr->reflect = TRUE;
547 if (creature_ptr->tim_reflect) {
548 creature_ptr->reflect = TRUE;
551 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
552 o_ptr = &creature_ptr->inventory_list[i];
556 object_flags(creature_ptr, o_ptr, flgs);
558 if (have_flag(flgs, TR_REFLECT))
559 creature_ptr->reflect = TRUE;
563 void have_see_nocto(player_type *creature_ptr)
565 creature_ptr->see_nocto = FALSE;
567 if (creature_ptr->pclass == CLASS_NINJA)
568 creature_ptr->see_nocto = TRUE;
571 void have_warning(player_type *creature_ptr)
574 BIT_FLAGS flgs[TR_FLAG_SIZE];
576 creature_ptr->warning = FALSE;
578 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
579 o_ptr = &creature_ptr->inventory_list[i];
583 object_flags(creature_ptr, o_ptr, flgs);
585 if (have_flag(flgs, TR_WARNING)) {
586 if (!o_ptr->inscription || !(angband_strchr(quark_str(o_ptr->inscription), '$')))
587 creature_ptr->warning = TRUE;
592 void have_anti_magic(player_type *creature_ptr)
595 BIT_FLAGS flgs[TR_FLAG_SIZE];
597 creature_ptr->anti_magic = FALSE;
599 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
600 o_ptr = &creature_ptr->inventory_list[i];
604 object_flags(creature_ptr, o_ptr, flgs);
606 if (have_flag(flgs, TR_NO_MAGIC))
607 creature_ptr->anti_magic = TRUE;
611 void have_anti_tele(player_type *creature_ptr)
614 BIT_FLAGS flgs[TR_FLAG_SIZE];
616 creature_ptr->anti_tele = FALSE;
618 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
619 o_ptr = &creature_ptr->inventory_list[i];
623 object_flags(creature_ptr, o_ptr, flgs);
625 if (have_flag(flgs, TR_NO_TELE))
626 creature_ptr->anti_tele = TRUE;
630 void have_sh_fire(player_type *creature_ptr)
633 BIT_FLAGS flgs[TR_FLAG_SIZE];
634 creature_ptr->sh_fire = FALSE;
636 if (creature_ptr->muta3 & MUT3_FIRE_BODY) {
637 creature_ptr->sh_fire = TRUE;
640 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
641 creature_ptr->sh_fire = TRUE;
644 if (creature_ptr->realm1 == REALM_HEX) {
645 if (hex_spelling(creature_ptr, HEX_DEMON_AURA)) {
646 creature_ptr->sh_fire = TRUE;
650 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
651 creature_ptr->sh_fire = TRUE;
654 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
655 creature_ptr->sh_fire = TRUE;
658 if (creature_ptr->tim_sh_fire) {
659 creature_ptr->sh_fire = TRUE;
662 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
663 o_ptr = &creature_ptr->inventory_list[i];
667 object_flags(creature_ptr, o_ptr, flgs);
668 if (have_flag(flgs, TR_SH_FIRE))
669 creature_ptr->sh_fire = TRUE;
673 void have_sh_elec(player_type *creature_ptr)
676 BIT_FLAGS flgs[TR_FLAG_SIZE];
677 creature_ptr->sh_elec = FALSE;
679 if (creature_ptr->muta3 & MUT3_ELEC_TOUC)
680 creature_ptr->sh_elec = TRUE;
682 if (creature_ptr->realm1 == REALM_HEX) {
683 if (hex_spelling(creature_ptr, HEX_SHOCK_CLOAK)) {
684 creature_ptr->sh_elec = TRUE;
688 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
689 creature_ptr->sh_elec = TRUE;
692 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
693 creature_ptr->sh_elec = TRUE;
696 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
697 o_ptr = &creature_ptr->inventory_list[i];
701 object_flags(creature_ptr, o_ptr, flgs);
702 if (have_flag(flgs, TR_SH_ELEC))
703 creature_ptr->sh_elec = TRUE;
707 void have_sh_cold(player_type *creature_ptr)
710 BIT_FLAGS flgs[TR_FLAG_SIZE];
711 creature_ptr->sh_cold = FALSE;
713 if (creature_ptr->realm1 == REALM_HEX) {
714 if (hex_spelling(creature_ptr, HEX_ICE_ARMOR)) {
715 creature_ptr->sh_cold = TRUE;
719 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
720 creature_ptr->sh_cold = TRUE;
723 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
724 creature_ptr->sh_cold = TRUE;
727 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
728 o_ptr = &creature_ptr->inventory_list[i];
732 object_flags(creature_ptr, o_ptr, flgs);
733 if (have_flag(flgs, TR_SH_COLD))
734 creature_ptr->sh_cold = TRUE;
738 void have_easy_spell(player_type *creature_ptr)
741 BIT_FLAGS flgs[TR_FLAG_SIZE];
742 creature_ptr->easy_spell = FALSE;
743 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
744 o_ptr = &creature_ptr->inventory_list[i];
748 object_flags(creature_ptr, o_ptr, flgs);
749 if (have_flag(flgs, TR_EASY_SPELL))
750 creature_ptr->easy_spell = TRUE;
754 void have_heavy_spell(player_type *creature_ptr)
757 BIT_FLAGS flgs[TR_FLAG_SIZE];
758 creature_ptr->heavy_spell = FALSE;
759 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
760 o_ptr = &creature_ptr->inventory_list[i];
764 object_flags(creature_ptr, o_ptr, flgs);
765 if (o_ptr->name2 == EGO_AMU_FOOL)
766 creature_ptr->heavy_spell = TRUE;
770 void have_hold_exp(player_type *creature_ptr)
773 BIT_FLAGS flgs[TR_FLAG_SIZE];
775 creature_ptr->hold_exp = FALSE;
777 if (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN) {
778 creature_ptr->hold_exp = TRUE;
781 if (creature_ptr->mimic_form == MIMIC_DEMON || creature_ptr->mimic_form == MIMIC_DEMON_LORD || creature_ptr->mimic_form == MIMIC_VAMPIRE) {
782 creature_ptr->hold_exp = TRUE;
785 if (is_specific_player_race(creature_ptr, RACE_HOBBIT) || is_specific_player_race(creature_ptr, RACE_SKELETON) ||
786 is_specific_player_race(creature_ptr, RACE_ZOMBIE) || is_specific_player_race(creature_ptr, RACE_VAMPIRE) ||
787 is_specific_player_race(creature_ptr, RACE_SPECTRE) || is_specific_player_race(creature_ptr, RACE_BALROG) ||
788 is_specific_player_race(creature_ptr, RACE_ANDROID)) {
789 creature_ptr->hold_exp = TRUE;
792 if (is_specific_player_race(creature_ptr, RACE_GOLEM)) {
793 if (creature_ptr->lev > 34)
794 creature_ptr->hold_exp = TRUE;
797 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
798 creature_ptr->hold_exp = TRUE;
801 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
802 o_ptr = &creature_ptr->inventory_list[i];
806 object_flags(creature_ptr, o_ptr, flgs);
807 if (have_flag(flgs, TR_HOLD_EXP))
808 creature_ptr->hold_exp = TRUE;
812 void have_see_inv(player_type *creature_ptr)
815 BIT_FLAGS flgs[TR_FLAG_SIZE];
816 creature_ptr->see_inv = FALSE;
818 if (creature_ptr->pclass == CLASS_NINJA || creature_ptr->lev > 29)
819 creature_ptr->see_inv = TRUE;
821 if (creature_ptr->mimic_form == MIMIC_DEMON || creature_ptr->mimic_form == MIMIC_DEMON_LORD || creature_ptr->mimic_form == MIMIC_VAMPIRE) {
822 creature_ptr->see_inv = TRUE;
825 if (!creature_ptr->mimic_form
826 && (creature_ptr->prace == RACE_HIGH_ELF || creature_ptr->prace == RACE_GOLEM || creature_ptr->prace == RACE_SKELETON
827 || creature_ptr->prace == RACE_ZOMBIE || creature_ptr->prace == RACE_SPECTRE || creature_ptr->prace == RACE_ARCHON)) {
828 creature_ptr->see_inv = TRUE;
831 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_DARK_ELF) {
832 if (creature_ptr->lev > 19)
833 creature_ptr->see_inv = TRUE;
836 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_MIND_FLAYER) {
837 if (creature_ptr->lev > 14)
838 creature_ptr->see_inv = TRUE;
841 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_IMP || creature_ptr->prace == RACE_BALROG)) {
842 if (creature_ptr->lev > 9)
843 creature_ptr->see_inv = TRUE;
846 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
847 creature_ptr->see_inv = TRUE;
850 if (creature_ptr->tim_invis) {
851 creature_ptr->see_inv = TRUE;
854 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
855 o_ptr = &creature_ptr->inventory_list[i];
859 object_flags(creature_ptr, o_ptr, flgs);
860 if (have_flag(flgs, TR_SEE_INVIS))
861 creature_ptr->see_inv = TRUE;
865 void have_free_act(player_type *creature_ptr)
868 BIT_FLAGS flgs[TR_FLAG_SIZE];
869 creature_ptr->free_act = FALSE;
871 if (creature_ptr->muta3 & MUT3_MOTION)
872 creature_ptr->free_act = TRUE;
874 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_GNOME) {
875 creature_ptr->free_act = TRUE;
878 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_GOLEM) {
879 creature_ptr->free_act = TRUE;
882 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_SPECTRE) {
883 creature_ptr->free_act = TRUE;
886 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_ANDROID) {
887 creature_ptr->free_act = TRUE;
890 if (heavy_armor(creature_ptr) && (!creature_ptr->inventory_list[INVEN_RARM].k_idx || have_right_hand_weapon(creature_ptr))
891 && (!creature_ptr->inventory_list[INVEN_LARM].k_idx || have_left_hand_weapon(creature_ptr))) {
892 if (creature_ptr->lev > 24)
893 creature_ptr->free_act = TRUE;
896 if (creature_ptr->pclass == CLASS_MONK || creature_ptr->pclass == CLASS_FORCETRAINER) {
897 if (!(heavy_armor(creature_ptr))) {
898 if (creature_ptr->lev > 24)
899 creature_ptr->free_act = TRUE;
903 if (creature_ptr->pclass == CLASS_BERSERKER) {
904 creature_ptr->free_act = TRUE;
907 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
908 creature_ptr->free_act = TRUE;
911 if (creature_ptr->magicdef) {
912 creature_ptr->free_act = TRUE;
915 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
916 o_ptr = &creature_ptr->inventory_list[i];
920 object_flags(creature_ptr, o_ptr, flgs);
921 if (have_flag(flgs, TR_FREE_ACT))
922 creature_ptr->free_act = TRUE;
926 void have_sustain_str(player_type *creature_ptr)
929 BIT_FLAGS flgs[TR_FLAG_SIZE];
930 creature_ptr->sustain_str = FALSE;
931 if (creature_ptr->pclass == CLASS_BERSERKER) {
932 creature_ptr->sustain_str = TRUE;
934 if (!creature_ptr->mimic_form
935 && (creature_ptr->prace == RACE_HALF_TROLL || creature_ptr->prace == RACE_HALF_OGRE || creature_ptr->prace == RACE_HALF_GIANT)) {
936 creature_ptr->sustain_str = TRUE;
938 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
939 creature_ptr->sustain_str = TRUE;
942 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
943 o_ptr = &creature_ptr->inventory_list[i];
947 object_flags(creature_ptr, o_ptr, flgs);
948 if (have_flag(flgs, TR_SUST_STR))
949 creature_ptr->sustain_str = TRUE;
953 void have_sustain_int(player_type *creature_ptr)
956 BIT_FLAGS flgs[TR_FLAG_SIZE];
957 creature_ptr->sustain_int = FALSE;
958 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_MIND_FLAYER)) {
959 creature_ptr->sustain_int = TRUE;
962 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
963 creature_ptr->sustain_int = TRUE;
966 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
967 o_ptr = &creature_ptr->inventory_list[i];
971 object_flags(creature_ptr, o_ptr, flgs);
972 if (have_flag(flgs, TR_SUST_INT))
973 creature_ptr->sustain_int = TRUE;
977 void have_sustain_wis(player_type *creature_ptr)
980 BIT_FLAGS flgs[TR_FLAG_SIZE];
981 creature_ptr->sustain_wis = FALSE;
982 if (creature_ptr->pclass == CLASS_MINDCRAFTER && creature_ptr->lev > 19)
983 creature_ptr->sustain_wis = TRUE;
985 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_MIND_FLAYER)) {
986 creature_ptr->sustain_wis = TRUE;
989 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
990 creature_ptr->sustain_wis = TRUE;
993 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
994 o_ptr = &creature_ptr->inventory_list[i];
998 object_flags(creature_ptr, o_ptr, flgs);
999 if (have_flag(flgs, TR_SUST_WIS))
1000 creature_ptr->sustain_wis = TRUE;
1004 void have_sustain_dex(player_type *creature_ptr)
1007 BIT_FLAGS flgs[TR_FLAG_SIZE];
1008 creature_ptr->sustain_dex = FALSE;
1009 if (creature_ptr->pclass == CLASS_BERSERKER) {
1010 creature_ptr->sustain_dex = TRUE;
1013 if (creature_ptr->pclass == CLASS_NINJA && creature_ptr->lev > 24)
1014 creature_ptr->sustain_dex = TRUE;
1016 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1017 creature_ptr->sustain_dex = TRUE;
1020 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1021 o_ptr = &creature_ptr->inventory_list[i];
1025 object_flags(creature_ptr, o_ptr, flgs);
1026 if (have_flag(flgs, TR_SUST_DEX))
1027 creature_ptr->sustain_dex = TRUE;
1031 void have_sustain_con(player_type *creature_ptr)
1034 BIT_FLAGS flgs[TR_FLAG_SIZE];
1035 creature_ptr->sustain_con = FALSE;
1036 if (creature_ptr->pclass == CLASS_BERSERKER) {
1037 creature_ptr->sustain_con = TRUE;
1040 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_AMBERITE || creature_ptr->prace == RACE_DUNADAN)) {
1041 creature_ptr->sustain_con = TRUE;
1044 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1045 creature_ptr->sustain_con = TRUE;
1048 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1049 o_ptr = &creature_ptr->inventory_list[i];
1053 object_flags(creature_ptr, o_ptr, flgs);
1054 if (have_flag(flgs, TR_SUST_CON))
1055 creature_ptr->sustain_con = TRUE;
1059 void have_sustain_chr(player_type *creature_ptr)
1062 BIT_FLAGS flgs[TR_FLAG_SIZE];
1063 creature_ptr->sustain_chr = FALSE;
1065 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1066 creature_ptr->sustain_chr = TRUE;
1069 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1070 o_ptr = &creature_ptr->inventory_list[i];
1074 object_flags(creature_ptr, o_ptr, flgs);
1075 if (have_flag(flgs, TR_SUST_CHR))
1076 creature_ptr->sustain_chr = TRUE;
1080 void have_levitation(player_type *creature_ptr)
1083 BIT_FLAGS flgs[TR_FLAG_SIZE];
1084 creature_ptr->levitation = FALSE;
1086 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1087 creature_ptr->levitation = TRUE;
1090 if (creature_ptr->muta3 & MUT3_WINGS)
1091 creature_ptr->levitation = TRUE;
1093 if (!creature_ptr->mimic_form
1094 && (creature_ptr->prace == RACE_DRACONIAN || creature_ptr->prace == RACE_SPECTRE || creature_ptr->prace == RACE_SPRITE
1095 || creature_ptr->prace == RACE_ARCHON || creature_ptr->prace == RACE_S_FAIRY)) {
1096 creature_ptr->levitation = TRUE;
1099 if (creature_ptr->special_defense & KAMAE_SEIRYU || creature_ptr->special_defense & KAMAE_SUZAKU) {
1100 creature_ptr->levitation = TRUE;
1103 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1104 creature_ptr->levitation = TRUE;
1107 if (creature_ptr->magicdef) {
1110 if (creature_ptr->riding) {
1111 monster_type *riding_m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
1112 monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
1113 creature_ptr->levitation = (riding_r_ptr->flags7 & RF7_CAN_FLY) ? TRUE : FALSE;
1116 if (creature_ptr->tim_levitation) {
1117 creature_ptr->levitation = TRUE;
1120 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1121 o_ptr = &creature_ptr->inventory_list[i];
1124 object_flags(creature_ptr, o_ptr, flgs);
1125 if (have_flag(flgs, TR_LEVITATION))
1126 creature_ptr->levitation = TRUE;
1130 void have_can_swim(player_type *creature_ptr)
1132 creature_ptr->can_swim = FALSE;
1133 if (creature_ptr->riding) {
1134 monster_type *riding_m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
1135 monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
1136 if (riding_r_ptr->flags7 & (RF7_CAN_SWIM | RF7_AQUATIC))
1137 creature_ptr->can_swim = TRUE;
1141 void have_slow_digest(player_type *creature_ptr)
1144 BIT_FLAGS flgs[TR_FLAG_SIZE];
1145 creature_ptr->slow_digest = FALSE;
1147 if (creature_ptr->pclass == CLASS_NINJA) {
1148 creature_ptr->slow_digest = TRUE;
1151 if (creature_ptr->lev > 14 && !creature_ptr->mimic_form && creature_ptr->prace == RACE_HALF_TROLL) {
1152 if (creature_ptr->pclass == CLASS_WARRIOR || creature_ptr->pclass == CLASS_BERSERKER) {
1153 creature_ptr->slow_digest = TRUE;
1154 /* Let's not make Regeneration
1155 * a disadvantage for the poor warriors who can
1156 * never learn a spell that satisfies hunger (actually
1157 * neither can rogues, but half-trolls are not
1158 * supposed to play rogues) */
1162 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1163 creature_ptr->slow_digest = TRUE;
1166 if (!creature_ptr->mimic_form
1167 && (creature_ptr->prace == RACE_GOLEM || creature_ptr->prace == RACE_ZOMBIE || creature_ptr->prace == RACE_SPECTRE
1168 || creature_ptr->prace == RACE_ANDROID)) {
1169 creature_ptr->slow_digest = TRUE;
1172 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1173 o_ptr = &creature_ptr->inventory_list[i];
1176 object_flags(creature_ptr, o_ptr, flgs);
1177 if (have_flag(flgs, TR_SLOW_DIGEST))
1178 creature_ptr->slow_digest = TRUE;
1182 void have_regenerate(player_type *creature_ptr)
1185 BIT_FLAGS flgs[TR_FLAG_SIZE];
1186 creature_ptr->regenerate = FALSE;
1188 if (!creature_ptr->mimic_form) {
1189 switch (creature_ptr->prace) {
1190 case RACE_HALF_TROLL:
1191 if (creature_ptr->lev > 14) {
1192 creature_ptr->regenerate = TRUE;
1196 creature_ptr->regenerate = TRUE;
1201 switch (creature_ptr->pclass) {
1203 if (creature_ptr->lev > 44)
1204 creature_ptr->regenerate = TRUE;
1206 case CLASS_BERSERKER:
1207 creature_ptr->regenerate = TRUE;
1211 if (creature_ptr->muta3 & MUT3_FLESH_ROT)
1212 creature_ptr->regenerate = FALSE;
1214 if (creature_ptr->muta3 & MUT3_REGEN)
1215 creature_ptr->regenerate = TRUE;
1217 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1218 creature_ptr->regenerate = TRUE;
1221 if (creature_ptr->realm1 == REALM_HEX) {
1222 if (hex_spelling(creature_ptr, HEX_DEMON_AURA)) {
1223 creature_ptr->regenerate = TRUE;
1227 if (creature_ptr->tim_regen) {
1228 creature_ptr->regenerate = TRUE;
1231 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1232 o_ptr = &creature_ptr->inventory_list[i];
1235 object_flags(creature_ptr, o_ptr, flgs);
1236 if (have_flag(flgs, TR_REGEN))
1237 creature_ptr->regenerate = TRUE;
1241 void have_curses(player_type *creature_ptr)
1244 BIT_FLAGS flgs[TR_FLAG_SIZE];
1245 creature_ptr->cursed = 0L;
1247 if (creature_ptr->pseikaku == PERSONALITY_SEXY)
1248 creature_ptr->cursed |= (TRC_AGGRAVATE);
1250 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1251 o_ptr = &creature_ptr->inventory_list[i];
1254 object_flags(creature_ptr, o_ptr, flgs);
1255 if (have_flag(flgs, TR_AGGRAVATE))
1256 creature_ptr->cursed |= TRC_AGGRAVATE;
1257 if (have_flag(flgs, TR_DRAIN_EXP))
1258 creature_ptr->cursed |= TRC_DRAIN_EXP;
1259 if (have_flag(flgs, TR_TY_CURSE))
1260 creature_ptr->cursed |= TRC_TY_CURSE;
1261 if (have_flag(flgs, TR_ADD_L_CURSE))
1262 creature_ptr->cursed |= TRC_ADD_L_CURSE;
1263 if (have_flag(flgs, TR_ADD_H_CURSE))
1264 creature_ptr->cursed |= TRC_ADD_H_CURSE;
1265 if (have_flag(flgs, TR_DRAIN_HP))
1266 creature_ptr->cursed |= TRC_DRAIN_HP;
1267 if (have_flag(flgs, TR_DRAIN_MANA))
1268 creature_ptr->cursed |= TRC_DRAIN_MANA;
1269 if (have_flag(flgs, TR_CALL_ANIMAL))
1270 creature_ptr->cursed |= TRC_CALL_ANIMAL;
1271 if (have_flag(flgs, TR_CALL_DEMON))
1272 creature_ptr->cursed |= TRC_CALL_DEMON;
1273 if (have_flag(flgs, TR_CALL_DRAGON))
1274 creature_ptr->cursed |= TRC_CALL_DRAGON;
1275 if (have_flag(flgs, TR_CALL_UNDEAD))
1276 creature_ptr->cursed |= TRC_CALL_UNDEAD;
1277 if (have_flag(flgs, TR_COWARDICE))
1278 creature_ptr->cursed |= TRC_COWARDICE;
1279 if (have_flag(flgs, TR_LOW_MELEE))
1280 creature_ptr->cursed |= TRC_LOW_MELEE;
1281 if (have_flag(flgs, TR_LOW_AC))
1282 creature_ptr->cursed |= TRC_LOW_AC;
1283 if (have_flag(flgs, TR_LOW_MAGIC))
1284 creature_ptr->cursed |= TRC_LOW_MAGIC;
1285 if (have_flag(flgs, TR_FAST_DIGEST))
1286 creature_ptr->cursed |= TRC_FAST_DIGEST;
1287 if (have_flag(flgs, TR_SLOW_REGEN))
1288 creature_ptr->cursed |= TRC_SLOW_REGEN;
1290 creature_ptr->cursed |= (o_ptr->curse_flags & (0xFFFFFFF0L));
1291 if (o_ptr->name1 == ART_CHAINSWORD)
1292 creature_ptr->cursed |= TRC_CHAINSWORD;
1294 if (have_flag(flgs, TR_TELEPORT)) {
1295 if (object_is_cursed(o_ptr))
1296 creature_ptr->cursed |= TRC_TELEPORT;
1298 concptr insc = quark_str(o_ptr->inscription);
1300 /* {.} will stop random teleportation. */
1301 if (o_ptr->inscription && angband_strchr(insc, '.')) {
1303 creature_ptr->cursed |= TRC_TELEPORT_SELF;
1309 if (creature_ptr->cursed & TRC_TELEPORT)
1310 creature_ptr->cursed &= ~(TRC_TELEPORT_SELF);
1312 if ((is_specific_player_race(creature_ptr, RACE_S_FAIRY)) && (creature_ptr->pseikaku != PERSONALITY_SEXY) && (creature_ptr->cursed & TRC_AGGRAVATE)) {
1313 creature_ptr->cursed &= ~(TRC_AGGRAVATE);
1317 void have_impact(player_type *creature_ptr)
1320 BIT_FLAGS flgs[TR_FLAG_SIZE];
1321 creature_ptr->impact[0] = FALSE;
1322 creature_ptr->impact[1] = FALSE;
1324 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1325 o_ptr = &creature_ptr->inventory_list[i];
1328 object_flags(creature_ptr, o_ptr, flgs);
1329 if (have_flag(flgs, TR_IMPACT))
1330 creature_ptr->impact[(i == INVEN_RARM) ? 0 : 1] = TRUE;
1334 void have_extra_blow(player_type *creature_ptr)
1337 BIT_FLAGS flgs[TR_FLAG_SIZE];
1338 creature_ptr->extra_blows[0] = creature_ptr->extra_blows[1] = 0;
1340 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1341 o_ptr = &creature_ptr->inventory_list[i];
1345 object_flags(creature_ptr, o_ptr, flgs);
1347 if (have_flag(flgs, TR_INFRA))
1348 creature_ptr->see_infra += o_ptr->pval;
1349 if (have_flag(flgs, TR_BLOWS)) {
1350 if ((i == INVEN_RARM || i == INVEN_RIGHT) && !have_two_handed_weapons(creature_ptr))
1351 creature_ptr->extra_blows[0] += o_ptr->pval;
1352 else if ((i == INVEN_LARM || i == INVEN_LEFT) && !have_two_handed_weapons(creature_ptr))
1353 creature_ptr->extra_blows[1] += o_ptr->pval;
1355 creature_ptr->extra_blows[0] += o_ptr->pval;
1356 creature_ptr->extra_blows[1] += o_ptr->pval;
1362 void have_resist_acid(player_type *creature_ptr)
1365 BIT_FLAGS flgs[TR_FLAG_SIZE];
1366 creature_ptr->resist_acid = FALSE;
1368 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1369 creature_ptr->resist_acid = TRUE;
1372 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_YEEK || creature_ptr->prace == RACE_KLACKON)) {
1373 creature_ptr->resist_acid = TRUE;
1376 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_DRACONIAN && creature_ptr->lev > 14) {
1377 creature_ptr->resist_acid = TRUE;
1380 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
1381 creature_ptr->resist_acid = TRUE;
1384 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1385 creature_ptr->resist_acid = TRUE;
1388 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1389 o_ptr = &creature_ptr->inventory_list[i];
1393 object_flags(creature_ptr, o_ptr, flgs);
1394 if (have_flag(flgs, TR_RES_ACID))
1395 creature_ptr->resist_acid = TRUE;
1398 if (creature_ptr->immune_acid)
1399 creature_ptr->resist_acid = TRUE;
1402 void have_resist_elec(player_type *creature_ptr)
1405 BIT_FLAGS flgs[TR_FLAG_SIZE];
1406 creature_ptr->resist_elec = FALSE;
1408 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1409 creature_ptr->resist_elec = TRUE;
1412 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_DRACONIAN && creature_ptr->lev > 19) {
1413 creature_ptr->resist_elec = TRUE;
1416 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
1417 creature_ptr->resist_elec = TRUE;
1420 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1421 creature_ptr->resist_elec = TRUE;
1424 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1425 o_ptr = &creature_ptr->inventory_list[i];
1429 object_flags(creature_ptr, o_ptr, flgs);
1430 if (have_flag(flgs, TR_RES_ELEC))
1431 creature_ptr->resist_elec = TRUE;
1434 if (creature_ptr->immune_elec)
1435 creature_ptr->resist_elec = TRUE;
1438 void have_resist_fire(player_type *creature_ptr)
1441 BIT_FLAGS flgs[TR_FLAG_SIZE];
1442 creature_ptr->resist_fire = FALSE;
1444 if (creature_ptr->mimic_form == MIMIC_DEMON || creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1445 creature_ptr->resist_fire = TRUE;
1448 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_DRACONIAN && creature_ptr->lev > 4) {
1449 creature_ptr->resist_fire = TRUE;
1452 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_IMP || creature_ptr->prace == RACE_BALROG)) {
1453 creature_ptr->resist_fire = TRUE;
1456 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
1457 creature_ptr->resist_fire = TRUE;
1460 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1461 creature_ptr->resist_fire = TRUE;
1464 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1465 o_ptr = &creature_ptr->inventory_list[i];
1469 object_flags(creature_ptr, o_ptr, flgs);
1471 if (have_flag(flgs, TR_RES_FIRE))
1472 creature_ptr->resist_fire = TRUE;
1475 if (creature_ptr->immune_fire)
1476 creature_ptr->resist_fire = TRUE;
1479 void have_resist_cold(player_type *creature_ptr)
1482 BIT_FLAGS flgs[TR_FLAG_SIZE];
1483 creature_ptr->resist_cold = FALSE;
1485 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD || creature_ptr->mimic_form == MIMIC_VAMPIRE) {
1486 creature_ptr->resist_cold = TRUE;
1489 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_ZOMBIE) && creature_ptr->lev > 4) {
1490 creature_ptr->resist_cold = TRUE;
1493 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_DRACONIAN || creature_ptr->prace == RACE_SKELETON) && creature_ptr->lev > 9) {
1494 creature_ptr->resist_cold = TRUE;
1497 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_VAMPIRE || creature_ptr->prace == RACE_SPECTRE)) {
1498 creature_ptr->resist_fire = TRUE;
1501 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
1502 creature_ptr->resist_cold = TRUE;
1505 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1506 creature_ptr->resist_cold = TRUE;
1509 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1510 o_ptr = &creature_ptr->inventory_list[i];
1514 object_flags(creature_ptr, o_ptr, flgs);
1516 if (have_flag(flgs, TR_RES_COLD))
1517 creature_ptr->resist_cold = TRUE;
1520 if (creature_ptr->immune_cold)
1521 creature_ptr->resist_cold = TRUE;
1524 void have_resist_pois(player_type *creature_ptr)
1527 BIT_FLAGS flgs[TR_FLAG_SIZE];
1528 creature_ptr->resist_pois = FALSE;
1530 if (creature_ptr->pclass == CLASS_NINJA && creature_ptr->lev > 19)
1531 creature_ptr->resist_pois = TRUE;
1533 if (creature_ptr->mimic_form == MIMIC_VAMPIRE || creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1534 creature_ptr->resist_pois = TRUE;
1537 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_DRACONIAN && creature_ptr->lev > 34) {
1538 creature_ptr->resist_pois = TRUE;
1541 if (!creature_ptr->mimic_form
1542 && (creature_ptr->prace == RACE_KOBOLD || creature_ptr->prace == RACE_GOLEM || creature_ptr->prace == RACE_SKELETON
1543 || creature_ptr->prace == RACE_VAMPIRE || creature_ptr->prace == RACE_SPECTRE || creature_ptr->prace == RACE_ANDROID)) {
1544 creature_ptr->resist_pois = TRUE;
1547 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
1548 creature_ptr->resist_pois = TRUE;
1551 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1552 creature_ptr->resist_pois = TRUE;
1555 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1556 o_ptr = &creature_ptr->inventory_list[i];
1560 object_flags(creature_ptr, o_ptr, flgs);
1562 if (have_flag(flgs, TR_RES_POIS))
1563 creature_ptr->resist_pois = TRUE;
1567 void have_resist_conf(player_type *creature_ptr)
1570 BIT_FLAGS flgs[TR_FLAG_SIZE];
1571 creature_ptr->resist_conf = FALSE;
1573 if (creature_ptr->pclass == CLASS_MINDCRAFTER && creature_ptr->lev > 29)
1574 creature_ptr->resist_conf = TRUE;
1576 if (creature_ptr->pseikaku == PERSONALITY_CHARGEMAN || creature_ptr->pseikaku == PERSONALITY_MUNCHKIN) {
1577 creature_ptr->resist_conf = TRUE;
1580 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_KLACKON || creature_ptr->prace == RACE_BEASTMAN || creature_ptr->prace == RACE_KUTAR)) {
1581 creature_ptr->resist_conf = TRUE;
1584 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1585 creature_ptr->resist_conf = TRUE;
1588 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1589 creature_ptr->resist_conf = TRUE;
1592 if (creature_ptr->magicdef) {
1593 creature_ptr->resist_conf = TRUE;
1596 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1597 o_ptr = &creature_ptr->inventory_list[i];
1601 object_flags(creature_ptr, o_ptr, flgs);
1603 if (have_flag(flgs, TR_RES_CONF))
1604 creature_ptr->resist_conf = TRUE;
1608 void have_resist_sound(player_type *creature_ptr)
1611 BIT_FLAGS flgs[TR_FLAG_SIZE];
1612 creature_ptr->resist_sound = FALSE;
1614 if (creature_ptr->pclass == CLASS_BARD) {
1615 creature_ptr->resist_sound = TRUE;
1618 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_CYCLOPS || creature_ptr->prace == RACE_BEASTMAN)) {
1619 creature_ptr->resist_sound = TRUE;
1622 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1623 creature_ptr->resist_sound = TRUE;
1626 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1627 o_ptr = &creature_ptr->inventory_list[i];
1631 object_flags(creature_ptr, o_ptr, flgs);
1633 if (have_flag(flgs, TR_RES_SOUND))
1634 creature_ptr->resist_sound = TRUE;
1638 void have_resist_lite(player_type *creature_ptr)
1641 BIT_FLAGS flgs[TR_FLAG_SIZE];
1642 creature_ptr->resist_lite = FALSE;
1644 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_ELF || creature_ptr->prace == RACE_HIGH_ELF || creature_ptr->prace == RACE_SPRITE)) {
1645 creature_ptr->resist_lite = TRUE;
1648 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1649 creature_ptr->resist_lite = TRUE;
1652 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1653 o_ptr = &creature_ptr->inventory_list[i];
1657 object_flags(creature_ptr, o_ptr, flgs);
1659 if (have_flag(flgs, TR_RES_LITE))
1660 creature_ptr->resist_lite = TRUE;
1664 void have_resist_dark(player_type *creature_ptr)
1667 BIT_FLAGS flgs[TR_FLAG_SIZE];
1668 creature_ptr->resist_dark = FALSE;
1670 if (creature_ptr->mimic_form == MIMIC_VAMPIRE) {
1671 creature_ptr->resist_dark = TRUE;
1674 if (!creature_ptr->mimic_form
1675 && (creature_ptr->prace == RACE_HALF_ORC || creature_ptr->prace == RACE_HALF_OGRE || creature_ptr->prace == RACE_NIBELUNG
1676 || creature_ptr->prace == RACE_DARK_ELF || creature_ptr->prace == RACE_VAMPIRE)) {
1677 creature_ptr->resist_lite = TRUE;
1680 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1681 creature_ptr->resist_dark = TRUE;
1684 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1685 o_ptr = &creature_ptr->inventory_list[i];
1689 object_flags(creature_ptr, o_ptr, flgs);
1691 if (have_flag(flgs, TR_RES_DARK))
1692 creature_ptr->resist_dark = TRUE;
1696 void have_resist_chaos(player_type *creature_ptr)
1699 BIT_FLAGS flgs[TR_FLAG_SIZE];
1700 creature_ptr->resist_chaos = FALSE;
1702 if (creature_ptr->pclass == CLASS_CHAOS_WARRIOR && creature_ptr->lev > 29)
1703 creature_ptr->resist_chaos = TRUE;
1705 if (creature_ptr->mimic_form == MIMIC_DEMON || creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1706 creature_ptr->resist_chaos = TRUE;
1709 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_HALF_TITAN)
1710 creature_ptr->resist_chaos = TRUE;
1712 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1713 creature_ptr->resist_chaos = TRUE;
1716 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1717 o_ptr = &creature_ptr->inventory_list[i];
1721 object_flags(creature_ptr, o_ptr, flgs);
1723 if (have_flag(flgs, TR_RES_CHAOS))
1724 creature_ptr->resist_chaos = TRUE;
1728 void have_resist_disen(player_type *creature_ptr)
1731 BIT_FLAGS flgs[TR_FLAG_SIZE];
1732 creature_ptr->resist_disen = FALSE;
1734 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1735 creature_ptr->resist_disen = TRUE;
1738 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_NIBELUNG)
1739 creature_ptr->resist_disen = TRUE;
1741 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1742 creature_ptr->resist_disen = TRUE;
1745 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1746 o_ptr = &creature_ptr->inventory_list[i];
1750 object_flags(creature_ptr, o_ptr, flgs);
1752 if (have_flag(flgs, TR_RES_DISEN))
1753 creature_ptr->resist_disen = TRUE;
1757 void have_resist_shard(player_type *creature_ptr)
1760 BIT_FLAGS flgs[TR_FLAG_SIZE];
1761 creature_ptr->resist_shard = FALSE;
1763 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_HALF_TITAN || creature_ptr->prace == RACE_SKELETON))
1764 creature_ptr->resist_shard = TRUE;
1766 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1767 creature_ptr->resist_shard = TRUE;
1770 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1771 o_ptr = &creature_ptr->inventory_list[i];
1775 object_flags(creature_ptr, o_ptr, flgs);
1777 if (have_flag(flgs, TR_RES_DISEN))
1778 creature_ptr->resist_shard = TRUE;
1782 void have_resist_nexus(player_type *creature_ptr)
1785 BIT_FLAGS flgs[TR_FLAG_SIZE];
1786 creature_ptr->resist_nexus = FALSE;
1788 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1789 creature_ptr->resist_nexus = TRUE;
1792 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1793 creature_ptr->resist_nexus = TRUE;
1796 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1797 o_ptr = &creature_ptr->inventory_list[i];
1801 object_flags(creature_ptr, o_ptr, flgs);
1803 if (have_flag(flgs, TR_RES_NEXUS))
1804 creature_ptr->resist_nexus = TRUE;
1808 void have_resist_blind(player_type *creature_ptr)
1811 BIT_FLAGS flgs[TR_FLAG_SIZE];
1812 creature_ptr->resist_blind = FALSE;
1814 if (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN) {
1815 creature_ptr->resist_blind = TRUE;
1818 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_DWARF)
1819 creature_ptr->resist_blind = TRUE;
1821 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1822 creature_ptr->resist_blind = TRUE;
1825 if (creature_ptr->magicdef) {
1826 creature_ptr->resist_blind = TRUE;
1829 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1830 o_ptr = &creature_ptr->inventory_list[i];
1834 object_flags(creature_ptr, o_ptr, flgs);
1836 if (have_flag(flgs, TR_RES_BLIND))
1837 creature_ptr->resist_blind = TRUE;
1841 void have_resist_neth(player_type *creature_ptr)
1844 BIT_FLAGS flgs[TR_FLAG_SIZE];
1846 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD || creature_ptr->mimic_form == MIMIC_DEMON || creature_ptr->mimic_form == MIMIC_VAMPIRE) {
1847 creature_ptr->resist_neth = TRUE;
1850 if (!creature_ptr->mimic_form
1851 && (creature_ptr->prace == RACE_ZOMBIE || creature_ptr->prace == RACE_VAMPIRE || creature_ptr->prace == RACE_SPECTRE
1852 || creature_ptr->prace == RACE_BALROG))
1853 creature_ptr->resist_neth = TRUE;
1855 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1856 creature_ptr->resist_neth = TRUE;
1859 if (creature_ptr->tim_res_nether) {
1860 creature_ptr->resist_neth = TRUE;
1863 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1864 o_ptr = &creature_ptr->inventory_list[i];
1868 object_flags(creature_ptr, o_ptr, flgs);
1870 if (have_flag(flgs, TR_RES_NETHER))
1871 creature_ptr->resist_neth = TRUE;
1875 void have_resist_time(player_type *creature_ptr)
1878 BIT_FLAGS flgs[TR_FLAG_SIZE];
1879 creature_ptr->resist_time = FALSE;
1881 if (creature_ptr->tim_res_time) {
1882 creature_ptr->resist_time = TRUE;
1885 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1886 o_ptr = &creature_ptr->inventory_list[i];
1890 object_flags(creature_ptr, o_ptr, flgs);
1891 if (o_ptr->name2 == EGO_RING_RES_TIME)
1892 creature_ptr->resist_time = TRUE;
1896 void have_resist_water(player_type *creature_ptr)
1898 creature_ptr->resist_water = FALSE;
1900 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_MERFOLK)
1901 creature_ptr->resist_water = TRUE;
1904 void have_resist_fear(player_type *creature_ptr)
1907 BIT_FLAGS flgs[TR_FLAG_SIZE];
1908 creature_ptr->resist_fear = FALSE;
1910 if (creature_ptr->muta3 & MUT3_FEARLESS)
1911 creature_ptr->resist_fear = TRUE;
1913 switch (creature_ptr->pclass) {
1915 if (creature_ptr->lev > 29)
1916 creature_ptr->resist_fear = TRUE;
1919 if (creature_ptr->lev > 39)
1920 creature_ptr->resist_fear = TRUE;
1922 case CLASS_CHAOS_WARRIOR:
1923 if (creature_ptr->lev > 39)
1924 creature_ptr->resist_fear = TRUE;
1926 case CLASS_MINDCRAFTER:
1927 if (creature_ptr->lev > 9)
1928 creature_ptr->resist_fear = TRUE;
1931 if (creature_ptr->lev > 29)
1932 creature_ptr->resist_fear = TRUE;
1935 creature_ptr->resist_fear = TRUE;
1939 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1940 creature_ptr->resist_fear = TRUE;
1943 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_BARBARIAN)
1944 creature_ptr->resist_fear = TRUE;
1946 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1947 creature_ptr->resist_fear = TRUE;
1950 if (is_hero(creature_ptr) || creature_ptr->shero) {
1951 creature_ptr->resist_fear = TRUE;
1954 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1955 o_ptr = &creature_ptr->inventory_list[i];
1959 object_flags(creature_ptr, o_ptr, flgs);
1960 if (have_flag(flgs, TR_RES_FEAR))
1961 creature_ptr->resist_fear = TRUE;
1965 void have_immune_acid(player_type *creature_ptr)
1968 BIT_FLAGS flgs[TR_FLAG_SIZE];
1969 creature_ptr->immune_acid = FALSE;
1971 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_YEEK && creature_ptr->lev > 19)
1972 creature_ptr->immune_acid = TRUE;
1974 if (creature_ptr->ele_immune) {
1975 if (creature_ptr->special_defense & DEFENSE_ACID)
1976 creature_ptr->immune_acid = TRUE;
1979 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1980 o_ptr = &creature_ptr->inventory_list[i];
1984 object_flags(creature_ptr, o_ptr, flgs);
1985 if (have_flag(flgs, TR_IM_ACID))
1986 creature_ptr->immune_acid = TRUE;
1990 void have_immune_elec(player_type *creature_ptr)
1993 BIT_FLAGS flgs[TR_FLAG_SIZE];
1994 creature_ptr->immune_elec = FALSE;
1995 if (creature_ptr->ele_immune) {
1996 if (creature_ptr->special_defense & DEFENSE_ELEC)
1997 creature_ptr->immune_elec = TRUE;
2000 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2001 o_ptr = &creature_ptr->inventory_list[i];
2005 object_flags(creature_ptr, o_ptr, flgs);
2006 if (have_flag(flgs, TR_IM_ELEC))
2007 creature_ptr->immune_elec = TRUE;
2011 void have_immune_fire(player_type *creature_ptr)
2014 BIT_FLAGS flgs[TR_FLAG_SIZE];
2015 creature_ptr->immune_fire = FALSE;
2016 if (creature_ptr->ele_immune) {
2017 if (creature_ptr->special_defense & DEFENSE_FIRE)
2018 creature_ptr->immune_fire = TRUE;
2021 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2022 o_ptr = &creature_ptr->inventory_list[i];
2026 object_flags(creature_ptr, o_ptr, flgs);
2027 if (have_flag(flgs, TR_IM_FIRE))
2028 creature_ptr->immune_fire = TRUE;
2032 void have_immune_cold(player_type *creature_ptr)
2035 BIT_FLAGS flgs[TR_FLAG_SIZE];
2036 creature_ptr->immune_cold = FALSE;
2037 if (creature_ptr->ele_immune) {
2038 if (creature_ptr->special_defense & DEFENSE_COLD)
2039 creature_ptr->immune_cold = TRUE;
2042 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2043 o_ptr = &creature_ptr->inventory_list[i];
2047 object_flags(creature_ptr, o_ptr, flgs);
2048 if (have_flag(flgs, TR_IM_COLD))
2049 creature_ptr->immune_cold = TRUE;
2053 bool have_right_hand_weapon(player_type *creature_ptr)
2055 if (has_melee_weapon(creature_ptr, INVEN_RARM))
2058 if (can_two_hands_wielding(creature_ptr)) {
2059 switch (creature_ptr->pclass) {
2061 case CLASS_FORCETRAINER:
2062 case CLASS_BERSERKER:
2063 if (empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM)) {
2073 bool have_left_hand_weapon(player_type *creature_ptr)
2075 return has_melee_weapon(creature_ptr, INVEN_LARM);
2078 bool have_two_handed_weapons(player_type *creature_ptr)
2080 if (can_two_hands_wielding(creature_ptr)) {
2081 if (have_right_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_LARM)
2082 && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_RARM])) {
2084 } else if (have_left_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_RARM)
2085 && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_LARM])) {
2092 void have_lite(player_type *creature_ptr)
2094 creature_ptr->lite = FALSE;
2095 if (creature_ptr->pclass == CLASS_NINJA)
2098 if (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN) {
2099 creature_ptr->lite = TRUE;
2102 if (creature_ptr->mimic_form == MIMIC_VAMPIRE) {
2103 creature_ptr->lite = TRUE;
2106 if (creature_ptr->muta3 & MUT3_FIRE_BODY) {
2107 creature_ptr->lite = TRUE;
2110 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_VAMPIRE)
2111 creature_ptr->lite = TRUE;
2113 if (creature_ptr->sh_fire)
2114 creature_ptr->lite = TRUE;
2116 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
2117 creature_ptr->lite = TRUE;
2121 bool is_disable_two_handed_bonus(player_type *creature_ptr, int i)
2124 o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
2125 if (has_melee_weapon(creature_ptr, INVEN_RARM + i)) {
2126 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))
2132 bool is_icky_wield_weapon(player_type *creature_ptr, int i)
2135 BIT_FLAGS flgs[TR_FLAG_SIZE];
2136 o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
2137 object_flags(creature_ptr, o_ptr, flgs);
2139 if ((creature_ptr->pclass == CLASS_PRIEST) && (!(have_flag(flgs, TR_BLESSED))) && ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM))) {
2141 } else if (creature_ptr->pclass == CLASS_SORCERER) {
2142 if (!((o_ptr->tval == TV_HAFTED) && ((o_ptr->sval == SV_WIZSTAFF) || (o_ptr->sval == SV_NAMAKE_HAMMER)))) {
2146 if (is_not_monk_weapon(creature_ptr, i) || is_not_ninja_weapon(creature_ptr, i)) {
2152 bool is_riding_wield_weapon(player_type *creature_ptr, int i)
2155 BIT_FLAGS flgs[TR_FLAG_SIZE];
2156 o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
2157 object_flags(creature_ptr, o_ptr, flgs);
2158 if (creature_ptr->riding != 0 && !(o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE))
2159 && !have_flag(flgs, TR_RIDING)) {
2165 bool is_not_ninja_weapon(player_type *creature_ptr, int i)
2167 tval_type tval = creature_ptr->inventory_list[INVEN_RARM + i].tval - TV_WEAPON_BEGIN;
2168 OBJECT_SUBTYPE_VALUE sval = creature_ptr->inventory_list[INVEN_RARM + i].sval;
2169 return creature_ptr->pclass == CLASS_NINJA
2170 && !((s_info[CLASS_NINJA].w_max[tval][sval] > WEAPON_EXP_BEGINNER) && (creature_ptr->inventory_list[INVEN_LARM - i].tval != TV_SHIELD));
2173 bool is_not_monk_weapon(player_type *creature_ptr, int i)
2175 tval_type tval = creature_ptr->inventory_list[INVEN_RARM + i].tval - TV_WEAPON_BEGIN;
2176 OBJECT_SUBTYPE_VALUE sval = creature_ptr->inventory_list[INVEN_RARM + i].sval;
2177 return (creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) && (!s_info[creature_ptr->pclass].w_max[tval][sval]);
2180 bool have_good_luck(player_type *creature_ptr) { return (creature_ptr->pseikaku == PERSONALITY_LUCKY) || (creature_ptr->muta3 |= MUT3_GOOD_LUCK); };