• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revision52b522ea771b6be49a0052699379f3588f8aae4b (tree)
Time2019-08-17 21:50:06
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #38997 do_cmd_mane() に player_type * 引数を追加.

Change Summary

Incremental Difference

--- a/src/cmd/cmd-mane.c
+++ b/src/cmd/cmd-mane.c
@@ -917,18 +917,18 @@ static bool use_mane(int spell)
917917 * when you run it. It's probably easy to fix but I haven't tried,
918918 * sorry.
919919 */
920-bool do_cmd_mane(bool baigaesi)
920+bool do_cmd_mane(player_type *creature_ptr, bool baigaesi)
921921 {
922922 int n = 0, j;
923923 PERCENTAGE chance;
924924 PERCENTAGE minfail = 0;
925- PLAYER_LEVEL plev = p_ptr->lev;
925+ PLAYER_LEVEL plev = creature_ptr->lev;
926926 monster_power spell;
927927 bool cast;
928928
929- if (cmd_limit_confused(p_ptr)) return FALSE;
929+ if (cmd_limit_confused(creature_ptr)) return FALSE;
930930
931- if (!p_ptr->mane_num)
931+ if (!creature_ptr->mane_num)
932932 {
933933 msg_print(_("まねられるものが何もない!", "You don't remember any action!"));
934934 return FALSE;
@@ -936,7 +936,7 @@ bool do_cmd_mane(bool baigaesi)
936936
937937 if (!get_mane_power(&n, baigaesi)) return FALSE;
938938
939- spell = monster_powers[p_ptr->mane_spell[n]];
939+ spell = monster_powers[creature_ptr->mane_spell[n]];
940940
941941 /* Spell failure chance */
942942 chance = spell.manefail;
@@ -945,21 +945,21 @@ bool do_cmd_mane(bool baigaesi)
945945 if (plev > spell.level) chance -= 3 * (plev - spell.level);
946946
947947 /* Reduce failure rate by 1 stat and DEX adjustment */
948- chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[p_ptr->stat_ind[A_DEX]] - 2) / 2;
948+ chance -= 3 * (adj_mag_stat[creature_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[creature_ptr->stat_ind[A_DEX]] - 2) / 2;
949949
950950 if (spell.manedam) chance = chance * damage / spell.manedam;
951951
952- chance += p_ptr->to_m_chance;
952+ chance += creature_ptr->to_m_chance;
953953
954954 /* Extract the minimum failure rate */
955- minfail = adj_mag_fail[p_ptr->stat_ind[spell.use_stat]];
955+ minfail = adj_mag_fail[creature_ptr->stat_ind[spell.use_stat]];
956956
957957 /* Minimum failure rate */
958958 if (chance < minfail) chance = minfail;
959959
960960 /* Stunning makes spells harder */
961- if (p_ptr->stun > 50) chance += 25;
962- else if (p_ptr->stun) chance += 15;
961+ if (creature_ptr->stun > 50) chance += 25;
962+ else if (creature_ptr->stun) chance += 15;
963963
964964 /* Always a 5 percent chance of working */
965965 if (chance > 95) chance = 95;
@@ -974,22 +974,22 @@ bool do_cmd_mane(bool baigaesi)
974974 else
975975 {
976976 sound(SOUND_ZAP);
977- cast = use_mane(p_ptr->mane_spell[n]);
977+ cast = use_mane(creature_ptr->mane_spell[n]);
978978 if (!cast) return FALSE;
979979 }
980980
981- p_ptr->mane_num--;
982- for (j = n; j < p_ptr->mane_num;j++)
981+ creature_ptr->mane_num--;
982+ for (j = n; j < creature_ptr->mane_num;j++)
983983 {
984- p_ptr->mane_spell[j] = p_ptr->mane_spell[j+1];
985- p_ptr->mane_dam[j] = p_ptr->mane_dam[j+1];
984+ creature_ptr->mane_spell[j] = creature_ptr->mane_spell[j+1];
985+ creature_ptr->mane_dam[j] = creature_ptr->mane_dam[j+1];
986986 }
987987
988- take_turn(p_ptr, 100);
988+ take_turn(creature_ptr, 100);
989989
990- p_ptr->redraw |= (PR_IMITATION);
991- p_ptr->window |= (PW_PLAYER);
992- p_ptr->window |= (PW_SPELL);
990+ creature_ptr->redraw |= (PR_IMITATION);
991+ creature_ptr->window |= (PW_PLAYER);
992+ creature_ptr->window |= (PW_SPELL);
993993
994994 return TRUE;
995995 }
--- a/src/cmd/cmd-mane.h
+++ b/src/cmd/cmd-mane.h
@@ -1,4 +1,4 @@
11 #pragma once
22
33 /* mane.c */
4-extern bool do_cmd_mane(bool baigaesi);
4+extern bool do_cmd_mane(player_type *creature_ptr, bool baigaesi);
--- a/src/core.c
+++ b/src/core.c
@@ -3894,7 +3894,7 @@ static void process_command(void)
38943894 )
38953895 do_cmd_mind();
38963896 else if (p_ptr->pclass == CLASS_IMITATOR)
3897- do_cmd_mane(FALSE);
3897+ do_cmd_mane(p_ptr, FALSE);
38983898 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
38993899 do_cmd_magic_eater(p_ptr, FALSE, FALSE);
39003900 else if (p_ptr->pclass == CLASS_SAMURAI)
--- a/src/racial.c
+++ b/src/racial.c
@@ -507,7 +507,7 @@ static bool exe_racial_power(player_type *creature_ptr, s32b command)
507507 case CLASS_IMITATOR:
508508 {
509509 handle_stuff();
510- if (!do_cmd_mane(TRUE)) return FALSE;
510+ if (!do_cmd_mane(p_ptr, TRUE)) return FALSE;
511511 break;
512512 }
513513 case CLASS_BEASTMASTER:
Show on old repository browser