• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revisioneea19244c22099a08b21432f3ff9ac48c20f0a82 (tree)
Zeit2020-08-02 11:56:28
Autordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #40514 have_see_inv() と have_hold_exp() を calc_bonuses() から分離. / Separated have_see_inv() and have_hold_exp() from calc_bonuses().

Ändern Zusammenfassung

Diff

--- a/src/player/player-class.c
+++ b/src/player/player-class.c
@@ -1271,8 +1271,6 @@ void calc_class_status(player_type *creature_ptr)
12711271 creature_ptr->resist_pois = TRUE;
12721272 if (creature_ptr->lev > 24)
12731273 creature_ptr->sustain_dex = TRUE;
1274- if (creature_ptr->lev > 29)
1275- creature_ptr->see_inv = TRUE;
12761274 if (creature_ptr->lev > 44) {
12771275 creature_ptr->oppose_pois = 1;
12781276 creature_ptr->redraw |= PR_STATUS;
--- a/src/player/player-personality.c
+++ b/src/player/player-personality.c
@@ -155,7 +155,6 @@ void set_personality_flags(player_type *creature_ptr)
155155 if (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN) {
156156 creature_ptr->resist_blind = TRUE;
157157 creature_ptr->resist_conf = TRUE;
158- creature_ptr->hold_exp = TRUE;
159158 if (creature_ptr->pclass != CLASS_NINJA)
160159 creature_ptr->lite = TRUE;
161160 }
--- a/src/player/player-race.c
+++ b/src/player/player-race.c
@@ -131,16 +131,13 @@ void calc_race_status(player_type *creature_ptr)
131131 if (creature_ptr->mimic_form) {
132132 switch (creature_ptr->mimic_form) {
133133 case MIMIC_DEMON:
134- creature_ptr->hold_exp = TRUE;
135134 creature_ptr->resist_chaos = TRUE;
136135 creature_ptr->resist_neth = TRUE;
137136 creature_ptr->resist_fire = TRUE;
138137 creature_ptr->oppose_fire = 1;
139- creature_ptr->see_inv = TRUE;
140138 creature_ptr->redraw |= PR_STATUS;
141139 break;
142140 case MIMIC_DEMON_LORD:
143- creature_ptr->hold_exp = TRUE;
144141 creature_ptr->resist_chaos = TRUE;
145142 creature_ptr->resist_neth = TRUE;
146143 creature_ptr->immune_fire = TRUE;
@@ -153,16 +150,13 @@ void calc_race_status(player_type *creature_ptr)
153150 creature_ptr->resist_disen = TRUE;
154151 creature_ptr->resist_nexus = TRUE;
155152 creature_ptr->resist_fear = TRUE;
156- creature_ptr->see_inv = TRUE;
157153 creature_ptr->levitation = TRUE;
158154 break;
159155 case MIMIC_VAMPIRE:
160156 creature_ptr->resist_dark = TRUE;
161- creature_ptr->hold_exp = TRUE;
162157 creature_ptr->resist_neth = TRUE;
163158 creature_ptr->resist_cold = TRUE;
164159 creature_ptr->resist_pois = TRUE;
165- creature_ptr->see_inv = TRUE;
166160 if (creature_ptr->pclass != CLASS_NINJA)
167161 creature_ptr->lite = TRUE;
168162 break;
@@ -172,9 +166,6 @@ void calc_race_status(player_type *creature_ptr)
172166 case RACE_ELF:
173167 creature_ptr->resist_lite = TRUE;
174168 break;
175- case RACE_HOBBIT:
176- creature_ptr->hold_exp = TRUE;
177- break;
178169 case RACE_GNOME:
179170 creature_ptr->free_act = TRUE;
180171 break;
@@ -205,7 +196,6 @@ void calc_race_status(player_type *creature_ptr)
205196 break;
206197 case RACE_HIGH_ELF:
207198 creature_ptr->resist_lite = TRUE;
208- creature_ptr->see_inv = TRUE;
209199 break;
210200 case RACE_BARBARIAN:
211201 creature_ptr->resist_fear = TRUE;
@@ -242,8 +232,6 @@ void calc_race_status(player_type *creature_ptr)
242232 break;
243233 case RACE_DARK_ELF:
244234 creature_ptr->resist_dark = TRUE;
245- if (creature_ptr->lev > 19)
246- creature_ptr->see_inv = TRUE;
247235 break;
248236 case RACE_DRACONIAN:
249237 creature_ptr->levitation = TRUE;
@@ -261,34 +249,23 @@ void calc_race_status(player_type *creature_ptr)
261249 case RACE_MIND_FLAYER:
262250 creature_ptr->sustain_int = TRUE;
263251 creature_ptr->sustain_wis = TRUE;
264- if (creature_ptr->lev > 14)
265- creature_ptr->see_inv = TRUE;
266252 break;
267253 case RACE_IMP:
268254 creature_ptr->resist_fire = TRUE;
269- if (creature_ptr->lev > 9)
270- creature_ptr->see_inv = TRUE;
271255 break;
272256 case RACE_GOLEM:
273257 creature_ptr->slow_digest = TRUE;
274258 creature_ptr->free_act = TRUE;
275- creature_ptr->see_inv = TRUE;
276259 creature_ptr->resist_pois = TRUE;
277- if (creature_ptr->lev > 34)
278- creature_ptr->hold_exp = TRUE;
279260 break;
280261 case RACE_SKELETON:
281262 creature_ptr->resist_shard = TRUE;
282- creature_ptr->hold_exp = TRUE;
283- creature_ptr->see_inv = TRUE;
284263 creature_ptr->resist_pois = TRUE;
285264 if (creature_ptr->lev > 9)
286265 creature_ptr->resist_cold = TRUE;
287266 break;
288267 case RACE_ZOMBIE:
289268 creature_ptr->resist_neth = TRUE;
290- creature_ptr->hold_exp = TRUE;
291- creature_ptr->see_inv = TRUE;
292269 creature_ptr->resist_pois = TRUE;
293270 creature_ptr->slow_digest = TRUE;
294271 if (creature_ptr->lev > 4)
@@ -296,7 +273,6 @@ void calc_race_status(player_type *creature_ptr)
296273 break;
297274 case RACE_VAMPIRE:
298275 creature_ptr->resist_dark = TRUE;
299- creature_ptr->hold_exp = TRUE;
300276 creature_ptr->resist_neth = TRUE;
301277 creature_ptr->resist_cold = TRUE;
302278 creature_ptr->resist_pois = TRUE;
@@ -307,8 +283,6 @@ void calc_race_status(player_type *creature_ptr)
307283 creature_ptr->levitation = TRUE;
308284 creature_ptr->free_act = TRUE;
309285 creature_ptr->resist_neth = TRUE;
310- creature_ptr->hold_exp = TRUE;
311- creature_ptr->see_inv = TRUE;
312286 creature_ptr->resist_pois = TRUE;
313287 creature_ptr->slow_digest = TRUE;
314288 creature_ptr->resist_cold = TRUE;
@@ -324,14 +298,10 @@ void calc_race_status(player_type *creature_ptr)
324298 break;
325299 case RACE_ARCHON:
326300 creature_ptr->levitation = TRUE;
327- creature_ptr->see_inv = TRUE;
328301 break;
329302 case RACE_BALROG:
330303 creature_ptr->resist_fire = TRUE;
331304 creature_ptr->resist_neth = TRUE;
332- creature_ptr->hold_exp = TRUE;
333- if (creature_ptr->lev > 9)
334- creature_ptr->see_inv = TRUE;
335305 if (creature_ptr->lev > 44) {
336306 creature_ptr->oppose_fire = 1;
337307 creature_ptr->redraw |= PR_STATUS;
@@ -351,7 +321,6 @@ void calc_race_status(player_type *creature_ptr)
351321 creature_ptr->slow_digest = TRUE;
352322 creature_ptr->free_act = TRUE;
353323 creature_ptr->resist_pois = TRUE;
354- creature_ptr->hold_exp = TRUE;
355324 break;
356325 case RACE_MERFOLK:
357326 creature_ptr->resist_water = TRUE;
--- a/src/player/player-status-flags.c
+++ b/src/player/player-status-flags.c
@@ -650,7 +650,7 @@ void have_sh_fire(player_type *creature_ptr)
650650 creature_ptr->sh_fire = TRUE;
651651 }
652652
653- if (creature_ptr->tim_sh_fire) {
653+ if (creature_ptr->tim_sh_fire) {
654654 creature_ptr->sh_fire = TRUE;
655655 }
656656
@@ -663,7 +663,6 @@ void have_sh_fire(player_type *creature_ptr)
663663 if (have_flag(flgs, TR_SH_FIRE))
664664 creature_ptr->sh_fire = TRUE;
665665 }
666-
667666 }
668667
669668 void have_sh_elec(player_type *creature_ptr)
@@ -762,3 +761,101 @@ void have_heavy_spell(player_type *creature_ptr)
762761 creature_ptr->heavy_spell = TRUE;
763762 }
764763 }
764+
765+void have_hold_exp(player_type *creature_ptr)
766+{
767+ object_type *o_ptr;
768+ BIT_FLAGS flgs[TR_FLAG_SIZE];
769+
770+ creature_ptr->hold_exp = FALSE;
771+
772+ if (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN) {
773+ creature_ptr->hold_exp = TRUE;
774+ }
775+
776+ if (creature_ptr->mimic_form == MIMIC_DEMON || creature_ptr->mimic_form == MIMIC_DEMON_LORD || creature_ptr->mimic_form == MIMIC_VAMPIRE) {
777+ creature_ptr->hold_exp = TRUE;
778+ }
779+
780+ if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_HOBBIT) {
781+ creature_ptr->hold_exp = TRUE;
782+ }
783+
784+ if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_GOLEM) {
785+ if (creature_ptr->lev > 34)
786+ creature_ptr->hold_exp = TRUE;
787+ }
788+
789+ if (!creature_ptr->mimic_form
790+ && (creature_ptr->prace == RACE_SKELETON || creature_ptr->prace == RACE_ZOMBIE || creature_ptr->prace == RACE_VAMPIRE
791+ || creature_ptr->prace == RACE_SPECTRE || creature_ptr->prace == RACE_BALROG || creature_ptr->prace == RACE_ANDROID)) {
792+ creature_ptr->hold_exp = TRUE;
793+ }
794+
795+ if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
796+ creature_ptr->hold_exp = TRUE;
797+ }
798+
799+ for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
800+ o_ptr = &creature_ptr->inventory_list[i];
801+ if (!o_ptr->k_idx)
802+ continue;
803+
804+ object_flags(creature_ptr, o_ptr, flgs);
805+ if (have_flag(flgs, TR_HOLD_EXP))
806+ creature_ptr->hold_exp = TRUE;
807+ }
808+}
809+
810+void have_see_inv(player_type *creature_ptr)
811+{
812+ object_type *o_ptr;
813+ BIT_FLAGS flgs[TR_FLAG_SIZE];
814+ creature_ptr->see_inv = FALSE;
815+
816+ if (creature_ptr->pclass == CLASS_NINJA || creature_ptr->lev > 29)
817+ creature_ptr->see_inv = TRUE;
818+
819+ if (creature_ptr->mimic_form == MIMIC_DEMON || creature_ptr->mimic_form == MIMIC_DEMON_LORD || creature_ptr->mimic_form == MIMIC_VAMPIRE) {
820+ creature_ptr->see_inv = TRUE;
821+ }
822+
823+ if (!creature_ptr->mimic_form
824+ && (creature_ptr->prace == RACE_HIGH_ELF || creature_ptr->prace == RACE_GOLEM || creature_ptr->prace == RACE_SKELETON
825+ || creature_ptr->prace == RACE_ZOMBIE || creature_ptr->prace == RACE_SPECTRE || creature_ptr->prace == RACE_ARCHON)) {
826+ creature_ptr->see_inv = TRUE;
827+ }
828+
829+ if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_DARK_ELF) {
830+ if (creature_ptr->lev > 19)
831+ creature_ptr->see_inv = TRUE;
832+ }
833+
834+ if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_MIND_FLAYER) {
835+ if (creature_ptr->lev > 14)
836+ creature_ptr->see_inv = TRUE;
837+ }
838+
839+ if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_IMP || creature_ptr->prace == RACE_BALROG)) {
840+ if (creature_ptr->lev > 9)
841+ creature_ptr->see_inv = TRUE;
842+ }
843+
844+ if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
845+ creature_ptr->see_inv = TRUE;
846+ }
847+
848+ if (creature_ptr->tim_invis) {
849+ creature_ptr->see_inv = TRUE;
850+ }
851+
852+ for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
853+ o_ptr = &creature_ptr->inventory_list[i];
854+ if (!o_ptr->k_idx)
855+ continue;
856+
857+ object_flags(creature_ptr, o_ptr, flgs);
858+ if (have_flag(flgs, TR_SEE_INVIS))
859+ creature_ptr->see_inv = TRUE;
860+ }
861+}
--- a/src/player/player-status-flags.h
+++ b/src/player/player-status-flags.h
@@ -33,5 +33,7 @@ void have_sh_elec(player_type *creature_ptr);
3333 void have_sh_cold(player_type *creature_ptr);
3434 void have_easy_spell(player_type *creature_ptr);
3535 void have_heavy_spell(player_type *creature_ptr);
36+void have_hold_exp(player_type *creature_ptr);
37+void have_see_inv(player_type *creature_ptr);
3638
3739
--- a/src/player/player-status.c
+++ b/src/player/player-status.c
@@ -566,13 +566,11 @@ static void clear_creature_bonuses(player_type *creature_ptr)
566566 creature_ptr->cursed = 0L;
567567 creature_ptr->impact[0] = FALSE;
568568 creature_ptr->impact[1] = FALSE;
569- creature_ptr->see_inv = FALSE;
570569 creature_ptr->free_act = FALSE;
571570 creature_ptr->slow_digest = FALSE;
572571 creature_ptr->regenerate = FALSE;
573572 creature_ptr->can_swim = FALSE;
574573 creature_ptr->levitation = FALSE;
575- creature_ptr->hold_exp = FALSE;
576574 creature_ptr->lite = FALSE;
577575 creature_ptr->sustain_str = FALSE;
578576 creature_ptr->sustain_int = FALSE;
@@ -707,6 +705,8 @@ void calc_bonuses(player_type *creature_ptr)
707705 have_sh_cold(creature_ptr);
708706 have_easy_spell(creature_ptr);
709707 have_heavy_spell(creature_ptr);
708+ have_hold_exp(creature_ptr);
709+ have_see_inv(creature_ptr);
710710
711711 calc_race_status(creature_ptr);
712712
@@ -4478,12 +4478,10 @@ bool is_echizen(player_type *creature_ptr)
44784478 void calc_timelimit_status(player_type *creature_ptr)
44794479 {
44804480 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
4481- creature_ptr->see_inv = TRUE;
44824481 creature_ptr->free_act = TRUE;
44834482 creature_ptr->slow_digest = TRUE;
44844483 creature_ptr->regenerate = TRUE;
44854484 creature_ptr->levitation = TRUE;
4486- creature_ptr->hold_exp = TRUE;
44874485 creature_ptr->lite = TRUE;
44884486 creature_ptr->sustain_str = TRUE;
44894487 creature_ptr->sustain_int = TRUE;
@@ -4537,10 +4535,6 @@ void calc_timelimit_status(player_type *creature_ptr)
45374535 creature_ptr->immune_cold = TRUE;
45384536 }
45394537
4540- if (creature_ptr->tim_invis) {
4541- creature_ptr->see_inv = TRUE;
4542- }
4543-
45444538 if (creature_ptr->tim_regen) {
45454539 creature_ptr->regenerate = TRUE;
45464540 }
@@ -4631,14 +4625,10 @@ void calc_equipment_status(player_type *creature_ptr)
46314625 if (have_flag(flgs, TR_REGEN))
46324626 creature_ptr->regenerate = TRUE;
46334627
4634- if (have_flag(flgs, TR_SEE_INVIS))
4635- creature_ptr->see_inv = TRUE;
46364628 if (have_flag(flgs, TR_LEVITATION))
46374629 creature_ptr->levitation = TRUE;
46384630 if (have_flag(flgs, TR_FREE_ACT))
46394631 creature_ptr->free_act = TRUE;
4640- if (have_flag(flgs, TR_HOLD_EXP))
4641- creature_ptr->hold_exp = TRUE;
46424632
46434633 if (have_flag(flgs, TR_TELEPORT)) {
46444634 if (object_is_cursed(o_ptr))
Show on old repository browser