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 BIT_FLAGS have_esp_undead(player_type *creature_ptr)
135 BIT_FLAGS flgs[TR_FLAG_SIZE];
136 BIT_FLAGS result = 0L;
138 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
139 o_ptr = &creature_ptr->inventory_list[i];
143 object_flags(creature_ptr, o_ptr, flgs);
145 if (have_flag(flgs, TR_ESP_UNDEAD))
146 result |= 0x01 << (i - INVEN_RARM);
152 BIT_FLAGS have_esp_demon(player_type *creature_ptr)
155 BIT_FLAGS flgs[TR_FLAG_SIZE];
156 BIT_FLAGS result = 0L;
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 result |= 0x01 << (i - INVEN_RARM);
172 BIT_FLAGS have_esp_orc(player_type *creature_ptr)
175 BIT_FLAGS flgs[TR_FLAG_SIZE];
176 BIT_FLAGS result = 0L;
178 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
179 o_ptr = &creature_ptr->inventory_list[i];
183 object_flags(creature_ptr, o_ptr, flgs);
185 if (have_flag(flgs, TR_ESP_ORC))
186 result |= 0x01 << (i - INVEN_RARM);
192 BIT_FLAGS have_esp_troll(player_type *creature_ptr)
195 BIT_FLAGS flgs[TR_FLAG_SIZE];
196 BIT_FLAGS result = 0L;
198 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
199 o_ptr = &creature_ptr->inventory_list[i];
203 object_flags(creature_ptr, o_ptr, flgs);
205 if (have_flag(flgs, TR_ESP_TROLL))
206 result |= 0x01 << (i - INVEN_RARM);
212 BIT_FLAGS have_esp_giant(player_type *creature_ptr)
215 BIT_FLAGS flgs[TR_FLAG_SIZE];
216 BIT_FLAGS result = 0L;
218 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
219 o_ptr = &creature_ptr->inventory_list[i];
223 object_flags(creature_ptr, o_ptr, flgs);
225 if (have_flag(flgs, TR_ESP_GIANT))
226 result |= 0x01 << (i - INVEN_RARM);
232 BIT_FLAGS have_esp_dragon(player_type *creature_ptr)
235 BIT_FLAGS flgs[TR_FLAG_SIZE];
236 BIT_FLAGS result = 0L;
238 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
239 o_ptr = &creature_ptr->inventory_list[i];
243 object_flags(creature_ptr, o_ptr, flgs);
245 if (have_flag(flgs, TR_ESP_DRAGON))
246 result |= 0x01 << (i - INVEN_RARM);
252 void have_esp_human(player_type *creature_ptr)
255 BIT_FLAGS flgs[TR_FLAG_SIZE];
257 creature_ptr->esp_human = FALSE;
259 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
260 o_ptr = &creature_ptr->inventory_list[i];
264 object_flags(creature_ptr, o_ptr, flgs);
266 if (have_flag(flgs, TR_ESP_HUMAN))
267 creature_ptr->esp_human = TRUE;
271 void have_esp_good(player_type *creature_ptr)
274 BIT_FLAGS flgs[TR_FLAG_SIZE];
276 creature_ptr->esp_good = FALSE;
278 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
279 o_ptr = &creature_ptr->inventory_list[i];
283 object_flags(creature_ptr, o_ptr, flgs);
285 if (have_flag(flgs, TR_ESP_GOOD))
286 creature_ptr->esp_good = TRUE;
290 void have_esp_nonliving(player_type *creature_ptr)
293 BIT_FLAGS flgs[TR_FLAG_SIZE];
295 creature_ptr->esp_nonliving = FALSE;
297 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
298 o_ptr = &creature_ptr->inventory_list[i];
302 object_flags(creature_ptr, o_ptr, flgs);
304 if (have_flag(flgs, TR_ESP_NONLIVING))
305 creature_ptr->esp_nonliving = TRUE;
309 void have_esp_unique(player_type *creature_ptr)
312 BIT_FLAGS flgs[TR_FLAG_SIZE];
314 creature_ptr->esp_unique = FALSE;
316 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
317 o_ptr = &creature_ptr->inventory_list[i];
321 object_flags(creature_ptr, o_ptr, flgs);
323 if (have_flag(flgs, TR_ESP_UNIQUE))
324 creature_ptr->esp_unique = TRUE;
328 void have_esp_telepathy(player_type *creature_ptr)
331 BIT_FLAGS flgs[TR_FLAG_SIZE];
333 creature_ptr->telepathy = FALSE;
335 if (is_time_limit_esp(creature_ptr)) {
336 creature_ptr->telepathy = TRUE;
339 if (creature_ptr->muta3 & MUT3_ESP) {
340 creature_ptr->telepathy = TRUE;
343 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_MIND_FLAYER && creature_ptr->lev > 29)
344 creature_ptr->telepathy = TRUE;
346 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_SPECTRE && creature_ptr->lev > 34)
347 creature_ptr->telepathy = TRUE;
349 if (creature_ptr->pclass == CLASS_MINDCRAFTER && creature_ptr->lev > 39)
350 creature_ptr->telepathy = TRUE;
352 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
353 creature_ptr->telepathy = TRUE;
356 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
357 creature_ptr->telepathy = TRUE;
360 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
361 o_ptr = &creature_ptr->inventory_list[i];
365 object_flags(creature_ptr, o_ptr, flgs);
367 if (have_flag(flgs, TR_TELEPATHY))
368 creature_ptr->telepathy = TRUE;
372 void have_bless_blade(player_type *creature_ptr)
375 BIT_FLAGS flgs[TR_FLAG_SIZE];
377 creature_ptr->bless_blade = FALSE;
379 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
380 o_ptr = &creature_ptr->inventory_list[i];
384 object_flags(creature_ptr, o_ptr, flgs);
386 if (have_flag(flgs, TR_BLESSED))
387 creature_ptr->bless_blade = TRUE;
391 void have_easy2_weapon(player_type *creature_ptr)
394 BIT_FLAGS flgs[TR_FLAG_SIZE];
396 creature_ptr->easy_2weapon = FALSE;
398 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
399 o_ptr = &creature_ptr->inventory_list[i];
403 object_flags(creature_ptr, o_ptr, flgs);
405 if (o_ptr->name2 == EGO_2WEAPON)
406 creature_ptr->easy_2weapon = TRUE;
410 void have_down_saving(player_type *creature_ptr)
413 BIT_FLAGS flgs[TR_FLAG_SIZE];
415 creature_ptr->down_saving = FALSE;
417 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
418 o_ptr = &creature_ptr->inventory_list[i];
422 object_flags(creature_ptr, o_ptr, flgs);
424 if (o_ptr->name2 == EGO_AMU_NAIVETY)
425 creature_ptr->down_saving = TRUE;
429 void have_no_ac(player_type *creature_ptr)
432 BIT_FLAGS flgs[TR_FLAG_SIZE];
434 creature_ptr->yoiyami = FALSE;
436 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
437 o_ptr = &creature_ptr->inventory_list[i];
441 object_flags(creature_ptr, o_ptr, flgs);
443 if (o_ptr->name2 == EGO_YOIYAMI)
444 creature_ptr->yoiyami = TRUE;
448 void have_no_flowed(player_type *creature_ptr)
451 bool have_sw = FALSE, have_kabe = FALSE;
452 OBJECT_IDX this_o_idx, next_o_idx = 0;
454 creature_ptr->no_flowed = FALSE;
456 if (creature_ptr->pass_wall && !creature_ptr->kill_wall)
457 creature_ptr->no_flowed = TRUE;
459 for (int i = 0; i < INVEN_PACK; i++) {
460 if ((creature_ptr->inventory_list[i].tval == TV_NATURE_BOOK) && (creature_ptr->inventory_list[i].sval == 2))
462 if ((creature_ptr->inventory_list[i].tval == TV_CRAFT_BOOK) && (creature_ptr->inventory_list[i].sval == 2))
466 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) {
467 o_ptr = &creature_ptr->current_floor_ptr->o_list[this_o_idx];
468 next_o_idx = o_ptr->next_o_idx;
470 if ((o_ptr->tval == TV_NATURE_BOOK) && (o_ptr->sval == 2))
472 if ((o_ptr->tval == TV_CRAFT_BOOK) && (o_ptr->sval == 2))
476 if (have_sw && ((creature_ptr->realm1 == REALM_NATURE) || (creature_ptr->realm2 == REALM_NATURE) || (creature_ptr->pclass == CLASS_SORCERER))) {
477 const magic_type *s_ptr = &mp_ptr->info[REALM_NATURE - 1][SPELL_SW];
478 if (creature_ptr->lev >= s_ptr->slevel)
479 creature_ptr->no_flowed = TRUE;
482 if (have_kabe && ((creature_ptr->realm1 == REALM_CRAFT) || (creature_ptr->realm2 == REALM_CRAFT) || (creature_ptr->pclass == CLASS_SORCERER))) {
483 const magic_type *s_ptr = &mp_ptr->info[REALM_CRAFT - 1][SPELL_WALL];
484 if (creature_ptr->lev >= s_ptr->slevel)
485 creature_ptr->no_flowed = TRUE;
489 void have_mighty_throw(player_type *creature_ptr)
493 creature_ptr->mighty_throw = FALSE;
495 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
496 o_ptr = &creature_ptr->inventory_list[i];
500 if (o_ptr->name2 == EGO_RING_THROW)
501 creature_ptr->mighty_throw = TRUE;
505 void have_dec_mana(player_type *creature_ptr)
508 BIT_FLAGS flgs[TR_FLAG_SIZE];
510 creature_ptr->xtra_might = FALSE;
512 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
513 o_ptr = &creature_ptr->inventory_list[i];
517 object_flags(creature_ptr, o_ptr, flgs);
519 if (have_flag(flgs, TR_DEC_MANA))
520 creature_ptr->dec_mana = TRUE;
524 void have_reflect(player_type *creature_ptr)
527 BIT_FLAGS flgs[TR_FLAG_SIZE];
529 creature_ptr->reflect = FALSE;
531 if (creature_ptr->pclass == CLASS_BERSERKER && creature_ptr->lev > 39)
532 creature_ptr->reflect = TRUE;
534 if (creature_ptr->pclass == CLASS_MIRROR_MASTER && creature_ptr->lev > 39)
535 creature_ptr->reflect = TRUE;
537 if (creature_ptr->special_defense & KAMAE_GENBU) {
538 creature_ptr->reflect = TRUE;
541 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
542 creature_ptr->reflect = TRUE;
545 if (creature_ptr->wraith_form) {
546 creature_ptr->reflect = TRUE;
549 if (creature_ptr->magicdef) {
550 creature_ptr->reflect = TRUE;
553 if (creature_ptr->tim_reflect) {
554 creature_ptr->reflect = TRUE;
557 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
558 o_ptr = &creature_ptr->inventory_list[i];
562 object_flags(creature_ptr, o_ptr, flgs);
564 if (have_flag(flgs, TR_REFLECT))
565 creature_ptr->reflect = TRUE;
569 void have_see_nocto(player_type *creature_ptr)
571 creature_ptr->see_nocto = FALSE;
573 if (creature_ptr->pclass == CLASS_NINJA)
574 creature_ptr->see_nocto = TRUE;
577 void have_warning(player_type *creature_ptr)
580 BIT_FLAGS flgs[TR_FLAG_SIZE];
582 creature_ptr->warning = FALSE;
584 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
585 o_ptr = &creature_ptr->inventory_list[i];
589 object_flags(creature_ptr, o_ptr, flgs);
591 if (have_flag(flgs, TR_WARNING)) {
592 if (!o_ptr->inscription || !(angband_strchr(quark_str(o_ptr->inscription), '$')))
593 creature_ptr->warning = TRUE;
598 void have_anti_magic(player_type *creature_ptr)
601 BIT_FLAGS flgs[TR_FLAG_SIZE];
603 creature_ptr->anti_magic = FALSE;
605 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
606 o_ptr = &creature_ptr->inventory_list[i];
610 object_flags(creature_ptr, o_ptr, flgs);
612 if (have_flag(flgs, TR_NO_MAGIC))
613 creature_ptr->anti_magic = TRUE;
617 void have_anti_tele(player_type *creature_ptr)
620 BIT_FLAGS flgs[TR_FLAG_SIZE];
622 creature_ptr->anti_tele = FALSE;
624 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
625 o_ptr = &creature_ptr->inventory_list[i];
629 object_flags(creature_ptr, o_ptr, flgs);
631 if (have_flag(flgs, TR_NO_TELE))
632 creature_ptr->anti_tele = TRUE;
636 void have_sh_fire(player_type *creature_ptr)
639 BIT_FLAGS flgs[TR_FLAG_SIZE];
640 creature_ptr->sh_fire = FALSE;
642 if (creature_ptr->muta3 & MUT3_FIRE_BODY) {
643 creature_ptr->sh_fire = TRUE;
646 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
647 creature_ptr->sh_fire = TRUE;
650 if (creature_ptr->realm1 == REALM_HEX) {
651 if (hex_spelling(creature_ptr, HEX_DEMON_AURA)) {
652 creature_ptr->sh_fire = TRUE;
656 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
657 creature_ptr->sh_fire = TRUE;
660 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
661 creature_ptr->sh_fire = TRUE;
664 if (creature_ptr->tim_sh_fire) {
665 creature_ptr->sh_fire = TRUE;
668 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
669 o_ptr = &creature_ptr->inventory_list[i];
673 object_flags(creature_ptr, o_ptr, flgs);
674 if (have_flag(flgs, TR_SH_FIRE))
675 creature_ptr->sh_fire = TRUE;
679 void have_sh_elec(player_type *creature_ptr)
682 BIT_FLAGS flgs[TR_FLAG_SIZE];
683 creature_ptr->sh_elec = FALSE;
685 if (creature_ptr->muta3 & MUT3_ELEC_TOUC)
686 creature_ptr->sh_elec = TRUE;
688 if (creature_ptr->realm1 == REALM_HEX) {
689 if (hex_spelling(creature_ptr, HEX_SHOCK_CLOAK)) {
690 creature_ptr->sh_elec = TRUE;
694 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
695 creature_ptr->sh_elec = TRUE;
698 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
699 creature_ptr->sh_elec = TRUE;
702 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
703 o_ptr = &creature_ptr->inventory_list[i];
707 object_flags(creature_ptr, o_ptr, flgs);
708 if (have_flag(flgs, TR_SH_ELEC))
709 creature_ptr->sh_elec = TRUE;
713 void have_sh_cold(player_type *creature_ptr)
716 BIT_FLAGS flgs[TR_FLAG_SIZE];
717 creature_ptr->sh_cold = FALSE;
719 if (creature_ptr->realm1 == REALM_HEX) {
720 if (hex_spelling(creature_ptr, HEX_ICE_ARMOR)) {
721 creature_ptr->sh_cold = TRUE;
725 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
726 creature_ptr->sh_cold = TRUE;
729 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
730 creature_ptr->sh_cold = TRUE;
733 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
734 o_ptr = &creature_ptr->inventory_list[i];
738 object_flags(creature_ptr, o_ptr, flgs);
739 if (have_flag(flgs, TR_SH_COLD))
740 creature_ptr->sh_cold = TRUE;
744 void have_easy_spell(player_type *creature_ptr)
747 BIT_FLAGS flgs[TR_FLAG_SIZE];
748 creature_ptr->easy_spell = FALSE;
749 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
750 o_ptr = &creature_ptr->inventory_list[i];
754 object_flags(creature_ptr, o_ptr, flgs);
755 if (have_flag(flgs, TR_EASY_SPELL))
756 creature_ptr->easy_spell = TRUE;
760 void have_heavy_spell(player_type *creature_ptr)
763 BIT_FLAGS flgs[TR_FLAG_SIZE];
764 creature_ptr->heavy_spell = FALSE;
765 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
766 o_ptr = &creature_ptr->inventory_list[i];
770 object_flags(creature_ptr, o_ptr, flgs);
771 if (o_ptr->name2 == EGO_AMU_FOOL)
772 creature_ptr->heavy_spell = TRUE;
776 void have_hold_exp(player_type *creature_ptr)
779 BIT_FLAGS flgs[TR_FLAG_SIZE];
781 creature_ptr->hold_exp = FALSE;
783 if (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN) {
784 creature_ptr->hold_exp = TRUE;
787 if (creature_ptr->mimic_form == MIMIC_DEMON || creature_ptr->mimic_form == MIMIC_DEMON_LORD || creature_ptr->mimic_form == MIMIC_VAMPIRE) {
788 creature_ptr->hold_exp = TRUE;
791 if (is_specific_player_race(creature_ptr, RACE_HOBBIT) || is_specific_player_race(creature_ptr, RACE_SKELETON) ||
792 is_specific_player_race(creature_ptr, RACE_ZOMBIE) || is_specific_player_race(creature_ptr, RACE_VAMPIRE) ||
793 is_specific_player_race(creature_ptr, RACE_SPECTRE) || is_specific_player_race(creature_ptr, RACE_BALROG) ||
794 is_specific_player_race(creature_ptr, RACE_ANDROID)) {
795 creature_ptr->hold_exp = TRUE;
798 if (is_specific_player_race(creature_ptr, RACE_GOLEM)) {
799 if (creature_ptr->lev > 34)
800 creature_ptr->hold_exp = TRUE;
803 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
804 creature_ptr->hold_exp = TRUE;
807 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
808 o_ptr = &creature_ptr->inventory_list[i];
812 object_flags(creature_ptr, o_ptr, flgs);
813 if (have_flag(flgs, TR_HOLD_EXP))
814 creature_ptr->hold_exp = TRUE;
818 void have_see_inv(player_type *creature_ptr)
821 BIT_FLAGS flgs[TR_FLAG_SIZE];
822 creature_ptr->see_inv = FALSE;
824 if (creature_ptr->pclass == CLASS_NINJA || creature_ptr->lev > 29)
825 creature_ptr->see_inv = TRUE;
827 if (creature_ptr->mimic_form == MIMIC_DEMON || creature_ptr->mimic_form == MIMIC_DEMON_LORD || creature_ptr->mimic_form == MIMIC_VAMPIRE) {
828 creature_ptr->see_inv = TRUE;
831 if (!creature_ptr->mimic_form
832 && (creature_ptr->prace == RACE_HIGH_ELF || creature_ptr->prace == RACE_GOLEM || creature_ptr->prace == RACE_SKELETON
833 || creature_ptr->prace == RACE_ZOMBIE || creature_ptr->prace == RACE_SPECTRE || creature_ptr->prace == RACE_ARCHON)) {
834 creature_ptr->see_inv = TRUE;
837 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_DARK_ELF) {
838 if (creature_ptr->lev > 19)
839 creature_ptr->see_inv = TRUE;
842 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_MIND_FLAYER) {
843 if (creature_ptr->lev > 14)
844 creature_ptr->see_inv = TRUE;
847 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_IMP || creature_ptr->prace == RACE_BALROG)) {
848 if (creature_ptr->lev > 9)
849 creature_ptr->see_inv = TRUE;
852 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
853 creature_ptr->see_inv = TRUE;
856 if (creature_ptr->tim_invis) {
857 creature_ptr->see_inv = TRUE;
860 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
861 o_ptr = &creature_ptr->inventory_list[i];
865 object_flags(creature_ptr, o_ptr, flgs);
866 if (have_flag(flgs, TR_SEE_INVIS))
867 creature_ptr->see_inv = TRUE;
871 void have_free_act(player_type *creature_ptr)
874 BIT_FLAGS flgs[TR_FLAG_SIZE];
875 creature_ptr->free_act = FALSE;
877 if (creature_ptr->muta3 & MUT3_MOTION)
878 creature_ptr->free_act = TRUE;
880 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_GNOME) {
881 creature_ptr->free_act = TRUE;
884 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_GOLEM) {
885 creature_ptr->free_act = TRUE;
888 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_SPECTRE) {
889 creature_ptr->free_act = TRUE;
892 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_ANDROID) {
893 creature_ptr->free_act = TRUE;
896 if (heavy_armor(creature_ptr) && (!creature_ptr->inventory_list[INVEN_RARM].k_idx || have_right_hand_weapon(creature_ptr))
897 && (!creature_ptr->inventory_list[INVEN_LARM].k_idx || have_left_hand_weapon(creature_ptr))) {
898 if (creature_ptr->lev > 24)
899 creature_ptr->free_act = TRUE;
902 if (creature_ptr->pclass == CLASS_MONK || creature_ptr->pclass == CLASS_FORCETRAINER) {
903 if (!(heavy_armor(creature_ptr))) {
904 if (creature_ptr->lev > 24)
905 creature_ptr->free_act = TRUE;
909 if (creature_ptr->pclass == CLASS_BERSERKER) {
910 creature_ptr->free_act = TRUE;
913 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
914 creature_ptr->free_act = TRUE;
917 if (creature_ptr->magicdef) {
918 creature_ptr->free_act = TRUE;
921 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
922 o_ptr = &creature_ptr->inventory_list[i];
926 object_flags(creature_ptr, o_ptr, flgs);
927 if (have_flag(flgs, TR_FREE_ACT))
928 creature_ptr->free_act = TRUE;
932 void have_sustain_str(player_type *creature_ptr)
935 BIT_FLAGS flgs[TR_FLAG_SIZE];
936 creature_ptr->sustain_str = FALSE;
937 if (creature_ptr->pclass == CLASS_BERSERKER) {
938 creature_ptr->sustain_str = TRUE;
940 if (!creature_ptr->mimic_form
941 && (creature_ptr->prace == RACE_HALF_TROLL || creature_ptr->prace == RACE_HALF_OGRE || creature_ptr->prace == RACE_HALF_GIANT)) {
942 creature_ptr->sustain_str = TRUE;
944 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
945 creature_ptr->sustain_str = TRUE;
948 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
949 o_ptr = &creature_ptr->inventory_list[i];
953 object_flags(creature_ptr, o_ptr, flgs);
954 if (have_flag(flgs, TR_SUST_STR))
955 creature_ptr->sustain_str = TRUE;
959 void have_sustain_int(player_type *creature_ptr)
962 BIT_FLAGS flgs[TR_FLAG_SIZE];
963 creature_ptr->sustain_int = FALSE;
964 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_MIND_FLAYER)) {
965 creature_ptr->sustain_int = TRUE;
968 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
969 creature_ptr->sustain_int = TRUE;
972 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
973 o_ptr = &creature_ptr->inventory_list[i];
977 object_flags(creature_ptr, o_ptr, flgs);
978 if (have_flag(flgs, TR_SUST_INT))
979 creature_ptr->sustain_int = TRUE;
983 void have_sustain_wis(player_type *creature_ptr)
986 BIT_FLAGS flgs[TR_FLAG_SIZE];
987 creature_ptr->sustain_wis = FALSE;
988 if (creature_ptr->pclass == CLASS_MINDCRAFTER && creature_ptr->lev > 19)
989 creature_ptr->sustain_wis = TRUE;
991 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_MIND_FLAYER)) {
992 creature_ptr->sustain_wis = TRUE;
995 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
996 creature_ptr->sustain_wis = TRUE;
999 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1000 o_ptr = &creature_ptr->inventory_list[i];
1004 object_flags(creature_ptr, o_ptr, flgs);
1005 if (have_flag(flgs, TR_SUST_WIS))
1006 creature_ptr->sustain_wis = TRUE;
1010 void have_sustain_dex(player_type *creature_ptr)
1013 BIT_FLAGS flgs[TR_FLAG_SIZE];
1014 creature_ptr->sustain_dex = FALSE;
1015 if (creature_ptr->pclass == CLASS_BERSERKER) {
1016 creature_ptr->sustain_dex = TRUE;
1019 if (creature_ptr->pclass == CLASS_NINJA && creature_ptr->lev > 24)
1020 creature_ptr->sustain_dex = TRUE;
1022 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1023 creature_ptr->sustain_dex = TRUE;
1026 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1027 o_ptr = &creature_ptr->inventory_list[i];
1031 object_flags(creature_ptr, o_ptr, flgs);
1032 if (have_flag(flgs, TR_SUST_DEX))
1033 creature_ptr->sustain_dex = TRUE;
1037 void have_sustain_con(player_type *creature_ptr)
1040 BIT_FLAGS flgs[TR_FLAG_SIZE];
1041 creature_ptr->sustain_con = FALSE;
1042 if (creature_ptr->pclass == CLASS_BERSERKER) {
1043 creature_ptr->sustain_con = TRUE;
1046 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_AMBERITE || creature_ptr->prace == RACE_DUNADAN)) {
1047 creature_ptr->sustain_con = TRUE;
1050 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1051 creature_ptr->sustain_con = TRUE;
1054 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1055 o_ptr = &creature_ptr->inventory_list[i];
1059 object_flags(creature_ptr, o_ptr, flgs);
1060 if (have_flag(flgs, TR_SUST_CON))
1061 creature_ptr->sustain_con = TRUE;
1065 void have_sustain_chr(player_type *creature_ptr)
1068 BIT_FLAGS flgs[TR_FLAG_SIZE];
1069 creature_ptr->sustain_chr = FALSE;
1071 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1072 creature_ptr->sustain_chr = TRUE;
1075 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1076 o_ptr = &creature_ptr->inventory_list[i];
1080 object_flags(creature_ptr, o_ptr, flgs);
1081 if (have_flag(flgs, TR_SUST_CHR))
1082 creature_ptr->sustain_chr = TRUE;
1086 void have_levitation(player_type *creature_ptr)
1089 BIT_FLAGS flgs[TR_FLAG_SIZE];
1090 creature_ptr->levitation = FALSE;
1092 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1093 creature_ptr->levitation = TRUE;
1096 if (creature_ptr->muta3 & MUT3_WINGS)
1097 creature_ptr->levitation = TRUE;
1099 if (!creature_ptr->mimic_form
1100 && (creature_ptr->prace == RACE_DRACONIAN || creature_ptr->prace == RACE_SPECTRE || creature_ptr->prace == RACE_SPRITE
1101 || creature_ptr->prace == RACE_ARCHON || creature_ptr->prace == RACE_S_FAIRY)) {
1102 creature_ptr->levitation = TRUE;
1105 if (creature_ptr->special_defense & KAMAE_SEIRYU || creature_ptr->special_defense & KAMAE_SUZAKU) {
1106 creature_ptr->levitation = TRUE;
1109 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1110 creature_ptr->levitation = TRUE;
1113 if (creature_ptr->magicdef) {
1116 if (creature_ptr->riding) {
1117 monster_type *riding_m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
1118 monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
1119 creature_ptr->levitation = (riding_r_ptr->flags7 & RF7_CAN_FLY) ? TRUE : FALSE;
1122 if (creature_ptr->tim_levitation) {
1123 creature_ptr->levitation = TRUE;
1126 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1127 o_ptr = &creature_ptr->inventory_list[i];
1130 object_flags(creature_ptr, o_ptr, flgs);
1131 if (have_flag(flgs, TR_LEVITATION))
1132 creature_ptr->levitation = TRUE;
1136 void have_can_swim(player_type *creature_ptr)
1138 creature_ptr->can_swim = FALSE;
1139 if (creature_ptr->riding) {
1140 monster_type *riding_m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
1141 monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
1142 if (riding_r_ptr->flags7 & (RF7_CAN_SWIM | RF7_AQUATIC))
1143 creature_ptr->can_swim = TRUE;
1147 void have_slow_digest(player_type *creature_ptr)
1150 BIT_FLAGS flgs[TR_FLAG_SIZE];
1151 creature_ptr->slow_digest = FALSE;
1153 if (creature_ptr->pclass == CLASS_NINJA) {
1154 creature_ptr->slow_digest = TRUE;
1157 if (creature_ptr->lev > 14 && !creature_ptr->mimic_form && creature_ptr->prace == RACE_HALF_TROLL) {
1158 if (creature_ptr->pclass == CLASS_WARRIOR || creature_ptr->pclass == CLASS_BERSERKER) {
1159 creature_ptr->slow_digest = TRUE;
1160 /* Let's not make Regeneration
1161 * a disadvantage for the poor warriors who can
1162 * never learn a spell that satisfies hunger (actually
1163 * neither can rogues, but half-trolls are not
1164 * supposed to play rogues) */
1168 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1169 creature_ptr->slow_digest = TRUE;
1172 if (!creature_ptr->mimic_form
1173 && (creature_ptr->prace == RACE_GOLEM || creature_ptr->prace == RACE_ZOMBIE || creature_ptr->prace == RACE_SPECTRE
1174 || creature_ptr->prace == RACE_ANDROID)) {
1175 creature_ptr->slow_digest = TRUE;
1178 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1179 o_ptr = &creature_ptr->inventory_list[i];
1182 object_flags(creature_ptr, o_ptr, flgs);
1183 if (have_flag(flgs, TR_SLOW_DIGEST))
1184 creature_ptr->slow_digest = TRUE;
1188 void have_regenerate(player_type *creature_ptr)
1191 BIT_FLAGS flgs[TR_FLAG_SIZE];
1192 creature_ptr->regenerate = FALSE;
1194 if (!creature_ptr->mimic_form) {
1195 switch (creature_ptr->prace) {
1196 case RACE_HALF_TROLL:
1197 if (creature_ptr->lev > 14) {
1198 creature_ptr->regenerate = TRUE;
1202 creature_ptr->regenerate = TRUE;
1207 switch (creature_ptr->pclass) {
1209 if (creature_ptr->lev > 44)
1210 creature_ptr->regenerate = TRUE;
1212 case CLASS_BERSERKER:
1213 creature_ptr->regenerate = TRUE;
1217 if (creature_ptr->muta3 & MUT3_FLESH_ROT)
1218 creature_ptr->regenerate = FALSE;
1220 if (creature_ptr->muta3 & MUT3_REGEN)
1221 creature_ptr->regenerate = TRUE;
1223 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1224 creature_ptr->regenerate = TRUE;
1227 if (creature_ptr->realm1 == REALM_HEX) {
1228 if (hex_spelling(creature_ptr, HEX_DEMON_AURA)) {
1229 creature_ptr->regenerate = TRUE;
1233 if (creature_ptr->tim_regen) {
1234 creature_ptr->regenerate = TRUE;
1237 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1238 o_ptr = &creature_ptr->inventory_list[i];
1241 object_flags(creature_ptr, o_ptr, flgs);
1242 if (have_flag(flgs, TR_REGEN))
1243 creature_ptr->regenerate = TRUE;
1247 void have_curses(player_type *creature_ptr)
1250 BIT_FLAGS flgs[TR_FLAG_SIZE];
1251 creature_ptr->cursed = 0L;
1253 if (creature_ptr->pseikaku == PERSONALITY_SEXY)
1254 creature_ptr->cursed |= (TRC_AGGRAVATE);
1256 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1257 o_ptr = &creature_ptr->inventory_list[i];
1260 object_flags(creature_ptr, o_ptr, flgs);
1261 if (have_flag(flgs, TR_AGGRAVATE))
1262 creature_ptr->cursed |= TRC_AGGRAVATE;
1263 if (have_flag(flgs, TR_DRAIN_EXP))
1264 creature_ptr->cursed |= TRC_DRAIN_EXP;
1265 if (have_flag(flgs, TR_TY_CURSE))
1266 creature_ptr->cursed |= TRC_TY_CURSE;
1267 if (have_flag(flgs, TR_ADD_L_CURSE))
1268 creature_ptr->cursed |= TRC_ADD_L_CURSE;
1269 if (have_flag(flgs, TR_ADD_H_CURSE))
1270 creature_ptr->cursed |= TRC_ADD_H_CURSE;
1271 if (have_flag(flgs, TR_DRAIN_HP))
1272 creature_ptr->cursed |= TRC_DRAIN_HP;
1273 if (have_flag(flgs, TR_DRAIN_MANA))
1274 creature_ptr->cursed |= TRC_DRAIN_MANA;
1275 if (have_flag(flgs, TR_CALL_ANIMAL))
1276 creature_ptr->cursed |= TRC_CALL_ANIMAL;
1277 if (have_flag(flgs, TR_CALL_DEMON))
1278 creature_ptr->cursed |= TRC_CALL_DEMON;
1279 if (have_flag(flgs, TR_CALL_DRAGON))
1280 creature_ptr->cursed |= TRC_CALL_DRAGON;
1281 if (have_flag(flgs, TR_CALL_UNDEAD))
1282 creature_ptr->cursed |= TRC_CALL_UNDEAD;
1283 if (have_flag(flgs, TR_COWARDICE))
1284 creature_ptr->cursed |= TRC_COWARDICE;
1285 if (have_flag(flgs, TR_LOW_MELEE))
1286 creature_ptr->cursed |= TRC_LOW_MELEE;
1287 if (have_flag(flgs, TR_LOW_AC))
1288 creature_ptr->cursed |= TRC_LOW_AC;
1289 if (have_flag(flgs, TR_LOW_MAGIC))
1290 creature_ptr->cursed |= TRC_LOW_MAGIC;
1291 if (have_flag(flgs, TR_FAST_DIGEST))
1292 creature_ptr->cursed |= TRC_FAST_DIGEST;
1293 if (have_flag(flgs, TR_SLOW_REGEN))
1294 creature_ptr->cursed |= TRC_SLOW_REGEN;
1296 creature_ptr->cursed |= (o_ptr->curse_flags & (0xFFFFFFF0L));
1297 if (o_ptr->name1 == ART_CHAINSWORD)
1298 creature_ptr->cursed |= TRC_CHAINSWORD;
1300 if (have_flag(flgs, TR_TELEPORT)) {
1301 if (object_is_cursed(o_ptr))
1302 creature_ptr->cursed |= TRC_TELEPORT;
1304 concptr insc = quark_str(o_ptr->inscription);
1306 /* {.} will stop random teleportation. */
1307 if (o_ptr->inscription && angband_strchr(insc, '.')) {
1309 creature_ptr->cursed |= TRC_TELEPORT_SELF;
1315 if (creature_ptr->cursed & TRC_TELEPORT)
1316 creature_ptr->cursed &= ~(TRC_TELEPORT_SELF);
1318 if ((is_specific_player_race(creature_ptr, RACE_S_FAIRY)) && (creature_ptr->pseikaku != PERSONALITY_SEXY) && (creature_ptr->cursed & TRC_AGGRAVATE)) {
1319 creature_ptr->cursed &= ~(TRC_AGGRAVATE);
1323 void have_impact(player_type *creature_ptr)
1326 BIT_FLAGS flgs[TR_FLAG_SIZE];
1327 creature_ptr->impact[0] = FALSE;
1328 creature_ptr->impact[1] = FALSE;
1330 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1331 o_ptr = &creature_ptr->inventory_list[i];
1334 object_flags(creature_ptr, o_ptr, flgs);
1335 if (have_flag(flgs, TR_IMPACT))
1336 creature_ptr->impact[(i == INVEN_RARM) ? 0 : 1] = TRUE;
1340 void have_extra_blow(player_type *creature_ptr)
1343 BIT_FLAGS flgs[TR_FLAG_SIZE];
1344 creature_ptr->extra_blows[0] = creature_ptr->extra_blows[1] = 0;
1346 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1347 o_ptr = &creature_ptr->inventory_list[i];
1351 object_flags(creature_ptr, o_ptr, flgs);
1353 if (have_flag(flgs, TR_INFRA))
1354 creature_ptr->see_infra += o_ptr->pval;
1355 if (have_flag(flgs, TR_BLOWS)) {
1356 if ((i == INVEN_RARM || i == INVEN_RIGHT) && !have_two_handed_weapons(creature_ptr))
1357 creature_ptr->extra_blows[0] += o_ptr->pval;
1358 else if ((i == INVEN_LARM || i == INVEN_LEFT) && !have_two_handed_weapons(creature_ptr))
1359 creature_ptr->extra_blows[1] += o_ptr->pval;
1361 creature_ptr->extra_blows[0] += o_ptr->pval;
1362 creature_ptr->extra_blows[1] += o_ptr->pval;
1368 void have_resist_acid(player_type *creature_ptr)
1371 BIT_FLAGS flgs[TR_FLAG_SIZE];
1372 creature_ptr->resist_acid = FALSE;
1374 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1375 creature_ptr->resist_acid = TRUE;
1378 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_YEEK || creature_ptr->prace == RACE_KLACKON)) {
1379 creature_ptr->resist_acid = TRUE;
1382 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_DRACONIAN && creature_ptr->lev > 14) {
1383 creature_ptr->resist_acid = TRUE;
1386 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
1387 creature_ptr->resist_acid = TRUE;
1390 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1391 creature_ptr->resist_acid = TRUE;
1394 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1395 o_ptr = &creature_ptr->inventory_list[i];
1399 object_flags(creature_ptr, o_ptr, flgs);
1400 if (have_flag(flgs, TR_RES_ACID))
1401 creature_ptr->resist_acid = TRUE;
1404 if (creature_ptr->immune_acid)
1405 creature_ptr->resist_acid = TRUE;
1408 void have_resist_elec(player_type *creature_ptr)
1411 BIT_FLAGS flgs[TR_FLAG_SIZE];
1412 creature_ptr->resist_elec = FALSE;
1414 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1415 creature_ptr->resist_elec = TRUE;
1418 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_DRACONIAN && creature_ptr->lev > 19) {
1419 creature_ptr->resist_elec = TRUE;
1422 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
1423 creature_ptr->resist_elec = TRUE;
1426 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1427 creature_ptr->resist_elec = TRUE;
1430 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1431 o_ptr = &creature_ptr->inventory_list[i];
1435 object_flags(creature_ptr, o_ptr, flgs);
1436 if (have_flag(flgs, TR_RES_ELEC))
1437 creature_ptr->resist_elec = TRUE;
1440 if (creature_ptr->immune_elec)
1441 creature_ptr->resist_elec = TRUE;
1444 void have_resist_fire(player_type *creature_ptr)
1447 BIT_FLAGS flgs[TR_FLAG_SIZE];
1448 creature_ptr->resist_fire = FALSE;
1450 if (creature_ptr->mimic_form == MIMIC_DEMON || creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1451 creature_ptr->resist_fire = TRUE;
1454 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_DRACONIAN && creature_ptr->lev > 4) {
1455 creature_ptr->resist_fire = TRUE;
1458 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_IMP || creature_ptr->prace == RACE_BALROG)) {
1459 creature_ptr->resist_fire = TRUE;
1462 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
1463 creature_ptr->resist_fire = TRUE;
1466 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1467 creature_ptr->resist_fire = TRUE;
1470 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1471 o_ptr = &creature_ptr->inventory_list[i];
1475 object_flags(creature_ptr, o_ptr, flgs);
1477 if (have_flag(flgs, TR_RES_FIRE))
1478 creature_ptr->resist_fire = TRUE;
1481 if (creature_ptr->immune_fire)
1482 creature_ptr->resist_fire = TRUE;
1485 void have_resist_cold(player_type *creature_ptr)
1488 BIT_FLAGS flgs[TR_FLAG_SIZE];
1489 creature_ptr->resist_cold = FALSE;
1491 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD || creature_ptr->mimic_form == MIMIC_VAMPIRE) {
1492 creature_ptr->resist_cold = TRUE;
1495 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_ZOMBIE) && creature_ptr->lev > 4) {
1496 creature_ptr->resist_cold = TRUE;
1499 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_DRACONIAN || creature_ptr->prace == RACE_SKELETON) && creature_ptr->lev > 9) {
1500 creature_ptr->resist_cold = TRUE;
1503 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_VAMPIRE || creature_ptr->prace == RACE_SPECTRE)) {
1504 creature_ptr->resist_fire = TRUE;
1507 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
1508 creature_ptr->resist_cold = TRUE;
1511 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1512 creature_ptr->resist_cold = TRUE;
1515 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1516 o_ptr = &creature_ptr->inventory_list[i];
1520 object_flags(creature_ptr, o_ptr, flgs);
1522 if (have_flag(flgs, TR_RES_COLD))
1523 creature_ptr->resist_cold = TRUE;
1526 if (creature_ptr->immune_cold)
1527 creature_ptr->resist_cold = TRUE;
1530 void have_resist_pois(player_type *creature_ptr)
1533 BIT_FLAGS flgs[TR_FLAG_SIZE];
1534 creature_ptr->resist_pois = FALSE;
1536 if (creature_ptr->pclass == CLASS_NINJA && creature_ptr->lev > 19)
1537 creature_ptr->resist_pois = TRUE;
1539 if (creature_ptr->mimic_form == MIMIC_VAMPIRE || creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1540 creature_ptr->resist_pois = TRUE;
1543 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_DRACONIAN && creature_ptr->lev > 34) {
1544 creature_ptr->resist_pois = TRUE;
1547 if (!creature_ptr->mimic_form
1548 && (creature_ptr->prace == RACE_KOBOLD || creature_ptr->prace == RACE_GOLEM || creature_ptr->prace == RACE_SKELETON
1549 || creature_ptr->prace == RACE_VAMPIRE || creature_ptr->prace == RACE_SPECTRE || creature_ptr->prace == RACE_ANDROID)) {
1550 creature_ptr->resist_pois = TRUE;
1553 if (creature_ptr->special_defense & KAMAE_SEIRYU) {
1554 creature_ptr->resist_pois = TRUE;
1557 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1558 creature_ptr->resist_pois = TRUE;
1561 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1562 o_ptr = &creature_ptr->inventory_list[i];
1566 object_flags(creature_ptr, o_ptr, flgs);
1568 if (have_flag(flgs, TR_RES_POIS))
1569 creature_ptr->resist_pois = TRUE;
1573 void have_resist_conf(player_type *creature_ptr)
1576 BIT_FLAGS flgs[TR_FLAG_SIZE];
1577 creature_ptr->resist_conf = FALSE;
1579 if (creature_ptr->pclass == CLASS_MINDCRAFTER && creature_ptr->lev > 29)
1580 creature_ptr->resist_conf = TRUE;
1582 if (creature_ptr->pseikaku == PERSONALITY_CHARGEMAN || creature_ptr->pseikaku == PERSONALITY_MUNCHKIN) {
1583 creature_ptr->resist_conf = TRUE;
1586 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_KLACKON || creature_ptr->prace == RACE_BEASTMAN || creature_ptr->prace == RACE_KUTAR)) {
1587 creature_ptr->resist_conf = TRUE;
1590 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1591 creature_ptr->resist_conf = TRUE;
1594 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1595 creature_ptr->resist_conf = TRUE;
1598 if (creature_ptr->magicdef) {
1599 creature_ptr->resist_conf = TRUE;
1602 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1603 o_ptr = &creature_ptr->inventory_list[i];
1607 object_flags(creature_ptr, o_ptr, flgs);
1609 if (have_flag(flgs, TR_RES_CONF))
1610 creature_ptr->resist_conf = TRUE;
1614 void have_resist_sound(player_type *creature_ptr)
1617 BIT_FLAGS flgs[TR_FLAG_SIZE];
1618 creature_ptr->resist_sound = FALSE;
1620 if (creature_ptr->pclass == CLASS_BARD) {
1621 creature_ptr->resist_sound = TRUE;
1624 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_CYCLOPS || creature_ptr->prace == RACE_BEASTMAN)) {
1625 creature_ptr->resist_sound = TRUE;
1628 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1629 creature_ptr->resist_sound = TRUE;
1632 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1633 o_ptr = &creature_ptr->inventory_list[i];
1637 object_flags(creature_ptr, o_ptr, flgs);
1639 if (have_flag(flgs, TR_RES_SOUND))
1640 creature_ptr->resist_sound = TRUE;
1644 void have_resist_lite(player_type *creature_ptr)
1647 BIT_FLAGS flgs[TR_FLAG_SIZE];
1648 creature_ptr->resist_lite = FALSE;
1650 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_ELF || creature_ptr->prace == RACE_HIGH_ELF || creature_ptr->prace == RACE_SPRITE)) {
1651 creature_ptr->resist_lite = TRUE;
1654 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1655 creature_ptr->resist_lite = TRUE;
1658 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1659 o_ptr = &creature_ptr->inventory_list[i];
1663 object_flags(creature_ptr, o_ptr, flgs);
1665 if (have_flag(flgs, TR_RES_LITE))
1666 creature_ptr->resist_lite = TRUE;
1670 void have_resist_dark(player_type *creature_ptr)
1673 BIT_FLAGS flgs[TR_FLAG_SIZE];
1674 creature_ptr->resist_dark = FALSE;
1676 if (creature_ptr->mimic_form == MIMIC_VAMPIRE) {
1677 creature_ptr->resist_dark = TRUE;
1680 if (!creature_ptr->mimic_form
1681 && (creature_ptr->prace == RACE_HALF_ORC || creature_ptr->prace == RACE_HALF_OGRE || creature_ptr->prace == RACE_NIBELUNG
1682 || creature_ptr->prace == RACE_DARK_ELF || creature_ptr->prace == RACE_VAMPIRE)) {
1683 creature_ptr->resist_lite = TRUE;
1686 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1687 creature_ptr->resist_dark = TRUE;
1690 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1691 o_ptr = &creature_ptr->inventory_list[i];
1695 object_flags(creature_ptr, o_ptr, flgs);
1697 if (have_flag(flgs, TR_RES_DARK))
1698 creature_ptr->resist_dark = TRUE;
1702 void have_resist_chaos(player_type *creature_ptr)
1705 BIT_FLAGS flgs[TR_FLAG_SIZE];
1706 creature_ptr->resist_chaos = FALSE;
1708 if (creature_ptr->pclass == CLASS_CHAOS_WARRIOR && creature_ptr->lev > 29)
1709 creature_ptr->resist_chaos = TRUE;
1711 if (creature_ptr->mimic_form == MIMIC_DEMON || creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1712 creature_ptr->resist_chaos = TRUE;
1715 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_HALF_TITAN)
1716 creature_ptr->resist_chaos = TRUE;
1718 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1719 creature_ptr->resist_chaos = TRUE;
1722 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1723 o_ptr = &creature_ptr->inventory_list[i];
1727 object_flags(creature_ptr, o_ptr, flgs);
1729 if (have_flag(flgs, TR_RES_CHAOS))
1730 creature_ptr->resist_chaos = TRUE;
1734 void have_resist_disen(player_type *creature_ptr)
1737 BIT_FLAGS flgs[TR_FLAG_SIZE];
1738 creature_ptr->resist_disen = FALSE;
1740 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1741 creature_ptr->resist_disen = TRUE;
1744 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_NIBELUNG)
1745 creature_ptr->resist_disen = TRUE;
1747 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1748 creature_ptr->resist_disen = TRUE;
1751 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1752 o_ptr = &creature_ptr->inventory_list[i];
1756 object_flags(creature_ptr, o_ptr, flgs);
1758 if (have_flag(flgs, TR_RES_DISEN))
1759 creature_ptr->resist_disen = TRUE;
1763 void have_resist_shard(player_type *creature_ptr)
1766 BIT_FLAGS flgs[TR_FLAG_SIZE];
1767 creature_ptr->resist_shard = FALSE;
1769 if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_HALF_TITAN || creature_ptr->prace == RACE_SKELETON))
1770 creature_ptr->resist_shard = TRUE;
1772 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1773 creature_ptr->resist_shard = TRUE;
1776 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1777 o_ptr = &creature_ptr->inventory_list[i];
1781 object_flags(creature_ptr, o_ptr, flgs);
1783 if (have_flag(flgs, TR_RES_DISEN))
1784 creature_ptr->resist_shard = TRUE;
1788 void have_resist_nexus(player_type *creature_ptr)
1791 BIT_FLAGS flgs[TR_FLAG_SIZE];
1792 creature_ptr->resist_nexus = FALSE;
1794 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1795 creature_ptr->resist_nexus = TRUE;
1798 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1799 creature_ptr->resist_nexus = TRUE;
1802 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1803 o_ptr = &creature_ptr->inventory_list[i];
1807 object_flags(creature_ptr, o_ptr, flgs);
1809 if (have_flag(flgs, TR_RES_NEXUS))
1810 creature_ptr->resist_nexus = TRUE;
1814 void have_resist_blind(player_type *creature_ptr)
1817 BIT_FLAGS flgs[TR_FLAG_SIZE];
1818 creature_ptr->resist_blind = FALSE;
1820 if (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN) {
1821 creature_ptr->resist_blind = TRUE;
1824 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_DWARF)
1825 creature_ptr->resist_blind = TRUE;
1827 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1828 creature_ptr->resist_blind = TRUE;
1831 if (creature_ptr->magicdef) {
1832 creature_ptr->resist_blind = TRUE;
1835 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1836 o_ptr = &creature_ptr->inventory_list[i];
1840 object_flags(creature_ptr, o_ptr, flgs);
1842 if (have_flag(flgs, TR_RES_BLIND))
1843 creature_ptr->resist_blind = TRUE;
1847 void have_resist_neth(player_type *creature_ptr)
1850 BIT_FLAGS flgs[TR_FLAG_SIZE];
1852 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD || creature_ptr->mimic_form == MIMIC_DEMON || creature_ptr->mimic_form == MIMIC_VAMPIRE) {
1853 creature_ptr->resist_neth = TRUE;
1856 if (!creature_ptr->mimic_form
1857 && (creature_ptr->prace == RACE_ZOMBIE || creature_ptr->prace == RACE_VAMPIRE || creature_ptr->prace == RACE_SPECTRE
1858 || creature_ptr->prace == RACE_BALROG))
1859 creature_ptr->resist_neth = TRUE;
1861 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1862 creature_ptr->resist_neth = TRUE;
1865 if (creature_ptr->tim_res_nether) {
1866 creature_ptr->resist_neth = TRUE;
1869 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1870 o_ptr = &creature_ptr->inventory_list[i];
1874 object_flags(creature_ptr, o_ptr, flgs);
1876 if (have_flag(flgs, TR_RES_NETHER))
1877 creature_ptr->resist_neth = TRUE;
1881 void have_resist_time(player_type *creature_ptr)
1884 BIT_FLAGS flgs[TR_FLAG_SIZE];
1885 creature_ptr->resist_time = FALSE;
1887 if (creature_ptr->tim_res_time) {
1888 creature_ptr->resist_time = TRUE;
1891 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1892 o_ptr = &creature_ptr->inventory_list[i];
1896 object_flags(creature_ptr, o_ptr, flgs);
1897 if (o_ptr->name2 == EGO_RING_RES_TIME)
1898 creature_ptr->resist_time = TRUE;
1902 void have_resist_water(player_type *creature_ptr)
1904 creature_ptr->resist_water = FALSE;
1906 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_MERFOLK)
1907 creature_ptr->resist_water = TRUE;
1910 void have_resist_fear(player_type *creature_ptr)
1913 BIT_FLAGS flgs[TR_FLAG_SIZE];
1914 creature_ptr->resist_fear = FALSE;
1916 if (creature_ptr->muta3 & MUT3_FEARLESS)
1917 creature_ptr->resist_fear = TRUE;
1919 switch (creature_ptr->pclass) {
1921 if (creature_ptr->lev > 29)
1922 creature_ptr->resist_fear = TRUE;
1925 if (creature_ptr->lev > 39)
1926 creature_ptr->resist_fear = TRUE;
1928 case CLASS_CHAOS_WARRIOR:
1929 if (creature_ptr->lev > 39)
1930 creature_ptr->resist_fear = TRUE;
1932 case CLASS_MINDCRAFTER:
1933 if (creature_ptr->lev > 9)
1934 creature_ptr->resist_fear = TRUE;
1937 if (creature_ptr->lev > 29)
1938 creature_ptr->resist_fear = TRUE;
1941 creature_ptr->resist_fear = TRUE;
1945 if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
1946 creature_ptr->resist_fear = TRUE;
1949 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_BARBARIAN)
1950 creature_ptr->resist_fear = TRUE;
1952 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1953 creature_ptr->resist_fear = TRUE;
1956 if (is_hero(creature_ptr) || creature_ptr->shero) {
1957 creature_ptr->resist_fear = TRUE;
1960 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1961 o_ptr = &creature_ptr->inventory_list[i];
1965 object_flags(creature_ptr, o_ptr, flgs);
1966 if (have_flag(flgs, TR_RES_FEAR))
1967 creature_ptr->resist_fear = TRUE;
1971 void have_immune_acid(player_type *creature_ptr)
1974 BIT_FLAGS flgs[TR_FLAG_SIZE];
1975 creature_ptr->immune_acid = FALSE;
1977 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_YEEK && creature_ptr->lev > 19)
1978 creature_ptr->immune_acid = TRUE;
1980 if (creature_ptr->ele_immune) {
1981 if (creature_ptr->special_defense & DEFENSE_ACID)
1982 creature_ptr->immune_acid = TRUE;
1985 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1986 o_ptr = &creature_ptr->inventory_list[i];
1990 object_flags(creature_ptr, o_ptr, flgs);
1991 if (have_flag(flgs, TR_IM_ACID))
1992 creature_ptr->immune_acid = TRUE;
1996 void have_immune_elec(player_type *creature_ptr)
1999 BIT_FLAGS flgs[TR_FLAG_SIZE];
2000 creature_ptr->immune_elec = FALSE;
2001 if (creature_ptr->ele_immune) {
2002 if (creature_ptr->special_defense & DEFENSE_ELEC)
2003 creature_ptr->immune_elec = TRUE;
2006 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2007 o_ptr = &creature_ptr->inventory_list[i];
2011 object_flags(creature_ptr, o_ptr, flgs);
2012 if (have_flag(flgs, TR_IM_ELEC))
2013 creature_ptr->immune_elec = TRUE;
2017 void have_immune_fire(player_type *creature_ptr)
2020 BIT_FLAGS flgs[TR_FLAG_SIZE];
2021 creature_ptr->immune_fire = FALSE;
2022 if (creature_ptr->ele_immune) {
2023 if (creature_ptr->special_defense & DEFENSE_FIRE)
2024 creature_ptr->immune_fire = TRUE;
2027 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2028 o_ptr = &creature_ptr->inventory_list[i];
2032 object_flags(creature_ptr, o_ptr, flgs);
2033 if (have_flag(flgs, TR_IM_FIRE))
2034 creature_ptr->immune_fire = TRUE;
2038 void have_immune_cold(player_type *creature_ptr)
2041 BIT_FLAGS flgs[TR_FLAG_SIZE];
2042 creature_ptr->immune_cold = FALSE;
2043 if (creature_ptr->ele_immune) {
2044 if (creature_ptr->special_defense & DEFENSE_COLD)
2045 creature_ptr->immune_cold = TRUE;
2048 for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2049 o_ptr = &creature_ptr->inventory_list[i];
2053 object_flags(creature_ptr, o_ptr, flgs);
2054 if (have_flag(flgs, TR_IM_COLD))
2055 creature_ptr->immune_cold = TRUE;
2059 bool have_right_hand_weapon(player_type *creature_ptr)
2061 if (has_melee_weapon(creature_ptr, INVEN_RARM))
2064 if (can_two_hands_wielding(creature_ptr)) {
2065 switch (creature_ptr->pclass) {
2067 case CLASS_FORCETRAINER:
2068 case CLASS_BERSERKER:
2069 if (empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM)) {
2079 bool have_left_hand_weapon(player_type *creature_ptr)
2081 return has_melee_weapon(creature_ptr, INVEN_LARM);
2084 bool have_two_handed_weapons(player_type *creature_ptr)
2086 if (can_two_hands_wielding(creature_ptr)) {
2087 if (have_right_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_LARM)
2088 && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_RARM])) {
2090 } else if (have_left_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_RARM)
2091 && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_LARM])) {
2098 void have_lite(player_type *creature_ptr)
2100 creature_ptr->lite = FALSE;
2101 if (creature_ptr->pclass == CLASS_NINJA)
2104 if (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN) {
2105 creature_ptr->lite = TRUE;
2108 if (creature_ptr->mimic_form == MIMIC_VAMPIRE) {
2109 creature_ptr->lite = TRUE;
2112 if (creature_ptr->muta3 & MUT3_FIRE_BODY) {
2113 creature_ptr->lite = TRUE;
2116 if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_VAMPIRE)
2117 creature_ptr->lite = TRUE;
2119 if (creature_ptr->sh_fire)
2120 creature_ptr->lite = TRUE;
2122 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
2123 creature_ptr->lite = TRUE;
2127 bool is_disable_two_handed_bonus(player_type *creature_ptr, int i)
2130 o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
2131 if (has_melee_weapon(creature_ptr, INVEN_RARM + i)) {
2132 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))
2138 bool is_icky_wield_weapon(player_type *creature_ptr, int i)
2141 BIT_FLAGS flgs[TR_FLAG_SIZE];
2142 o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
2143 object_flags(creature_ptr, o_ptr, flgs);
2145 if ((creature_ptr->pclass == CLASS_PRIEST) && (!(have_flag(flgs, TR_BLESSED))) && ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM))) {
2147 } else if (creature_ptr->pclass == CLASS_SORCERER) {
2148 if (!((o_ptr->tval == TV_HAFTED) && ((o_ptr->sval == SV_WIZSTAFF) || (o_ptr->sval == SV_NAMAKE_HAMMER)))) {
2152 if (is_not_monk_weapon(creature_ptr, i) || is_not_ninja_weapon(creature_ptr, i)) {
2158 bool is_riding_wield_weapon(player_type *creature_ptr, int i)
2161 BIT_FLAGS flgs[TR_FLAG_SIZE];
2162 o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
2163 object_flags(creature_ptr, o_ptr, flgs);
2164 if (creature_ptr->riding != 0 && !(o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE))
2165 && !have_flag(flgs, TR_RIDING)) {
2171 bool is_not_ninja_weapon(player_type *creature_ptr, int i)
2173 tval_type tval = creature_ptr->inventory_list[INVEN_RARM + i].tval - TV_WEAPON_BEGIN;
2174 OBJECT_SUBTYPE_VALUE sval = creature_ptr->inventory_list[INVEN_RARM + i].sval;
2175 return creature_ptr->pclass == CLASS_NINJA
2176 && !((s_info[CLASS_NINJA].w_max[tval][sval] > WEAPON_EXP_BEGINNER) && (creature_ptr->inventory_list[INVEN_LARM - i].tval != TV_SHIELD));
2179 bool is_not_monk_weapon(player_type *creature_ptr, int i)
2181 tval_type tval = creature_ptr->inventory_list[INVEN_RARM + i].tval - TV_WEAPON_BEGIN;
2182 OBJECT_SUBTYPE_VALUE sval = creature_ptr->inventory_list[INVEN_RARM + i].sval;
2183 return (creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) && (!s_info[creature_ptr->pclass].w_max[tval][sval]);
2186 bool have_good_luck(player_type *creature_ptr) { return (creature_ptr->pseikaku == PERSONALITY_LUCKY) || (creature_ptr->muta3 |= MUT3_GOOD_LUCK); };