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

hengband: Commit

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


Commit MetaInfo

Revision123a6feeecb7fc555d21d9538ad2cd7bef00dc6a (tree)
Time2020-08-10 00:29:01
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

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

Change Summary

Incremental Difference

--- a/src/player/player-race.c
+++ b/src/player/player-race.c
@@ -144,7 +144,6 @@ void calc_race_status(player_type *creature_ptr)
144144 creature_ptr->resist_fear = TRUE;
145145 break;
146146 case MIMIC_VAMPIRE:
147- creature_ptr->resist_dark = TRUE;
148147 creature_ptr->resist_neth = TRUE;
149148 if (creature_ptr->pclass != CLASS_NINJA)
150149 creature_ptr->lite = TRUE;
@@ -156,15 +155,9 @@ void calc_race_status(player_type *creature_ptr)
156155 case RACE_DWARF:
157156 creature_ptr->resist_blind = TRUE;
158157 break;
159- case RACE_HALF_ORC:
160- creature_ptr->resist_dark = TRUE;
161- break;
162158 case RACE_BARBARIAN:
163159 creature_ptr->resist_fear = TRUE;
164160 break;
165- case RACE_HALF_OGRE:
166- creature_ptr->resist_dark = TRUE;
167- break;
168161 case RACE_HALF_GIANT:
169162 creature_ptr->resist_shard = TRUE;
170163 break;
@@ -180,10 +173,6 @@ void calc_race_status(player_type *creature_ptr)
180173 break;
181174 case RACE_NIBELUNG:
182175 creature_ptr->resist_disen = TRUE;
183- creature_ptr->resist_dark = TRUE;
184- break;
185- case RACE_DARK_ELF:
186- creature_ptr->resist_dark = TRUE;
187176 break;
188177 case RACE_SKELETON:
189178 creature_ptr->resist_shard = TRUE;
@@ -193,7 +182,6 @@ void calc_race_status(player_type *creature_ptr)
193182 creature_ptr->slow_digest = TRUE;
194183 break;
195184 case RACE_VAMPIRE:
196- creature_ptr->resist_dark = TRUE;
197185 creature_ptr->resist_neth = TRUE;
198186 if (creature_ptr->pclass != CLASS_NINJA)
199187 creature_ptr->lite = TRUE;
--- a/src/player/player-status-flags.c
+++ b/src/player/player-status-flags.c
@@ -1663,3 +1663,35 @@ void have_resist_lite(player_type *creature_ptr)
16631663 creature_ptr->resist_lite = TRUE;
16641664 }
16651665 }
1666+
1667+void have_resist_dark(player_type *creature_ptr)
1668+{
1669+ object_type *o_ptr;
1670+ BIT_FLAGS flgs[TR_FLAG_SIZE];
1671+ creature_ptr->resist_dark = FALSE;
1672+
1673+ if (creature_ptr->mimic_form == MIMIC_VAMPIRE) {
1674+ creature_ptr->resist_dark = TRUE;
1675+ }
1676+
1677+ if (!creature_ptr->mimic_form
1678+ && (creature_ptr->prace == RACE_HALF_ORC || creature_ptr->prace == RACE_HALF_OGRE || creature_ptr->prace == RACE_NIBELUNG
1679+ || creature_ptr->prace == RACE_DARK_ELF || creature_ptr->prace == RACE_VAMPIRE)) {
1680+ creature_ptr->resist_lite = TRUE;
1681+ }
1682+
1683+ if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
1684+ creature_ptr->resist_dark = TRUE;
1685+ }
1686+
1687+ for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
1688+ o_ptr = &creature_ptr->inventory_list[i];
1689+ if (!o_ptr->k_idx)
1690+ continue;
1691+
1692+ object_flags(creature_ptr, o_ptr, flgs);
1693+
1694+ if (have_flag(flgs, TR_RES_DARK))
1695+ creature_ptr->resist_dark = TRUE;
1696+ }
1697+}
--- a/src/player/player-status-flags.h
+++ b/src/player/player-status-flags.h
@@ -57,5 +57,6 @@ 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);
5959 void have_resist_lite(player_type *creature_ptr);
60+void have_resist_dark(player_type *creature_ptr);
6061
6162
--- 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_dark = FALSE;
564563 creature_ptr->resist_chaos = FALSE;
565564 creature_ptr->resist_disen = FALSE;
566565 creature_ptr->resist_shard = FALSE;
@@ -732,6 +731,7 @@ void calc_bonuses(player_type *creature_ptr)
732731 have_resist_conf(creature_ptr);
733732 have_resist_sound(creature_ptr);
734733 have_resist_lite(creature_ptr);
734+ have_resist_dark(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_dark = TRUE;
44434442 creature_ptr->resist_chaos = TRUE;
44444443 creature_ptr->resist_disen = TRUE;
44454444 creature_ptr->resist_shard = TRUE;
@@ -4510,8 +4509,6 @@ void calc_equipment_status(player_type *creature_ptr)
45104509
45114510 if (have_flag(flgs, TR_RES_FEAR))
45124511 creature_ptr->resist_fear = TRUE;
4513- if (have_flag(flgs, TR_RES_DARK))
4514- creature_ptr->resist_dark = TRUE;
45154512 if (have_flag(flgs, TR_RES_CHAOS))
45164513 creature_ptr->resist_chaos = TRUE;
45174514 if (have_flag(flgs, TR_RES_DISEN))
Show on old repository browser