*/
void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
{
- update_player_turn_energy(user_ptr, 100);
+ update_player_turn_energy(user_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
ae_type tmp_ae;
ae_type *ae_ptr = initialize_ae_type(user_ptr, &tmp_ae, item);
decide_activation_level(user_ptr, ae_ptr);
}
creature_ptr->leaving = TRUE;
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
return;
}
{
grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
feature_type *f_ptr = &f_info[g_ptr->feat];
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
if (!has_flag(f_ptr->flags, FF_OPEN)) {
msg_format(_("%sはがっちりと閉じられているようだ。", "The %s appears to be stuck."), f_info[get_feat_mimic(g_ptr)].name.c_str());
return FALSE;
grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
FEAT_IDX old_feat = g_ptr->feat;
bool more = FALSE;
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
if (!has_flag(f_info[old_feat].flags, FF_CLOSE))
return more;
{
bool more = FALSE;
object_type *o_ptr = &creature_ptr->current_floor_ptr->o_list[o_idx];
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
int i = creature_ptr->skill_dis;
if (creature_ptr->blind || no_lite(creature_ptr))
i = i / 10;
int power = f_ptr->power;
bool more = FALSE;
int i = creature_ptr->skill_dis;
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
if (creature_ptr->blind || no_lite(creature_ptr))
i = i / 10;
int temp = f_ptr->power;
bool more = FALSE;
concptr name = f_info[get_feat_mimic(g_ptr)].name.c_str();
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
msg_format(_("%sに体当たりをした!", "You smash into the %s!"), name);
temp = (bash - (temp * 10));
if (creature_ptr->pclass == CLASS_BERSERKER)
}
adjust_racial_power_difficulty(creature_ptr, rpi_ptr, &difficulty);
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
if (randint1(creature_ptr->stat_cur[use_stat]) >= ((difficulty / 2) + randint1(difficulty / 2)))
return RACIAL_SUCCESS;
if (--creature_ptr->running <= 0)
return;
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
exe_movement(creature_ptr, find_current, FALSE, FALSE);
if (player_bold(creature_ptr, creature_ptr->run_py, creature_ptr->run_px)) {
creature_ptr->run_py = 0;
return;
}
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
exe_movement(creature_ptr, travel.dir, always_pickup, FALSE);
if ((creature_ptr->y == travel.y) && (creature_ptr->x == travel.x)) {
travel.run = 0;
if (!do_cmd_tunnel_test(creature_ptr->current_floor_ptr, y, x))
return FALSE;
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
f_ptr = &f_info[g_ptr->feat];
power = f_ptr->power;
disturb(attacker_ptr, FALSE, TRUE);
- update_player_turn_energy(attacker_ptr, 100);
+ update_player_turn_energy(attacker_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
if (!can_attack_with_main_hand(attacker_ptr) && !can_attack_with_sub_hand(attacker_ptr)
&& attacker_ptr->muta.has_none_of(mutation_attack_methods)) {
if (!exe_spell(creature_ptr, REALM_HISSATSU, n, SPELL_CAST))
return;
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
/* Use some mana */
creature_ptr->csp -= spell.smana;
if (!gain) {
msg_print(_("何も覚えられなかった。", "You were not able to learn any special attacks."));
} else {
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
}
creature_ptr->update |= (PU_SPELLS);
creature_ptr->mane_dam[j] = creature_ptr->mane_dam[j + 1];
}
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
creature_ptr->redraw |= (PR_IMITATION);
creature_ptr->window_flags |= (PW_PLAYER);
{
if (cm_ptr->on_mirror && (caster_ptr->pclass == CLASS_MIRROR_MASTER)) {
if (cm_ptr->n == 3 || cm_ptr->n == 5 || cm_ptr->n == 7 || cm_ptr->n == 16) {
- update_player_turn_energy(caster_ptr, 50);
+ update_player_turn_energy(caster_ptr, 50, update_turn_type::ENERGY_SUBSTITUTION);
return;
}
}
- update_player_turn_energy(caster_ptr, 100);
+ update_player_turn_energy(caster_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
}
static bool judge_mind_chance(player_type *caster_ptr, cm_type *cm_ptr)
creature_ptr->leaving = TRUE;
creature_ptr->oldpx = 0;
creature_ptr->oldpy = 0;
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
return;
}
if (!go_up)
return;
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
if (autosave_l)
do_cmd_save_game(creature_ptr, TRUE);
creature_ptr->leaving = TRUE;
creature_ptr->oldpx = 0;
creature_ptr->oldpy = 0;
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
return;
}
prepare_change_floor_mode(creature_ptr, CFM_FIRST_FLOOR);
}
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
if (autosave_l)
do_cmd_save_game(creature_ptr, TRUE);
bool more = FALSE;
DIRECTION dir;
if (get_rep_dir(creature_ptr, &dir, FALSE)) {
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
if ((dir != 5) && (creature_ptr->special_defense & KATA_MUSOU))
set_action(creature_ptr, ACTION_NONE);
creature_ptr->oldpy = randint1(MAX_HGT - 2);
creature_ptr->oldpx = randint1(MAX_WID - 2);
change_wild_mode(creature_ptr, TRUE);
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
}
}
command_arg = 0;
}
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
if (pickup)
mpe_mode |= MPE_DO_PICKUP;
if (creature_ptr->special_defense & NINJA_S_STEALTH)
set_superstealth(creature_ptr, FALSE);
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
if (command_arg > 100)
chg_virtue(creature_ptr, V_DILIGENCE, -1);
bool flag = TRUE;
bool more = FALSE;
object_type *o_ptr = &creature_ptr->current_floor_ptr->o_list[o_idx];
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
if (o_ptr->pval > 0) {
flag = FALSE;
int i = creature_ptr->skill_dis;
if (!has_flag(f_info[feat].flags, FF_OPEN) && !o_idx) {
msg_print(_("そこには開けるものが見当たらない。", "You see nothing there to open."));
} else if (g_ptr->m_idx && creature_ptr->riding != g_ptr->m_idx) {
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE);
} else if (o_idx) {
if (!has_flag(f_info[feat].flags, FF_CLOSE)) {
msg_print(_("そこには閉じるものが見当たらない。", "You see nothing there to close."));
} else if (g_ptr->m_idx) {
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE);
} else {
if (!has_flag(f_info[feat].flags, FF_BASH)) {
msg_print(_("そこには体当たりするものが見当たらない。", "You see nothing there to bash."));
} else if (g_ptr->m_idx) {
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE);
} else {
} else if (!get_spike(creature_ptr, &item)) {
msg_print(_("くさびを持っていない!", "You have no spikes!"));
} else if (g_ptr->m_idx) {
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE);
} else {
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
msg_format(_("%sにくさびを打ち込んだ。", "You jam the %s with a spike."), f_info[feat].name.c_str());
cave_alter_feat(creature_ptr, y, x, FF_SPIKE);
vary_item(creature_ptr, item, -1);
command_arg = 0;
}
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
search(creature_ptr);
if (creature_ptr->action == ACTION_SEARCH)
FEAT_IDX feat = get_feat_mimic(g_ptr);
feature_type *f_ptr;
f_ptr = &f_info[feat];
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
if (g_ptr->m_idx) {
do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE);
return FALSE;
return FALSE;
if (g_ptr->m_idx) {
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
}
if (r_info[m_ptr->r_idx].level > randint1((creature_ptr->skill_exp[GINOU_RIDING] / 50 + creature_ptr->lev / 2 + 20))) {
msg_print(_("うまく乗れなかった。", "You failed to ride."));
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
return FALSE;
}
health_track(creature_ptr, 0);
}
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
/* Mega-Hack -- Forget the view and lite */
creature_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
#endif
}
- update_player_turn_energy(caster_ptr, 100);
+ update_player_turn_energy(caster_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
switch (mp_ptr->spell_book) {
case TV_LIFE_BOOK:
}
}
- update_player_turn_energy(caster_ptr, 100);
+ update_player_turn_energy(caster_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
/* Over-exert the player */
if (over_exerted) {
else if (!has_flag(f_info[feat].flags, FF_TUNNEL))
msg_print(_("そこは掘れない。", "You can't tunnel through that."));
else if (g_ptr->m_idx) {
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE);
} else
{
if (player_ptr->wild_mode) return;
- update_player_turn_energy(player_ptr, 100);
+ update_player_turn_energy(player_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
if (!cave_has_flag_bold(player_ptr->current_floor_ptr, player_ptr->y, player_ptr->x, FF_BLDG))
{
destroy_ptr->o_ptr->number = destroy_ptr->amt;
describe_flavor(creature_ptr, destroy_ptr->o_name, destroy_ptr->o_ptr, 0);
destroy_ptr->o_ptr->number = destroy_ptr->old_number;
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
if (!can_player_destroy_object(creature_ptr, destroy_ptr->o_ptr)) {
reset_player_turn(creature_ptr);
msg_format(_("%sは破壊不可能だ。", "You cannot destroy %s."), destroy_ptr->o_name);
sound(SOUND_EAT);
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
/* Object level */
int lev = k_info[o_ptr->k_idx].level;
autopick_alter_item(creature_ptr, item, FALSE);
}
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
q_ptr = &forge;
object_copy(q_ptr, o_ptr);
q_ptr->number = 1;
msg_print(_("呪いを打ち破った。", "You break the curse."));
} else {
msg_print(_("装備を外せなかった。", "You couldn't remove the equipment."));
- update_player_turn_energy(creature_ptr, 50);
+ update_player_turn_energy(creature_ptr, 50, update_turn_type::ENERGY_SUBSTITUTION);
return;
}
}
- update_player_turn_energy(creature_ptr, 50);
+ update_player_turn_energy(creature_ptr, 50, update_turn_type::ENERGY_SUBSTITUTION);
(void)inven_takeoff(creature_ptr, item, 255);
verify_equip_slot(creature_ptr, item);
calc_android_exp(creature_ptr);
return;
}
- update_player_turn_energy(creature_ptr, 50);
+ update_player_turn_energy(creature_ptr, 50, update_turn_type::ENERGY_SUBSTITUTION);
drop_from_inventory(creature_ptr, item, amt);
if (item >= INVEN_MAIN_HAND) {
verify_equip_slot(creature_ptr, item);
sound(SOUND_FAIL);
if (randint1(100) >= chance)
chg_virtue(creature_ptr, V_CHANCE,-1);
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
return TRUE;
}
if (randint1(100) < chance)
chg_virtue(creature_ptr, V_CHANCE,1);
}
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
if (tval == TV_ROD) creature_ptr->magic_num1[item] += k_info[k_idx].pval * EATER_ROD_CHARGE;
else creature_ptr->magic_num1[item] -= EATER_CHARGE;
BIT_FLAGS flgs[TR_FLAG_SIZE], flgs2[TR_FLAG_SIZE];
object_flags(user_ptr, o_ptr, flgs);
- update_player_turn_energy(user_ptr, 50);
+ update_player_turn_energy(user_ptr, 50, update_turn_type::ENERGY_SUBSTITUTION);
j_ptr = &user_ptr->inventory_list[INVEN_LITE];
object_flags(user_ptr, j_ptr, flgs2);
j_ptr->xtra4 += o_ptr->xtra4;
BIT_FLAGS flgs[TR_FLAG_SIZE], flgs2[TR_FLAG_SIZE];
object_flags(user_ptr, o_ptr, flgs);
- update_player_turn_energy(user_ptr, 50);
+ update_player_turn_energy(user_ptr, 50, update_turn_type::ENERGY_SUBSTITUTION);
j_ptr = &user_ptr->inventory_list[INVEN_LITE];
object_flags(user_ptr, j_ptr, flgs2);
j_ptr->xtra4 += o_ptr->xtra4 + 5;
return;
}
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
object_flags(creature_ptr, o_ptr, old_flgs);
if (has_flag(old_flgs, TR_KILL_DRAGON))
if (es_ptr->add == ESSENCE_ATTACK) {
if ((o_ptr->to_h >= creature_ptr->lev / 5 + 5) && (o_ptr->to_d >= creature_ptr->lev / 5 + 5)) {
msg_print(_("改良に失敗した。", "You failed to enchant."));
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
return;
} else {
if (o_ptr->to_h < creature_ptr->lev / 5 + 5)
} else if (es_ptr->add == ESSENCE_AC) {
if (o_ptr->to_a >= creature_ptr->lev / 5 + 5) {
msg_print(_("改良に失敗した。", "You failed to enchant."));
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
return;
} else {
if (o_ptr->to_a < creature_ptr->lev / 5 + 5)
}
}
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
_(msg_format("%sに%sの能力を付加しました。", o_name, es_ptr->add_name), msg_format("You have added ability of %s to %s.", es_ptr->add_name, o_name));
creature_ptr->update |= (PU_COMBINE | PU_REORDER);
creature_ptr->window_flags |= (PW_INVEN);
if (!get_check(format(_("よろしいですか? [%s]", "Are you sure? [%s]"), o_name)))
return;
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
if (o_ptr->xtra3 == 1 + ESSENCE_SLAY_GLOVE) {
o_ptr->to_h -= (o_ptr->xtra4 >> 8);
static void set_class_specific_throw_params(player_type *creature_ptr, it_type *it_ptr)
{
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
if ((creature_ptr->pclass == CLASS_ROGUE) || (creature_ptr->pclass == CLASS_NINJA))
creature_ptr->energy_use -= creature_ptr->lev;
return;
}
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
lev = k_info[o_ptr->k_idx].level;
if (lev > 50)
return;
}
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
lev = k_info[o_ptr->k_idx].level;
}
target_pet = old_target_pet;
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
/* Get the level */
lev = k_info[o_ptr->k_idx].level;
command_cmd = SPECIAL_KEY_BUILDING;
process_command(creature_ptr);
} else if ((creature_ptr->paralyzed || creature_ptr->stun >= 100) && !cheat_immortal) {
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
} else if (creature_ptr->action == ACTION_REST) {
if (creature_ptr->resting > 0) {
creature_ptr->resting--;
creature_ptr->redraw |= (PR_STATE);
}
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
} else if (creature_ptr->action == ACTION_FISH) {
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
} else if (creature_ptr->running) {
run_step(creature_ptr, 0);
} else if (travel.run) {
if (player_ptr->wild_mode)
return;
- update_player_turn_energy(player_ptr, 100);
+ update_player_turn_energy(player_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
if (!cave_has_flag_bold(player_ptr->current_floor_ptr, player_ptr->y, player_ptr->x, FF_QUEST_ENTER)) {
msg_print(_("ここにはクエストの入口はない。", "You see no quest level here."));
}
}
- update_player_turn_energy(creature_ptr, 1000);
+ update_player_turn_energy(creature_ptr, 1000, update_turn_type::ENERGY_SUBSTITUTION);
creature_ptr->oldpx = creature_ptr->x;
creature_ptr->oldpy = creature_ptr->y;
if (hex_spelling_any(creature_ptr))
}
}
- update_player_turn_energy(caster_ptr, 100);
+ update_player_turn_energy(caster_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
caster_ptr->redraw |= PR_MANA;
caster_ptr->window_flags |= PW_PLAYER | PW_SPELL;
return TRUE;
PROJECT_JUMP | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM);
caster_ptr->csp = MAX(0, caster_ptr->csp - caster_ptr->msp * 10 / (20 + randint1(10)));
- update_player_turn_energy(caster_ptr, 100);
+ update_player_turn_energy(caster_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
set_bits(caster_ptr->redraw, PR_MANA);
set_bits(caster_ptr->window_flags, PW_PLAYER | PW_SPELL);
}
}
- update_player_turn_energy(caster_ptr, 100);
+ update_player_turn_energy(caster_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
set_bits(caster_ptr->redraw, PR_MANA);
set_bits(caster_ptr->window_flags, PW_PLAYER | PW_SPELL);
}
msg_format(_("%sの魔力を取り込んだ。", "You absorb magic of %s."), o_name);
vary_item(user_ptr, item, -999);
- update_player_turn_energy(user_ptr, 100);
+ update_player_turn_energy(user_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
return TRUE;
}
}
do_cmd_throw(caster_ptr, 1, FALSE, slot);
- update_player_turn_energy(caster_ptr, 100);
+ update_player_turn_energy(caster_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
}
break;
#include "main/sound-definitions-table.h"
#include "main/sound-of-music.h"
#include "mind/snipe-types.h"
+#include "monster-race/monster-race.h"
#include "monster-race/race-flags-resistance.h"
#include "monster-race/race-flags3.h"
-#include "monster-race/monster-race.h"
#include "player-status/player-energy.h"
#include "system/monster-race-definition.h"
#include "system/monster-type-definition.h"
#define MAX_SNIPE_POWERS 16
/*! スナイパー技能情報の構造体 */
-typedef struct snipe_power
-{
- PLAYER_LEVEL min_lev;
- MANA_POINT mana_cost;
- concptr name;
+typedef struct snipe_power {
+ PLAYER_LEVEL min_lev;
+ MANA_POINT mana_cost;
+ concptr name;
} snipe_power;
/*! スナイパー技能の解説メッセージ */
-static concptr const snipe_tips[MAX_SNIPE_POWERS] =
-{
+static concptr const snipe_tips[MAX_SNIPE_POWERS] = {
#ifdef JP
- "精神を集中する。射撃の威力、精度が上がり、高度な射撃術が使用できるようになる。",
- "光る矢を放つ。光に弱いモンスターに威力を発揮する。",
- "射撃を行った後、短距離の瞬間移動を行う。",
- "軌道上の罠をすべて無効にする低空飛行の矢を放つ。",
- "火炎属性の矢を放つ。",
- "壁を粉砕する矢を放つ。岩でできたモンスターと無生物のモンスターに威力を発揮する。",
- "冷気属性の矢を放つ。",
- "敵を突き飛ばす矢を放つ。",
- "複数の敵を貫通する矢を放つ。",
- "善良なモンスターに威力を発揮する矢を放つ。",
- "邪悪なモンスターに威力を発揮する矢を放つ。",
- "当たると爆発する矢を放つ。",
- "2回射撃を行う。",
- "電撃属性の矢を放つ。",
- "敵の急所にめがけて矢を放つ。成功すると敵を一撃死させる。失敗すると1ダメージ。",
- "全てのモンスターに高威力を発揮する矢を放つ。反動による副次効果を受ける。",
+ "精神を集中する。射撃の威力、精度が上がり、高度な射撃術が使用できるようになる。",
+ "光る矢を放つ。光に弱いモンスターに威力を発揮する。",
+ "射撃を行った後、短距離の瞬間移動を行う。",
+ "軌道上の罠をすべて無効にする低空飛行の矢を放つ。",
+ "火炎属性の矢を放つ。",
+ "壁を粉砕する矢を放つ。岩でできたモンスターと無生物のモンスターに威力を発揮する。",
+ "冷気属性の矢を放つ。",
+ "敵を突き飛ばす矢を放つ。",
+ "複数の敵を貫通する矢を放つ。",
+ "善良なモンスターに威力を発揮する矢を放つ。",
+ "邪悪なモンスターに威力を発揮する矢を放つ。",
+ "当たると爆発する矢を放つ。",
+ "2回射撃を行う。",
+ "電撃属性の矢を放つ。",
+ "敵の急所にめがけて矢を放つ。成功すると敵を一撃死させる。失敗すると1ダメージ。",
+ "全てのモンスターに高威力を発揮する矢を放つ。反動による副次効果を受ける。",
#else
- "Concentrate your mind for shooting.",
- "Shoot a glowing arrow effective against light-sensitive foes.",
- "Blink after shooting.",
- "Shoot an arrow able to shatter traps.",
- "Deals extra damage of fire.",
- "Shoot an arrow able to shatter rocks.",
- "Deals extra damage of ice.",
- "Shoot an arrow that pushes away the target.",
- "Shoot an arrow that does not always stop at the first target on its path."
- "Deals more damage to good monsters.",
- "Deals more damage to evil monsters.",
- "Shoot an arrow that explodes when it hits a monster.",
- "Shoot two arrows at once.",
- "Deals extra damage of lightning.",
- "Deals quick death or 1 damage.",
- "Deals great damage to all monsters, and some side effects to you.",
+ "Concentrate your mind for shooting.",
+ "Shoot a glowing arrow effective against light-sensitive foes.",
+ "Blink after shooting.",
+ "Shoot an arrow able to shatter traps.",
+ "Deals extra damage of fire.",
+ "Shoot an arrow able to shatter rocks.",
+ "Deals extra damage of ice.",
+ "Shoot an arrow that pushes away the target.",
+ "Shoot an arrow that does not always stop at the first target on its path."
+ "Deals more damage to good monsters.",
+ "Deals more damage to evil monsters.",
+ "Shoot an arrow that explodes when it hits a monster.",
+ "Shoot two arrows at once.",
+ "Deals extra damage of lightning.",
+ "Deals quick death or 1 damage.",
+ "Deals great damage to all monsters, and some side effects to you.",
#endif
};
/*! スナイパー技能テーブル */
-static snipe_power const snipe_powers[MAX_SNIPE_POWERS] =
-{
- /* Level gained, cost, name */
+static snipe_power const snipe_powers[MAX_SNIPE_POWERS] = {
+/* Level gained, cost, name */
#ifdef JP
- { 1, 0, "精神集中" },
- { 2, 1, "フラッシュアロー" },
- { 3, 1, "シュート&アウェイ" },
- { 5, 1, "解除の矢" },
- { 8, 2, "火炎の矢" },
- { 10, 2, "岩砕き" },
- { 13, 2, "冷気の矢" },
- { 18, 2, "烈風弾"},
- { 22, 3, "貫通弾" },
- { 25, 4, "邪念弾"},
- { 26, 4, "破魔矢" },
- { 30, 3, "爆発の矢"},
- { 32, 4, "ダブルショット" },
- { 36, 3, "プラズマボルト" },
- { 40, 3, "ニードルショット" },
- { 48, 7, "セイントスターアロー" },
+ { 1, 0, "精神集中" },
+ { 2, 1, "フラッシュアロー" },
+ { 3, 1, "シュート&アウェイ" },
+ { 5, 1, "解除の矢" },
+ { 8, 2, "火炎の矢" },
+ { 10, 2, "岩砕き" },
+ { 13, 2, "冷気の矢" },
+ { 18, 2, "烈風弾" },
+ { 22, 3, "貫通弾" },
+ { 25, 4, "邪念弾" },
+ { 26, 4, "破魔矢" },
+ { 30, 3, "爆発の矢" },
+ { 32, 4, "ダブルショット" },
+ { 36, 3, "プラズマボルト" },
+ { 40, 3, "ニードルショット" },
+ { 48, 7, "セイントスターアロー" },
#else
- { 1, 0, "Concentration" },
- { 2, 1, "Flash Arrow" },
- { 3, 1, "Shoot & Away" },
- { 5, 1, "Disarm Shot" },
- { 8, 2, "Fire Shot" },
- { 10, 2, "Shatter Arrow" },
- { 13, 2, "Ice Shot" },
- { 18, 2, "Rushing Arrow"},
- { 22, 3, "Piercing Shot" },
- { 25, 4, "Evil Shot"},
- { 26, 4, "Holy Shot" },
- { 30, 3, "Missile"},
- { 32, 4, "Double Shot" },
- { 36, 3, "Plasma Bolt" },
- { 40, 3, "Needle Shot" },
- { 48, 7, "Saint Stars Arrow" },
+ { 1, 0, "Concentration" },
+ { 2, 1, "Flash Arrow" },
+ { 3, 1, "Shoot & Away" },
+ { 5, 1, "Disarm Shot" },
+ { 8, 2, "Fire Shot" },
+ { 10, 2, "Shatter Arrow" },
+ { 13, 2, "Ice Shot" },
+ { 18, 2, "Rushing Arrow" },
+ { 22, 3, "Piercing Shot" },
+ { 25, 4, "Evil Shot" },
+ { 26, 4, "Holy Shot" },
+ { 30, 3, "Missile" },
+ { 32, 4, "Double Shot" },
+ { 36, 3, "Plasma Bolt" },
+ { 40, 3, "Needle Shot" },
+ { 48, 7, "Saint Stars Arrow" },
#endif
};
-/*!
+/*!
* @brief スナイパーの集中度加算
* @return 常にTRUEを返す
*/
static bool snipe_concentrate(player_type *creature_ptr)
{
- if ((int)creature_ptr->concent < (2 + (creature_ptr->lev + 5) / 10)) creature_ptr->concent++;
+ if ((int)creature_ptr->concent < (2 + (creature_ptr->lev + 5) / 10))
+ creature_ptr->concent++;
- msg_format(_("集中した。(集中度 %d)", "You concentrate deeply. (lvl %d)"), creature_ptr->concent);
- creature_ptr->reset_concent = FALSE;
+ msg_format(_("集中した。(集中度 %d)", "You concentrate deeply. (lvl %d)"), creature_ptr->concent);
+ creature_ptr->reset_concent = FALSE;
- creature_ptr->update |= (PU_BONUS | PU_MONSTERS);
- creature_ptr->redraw |= (PR_STATUS);
- return TRUE;
+ creature_ptr->update |= (PU_BONUS | PU_MONSTERS);
+ creature_ptr->redraw |= (PR_STATUS);
+ return TRUE;
}
-/*!
+/*!
* @brief スナイパーの集中度リセット
* @param msg TRUEならばメッセージを表示する
* @return なし
*/
void reset_concentration(player_type *creature_ptr, bool msg)
{
- if (msg)
- {
- msg_print(_("集中力が途切れてしまった。", "Stop concentrating."));
- }
+ if (msg) {
+ msg_print(_("集中力が途切れてしまった。", "Stop concentrating."));
+ }
- creature_ptr->concent = 0;
- creature_ptr->reset_concent = FALSE;
+ creature_ptr->concent = 0;
+ creature_ptr->reset_concent = FALSE;
- creature_ptr->update |= (PU_BONUS | PU_MONSTERS);
- creature_ptr->redraw |= (PR_STATUS);
+ creature_ptr->update |= (PU_BONUS | PU_MONSTERS);
+ creature_ptr->redraw |= (PR_STATUS);
}
-/*!
+/*!
* @brief スナイパーの集中度によるダメージボーナスを加算する
* @param tdam 算出中のダメージ
* @return 集中度修正を加えたダメージ
*/
int boost_concentration_damage(player_type *creature_ptr, int tdam)
{
- tdam *= (10 + creature_ptr->concent);
- tdam /= 10;
+ tdam *= (10 + creature_ptr->concent);
+ tdam /= 10;
- return (tdam);
+ return (tdam);
}
-/*!
+/*!
* @brief スナイパーの技能リストを表示する
* @return なし
*/
void display_snipe_list(player_type *sniper_ptr)
{
- int i;
- TERM_LEN y = 1;
- TERM_LEN x = 1;
- PLAYER_LEVEL plev = sniper_ptr->lev;
- snipe_power spell;
- char psi_desc[80];
-
- /* Display a list of spells */
- prt("", y, x);
- put_str(_("名前", "Name"), y, x + 5);
- put_str(_("Lv MP", "Lv Mana"), y, x + 35);
-
- for (i = 0; i < MAX_SNIPE_POWERS; i++)
- {
- /* Access the available spell */
- spell = snipe_powers[i];
- if (spell.min_lev > plev) continue;
-
- sprintf(psi_desc, " %c) %-30s%2d %4d",
- I2A(i), spell.name, spell.min_lev, spell.mana_cost);
-
- if (spell.mana_cost > (int)sniper_ptr->concent)
- term_putstr(x, y + i + 1, -1, TERM_SLATE, psi_desc);
- else
- term_putstr(x, y + i + 1, -1, TERM_WHITE, psi_desc);
- }
- return;
+ int i;
+ TERM_LEN y = 1;
+ TERM_LEN x = 1;
+ PLAYER_LEVEL plev = sniper_ptr->lev;
+ snipe_power spell;
+ char psi_desc[80];
+
+ /* Display a list of spells */
+ prt("", y, x);
+ put_str(_("名前", "Name"), y, x + 5);
+ put_str(_("Lv MP", "Lv Mana"), y, x + 35);
+
+ for (i = 0; i < MAX_SNIPE_POWERS; i++) {
+ /* Access the available spell */
+ spell = snipe_powers[i];
+ if (spell.min_lev > plev)
+ continue;
+
+ sprintf(psi_desc, " %c) %-30s%2d %4d", I2A(i), spell.name, spell.min_lev, spell.mana_cost);
+
+ if (spell.mana_cost > (int)sniper_ptr->concent)
+ term_putstr(x, y + i + 1, -1, TERM_SLATE, psi_desc);
+ else
+ term_putstr(x, y + i + 1, -1, TERM_WHITE, psi_desc);
+ }
+ return;
}
-
-/*!
+/*!
* @brief スナイパー技能を選択する
* @param sn 選択した特殊技能ID、キャンセルの場合-1、不正な選択の場合-2を返す
* @param only_browse 一覧を見るだけの場合TRUEを返す
*/
static int get_snipe_power(player_type *sniper_ptr, COMMAND_CODE *sn, bool only_browse)
{
- COMMAND_CODE i;
- int num = 0;
- TERM_LEN y = 1;
- TERM_LEN x = 20;
- PLAYER_LEVEL plev = sniper_ptr->lev;
- int ask;
- char choice;
- char out_val[160];
- concptr p = _("射撃術", "power");
- snipe_power spell;
- bool flag, redraw;
-
- repeat_push(*sn);
-
- /* Assume cancelled */
- *sn = (-1);
-
- /* Repeat previous command */
- /* Get the spell, if available */
- if (repeat_pull(sn))
- {
- /* Verify the spell */
- if ((snipe_powers[*sn].min_lev <= plev) && (snipe_powers[*sn].mana_cost <= (int)sniper_ptr->concent))
- {
- /* Success */
- return TRUE;
- }
- }
-
- flag = FALSE;
- redraw = FALSE;
-
- for (i = 0; i < MAX_SNIPE_POWERS; i++)
- {
- if ((snipe_powers[i].min_lev <= plev) &&
- ((only_browse) || (snipe_powers[i].mana_cost <= (int)sniper_ptr->concent)))
- {
- num = i;
- }
- }
-
- /* Build a prompt (accept all spells) */
- if (only_browse)
- {
- (void)strnfmt(out_val, 78,
- _("(%^s %c-%c, '*'で一覧, ESC) どの%sについて知りますか?", "(%^ss %c-%c, *=List, ESC=exit) Use which %s? "),
- p, I2A(0), I2A(num), p);
- }
- else
- {
- (void)strnfmt(out_val, 78,
- _("(%^s %c-%c, '*'で一覧, ESC) どの%sを使いますか?", "(%^ss %c-%c, *=List, ESC=exit) Use which %s? "),
- p, I2A(0), I2A(num), p);
- }
-
- choice = always_show_list ? ESCAPE : 1;
- while (!flag)
- {
- if(choice == ESCAPE) choice = ' ';
- else if( !get_com(out_val, &choice, FALSE) )break;
-
- /* Request redraw */
- if ((choice == ' ') || (choice == '*') || (choice == '?'))
- {
- /* Show the list */
- if (!redraw)
- {
- char psi_index[6];
- char psi_desc[75];
- redraw = TRUE;
- if (!only_browse) screen_save();
-
- /* Display a list of spells */
- prt("", y, x);
- put_str(_("名前", "Name"), y, x + 5);
- put_str(_("Lv 集中度", "Lv Pow"), y, x + 35);
-
- /* Dump the spells */
- for (i = 0; i < MAX_SNIPE_POWERS; i++)
- {
- term_color_type tcol = TERM_WHITE;
- term_erase(x, y + i + 1, 255);
-
- /* Access the spell */
- spell = snipe_powers[i];
-
- /* Dump the spell --(-- */
- if (spell.min_lev > plev)
- sprintf(psi_index, " ) ");
- else
- sprintf(psi_index, " %c) ", I2A(i));
-
- sprintf(psi_desc, "%-30s%2d %4d",
- spell.name, spell.min_lev, spell.mana_cost);
-
- if (spell.min_lev > plev)
- tcol = TERM_SLATE;
- else if (spell.mana_cost > (int)sniper_ptr->concent)
- tcol = TERM_L_BLUE;
-
- term_putstr(x, y + i + 1, -1, tcol, psi_index);
- term_putstr(x + 5, y + i + 1, -1, tcol, psi_desc);
- }
-
- /* Clear the bottom line */
- prt("", y + i + 1, x);
- }
-
- /* Hide the list */
- else
- {
- /* Hide list */
- redraw = FALSE;
- if (!only_browse) screen_load();
- }
-
- /* Redo asking */
- continue;
- }
-
- /* Note verify */
- ask = isupper(choice);
-
- /* Lowercase */
- if (ask) choice = (char)tolower(choice);
-
- /* Extract request */
- i = (islower(choice) ? A2I(choice) : -1);
-
- /* Totally Illegal */
- if ((i < 0) || (i > num) ||
- (!only_browse &&(snipe_powers[i].mana_cost > (int)sniper_ptr->concent)))
- {
- bell();
- continue;
- }
-
- /* Save the spell index */
- spell = snipe_powers[i];
-
- /* Verify it */
- if (ask)
- {
- char tmp_val[160];
-
- /* Prompt */
- (void) strnfmt(tmp_val, 78, _("%sを使いますか?", "Use %s? "), snipe_powers[i].name);
-
- /* Belay that order */
- if (!get_check(tmp_val)) continue;
- }
-
- /* Stop the loop */
- flag = TRUE;
- }
- if (redraw && !only_browse) screen_load();
-
- sniper_ptr->window_flags |= (PW_SPELL);
- handle_stuff(sniper_ptr);
-
- /* Abort if needed */
- if (!flag) return FALSE;
-
- /* Save the choice */
- (*sn) = i;
-
- repeat_push(*sn);
-
- /* Success */
- return TRUE;
+ COMMAND_CODE i;
+ int num = 0;
+ TERM_LEN y = 1;
+ TERM_LEN x = 20;
+ PLAYER_LEVEL plev = sniper_ptr->lev;
+ int ask;
+ char choice;
+ char out_val[160];
+ concptr p = _("射撃術", "power");
+ snipe_power spell;
+ bool flag, redraw;
+
+ repeat_push(*sn);
+
+ /* Assume cancelled */
+ *sn = (-1);
+
+ /* Repeat previous command */
+ /* Get the spell, if available */
+ if (repeat_pull(sn)) {
+ /* Verify the spell */
+ if ((snipe_powers[*sn].min_lev <= plev) && (snipe_powers[*sn].mana_cost <= (int)sniper_ptr->concent)) {
+ /* Success */
+ return TRUE;
+ }
+ }
+
+ flag = FALSE;
+ redraw = FALSE;
+
+ for (i = 0; i < MAX_SNIPE_POWERS; i++) {
+ if ((snipe_powers[i].min_lev <= plev) && ((only_browse) || (snipe_powers[i].mana_cost <= (int)sniper_ptr->concent))) {
+ num = i;
+ }
+ }
+
+ /* Build a prompt (accept all spells) */
+ if (only_browse) {
+ (void)strnfmt(
+ out_val, 78, _("(%^s %c-%c, '*'で一覧, ESC) どの%sについて知りますか?", "(%^ss %c-%c, *=List, ESC=exit) Use which %s? "), p, I2A(0), I2A(num), p);
+ } else {
+ (void)strnfmt(
+ out_val, 78, _("(%^s %c-%c, '*'で一覧, ESC) どの%sを使いますか?", "(%^ss %c-%c, *=List, ESC=exit) Use which %s? "), p, I2A(0), I2A(num), p);
+ }
+
+ choice = always_show_list ? ESCAPE : 1;
+ while (!flag) {
+ if (choice == ESCAPE)
+ choice = ' ';
+ else if (!get_com(out_val, &choice, FALSE))
+ break;
+
+ /* Request redraw */
+ if ((choice == ' ') || (choice == '*') || (choice == '?')) {
+ /* Show the list */
+ if (!redraw) {
+ char psi_index[6];
+ char psi_desc[75];
+ redraw = TRUE;
+ if (!only_browse)
+ screen_save();
+
+ /* Display a list of spells */
+ prt("", y, x);
+ put_str(_("名前", "Name"), y, x + 5);
+ put_str(_("Lv 集中度", "Lv Pow"), y, x + 35);
+
+ /* Dump the spells */
+ for (i = 0; i < MAX_SNIPE_POWERS; i++) {
+ term_color_type tcol = TERM_WHITE;
+ term_erase(x, y + i + 1, 255);
+
+ /* Access the spell */
+ spell = snipe_powers[i];
+
+ /* Dump the spell --(-- */
+ if (spell.min_lev > plev)
+ sprintf(psi_index, " ) ");
+ else
+ sprintf(psi_index, " %c) ", I2A(i));
+
+ sprintf(psi_desc, "%-30s%2d %4d", spell.name, spell.min_lev, spell.mana_cost);
+
+ if (spell.min_lev > plev)
+ tcol = TERM_SLATE;
+ else if (spell.mana_cost > (int)sniper_ptr->concent)
+ tcol = TERM_L_BLUE;
+
+ term_putstr(x, y + i + 1, -1, tcol, psi_index);
+ term_putstr(x + 5, y + i + 1, -1, tcol, psi_desc);
+ }
+
+ /* Clear the bottom line */
+ prt("", y + i + 1, x);
+ }
+
+ /* Hide the list */
+ else {
+ /* Hide list */
+ redraw = FALSE;
+ if (!only_browse)
+ screen_load();
+ }
+
+ /* Redo asking */
+ continue;
+ }
+
+ /* Note verify */
+ ask = isupper(choice);
+
+ /* Lowercase */
+ if (ask)
+ choice = (char)tolower(choice);
+
+ /* Extract request */
+ i = (islower(choice) ? A2I(choice) : -1);
+
+ /* Totally Illegal */
+ if ((i < 0) || (i > num) || (!only_browse && (snipe_powers[i].mana_cost > (int)sniper_ptr->concent))) {
+ bell();
+ continue;
+ }
+
+ /* Save the spell index */
+ spell = snipe_powers[i];
+
+ /* Verify it */
+ if (ask) {
+ char tmp_val[160];
+
+ /* Prompt */
+ (void)strnfmt(tmp_val, 78, _("%sを使いますか?", "Use %s? "), snipe_powers[i].name);
+
+ /* Belay that order */
+ if (!get_check(tmp_val))
+ continue;
+ }
+
+ /* Stop the loop */
+ flag = TRUE;
+ }
+ if (redraw && !only_browse)
+ screen_load();
+
+ sniper_ptr->window_flags |= (PW_SPELL);
+ handle_stuff(sniper_ptr);
+
+ /* Abort if needed */
+ if (!flag)
+ return FALSE;
+
+ /* Save the choice */
+ (*sn) = i;
+
+ repeat_push(*sn);
+
+ /* Success */
+ return TRUE;
}
-
/*!
* @brief スナイバー技能のスレイ倍率計算を行う /
* Calcurate magnification of snipe technics
*/
MULTIPLY calc_snipe_damage_with_slay(player_type *sniper_ptr, MULTIPLY mult, monster_type *m_ptr, SPELL_IDX snipe_type)
{
- monster_race *r_ptr = &r_info[m_ptr->r_idx];
- bool seen = is_seen(sniper_ptr, m_ptr);
-
- switch (snipe_type)
- {
- case SP_LITE:
- if (r_ptr->flags3 & (RF3_HURT_LITE))
- {
- MULTIPLY n = 20 + sniper_ptr->concent;
- if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
- if (mult < n) mult = n;
- }
- break;
- case SP_FIRE:
- if (r_ptr->flagsr & RFR_IM_FIRE)
- {
- if (seen) r_ptr->r_flagsr |= RFR_IM_FIRE;
- }
- else
- {
- MULTIPLY n = 15 + (sniper_ptr->concent * 3);
- if (mult < n) mult = n;
- }
- break;
- case SP_COLD:
- if (r_ptr->flagsr & RFR_IM_COLD)
- {
- if (seen) r_ptr->r_flagsr |= RFR_IM_COLD;
- }
- else
- {
- MULTIPLY n = 15 + (sniper_ptr->concent * 3);
- if (mult < n) mult = n;
- }
- break;
- case SP_ELEC:
- if (r_ptr->flagsr & RFR_IM_ELEC)
- {
- if (seen) r_ptr->r_flagsr |= RFR_IM_ELEC;
- }
- else
- {
- MULTIPLY n = 18 + (sniper_ptr->concent * 4);
- if (mult < n) mult = n;
- }
- break;
- case SP_KILL_WALL:
- if (r_ptr->flags3 & RF3_HURT_ROCK)
- {
- MULTIPLY n = 15 + (sniper_ptr->concent * 2);
- if (seen) r_ptr->r_flags3 |= RF3_HURT_ROCK;
- if (mult < n) mult = n;
- }
- else if (r_ptr->flags3 & RF3_NONLIVING)
- {
- MULTIPLY n = 15 + (sniper_ptr->concent * 2);
- if (seen) r_ptr->r_flags3 |= RF3_NONLIVING;
- if (mult < n) mult = n;
- }
- break;
- case SP_EVILNESS:
- if (r_ptr->flags3 & RF3_GOOD)
- {
- MULTIPLY n = 15 + (sniper_ptr->concent * 4);
- if (seen) r_ptr->r_flags3 |= RF3_GOOD;
- if (mult < n) mult = n;
- }
- break;
- case SP_HOLYNESS:
- if (r_ptr->flags3 & RF3_EVIL)
- {
- MULTIPLY n = 12 + (sniper_ptr->concent * 3);
- if (seen) r_ptr->r_flags3 |= RF3_EVIL;
- if (r_ptr->flags3 & (RF3_HURT_LITE))
- {
- n += (sniper_ptr->concent * 3);
- if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
- }
- if (mult < n) mult = n;
- }
- break;
- case SP_FINAL:
- if (mult < 50) mult = 50;
- break;
- }
-
- return (mult);
+ monster_race *r_ptr = &r_info[m_ptr->r_idx];
+ bool seen = is_seen(sniper_ptr, m_ptr);
+
+ switch (snipe_type) {
+ case SP_LITE:
+ if (r_ptr->flags3 & (RF3_HURT_LITE)) {
+ MULTIPLY n = 20 + sniper_ptr->concent;
+ if (seen)
+ r_ptr->r_flags3 |= (RF3_HURT_LITE);
+ if (mult < n)
+ mult = n;
+ }
+ break;
+ case SP_FIRE:
+ if (r_ptr->flagsr & RFR_IM_FIRE) {
+ if (seen)
+ r_ptr->r_flagsr |= RFR_IM_FIRE;
+ } else {
+ MULTIPLY n = 15 + (sniper_ptr->concent * 3);
+ if (mult < n)
+ mult = n;
+ }
+ break;
+ case SP_COLD:
+ if (r_ptr->flagsr & RFR_IM_COLD) {
+ if (seen)
+ r_ptr->r_flagsr |= RFR_IM_COLD;
+ } else {
+ MULTIPLY n = 15 + (sniper_ptr->concent * 3);
+ if (mult < n)
+ mult = n;
+ }
+ break;
+ case SP_ELEC:
+ if (r_ptr->flagsr & RFR_IM_ELEC) {
+ if (seen)
+ r_ptr->r_flagsr |= RFR_IM_ELEC;
+ } else {
+ MULTIPLY n = 18 + (sniper_ptr->concent * 4);
+ if (mult < n)
+ mult = n;
+ }
+ break;
+ case SP_KILL_WALL:
+ if (r_ptr->flags3 & RF3_HURT_ROCK) {
+ MULTIPLY n = 15 + (sniper_ptr->concent * 2);
+ if (seen)
+ r_ptr->r_flags3 |= RF3_HURT_ROCK;
+ if (mult < n)
+ mult = n;
+ } else if (r_ptr->flags3 & RF3_NONLIVING) {
+ MULTIPLY n = 15 + (sniper_ptr->concent * 2);
+ if (seen)
+ r_ptr->r_flags3 |= RF3_NONLIVING;
+ if (mult < n)
+ mult = n;
+ }
+ break;
+ case SP_EVILNESS:
+ if (r_ptr->flags3 & RF3_GOOD) {
+ MULTIPLY n = 15 + (sniper_ptr->concent * 4);
+ if (seen)
+ r_ptr->r_flags3 |= RF3_GOOD;
+ if (mult < n)
+ mult = n;
+ }
+ break;
+ case SP_HOLYNESS:
+ if (r_ptr->flags3 & RF3_EVIL) {
+ MULTIPLY n = 12 + (sniper_ptr->concent * 3);
+ if (seen)
+ r_ptr->r_flags3 |= RF3_EVIL;
+ if (r_ptr->flags3 & (RF3_HURT_LITE)) {
+ n += (sniper_ptr->concent * 3);
+ if (seen)
+ r_ptr->r_flags3 |= (RF3_HURT_LITE);
+ }
+ if (mult < n)
+ mult = n;
+ }
+ break;
+ case SP_FINAL:
+ if (mult < 50)
+ mult = 50;
+ break;
+ }
+
+ return (mult);
}
-
/*!
* @brief スナイパー技能の発動 /
* do_cmd_cast calls this function if the player's class is 'snipe'.
*/
static bool cast_sniper_spell(player_type *sniper_ptr, int spell)
{
- object_type *o_ptr = &sniper_ptr->inventory_list[INVEN_BOW];
- SPELL_IDX snipe_type = SP_NONE;
-
- if (o_ptr->tval != TV_BOW)
- {
- msg_print(_("弓を装備していない!", "You wield no bow!"));
- return FALSE;
- }
-
- /* spell code */
- switch (spell)
- {
- case 0: /* Concentration */
- if (!snipe_concentrate(sniper_ptr)) return FALSE;
- update_player_turn_energy(sniper_ptr, 100);
- return TRUE;
- case 1: snipe_type = SP_LITE; break;
- case 2: snipe_type = SP_AWAY; break;
- case 3: snipe_type = SP_KILL_TRAP; break;
- case 4: snipe_type = SP_FIRE; break;
- case 5: snipe_type = SP_KILL_WALL; break;
- case 6: snipe_type = SP_COLD; break;
- case 7: snipe_type = SP_RUSH; break;
- case 8: snipe_type = SP_PIERCE; break;
- case 9: snipe_type = SP_EVILNESS; break;
- case 10: snipe_type = SP_HOLYNESS; break;
- case 11: snipe_type = SP_EXPLODE; break;
- case 12: snipe_type = SP_DOUBLE; break;
- case 13: snipe_type = SP_ELEC; break;
- case 14: snipe_type = SP_NEEDLE; break;
- case 15: snipe_type = SP_FINAL; break;
- default:
- msg_print(_("なに?", "Zap?"));
- }
-
- command_cmd = 'f';
- do_cmd_fire(sniper_ptr, snipe_type);
-
- return (sniper_ptr->is_fired);
+ object_type *o_ptr = &sniper_ptr->inventory_list[INVEN_BOW];
+ SPELL_IDX snipe_type = SP_NONE;
+
+ if (o_ptr->tval != TV_BOW) {
+ msg_print(_("弓を装備していない!", "You wield no bow!"));
+ return FALSE;
+ }
+
+ /* spell code */
+ switch (spell) {
+ case 0: /* Concentration */
+ if (!snipe_concentrate(sniper_ptr))
+ return FALSE;
+ update_player_turn_energy(sniper_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
+ return TRUE;
+ case 1:
+ snipe_type = SP_LITE;
+ break;
+ case 2:
+ snipe_type = SP_AWAY;
+ break;
+ case 3:
+ snipe_type = SP_KILL_TRAP;
+ break;
+ case 4:
+ snipe_type = SP_FIRE;
+ break;
+ case 5:
+ snipe_type = SP_KILL_WALL;
+ break;
+ case 6:
+ snipe_type = SP_COLD;
+ break;
+ case 7:
+ snipe_type = SP_RUSH;
+ break;
+ case 8:
+ snipe_type = SP_PIERCE;
+ break;
+ case 9:
+ snipe_type = SP_EVILNESS;
+ break;
+ case 10:
+ snipe_type = SP_HOLYNESS;
+ break;
+ case 11:
+ snipe_type = SP_EXPLODE;
+ break;
+ case 12:
+ snipe_type = SP_DOUBLE;
+ break;
+ case 13:
+ snipe_type = SP_ELEC;
+ break;
+ case 14:
+ snipe_type = SP_NEEDLE;
+ break;
+ case 15:
+ snipe_type = SP_FINAL;
+ break;
+ default:
+ msg_print(_("なに?", "Zap?"));
+ }
+
+ command_cmd = 'f';
+ do_cmd_fire(sniper_ptr, snipe_type);
+
+ return (sniper_ptr->is_fired);
}
/*!
*/
void do_cmd_snipe(player_type *sniper_ptr)
{
- COMMAND_CODE n = 0;
- bool cast;
-
- if(cmd_limit_confused(sniper_ptr)) return;
- if(cmd_limit_image(sniper_ptr)) return;
- if(cmd_limit_stun(sniper_ptr)) return;
-
- if (!get_snipe_power(sniper_ptr, &n, FALSE)) return;
-
- sound(SOUND_SHOOT);
- cast = cast_sniper_spell(sniper_ptr, n);
-
- if (!cast) return;
- sniper_ptr->redraw |= (PR_HP | PR_MANA);
- sniper_ptr->window_flags |= (PW_PLAYER);
- sniper_ptr->window_flags |= (PW_SPELL);
+ COMMAND_CODE n = 0;
+ bool cast;
+
+ if (cmd_limit_confused(sniper_ptr))
+ return;
+ if (cmd_limit_image(sniper_ptr))
+ return;
+ if (cmd_limit_stun(sniper_ptr))
+ return;
+
+ if (!get_snipe_power(sniper_ptr, &n, FALSE))
+ return;
+
+ sound(SOUND_SHOOT);
+ cast = cast_sniper_spell(sniper_ptr, n);
+
+ if (!cast)
+ return;
+ sniper_ptr->redraw |= (PR_HP | PR_MANA);
+ sniper_ptr->window_flags |= (PW_PLAYER);
+ sniper_ptr->window_flags |= (PW_SPELL);
}
/*!
*/
void do_cmd_snipe_browse(player_type *sniper_ptr)
{
- COMMAND_CODE n = 0;
- int j, line;
- char temp[62 * 4];
-
- screen_save();
-
- while (TRUE)
- {
- if (!get_snipe_power(sniper_ptr, &n, TRUE))
- {
- screen_load();
- return;
- }
-
- /* Clear lines, position cursor (really should use strlen here) */
- term_erase(12, 22, 255);
- term_erase(12, 21, 255);
- term_erase(12, 20, 255);
- term_erase(12, 19, 255);
- term_erase(12, 18, 255);
-
- shape_buffer(snipe_tips[n], 62, temp, sizeof(temp));
- for(j = 0, line = 19; temp[j]; j += (1 + strlen(&temp[j])))
- {
- prt(&temp[j], line, 15);
- line++;
- }
- }
+ COMMAND_CODE n = 0;
+ int j, line;
+ char temp[62 * 4];
+
+ screen_save();
+
+ while (TRUE) {
+ if (!get_snipe_power(sniper_ptr, &n, TRUE)) {
+ screen_load();
+ return;
+ }
+
+ /* Clear lines, position cursor (really should use strlen here) */
+ term_erase(12, 22, 255);
+ term_erase(12, 21, 255);
+ term_erase(12, 20, 255);
+ term_erase(12, 19, 255);
+ term_erase(12, 18, 255);
+
+ shape_buffer(snipe_tips[n], 62, temp, sizeof(temp));
+ for (j = 0, line = 19; temp[j]; j += (1 + strlen(&temp[j]))) {
+ prt(&temp[j], line, 15);
+ line++;
+ }
+ }
}
* level. This should prevent the level from being "swamped" by\n
* reproducing monsters. It also allows a large mass of mice to\n
* prevent a louse from multiplying, but this is a small price to\n
- * pay for a simple multiplication method.\n
+ * pay for a simple ENERGY_MULTIPLICATION method.\n
*\n
* XXX Monster fear is slightly odd, in particular, monsters will\n
* fixate on opening a door even if they cannot open it. Actually,\n
* @details
* <pre>
* Even the 64 bit operation is not big enough to avoid overflaw
- * unless we carefully choose orders of multiplication and division.
+ * unless we carefully choose orders of ENERGY_MULTIPLICATION and ENERGY_DIVISION.
* Get the coefficient first, and multiply (potentially huge) base
* experience point of a monster later.
* </pre>
if (!target_ptr->current_floor_ptr->dun_level && (!(r_ptr->flags8 & RF8_WILD_ONLY) || !(r_ptr->flags1 & RF1_UNIQUE)))
s64b_mul(&div_h, &div_l, 0, 5);
- /* Do division first to prevent overflaw */
+ /* Do ENERGY_DIVISION first to prevent overflaw */
s64b_div(&new_exp, &new_exp_frac, div_h, div_l);
/* Special penalty for mutiply-monster */
* @return 算出されたボーナス値
* @details
* To avoid floating point but still provide a smooth distribution of bonuses,\n
- * we simply round the results of division in such a way as to "average" the\n
+ * we simply round the results of ENERGY_DIVISION in such a way as to "average" the\n
* correct floating point value.\n
*\n
* This function has been changed. It uses "randnor()" to choose values from\n
object_type forge;
object_type *q_ptr;
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
if (creature_ptr->timewalk) {
if (flush_failure)
int k, used_up, ident, lev;
object_type *o_ptr;
o_ptr = ref_item(creature_ptr, item);
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
if (cmd_limit_time_walk(creature_ptr))
return;
#include "player-status/player-energy.h"
#include "system/player-type-definition.h"
-// todo 第3引数 (演算:代入、加算、減算、他)を導入する。enumを使う
-void update_player_turn_energy(player_type *creature_ptr, PERCENTAGE need_cost)
+/*
+ * @brief プレーヤーの行動エネルギーを更新する
+ * @param creature_ptr プレーヤーの参照ポインタ
+ * @param need_cost 行動エネルギー
+ * @param ut_type 現在値に対する演算方法
+ * @return なし
+ */
+void update_player_turn_energy(player_type *creature_ptr, ENERGY need_cost, update_turn_type ut_type)
{
- creature_ptr->energy_use = (ENERGY)need_cost;
+ switch (ut_type) {
+ case update_turn_type::ENERGY_SUBSTITUTION:
+ creature_ptr->energy_use = need_cost;
+ return;
+ case update_turn_type::ENERGY_ADDITION:
+ creature_ptr->energy_use += need_cost;
+ return;
+ case update_turn_type::ENERGY_SUBTRACTION:
+ creature_ptr->energy_use -= need_cost;
+ return;
+ case update_turn_type::ENERGY_MULTIPLICATION:
+ creature_ptr->energy_use *= need_cost;
+ return;
+ case update_turn_type::ENERGY_DIVISION:
+ creature_ptr->energy_use /= need_cost;
+ return;
+ default:
+ return;
+ }
}
/*
*/
void reset_player_turn(player_type *creature_ptr)
{
- creature_ptr->energy_use = 0;
+ update_player_turn_energy(creature_ptr, 0, update_turn_type::ENERGY_SUBSTITUTION);
}
#include "system/angband.h"
+enum class update_turn_type {
+ ENERGY_SUBSTITUTION,
+ ENERGY_ADDITION,
+ ENERGY_SUBTRACTION,
+ ENERGY_MULTIPLICATION,
+ ENERGY_DIVISION,
+};
+
typedef struct player_type player_type;
-void update_player_turn_energy(player_type *creature_ptr, PERCENTAGE need_cost);
+void update_player_turn_energy(player_type *creature_ptr, ENERGY need_cost, update_turn_type ut_type);
void reset_player_turn(player_type *creature_ptr);
}
case ACTION_HAYAGAKE: {
msg_print(_("足が重くなった。", "You are no longer walking extremely fast."));
- update_player_turn_energy(creature_ptr, 100);
+ update_player_turn_energy(creature_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
break;
}
case ACTION_SPELL: {
player_ptr->town_num = old_town_num;
select_floor_music(player_ptr);
- update_player_turn_energy(player_ptr, 100);
+ update_player_turn_energy(player_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
current_world_ptr->character_icky_depth = 0;
command_new = 0;
command_see = FALSE;
#define BREAK_RUNE_PROTECTION 550 /*!< 守りのルーンの強靭度 / Rune of protection resistance */
#define BREAK_RUNE_EXPLOSION 299 /*!< 爆発のルーンの発動しやすさ / For explosive runes */
#define BTH_PLUS_ADJ 3 /*!< 武器経験値及びプレイヤーの打撃/射撃能力に応じた修正値倍率 / Adjust BTH per plus-to-hit */
-#define MON_MULT_ADJ 8 /*!< モンスターの増殖しにくさの基本倍率 / High value slows multiplication */
+#define MON_MULT_ADJ 8 /*!< モンスターの増殖しにくさの基本倍率 / High value slows ENERGY_MULTIPLICATION */
#define MON_SUMMON_ADJ 2 /*!< 現在未使用 Adjust level of summoned creatures */
#define MON_DRAIN_LIFE 2 /*!< モンスターの打撃によるプレイヤーの経験値吸収基本倍率(%) / Percent of player exp drained per hit */
#define USE_DEVICE 3 /*!< 魔道具の最低失敗基準値 x> Harder devices x< Easier devices */
}
/*
- * Extract a "random" number from 0 to m-1, via "division"
+ * Extract a "random" number from 0 to m-1, via "ENERGY_DIVISION"
*/
static s32b Rand_div_impl(s32b m, u32b *state)
{
}
-/* Reminder of division (A % B) */
+/* Reminder of ENERGY_DIVISION (A % B) */
void s64b_mod(s32b *A1, u32b *A2, s32b B1, u32b B2)
{
s32b tmp1 = (*A1);
player_ptr->oldpy = randint1(MAX_HGT - 2);
player_ptr->oldpx = randint1(MAX_WID - 2);
change_wild_mode(player_ptr, TRUE);
- update_player_turn_energy(player_ptr, 100);
+ update_player_turn_energy(player_ptr, 100, update_turn_type::ENERGY_SUBSTITUTION);
}
player_ptr->invoking_midnight_curse = TRUE;