変愚蛮怒のメインリポジトリです
Revision | 123a6feeecb7fc555d21d9538ad2cd7bef00dc6a (tree) |
---|---|
Time | 2020-08-10 00:29:01 |
Author | deskull <deskull@user...> |
Commiter | deskull |
[Refactor] #40514 have_resist_dark() を calc_bonuses() から分離. / Separated have_resist_dark() from calc_bonuses().
@@ -144,7 +144,6 @@ void calc_race_status(player_type *creature_ptr) | ||
144 | 144 | creature_ptr->resist_fear = TRUE; |
145 | 145 | break; |
146 | 146 | case MIMIC_VAMPIRE: |
147 | - creature_ptr->resist_dark = TRUE; | |
148 | 147 | creature_ptr->resist_neth = TRUE; |
149 | 148 | if (creature_ptr->pclass != CLASS_NINJA) |
150 | 149 | creature_ptr->lite = TRUE; |
@@ -156,15 +155,9 @@ void calc_race_status(player_type *creature_ptr) | ||
156 | 155 | case RACE_DWARF: |
157 | 156 | creature_ptr->resist_blind = TRUE; |
158 | 157 | break; |
159 | - case RACE_HALF_ORC: | |
160 | - creature_ptr->resist_dark = TRUE; | |
161 | - break; | |
162 | 158 | case RACE_BARBARIAN: |
163 | 159 | creature_ptr->resist_fear = TRUE; |
164 | 160 | break; |
165 | - case RACE_HALF_OGRE: | |
166 | - creature_ptr->resist_dark = TRUE; | |
167 | - break; | |
168 | 161 | case RACE_HALF_GIANT: |
169 | 162 | creature_ptr->resist_shard = TRUE; |
170 | 163 | break; |
@@ -180,10 +173,6 @@ void calc_race_status(player_type *creature_ptr) | ||
180 | 173 | break; |
181 | 174 | case RACE_NIBELUNG: |
182 | 175 | creature_ptr->resist_disen = TRUE; |
183 | - creature_ptr->resist_dark = TRUE; | |
184 | - break; | |
185 | - case RACE_DARK_ELF: | |
186 | - creature_ptr->resist_dark = TRUE; | |
187 | 176 | break; |
188 | 177 | case RACE_SKELETON: |
189 | 178 | creature_ptr->resist_shard = TRUE; |
@@ -193,7 +182,6 @@ void calc_race_status(player_type *creature_ptr) | ||
193 | 182 | creature_ptr->slow_digest = TRUE; |
194 | 183 | break; |
195 | 184 | case RACE_VAMPIRE: |
196 | - creature_ptr->resist_dark = TRUE; | |
197 | 185 | creature_ptr->resist_neth = TRUE; |
198 | 186 | if (creature_ptr->pclass != CLASS_NINJA) |
199 | 187 | creature_ptr->lite = TRUE; |
@@ -1663,3 +1663,35 @@ void have_resist_lite(player_type *creature_ptr) | ||
1663 | 1663 | creature_ptr->resist_lite = TRUE; |
1664 | 1664 | } |
1665 | 1665 | } |
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 | +} |
@@ -57,5 +57,6 @@ void have_resist_pois(player_type *creature_ptr); | ||
57 | 57 | void have_resist_conf(player_type *creature_ptr); |
58 | 58 | void have_resist_sound(player_type *creature_ptr); |
59 | 59 | void have_resist_lite(player_type *creature_ptr); |
60 | +void have_resist_dark(player_type *creature_ptr); | |
60 | 61 | |
61 | 62 |
@@ -560,7 +560,6 @@ static void delayed_visual_update(player_type *player_ptr) | ||
560 | 560 | */ |
561 | 561 | static void clear_creature_bonuses(player_type *creature_ptr) |
562 | 562 | { |
563 | - creature_ptr->resist_dark = FALSE; | |
564 | 563 | creature_ptr->resist_chaos = FALSE; |
565 | 564 | creature_ptr->resist_disen = FALSE; |
566 | 565 | creature_ptr->resist_shard = FALSE; |
@@ -732,6 +731,7 @@ void calc_bonuses(player_type *creature_ptr) | ||
732 | 731 | have_resist_conf(creature_ptr); |
733 | 732 | have_resist_sound(creature_ptr); |
734 | 733 | have_resist_lite(creature_ptr); |
734 | + have_resist_dark(creature_ptr); | |
735 | 735 | |
736 | 736 | calc_race_status(creature_ptr); |
737 | 737 |
@@ -4439,7 +4439,6 @@ void calc_timelimit_status(player_type *creature_ptr) | ||
4439 | 4439 | { |
4440 | 4440 | if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) { |
4441 | 4441 | creature_ptr->lite = TRUE; |
4442 | - creature_ptr->resist_dark = TRUE; | |
4443 | 4442 | creature_ptr->resist_chaos = TRUE; |
4444 | 4443 | creature_ptr->resist_disen = TRUE; |
4445 | 4444 | creature_ptr->resist_shard = TRUE; |
@@ -4510,8 +4509,6 @@ void calc_equipment_status(player_type *creature_ptr) | ||
4510 | 4509 | |
4511 | 4510 | if (have_flag(flgs, TR_RES_FEAR)) |
4512 | 4511 | creature_ptr->resist_fear = TRUE; |
4513 | - if (have_flag(flgs, TR_RES_DARK)) | |
4514 | - creature_ptr->resist_dark = TRUE; | |
4515 | 4512 | if (have_flag(flgs, TR_RES_CHAOS)) |
4516 | 4513 | creature_ptr->resist_chaos = TRUE; |
4517 | 4514 | if (have_flag(flgs, TR_RES_DISEN)) |