-#include "art-definition/art-sword-types.h"
+#include "player/player-status-flags.h"
+#include "art-definition/art-sword-types.h"
#include "grid/grid.h"
#include "inventory/inventory-slot-types.h"
#include "monster-race/monster-race.h"
#include "player/player-race.h"
#include "player/player-skill.h"
#include "player/player-status.h"
-#include "player/player-status-flags.h"
#include "player/special-defense-types.h"
#include "realm/realm-hex-numbers.h"
#include "realm/realm-song-numbers.h"
#include "realm/realm-types.h"
#include "spell-realm/spells-hex.h"
+#include "sv-definition/sv-weapon-types.h"
#include "system/floor-type-definition.h"
#include "system/monster-type-definition.h"
#include "system/object-type-definition.h"
-#include "sv-definition/sv-weapon-types.h"
#include "util/bit-flags-calculator.h"
#include "util/quarks.h"
#include "util/string-processor.h"
-void have_kill_wall(player_type *creature_ptr)
+bool have_kill_wall(player_type *creature_ptr)
{
- creature_ptr->kill_wall = FALSE;
-
- if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
- creature_ptr->kill_wall = TRUE;
- }
-
- if (music_singing(creature_ptr, MUSIC_WALL)) {
- creature_ptr->kill_wall = TRUE;
+ if (creature_ptr->mimic_form == MIMIC_DEMON_LORD || music_singing(creature_ptr, MUSIC_WALL)) {
+ return TRUE;
}
if (creature_ptr->riding) {
monster_type *riding_m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
if (riding_r_ptr->flags2 & RF2_KILL_WALL)
- creature_ptr->kill_wall = TRUE;
+ return TRUE;
}
+
+ return FALSE;
}
-void have_pass_wall(player_type *creature_ptr)
+bool have_pass_wall(player_type *creature_ptr)
{
- creature_ptr->pass_wall = FALSE;
-
- if (creature_ptr->wraith_form) {
- creature_ptr->pass_wall = TRUE;
- }
+ bool pow = FALSE;
- if (creature_ptr->tim_pass_wall) {
- creature_ptr->pass_wall = TRUE;
- }
-
- if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_SPECTRE) {
- creature_ptr->pass_wall = TRUE;
+ if (creature_ptr->wraith_form || creature_ptr->tim_pass_wall || (!creature_ptr->mimic_form && creature_ptr->prace == RACE_SPECTRE)) {
+ pow = TRUE;
}
if (creature_ptr->riding) {
monster_type *riding_m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
if (!(riding_r_ptr->flags2 & RF2_PASS_WALL))
- creature_ptr->pass_wall = FALSE;
+ pow = FALSE;
}
+
+ return pow;
}
-void have_xtra_might(player_type *creature_ptr)
+BIT_FLAGS have_xtra_might(player_type *creature_ptr)
{
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
+ BIT_FLAGS result = 0L;
- creature_ptr->xtra_might = FALSE;
-
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
object_flags(creature_ptr, o_ptr, flgs);
if (have_flag(flgs, TR_XTRA_MIGHT))
- creature_ptr->xtra_might = TRUE;
+ result |= 0x01 << (i - INVEN_RARM);
}
+
+ return result;
}
-void have_esp_evil(player_type *creature_ptr)
+BIT_FLAGS have_esp_evil(player_type *creature_ptr)
{
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
-
- creature_ptr->esp_evil = FALSE;
+ BIT_FLAGS result = 0L;
if (creature_ptr->realm1 == REALM_HEX) {
if (hex_spelling(creature_ptr, HEX_DETECT_EVIL))
- creature_ptr->esp_evil = TRUE;
+ result |= 0x01 << FLAG_CAUSE_MAGIC_TIME_EFFECT;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
object_flags(creature_ptr, o_ptr, flgs);
if (have_flag(flgs, TR_ESP_EVIL))
- creature_ptr->esp_evil = TRUE;
+ result |= 0x01 << (i - INVEN_RARM);
}
+
+ return result;
}
-void have_esp_animal(player_type *creature_ptr)
+BIT_FLAGS have_esp_animal(player_type *creature_ptr)
{
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
+ BIT_FLAGS result = 0L;
- creature_ptr->esp_animal = FALSE;
-
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
object_flags(creature_ptr, o_ptr, flgs);
if (have_flag(flgs, TR_ESP_ANIMAL))
- creature_ptr->esp_animal = TRUE;
+ result |= 0x01 << (i - INVEN_RARM);
}
+
+ return result;
}
-void have_esp_undead(player_type *creature_ptr)
+BIT_FLAGS have_esp_undead(player_type *creature_ptr)
{
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
+ BIT_FLAGS result = 0L;
- creature_ptr->esp_undead = FALSE;
-
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
object_flags(creature_ptr, o_ptr, flgs);
if (have_flag(flgs, TR_ESP_UNDEAD))
- creature_ptr->esp_undead = TRUE;
+ result |= 0x01 << (i - INVEN_RARM);
}
+
+ return result;
}
-void have_esp_demon(player_type *creature_ptr)
+BIT_FLAGS have_esp_demon(player_type *creature_ptr)
{
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
+ BIT_FLAGS result = 0L;
- creature_ptr->esp_demon = FALSE;
-
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
object_flags(creature_ptr, o_ptr, flgs);
if (have_flag(flgs, TR_ESP_DEMON))
- creature_ptr->esp_demon = TRUE;
+ result |= 0x01 << (i - INVEN_RARM);
}
+
+ return result;
}
-void have_esp_orc(player_type *creature_ptr)
+BIT_FLAGS have_esp_orc(player_type *creature_ptr)
{
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
+ BIT_FLAGS result = 0L;
- creature_ptr->esp_orc = FALSE;
-
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
object_flags(creature_ptr, o_ptr, flgs);
if (have_flag(flgs, TR_ESP_ORC))
- creature_ptr->esp_orc = TRUE;
+ result |= 0x01 << (i - INVEN_RARM);
}
+
+ return result;
}
-void have_esp_troll(player_type *creature_ptr)
+BIT_FLAGS have_esp_troll(player_type *creature_ptr)
{
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
+ BIT_FLAGS result = 0L;
- creature_ptr->esp_troll = FALSE;
-
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
object_flags(creature_ptr, o_ptr, flgs);
if (have_flag(flgs, TR_ESP_TROLL))
- creature_ptr->esp_troll = TRUE;
+ result |= 0x01 << (i - INVEN_RARM);
}
+
+ return result;
}
-void have_esp_giant(player_type *creature_ptr)
+BIT_FLAGS have_esp_giant(player_type *creature_ptr)
{
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
+ BIT_FLAGS result = 0L;
- creature_ptr->esp_giant = FALSE;
-
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
object_flags(creature_ptr, o_ptr, flgs);
if (have_flag(flgs, TR_ESP_GIANT))
- creature_ptr->esp_giant = TRUE;
+ result |= 0x01 << (i - INVEN_RARM);
}
+
+ return result;
}
-void have_esp_dragon(player_type *creature_ptr)
+BIT_FLAGS have_esp_dragon(player_type *creature_ptr)
{
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
+ BIT_FLAGS result = 0L;
- creature_ptr->esp_dragon = FALSE;
-
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
object_flags(creature_ptr, o_ptr, flgs);
if (have_flag(flgs, TR_ESP_DRAGON))
- creature_ptr->esp_dragon = TRUE;
+ result |= 0x01 << (i - INVEN_RARM);
}
+
+ return result;
}
void have_esp_human(player_type *creature_ptr)
creature_ptr->esp_human = FALSE;
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->esp_good = FALSE;
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->esp_nonliving = FALSE;
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->esp_unique = FALSE;
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->telepathy = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->bless_blade = FALSE;
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->easy_2weapon = FALSE;
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->down_saving = FALSE;
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->yoiyami = FALSE;
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->mighty_throw = FALSE;
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->xtra_might = FALSE;
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->reflect = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->warning = FALSE;
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->anti_magic = FALSE;
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->anti_tele = FALSE;
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->sh_fire = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->sh_elec = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->sh_cold = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
creature_ptr->easy_spell = FALSE;
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
creature_ptr->heavy_spell = FALSE;
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->hold_exp = TRUE;
}
- if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_HOBBIT) {
+ if (is_specific_player_race(creature_ptr, RACE_HOBBIT) || is_specific_player_race(creature_ptr, RACE_SKELETON) ||
+ is_specific_player_race(creature_ptr, RACE_ZOMBIE) || is_specific_player_race(creature_ptr, RACE_VAMPIRE) ||
+ is_specific_player_race(creature_ptr, RACE_SPECTRE) || is_specific_player_race(creature_ptr, RACE_BALROG) ||
+ is_specific_player_race(creature_ptr, RACE_ANDROID)) {
creature_ptr->hold_exp = TRUE;
}
- if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_GOLEM) {
+ if (is_specific_player_race(creature_ptr, RACE_GOLEM)) {
if (creature_ptr->lev > 34)
creature_ptr->hold_exp = TRUE;
}
- if (!creature_ptr->mimic_form
- && (creature_ptr->prace == RACE_SKELETON || creature_ptr->prace == RACE_ZOMBIE || creature_ptr->prace == RACE_VAMPIRE
- || creature_ptr->prace == RACE_SPECTRE || creature_ptr->prace == RACE_BALROG || creature_ptr->prace == RACE_ANDROID)) {
- creature_ptr->hold_exp = TRUE;
- }
-
if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
creature_ptr->hold_exp = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->see_inv = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->free_act = TRUE;
}
- if (heavy_armor(creature_ptr) && (!creature_ptr->inventory_list[INVEN_RARM].k_idx || creature_ptr->right_hand_weapon)
- && (!creature_ptr->inventory_list[INVEN_LARM].k_idx || creature_ptr->left_hand_weapon)) {
+ if (heavy_armor(creature_ptr) && (!creature_ptr->inventory_list[INVEN_RARM].k_idx || have_right_hand_weapon(creature_ptr))
+ && (!creature_ptr->inventory_list[INVEN_LARM].k_idx || have_left_hand_weapon(creature_ptr))) {
if (creature_ptr->lev > 24)
creature_ptr->free_act = TRUE;
}
creature_ptr->free_act = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->sustain_str = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->sustain_int = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->sustain_wis = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->sustain_dex = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->sustain_con = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->sustain_chr = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->levitation = TRUE;
}
+ if (creature_ptr->muta3 & MUT3_WINGS)
+ creature_ptr->levitation = TRUE;
+
if (!creature_ptr->mimic_form
&& (creature_ptr->prace == RACE_DRACONIAN || creature_ptr->prace == RACE_SPECTRE || creature_ptr->prace == RACE_SPRITE
|| creature_ptr->prace == RACE_ARCHON || creature_ptr->prace == RACE_S_FAIRY)) {
creature_ptr->levitation = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->slow_digest = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->regenerate = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
if (creature_ptr->pseikaku == PERSONALITY_SEXY)
creature_ptr->cursed |= (TRC_AGGRAVATE);
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->impact[0] = FALSE;
creature_ptr->impact[1] = FALSE;
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
BIT_FLAGS flgs[TR_FLAG_SIZE];
creature_ptr->extra_blows[0] = creature_ptr->extra_blows[1] = 0;
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
if (have_flag(flgs, TR_INFRA))
creature_ptr->see_infra += o_ptr->pval;
if (have_flag(flgs, TR_BLOWS)) {
- if ((i == INVEN_RARM || i == INVEN_RIGHT) && !creature_ptr->two_handed_weapon)
+ if ((i == INVEN_RARM || i == INVEN_RIGHT) && !have_two_handed_weapons(creature_ptr))
creature_ptr->extra_blows[0] += o_ptr->pval;
- else if ((i == INVEN_LARM || i == INVEN_LEFT) && !creature_ptr->two_handed_weapon)
+ else if ((i == INVEN_LARM || i == INVEN_LEFT) && !have_two_handed_weapons(creature_ptr))
creature_ptr->extra_blows[1] += o_ptr->pval;
else {
creature_ptr->extra_blows[0] += o_ptr->pval;
creature_ptr->resist_acid = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->resist_elec = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->resist_fire = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->resist_cold = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->resist_pois = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->resist_conf = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->resist_sound = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->resist_lite = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->resist_dark = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->resist_chaos = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->resist_disen = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->resist_shard = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->resist_nexus = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->resist_blind = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->resist_neth = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->resist_time = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
BIT_FLAGS flgs[TR_FLAG_SIZE];
creature_ptr->resist_fear = FALSE;
+ if (creature_ptr->muta3 & MUT3_FEARLESS)
+ creature_ptr->resist_fear = TRUE;
+
switch (creature_ptr->pclass) {
case CLASS_WARRIOR:
if (creature_ptr->lev > 29)
creature_ptr->resist_fear = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->immune_acid = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->immune_elec = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->immune_fire = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
creature_ptr->immune_cold = TRUE;
}
- for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
}
}
-void have_right_hand_weapon(player_type *creature_ptr)
+bool have_right_hand_weapon(player_type *creature_ptr)
{
- creature_ptr->right_hand_weapon = FALSE;
if (has_melee_weapon(creature_ptr, INVEN_RARM))
- creature_ptr->right_hand_weapon = TRUE;
+ return TRUE;
if (can_two_hands_wielding(creature_ptr)) {
switch (creature_ptr->pclass) {
case CLASS_FORCETRAINER:
case CLASS_BERSERKER:
if (empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM)) {
- creature_ptr->right_hand_weapon = TRUE;
+ return TRUE;
}
break;
}
}
+
+ return FALSE;
}
-void have_left_hand_weapon(player_type *creature_ptr)
+bool have_left_hand_weapon(player_type *creature_ptr)
{
- creature_ptr->left_hand_weapon = FALSE;
- if (has_melee_weapon(creature_ptr, INVEN_LARM)) {
- creature_ptr->left_hand_weapon = TRUE;
- }
+ return has_melee_weapon(creature_ptr, INVEN_LARM);
}
-void have_two_handed_weapons(player_type *creature_ptr)
+bool have_two_handed_weapons(player_type *creature_ptr)
{
- creature_ptr->two_handed_weapon = FALSE;
if (can_two_hands_wielding(creature_ptr)) {
- if (creature_ptr->right_hand_weapon && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_LARM)
+ if (have_right_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_LARM)
&& object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_RARM])) {
- creature_ptr->two_handed_weapon = TRUE;
- } else if (creature_ptr->left_hand_weapon && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_RARM)
+ return TRUE;
+ } else if (have_left_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_RARM)
&& object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_LARM])) {
- creature_ptr->two_handed_weapon = TRUE;
- } else {
- switch (creature_ptr->pclass) {
- case CLASS_MONK:
- case CLASS_FORCETRAINER:
- case CLASS_BERSERKER:
- if (empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM)) {
- creature_ptr->two_handed_weapon = TRUE;
- }
- }
+ return TRUE;
}
}
+ return FALSE;
}
void have_lite(player_type *creature_ptr)
if (creature_ptr->pclass == CLASS_NINJA)
return;
+ if (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN) {
+ creature_ptr->lite = TRUE;
+ }
+
if (creature_ptr->mimic_form == MIMIC_VAMPIRE) {
creature_ptr->lite = TRUE;
}
+ if (creature_ptr->muta3 & MUT3_FIRE_BODY) {
+ creature_ptr->lite = TRUE;
+ }
+
if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_VAMPIRE)
creature_ptr->lite = TRUE;
object_type *o_ptr;
o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
if (has_melee_weapon(creature_ptr, INVEN_RARM + i)) {
- if (creature_ptr->hold *= 2 >= o_ptr->weight / 10 && creature_ptr->two_handed_weapon && (creature_ptr->hold *= 2 < o_ptr->weight / 5))
+ 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))
return TRUE;
}
return FALSE;
}
-void is_icky_wield_weapon(player_type* creature_ptr, int i)
+bool is_icky_wield_weapon(player_type *creature_ptr, int i)
{
-
- object_type *o_ptr;
+ object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
object_flags(creature_ptr, o_ptr, flgs);
- creature_ptr->icky_wield[i] = FALSE;
if ((creature_ptr->pclass == CLASS_PRIEST) && (!(have_flag(flgs, TR_BLESSED))) && ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM))) {
- creature_ptr->icky_wield[i] = TRUE;
+ return TRUE;
} else if (creature_ptr->pclass == CLASS_SORCERER) {
if (!((o_ptr->tval == TV_HAFTED) && ((o_ptr->sval == SV_WIZSTAFF) || (o_ptr->sval == SV_NAMAKE_HAMMER)))) {
- creature_ptr->icky_wield[i] = TRUE;
+ return TRUE;
}
}
if (is_not_monk_weapon(creature_ptr, i) || is_not_ninja_weapon(creature_ptr, i)) {
- creature_ptr->icky_wield[i] = TRUE;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+bool is_riding_wield_weapon(player_type *creature_ptr, int i)
+{
+ object_type *o_ptr;
+ BIT_FLAGS flgs[TR_FLAG_SIZE];
+ o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
+ object_flags(creature_ptr, o_ptr, flgs);
+ if (creature_ptr->riding != 0 && !(o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE))
+ && !have_flag(flgs, TR_RIDING)) {
+ return TRUE;
}
+ return FALSE;
}
bool is_not_ninja_weapon(player_type *creature_ptr, int i)
OBJECT_SUBTYPE_VALUE sval = creature_ptr->inventory_list[INVEN_RARM + i].sval;
return (creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) && (!s_info[creature_ptr->pclass].w_max[tval][sval]);
}
+
+bool have_good_luck(player_type *creature_ptr) { return (creature_ptr->pseikaku == PERSONALITY_LUCKY) || (creature_ptr->muta3 |= MUT3_GOOD_LUCK); };