From 18 Jan, 2021 0:00 UTC: All services will be temporary unavailable for maintenance
  • R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision0e25ed3700452f10444133fa126571ca140feaaa (tree)
Time2020-08-10 00:20:11
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #40514 have_resist_lite() を calc_bonuses() から分離. / Separated have_resist_lite() from calc_bonuses().

Change Summary

Incremental Difference

--- a/src/player/player-race.c
+++ b/src/player/player-race.c
@@ -152,18 +152,13 @@ void calc_race_status(player_type *creature_ptr)
152152 }
153153 } else {
154154 switch (creature_ptr->prace) {
155- case RACE_ELF:
156- creature_ptr->resist_lite = TRUE;
157- break;
155+
158156 case RACE_DWARF:
159157 creature_ptr->resist_blind = TRUE;
160158 break;
161159 case RACE_HALF_ORC:
162160 creature_ptr->resist_dark = TRUE;
163161 break;
164- case RACE_HIGH_ELF:
165- creature_ptr->resist_lite = TRUE;
166- break;
167162 case RACE_BARBARIAN:
168163 creature_ptr->resist_fear = TRUE;
169164 break;
@@ -208,9 +203,7 @@ void calc_race_status(player_type *creature_ptr)
208203 creature_ptr->resist_pois = TRUE;
209204 creature_ptr->pass_wall = TRUE;
210205 break;
211- case RACE_SPRITE:
212- creature_ptr->resist_lite = TRUE;
213- break;
206+
214207 case RACE_BALROG:
215208 creature_ptr->resist_neth = TRUE;
216209 if (creature_ptr->lev > 44) {
--- a/src/player/player-status-flags.c
+++ b/src/player/player-status-flags.c
@@ -1637,3 +1637,29 @@ void have_resist_sound(player_type *creature_ptr)
16371637 creature_ptr->resist_sound = TRUE;
16381638 }
16391639 }
1640+
1641+void have_resist_lite(player_type *creature_ptr)
1642+{
1643+ object_type *o_ptr;
1644+ BIT_FLAGS flgs[TR_FLAG_SIZE];
1645+ creature_ptr->resist_lite = FALSE;
1646+
1647+ if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_ELF || creature_ptr->prace == RACE_HIGH_ELF || creature_ptr->prace == RACE_SPRITE)) {
1648+ creature_ptr->resist_lite = TRUE;
1649+ }
1650+
1651+ if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1652+ creature_ptr->resist_lite = TRUE;
1653+ }
1654+
1655+ for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1656+ o_ptr = &creature_ptr->inventory_list[i];
1657+ if (!o_ptr->k_idx)
1658+ continue;
1659+
1660+ object_flags(creature_ptr, o_ptr, flgs);
1661+
1662+ if (have_flag(flgs, TR_RES_LITE))
1663+ creature_ptr->resist_lite = TRUE;
1664+ }
1665+}
--- a/src/player/player-status-flags.h
+++ b/src/player/player-status-flags.h
@@ -56,5 +56,6 @@ void have_resist_cold(player_type *creature_ptr);
5656 void have_resist_pois(player_type *creature_ptr);
5757 void have_resist_conf(player_type *creature_ptr);
5858 void have_resist_sound(player_type *creature_ptr);
59+void have_resist_lite(player_type *creature_ptr);
5960
6061
--- a/src/player/player-status.c
+++ b/src/player/player-status.c
@@ -560,7 +560,6 @@ static void delayed_visual_update(player_type *player_ptr)
560560 */
561561 static void clear_creature_bonuses(player_type *creature_ptr)
562562 {
563- creature_ptr->resist_lite = FALSE;
564563 creature_ptr->resist_dark = FALSE;
565564 creature_ptr->resist_chaos = FALSE;
566565 creature_ptr->resist_disen = FALSE;
@@ -732,6 +731,7 @@ void calc_bonuses(player_type *creature_ptr)
732731 have_resist_pois(creature_ptr);
733732 have_resist_conf(creature_ptr);
734733 have_resist_sound(creature_ptr);
734+ have_resist_lite(creature_ptr);
735735
736736 calc_race_status(creature_ptr);
737737
@@ -4439,7 +4439,6 @@ void calc_timelimit_status(player_type *creature_ptr)
44394439 {
44404440 if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
44414441 creature_ptr->lite = TRUE;
4442- creature_ptr->resist_lite = TRUE;
44434442 creature_ptr->resist_dark = TRUE;
44444443 creature_ptr->resist_chaos = TRUE;
44454444 creature_ptr->resist_disen = TRUE;
@@ -4511,8 +4510,6 @@ void calc_equipment_status(player_type *creature_ptr)
45114510
45124511 if (have_flag(flgs, TR_RES_FEAR))
45134512 creature_ptr->resist_fear = TRUE;
4514- if (have_flag(flgs, TR_RES_LITE))
4515- creature_ptr->resist_lite = TRUE;
45164513 if (have_flag(flgs, TR_RES_DARK))
45174514 creature_ptr->resist_dark = TRUE;
45184515 if (have_flag(flgs, TR_RES_CHAOS))
Show on old repository browser