• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision5a44b5a534facdb73b52e30e16c281153034950f (tree)
Time2020-09-14 23:15:33
AuthorHourier <hourier@user...>
CommiterHourier

Log Message

Merge branch 'For2.2.2-Refactoring' into For3.0.0-Monster-Adjustment

Change Summary

Incremental Difference

--- a/lib/edit/a_info.txt
+++ b/lib/edit/a_info.txt
@@ -2842,7 +2842,7 @@ E:'Zantetsuken'
28422842 I:23:20:2
28432843 W:30:25:120:80000
28442844 P:0:10d4:17:21:0
2845-F:STR | DEX | VORPAL | TUNNEL | SHOW_MODS
2845+F:STR | DEX | VORPAL | TUNNEL | SHOW_MODS | INVULN_ARROW
28462846 D:$It's a sharp Japanese sword said to be capable of cutting anything.
28472847 D:鋼をも切り裂く、切れ味抜群の日本刀だ。
28482848
--- a/lib/help/jdungeon.txt
+++ b/lib/help/jdungeon.txt
@@ -29,35 +29,39 @@
2929
3030 --- 視線を遮らないダンジョンの地形を表す文字 ---
3131
32- [[[[w|.| 床 [[[[v|*| 鏡
33- [[[[w|.| 隠れたトラップ [[[[y|;| 回避の彫像
34- [[[[w|^| トラップ [[[[R|;| 爆発ルーン
35- [[[[u|.| 砂地 [[[[B|*| パターンの一部
36- [[[[g|.| 草地 [[[[b|*| パターンの一部
37- [[[[G|:| 花 [[[[U|1| 雑貨屋
38- [[[[g|:| 草むら [[[[s|2| 防具屋
39- [[[[B|.| 沼地 [[[[w|3| 武器専門店
40- [[[[B|~| 浅い水の流れ [[[[g|4| 寺院
41- [[[[b|~| 深い水 [[[[b|5| 錬金術の店
42- [[[[U|~| 浅い溶岩の流れ [[[[r|6| 魔法の店
43- [[[[r|~| 深い溶岩溜り [[[[D|7| ブラック・マーケット
44- [[[[D|#| 暗い穴 [[[[y|8| 我が家
45- [[[[U|'| 開いたドア [[[[o|9| 書店
46- [[[[u|'| 壊れたドア [[[[v|0| 博物館
47- [[[[w|<| 上り階段 [[[[B|+| その他の建物
48- [[[[w|>| 下り階段 [[[[v|+| その他の建物
49- [[[[U|<| 上り坑道
50- [[[[U|>| 下り坑道
51- [[[[v|>| ダンジョンへの入口
52- [[[[y|>| クエスト入口
32+ [[[[w|.| 床 [[[[r|'| 空いたカーテン
33+ [[[[w|.| 隠れたトラップ [[[[w|<| 上り階段
34+ [[[[w|^| トラップ [[[[w|>| 下り階段
35+ [[[[u|.| 砂地 [[[[U|<| 上り坑道
36+ [[[[g|.| 草地 [[[[U|>| 下り坑道
37+ [[[[G|:| 花 [[[[v|>| ダンジョンへの入口
38+ [[[[g|:| 草むら [[[[y|>| クエスト入口
39+ [[[[B|.| 沼地 [[[[v|*| 鏡
40+ [[[[B|~| 浅い水の流れ [[[[y|;| 回避の彫像
41+ [[[[b|~| 深い水 [[[[R|;| 爆発ルーン
42+ [[[[o|~| 浅い溶岩の流れ [[[[B|*| パターンの一部
43+ [[[[r|~| 深い溶岩溜り [[[[b|*| パターンの一部
44+ [[[[B|^| 低温帯           [[[[U|1| 雑貨屋
45+ [[[[b|^| 極低温帯          [[[[s|2| 防具屋
46+ [[[[o|^| 帯電帯           [[[[w|3| 武器専門店
47+ [[[[y|^| 高圧帯電帯         [[[[g|4| 寺院
48+ [[[[U|~| 浅い酸の沼         [[[[b|5| 錬金術の店
49+ [[[[u|~| 深い酸の沼         [[[[r|6| 魔法の店
50+ [[[[G|~| 浅い毒の沼         [[[[D|7| ブラック・マーケット
51+ [[[[g|~| 深い毒の沼         [[[[y|8| 我が家
52+ [[[[D|#| 暗い穴  [[[[o|9| 書店
53+ [[[[U|'| 開いたドア [[[[v|0| 博物館
54+ [[[[u|'| 壊れたドア [[[[B|+| その他の建物
55+ [[[[w|+| 閉じたガラスのドア     [[[[v|+| その他の建物
56+ [[[[w|#| ガラスの壁
5357
5458 --- 視線を遮るダンジョンの地形を表す文字 ---
5559
5660 [[[[w|#| 花崗岩の壁 [[[[G|#| 木
5761 [[[[s|%| 溶岩の鉱脈 [[[[o|^| 山脈
5862 [[[[w|%| 石英の鉱脈 [[[[U|+| 閉じたドア
59- [[[[w|#| 隠しドア [[[[w|:| 岩石
60- [[[[o|*| 財宝を含有した鉱脈
63+ [[[[w|#| 隠しドア [[[[R|'| カーテン
64+ [[[[o|*| 財宝を含有した鉱脈     [[[[w|:| 岩石
6165
6266
6367 ***** <WithinDungeon>
@@ -216,8 +220,10 @@
216220 実際の雰囲気はいくつかの要素から決定されます。雰囲気のレベルを上げるも
217221 のには宝物庫や特別な部屋、もっと深い階で出るアイテムやモンスター、一定
218222 以上の質を持つアイテム(名のあるアイテムやアーティファクト、および「特
219-別」なアイテム(jobjects.txt を参照))です。雰囲気はその階に立ち入った時
220-のもので、その後に生成されたモンスターやアイテムでは変化しません。
223+別」なアイテム(jobjects.txt を参照))です。雰囲気は知覚の技能値と階層に
224+よって規定されるターンごとに現在の状況を更新します。場違いに強力なモン
225+スターを倒したりアイテムを拾ったりすれば階層の雰囲気が落ち着いてくるで
226+しょう。
221227
222228 変愚蛮怒では雰囲気がひどいほど良い階になっています。つまらない階から順
223229 に以下のようになります:
@@ -293,6 +299,7 @@ Original : (??)
293299 Updated : (??)
294300 Updated : Zangband DevTeam
295301 Updated : Hengband 1.0.11
302+Updated : Hengband 3.0.0
296303
297304 ***** Begin Hyperlinks
298305 ***** [b] jcommand.txt
--- a/lib/help/jmonster.txt
+++ b/lib/help/jmonster.txt
@@ -164,14 +164,19 @@
164164 コマンドで指示する事ができます。「プレイヤーを巻き込む範囲魔法を使う」
165165 を(ON)にすればいいのです。
166166
167-最後に、ペットの制御を維持するのには大きな精神力が必要となり、ペット達
168-のレベルの合計が大きければ大きいほど、MPの回復率は小さくなります。そし
169-て、維持コストが100%を超えるとMPは回復せずに逆に下がり始めます。戦士や
170-騎兵等のMPを持たない職業の場合はペットの維持コストが100%を超えた時点で
171-それ以上ペットを維持する事ができなくなります。何体かのペットを即座に解
172-放しなければならないでしょう。他の怪物を召喚するような怪物をペットにす
173-るときはこのことを忘れないようにして下さい。
174-
167+ペットの制御を維持するのには大きな精神力が必要となり、ペット達のレベル
168+の合計が大きければ大きいほど、MPの回復率は小さくなります。そして、維持
169+コストが100%を超えるとMPは回復せずに逆に下がり始めます。戦士や騎兵等の
170+MPを持たない職業の場合はペットの維持コストが100%を超えた時点でそれ以上
171+ペットを維持する事ができなくなります。何体かのペットを即座に解放しなけ
172+ればならないでしょう。他の怪物を召喚するような怪物をペットにするときは
173+このことを忘れないようにして下さい。
174+
175+ペットは帰還や階段、地上マップの端といった画面が切り替わるときにはあな
176+たに隣接、もしくは乗馬していなければはぐれてしまいます。ペットに名前を
177+付ける(後述のペットへの命令も参照してください)ことにより3マス以内にま
178+で次のマップにペットを連れて行ける範囲を広げることができます。また広域
179+マップにペットを連れて行く方法は現バージョン(2.2.1)時点にはありません。
175180
176181 --- ペットの入手 ---
177182
@@ -258,8 +263,10 @@
258263 ペットに名前をつける。
259264 ペットに自由な名前を付けられます。名前が付いたペットは「ペット
260265 を解放」コマンドで他のモンスターよりも先に質問してくるので、間
261- 違って解放してしまう事が少なくなります。また、プレイ記録機能に
262- は名前の付いたペットの情報を記録するオプションがあります。
266+ 違って解放してしまう事が少なくなります。さらに次のマップに移る
267+ 際にペットを連れて行ける範囲を3マス以内にまで広げることができ
268+ ます。また、プレイ記録機能には名前の付いたペットの情報を記録す
269+ るオプションがあります。
263270
264271 武器を両手で持つ
265272 武器を片手で持つ
--- a/src/core/hp-mp-processor.c
+++ b/src/core/hp-mp-processor.c
@@ -27,6 +27,7 @@
2727 #include "util/bit-flags-calculator.h"
2828 #include "view/display-messages.h"
2929 #include "world/world.h"
30+#include "player/player-status-resist.h"
3031
3132 /*!
3233 * @brief 10ゲームターンが進行するごとにプレイヤーのHPとMPの増減処理を行う。
@@ -244,10 +245,7 @@ void process_player_hp_mp(player_type *creature_ptr)
244245 }
245246
246247 if (damage) {
247- if (creature_ptr->resist_pois)
248- damage = damage / 3;
249- if (is_oppose_pois(creature_ptr))
250- damage = damage / 3;
248+ damage = calc_pois_damage_rate(creature_ptr) / 100;
251249 if (creature_ptr->levitation)
252250 damage = damage / 5;
253251
--- a/src/effect/effect-player-resist-hurt.c
+++ b/src/effect/effect-player-resist-hurt.c
@@ -44,10 +44,7 @@ void effect_player_poison(player_type *target_ptr, effect_player_type *ep_ptr)
4444 if (target_ptr->blind)
4545 msg_print(_("毒で攻撃された!", "You are hit by poison!"));
4646
47- if (target_ptr->resist_pois)
48- ep_ptr->dam = (ep_ptr->dam + 2) / 3;
49- if (double_resist)
50- ep_ptr->dam = (ep_ptr->dam + 2) / 3;
47+ ep_ptr->dam = ep_ptr->dam * calc_pois_damage_rate(target_ptr) / 100;
5148
5249 if ((!(double_resist || target_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !check_multishadow(target_ptr)) {
5350 do_dec_stat(target_ptr, A_CON);
@@ -65,10 +62,7 @@ void effect_player_nuke(player_type *target_ptr, effect_player_type *ep_ptr)
6562 if (target_ptr->blind)
6663 msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
6764
68- if (target_ptr->resist_pois)
69- ep_ptr->dam = (2 * ep_ptr->dam + 2) / 5;
70- if (double_resist)
71- ep_ptr->dam = (2 * ep_ptr->dam + 2) / 5;
65+ ep_ptr->dam = ep_ptr->dam * calc_pois_damage_rate(target_ptr) / 100;
7266
7367 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
7468 if ((double_resist || target_ptr->resist_pois) || check_multishadow(target_ptr))
@@ -101,10 +95,7 @@ void effect_player_holy_fire(player_type *target_ptr, effect_player_type *ep_ptr
10195 if (target_ptr->blind)
10296 msg_print(_("何かで攻撃された!", "You are hit by something!"));
10397
104- if (target_ptr->align > 10)
105- ep_ptr->dam /= 2;
106- else if (target_ptr->align < -10)
107- ep_ptr->dam *= 2;
98+ ep_ptr->dam = ep_ptr->dam * calc_holy_fire_damage_rate(target_ptr, CALC_RAND) / 100;
10899
109100 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
110101 }
@@ -114,8 +105,7 @@ void effect_player_hell_fire(player_type *target_ptr, effect_player_type *ep_ptr
114105 if (target_ptr->blind)
115106 msg_print(_("何かで攻撃された!", "You are hit by something!"));
116107
117- if (target_ptr->align > 10)
118- ep_ptr->dam *= 2;
108+ ep_ptr->dam = ep_ptr->dam * calc_hell_fire_damage_rate(target_ptr, CALC_RAND) / 100;
119109
120110 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
121111 }
@@ -128,7 +118,7 @@ void effect_player_arrow(player_type *target_ptr, effect_player_type *ep_ptr)
128118 return;
129119 }
130120
131- if ((target_ptr->inventory_list[INVEN_RARM].name1 == ART_ZANTETSU) || (target_ptr->inventory_list[INVEN_LARM].name1 == ART_ZANTETSU)) {
121+ if (has_invuln_arrow(target_ptr)) {
132122 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
133123 return;
134124 }
@@ -157,11 +147,9 @@ void effect_player_nether(player_type *target_ptr, effect_player_type *ep_ptr)
157147 if (target_ptr->blind)
158148 msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
159149
160- if (target_ptr->resist_neth) {
161- if (!is_specific_player_race(target_ptr, RACE_SPECTRE))
162- ep_ptr->dam *= 6;
163- ep_ptr->dam /= (randint1(4) + 7);
164- } else if (!check_multishadow(target_ptr))
150+ ep_ptr->dam = ep_ptr->dam * calc_nether_damage_rate(target_ptr, CALC_RAND) / 100;
151+
152+ if (!target_ptr->resist_neth && !check_multishadow(target_ptr))
165153 drain_exp(target_ptr, 200 + (target_ptr->exp / 100), 200 + (target_ptr->exp / 1000), 75);
166154
167155 if (!is_specific_player_race(target_ptr, RACE_SPECTRE) || check_multishadow(target_ptr)) {
@@ -204,10 +192,8 @@ void effect_player_chaos(player_type *target_ptr, effect_player_type *ep_ptr)
204192 {
205193 if (target_ptr->blind)
206194 msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
207- if (target_ptr->resist_chaos) {
208- ep_ptr->dam *= 6;
209- ep_ptr->dam /= (randint1(4) + 7);
210- }
195+
196+ ep_ptr->dam = ep_ptr->dam * calc_chaos_damage_rate(target_ptr, CALC_RAND) / 100;
211197
212198 if (check_multishadow(target_ptr)) {
213199 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
@@ -240,10 +226,10 @@ void effect_player_shards(player_type *target_ptr, effect_player_type *ep_ptr)
240226 {
241227 if (target_ptr->blind)
242228 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
243- if (target_ptr->resist_shard) {
244- ep_ptr->dam *= 6;
245- ep_ptr->dam /= (randint1(4) + 7);
246- } else if (!check_multishadow(target_ptr)) {
229+
230+ ep_ptr->dam = ep_ptr->dam * calc_shards_damage_rate(target_ptr, CALC_RAND) / 100;
231+
232+ if (!target_ptr->resist_shard && !check_multishadow(target_ptr)) {
247233 (void)set_cut(target_ptr, target_ptr->cut + ep_ptr->dam);
248234 }
249235
@@ -257,10 +243,10 @@ void effect_player_sound(player_type *target_ptr, effect_player_type *ep_ptr)
257243 {
258244 if (target_ptr->blind)
259245 msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
260- if (target_ptr->resist_sound) {
261- ep_ptr->dam *= 5;
262- ep_ptr->dam /= (randint1(4) + 7);
263- } else if (!check_multishadow(target_ptr)) {
246+
247+ ep_ptr->dam = ep_ptr->dam * calc_sound_damage_rate(target_ptr, CALC_RAND) / 100;
248+
249+ if (!target_ptr->resist_sound && !check_multishadow(target_ptr)) {
264250 int plus_stun = (randint1((ep_ptr->dam > 90) ? 35 : (ep_ptr->dam / 3 + 5)));
265251 (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
266252 }
@@ -275,10 +261,10 @@ void effect_player_confusion(player_type *target_ptr, effect_player_type *ep_ptr
275261 {
276262 if (target_ptr->blind)
277263 msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
278- if (target_ptr->resist_conf) {
279- ep_ptr->dam *= 5;
280- ep_ptr->dam /= (randint1(4) + 7);
281- } else if (!check_multishadow(target_ptr)) {
264+
265+ ep_ptr->dam = ep_ptr->dam * calc_conf_damage_rate(target_ptr, CALC_RAND) / 100;
266+
267+ if (!target_ptr->resist_conf && !check_multishadow(target_ptr)) {
282268 (void)set_confused(target_ptr, target_ptr->confused + randint1(20) + 10);
283269 }
284270
@@ -289,10 +275,10 @@ void effect_player_disenchant(player_type *target_ptr, effect_player_type *ep_pt
289275 {
290276 if (target_ptr->blind)
291277 msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
292- if (target_ptr->resist_disen) {
293- ep_ptr->dam *= 6;
294- ep_ptr->dam /= (randint1(4) + 7);
295- } else if (!check_multishadow(target_ptr)) {
278+
279+ ep_ptr->dam = ep_ptr->dam * calc_disenchant_damage_rate(target_ptr, CALC_RAND) / 100;
280+
281+ if (!target_ptr->resist_disen && !check_multishadow(target_ptr)) {
296282 (void)apply_disenchant(target_ptr, 0);
297283 }
298284
@@ -303,10 +289,10 @@ void effect_player_nexus(player_type *target_ptr, effect_player_type *ep_ptr)
303289 {
304290 if (target_ptr->blind)
305291 msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
306- if (target_ptr->resist_nexus) {
307- ep_ptr->dam *= 6;
308- ep_ptr->dam /= (randint1(4) + 7);
309- } else if (!check_multishadow(target_ptr)) {
292+
293+ ep_ptr->dam = ep_ptr->dam * calc_nexus_damage_rate(target_ptr, CALC_RAND) / 100;
294+
295+ if (!target_ptr->resist_nexus && !check_multishadow(target_ptr)) {
310296 apply_nexus(ep_ptr->m_ptr, target_ptr);
311297 }
312298
@@ -332,9 +318,9 @@ void effect_player_rocket(player_type *target_ptr, effect_player_type *ep_ptr)
332318 (void)set_stun(target_ptr, target_ptr->stun + randint1(20));
333319 }
334320
335- if (target_ptr->resist_shard) {
336- ep_ptr->dam /= 2;
337- } else if (!check_multishadow(target_ptr)) {
321+ ep_ptr->dam = ep_ptr->dam * calc_rocket_damage_rate(target_ptr, CALC_RAND) / 100;
322+
323+ if (!target_ptr->resist_shard && !check_multishadow(target_ptr)) {
338324 (void)set_cut(target_ptr, target_ptr->cut + (ep_ptr->dam / 2));
339325 }
340326
@@ -359,22 +345,17 @@ void effect_player_lite(player_type *target_ptr, effect_player_type *ep_ptr)
359345 {
360346 if (target_ptr->blind)
361347 msg_print(_("何かで攻撃された!", "You are hit by something!"));
362- if (target_ptr->resist_lite) {
363- ep_ptr->dam *= 4;
364- ep_ptr->dam /= (randint1(4) + 7);
365- } else if (!target_ptr->blind && !target_ptr->resist_blind && !check_multishadow(target_ptr)) {
348+ if (!target_ptr->blind && !target_ptr->resist_blind && !check_multishadow(target_ptr)) {
366349 (void)set_blind(target_ptr, target_ptr->blind + randint1(5) + 2);
367350 }
368351
369- ep_ptr->dam = ep_ptr->dam * calc_vuln_fire_rate(target_ptr) / 100;
352+ ep_ptr->dam = ep_ptr->dam * calc_lite_damage_rate(target_ptr, CALC_RAND) / 100;
370353
371354 if (is_specific_player_race(target_ptr, RACE_VAMPIRE) || (target_ptr->mimic_form == MIMIC_VAMPIRE)) {
372355 if (!check_multishadow(target_ptr))
373356 msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
374357 }
375358
376- if (target_ptr->wraith_form)
377- ep_ptr->dam *= 2;
378359 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
379360
380361 if (!target_ptr->wraith_form || check_multishadow(target_ptr))
@@ -392,13 +373,10 @@ void effect_player_dark(player_type *target_ptr, effect_player_type *ep_ptr)
392373 {
393374 if (target_ptr->blind)
394375 msg_print(_("何かで攻撃された!", "You are hit by something!"));
395- if (target_ptr->resist_dark) {
396- ep_ptr->dam *= 4;
397- ep_ptr->dam /= (randint1(4) + 7);
398376
399- if (is_specific_player_race(target_ptr, RACE_VAMPIRE) || (target_ptr->mimic_form == MIMIC_VAMPIRE) || target_ptr->wraith_form)
400- ep_ptr->dam = 0;
401- } else if (!target_ptr->blind && !target_ptr->resist_blind && !check_multishadow(target_ptr)) {
377+ ep_ptr->dam = ep_ptr->dam * calc_dark_damage_rate(target_ptr, CALC_RAND) / 100;
378+
379+ if (!target_ptr->blind && !target_ptr->resist_blind && !check_multishadow(target_ptr)) {
402380 (void)set_blind(target_ptr, target_ptr->blind + randint1(5) + 2);
403381 }
404382
@@ -488,21 +466,16 @@ void effect_player_time(player_type *target_ptr, effect_player_type *ep_ptr)
488466 if (target_ptr->blind)
489467 msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
490468
491- if (target_ptr->resist_time) {
492- ep_ptr->dam *= 4;
493- ep_ptr->dam /= (randint1(4) + 7);
494- msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
495- ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
496- return;
497- }
498-
499- if (check_multishadow(target_ptr)) {
469+ ep_ptr->dam = ep_ptr->dam * calc_time_damage_rate(target_ptr, CALC_RAND) / 100;
470+ if (!check_multishadow(target_ptr)) {
471+ if (target_ptr->resist_time) {
472+ msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
473+ }
500474 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
501- return;
475+ if (!target_ptr->resist_time) {
476+ effect_player_time_addition(target_ptr);
477+ }
502478 }
503-
504- effect_player_time_addition(target_ptr);
505- ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
506479 }
507480
508481 void effect_player_gravity(player_type *target_ptr, effect_player_type *ep_ptr)
--- a/src/info-reader/kind-info-tokens-table.c
+++ b/src/info-reader/kind-info-tokens-table.c
@@ -155,6 +155,7 @@ concptr k_info_flags[NUM_K_FLAGS] = {
155155 "HEAVY_SPELL",
156156 "RES_TIME",
157157 "RES_WATER",
158+ "INVULN_ARROW",
158159 };
159160
160161 /*!
--- a/src/info-reader/kind-info-tokens-table.h
+++ b/src/info-reader/kind-info-tokens-table.h
@@ -2,7 +2,7 @@
22
33 #include "system/angband.h"
44
5-#define NUM_K_FLAGS 145
5+#define NUM_K_FLAGS 146
66 #define NUM_K_GENERATION_FLAGS 32
77
88 extern concptr k_info_flags[NUM_K_FLAGS];
--- a/src/main.c
+++ b/src/main.c
@@ -1,6 +1,4 @@
1-/* File: main.c */
2-
3-/*
1+/*
42 * Copyright (c) 1997 Ben Harrison, and others
53 *
64 * This software may be copied and distributed for educational, research,
@@ -42,68 +40,7 @@
4240 */
4341
4442
45-#if !defined(WINDOWS)
46-
47-/*
48- * Nuke a term
49- */
50-static errr term_nuke(term_type *t)
51-{
52- TERM_LEN w = t->wid;
53- TERM_LEN h = t->hgt;
54-
55- /* Call the special "nuke" hook */
56- if (t->active_flag) {
57- /* Call the "nuke" hook */
58- if (t->nuke_hook)
59- (*t->nuke_hook)(t);
60-
61- /* Remember */
62- t->active_flag = FALSE;
63-
64- /* Assume not mapped */
65- t->mapped_flag = FALSE;
66- }
67-
68- /* Nuke "displayed" */
69- term_win_nuke(t->old, w, h);
70-
71- /* Kill "displayed" */
72- KILL(t->old, term_win);
73-
74- /* Nuke "requested" */
75- term_win_nuke(t->scr, w, h);
76-
77- /* Kill "requested" */
78- KILL(t->scr, term_win);
79-
80- /* If needed */
81- if (t->mem) {
82- /* Nuke "memorized" */
83- term_win_nuke(t->mem, w, h);
84-
85- /* Kill "memorized" */
86- KILL(t->mem, term_win);
87- }
88-
89- /* If needed */
90- if (t->tmp) {
91- /* Nuke "temporary" */
92- term_win_nuke(t->tmp, w, h);
93-
94- /* Kill "temporary" */
95- KILL(t->tmp, term_win);
96- }
97-
98- /* Free some arrays */
99- C_KILL(t->x1, h, TERM_LEN);
100- C_KILL(t->x2, h, TERM_LEN);
101-
102- /* Free the input queue */
103- C_KILL(t->key_queue, t->key_size, char);
104- return 0;
105-}
106-
43+#ifndef WINDOWS
10744 /*
10845 * A hook for "quit()".
10946 *
--- a/src/object-enchant/tr-types.h
+++ b/src/object-enchant/tr-types.h
@@ -153,5 +153,6 @@ typedef enum tr_type {
153153 TR_HEAVY_SPELL = 142,
154154 TR_RES_TIME = 143,
155155 TR_RES_WATER = 144,
156- TR_FLAG_MAX = 145,
156+ TR_INVULN_ARROW = 145,
157+ TR_FLAG_MAX = 146,
157158 } tr_type;
--- a/src/object/warning.c
+++ b/src/object/warning.c
@@ -89,50 +89,28 @@ static void spell_damcalc(player_type *target_ptr, monster_type *m_ptr, EFFECT_I
8989 switch (typ) {
9090 case GF_ELEC:
9191 if (is_immune_elec(target_ptr)) {
92- dam = 0;
9392 ignore_wraith_form = TRUE;
94- break;
9593 }
96- dam = dam * calc_vuln_elec_rate(target_ptr) / 100;
97- if (target_ptr->resist_elec)
98- dam = (dam + 2) / 3;
99- if (is_oppose_elec(target_ptr))
100- dam = (dam + 2) / 3;
94+ dam = dam * calc_elec_damage_rate(target_ptr) / 100;
10195 break;
10296
10397 case GF_POIS:
104- if (target_ptr->resist_pois)
105- dam = (dam + 2) / 3;
106- if (is_oppose_pois(target_ptr))
107- dam = (dam + 2) / 3;
98+ dam = dam * calc_pois_damage_rate(target_ptr) / 100;
10899 break;
109100
110101 case GF_ACID:
111102 if (is_immune_acid(target_ptr)) {
112- dam = 0;
113103 ignore_wraith_form = TRUE;
114- break;
115104 }
116-
117- dam = dam * calc_vuln_acid_rate(target_ptr) / 100;
118- if (target_ptr->resist_acid)
119- dam = (dam + 2) / 3;
120- if (is_oppose_acid(target_ptr))
121- dam = (dam + 2) / 3;
105+ dam = dam * calc_acid_damage_rate(target_ptr) / 100;
122106 break;
123107
124108 case GF_COLD:
125109 case GF_ICE:
126110 if (is_immune_cold(target_ptr)) {
127- dam = 0;
128111 ignore_wraith_form = TRUE;
129- break;
130112 }
131- dam = dam * calc_vuln_cold_rate(target_ptr) / 100;
132- if (target_ptr->resist_cold)
133- dam = (dam + 2) / 3;
134- if (is_oppose_cold(target_ptr))
135- dam = (dam + 2) / 3;
113+ dam = dam * calc_cold_damage_rate(target_ptr) / 100;
136114 break;
137115
138116 case GF_FIRE:
@@ -141,12 +119,7 @@ static void spell_damcalc(player_type *target_ptr, monster_type *m_ptr, EFFECT_I
141119 ignore_wraith_form = TRUE;
142120 break;
143121 }
144- dam = dam * calc_vuln_fire_rate(target_ptr) / 100;
145- if (target_ptr->resist_fire)
146- dam = (dam + 2) / 3;
147- if (is_oppose_fire(target_ptr))
148- dam = (dam + 2) / 3;
149- break;
122+ dam = dam * calc_fire_damage_rate(target_ptr) / 100;
150123
151124 case GF_PSY_SPEAR:
152125 ignore_wraith_form = TRUE;
@@ -154,69 +127,56 @@ static void spell_damcalc(player_type *target_ptr, monster_type *m_ptr, EFFECT_I
154127
155128 case GF_ARROW:
156129 if (!target_ptr->blind
157- && ((target_ptr->inventory_list[INVEN_RARM].k_idx && (target_ptr->inventory_list[INVEN_RARM].name1 == ART_ZANTETSU))
158- || (target_ptr->inventory_list[INVEN_LARM].k_idx && (target_ptr->inventory_list[INVEN_LARM].name1 == ART_ZANTETSU)))) {
130+ && (has_invuln_arrow(target_ptr))) {
159131 dam = 0;
160132 ignore_wraith_form = TRUE;
161133 }
162-
163134 break;
164135
165136 case GF_LITE:
166- if (target_ptr->resist_lite)
167- dam /= 2; /* Worst case of 4 / (d4 + 7) */
168- dam = dam * calc_vuln_lite_rate(target_ptr) / 100;
137+ dam = dam * calc_lite_damage_rate(target_ptr, CALC_MAX) / 100;
169138 break;
170139
171140 case GF_DARK:
172- if (is_specific_player_race(target_ptr, RACE_VAMPIRE) || (target_ptr->mimic_form == MIMIC_VAMPIRE) || target_ptr->wraith_form) {
173- dam = 0;
141+ dam = dam * calc_dark_damage_rate(target_ptr, CALC_MAX) / 100;
142+ if (is_specific_player_race(target_ptr, RACE_VAMPIRE) || (target_ptr->mimic_form == MIMIC_VAMPIRE) || target_ptr->wraith_form)
174143 ignore_wraith_form = TRUE;
175- } else if (target_ptr->resist_dark)
176- dam /= 2; /* Worst case of 4 / (d4 + 7) */
177144 break;
178145
179146 case GF_SHARDS:
180- if (target_ptr->resist_shard)
181- dam = dam * 3 / 4; /* Worst case of 6 / (d4 + 7) */
147+ dam = dam * calc_shards_damage_rate(target_ptr, CALC_MAX) / 100;
182148 break;
183149
184150 case GF_SOUND:
185- if (target_ptr->resist_sound)
186- dam = dam * 5 / 8; /* Worst case of 5 / (d4 + 7) */
151+ dam = dam * calc_sound_damage_rate(target_ptr, CALC_MAX) / 100;
187152 break;
188153
189154 case GF_CONFUSION:
190- if (target_ptr->resist_conf)
191- dam = dam * 5 / 8; /* Worst case of 5 / (d4 + 7) */
155+ dam = dam * calc_conf_damage_rate(target_ptr, CALC_MAX) / 100;
192156 break;
193157
194158 case GF_CHAOS:
195- if (target_ptr->resist_chaos)
196- dam = dam * 3 / 4; /* Worst case of 6 / (d4 + 7) */
159+ dam = dam * calc_chaos_damage_rate(target_ptr, CALC_MAX) / 100;
197160 break;
198161
199162 case GF_NETHER:
163+ dam = dam * calc_nether_damage_rate(target_ptr, CALC_MAX) / 100;
200164 if (is_specific_player_race(target_ptr, RACE_SPECTRE)) {
201- dam = 0;
202165 ignore_wraith_form = TRUE;
203- } else if (target_ptr->resist_neth)
204- dam = dam * 3 / 4; /* Worst case of 6 / (d4 + 7) */
166+ dam = 0;
167+ }
205168 break;
206169
207170 case GF_DISENCHANT:
208- if (target_ptr->resist_disen)
209- dam = dam * 3 / 4; /* Worst case of 6 / (d4 + 7) */
171+ dam = dam * calc_disenchant_damage_rate(target_ptr, CALC_MAX) / 100;
210172 break;
211173
212174 case GF_NEXUS:
213- if (target_ptr->resist_nexus)
214- dam = dam * 3 / 4; /* Worst case of 6 / (d4 + 7) */
175+ dam = dam * calc_nexus_damage_rate(target_ptr, CALC_MAX) / 100;
215176 break;
216177
217178 case GF_TIME:
218- if (target_ptr->resist_time)
219- dam /= 2; /* Worst case of 4 / (d4 + 7) */
179+ dam = dam * calc_time_damage_rate(target_ptr, CALC_MAX) / 100;
220180 break;
221181
222182 case GF_GRAVITY:
@@ -225,15 +185,11 @@ static void spell_damcalc(player_type *target_ptr, monster_type *m_ptr, EFFECT_I
225185 break;
226186
227187 case GF_ROCKET:
228- if (target_ptr->resist_shard)
229- dam /= 2;
188+ dam = dam * calc_rocket_damage_rate(target_ptr, CALC_MAX) / 100;
230189 break;
231190
232191 case GF_NUKE:
233- if (target_ptr->resist_pois)
234- dam = (2 * dam + 2) / 5;
235- if (is_oppose_pois(target_ptr))
236- dam = (2 * dam + 2) / 5;
192+ dam = dam * calc_nuke_damage_rate(target_ptr) / 100;
237193 break;
238194
239195 case GF_DEATH_RAY:
@@ -261,15 +217,11 @@ static void spell_damcalc(player_type *target_ptr, monster_type *m_ptr, EFFECT_I
261217 break;
262218
263219 case GF_HOLY_FIRE:
264- if (target_ptr->align > 10)
265- dam /= 2;
266- else if (target_ptr->align < -10)
267- dam *= 2;
220+ dam = dam * calc_holy_fire_damage_rate(target_ptr, CALC_MAX) / 100;
268221 break;
269222
270223 case GF_HELL_FIRE:
271- if (target_ptr->align > 10)
272- dam *= 2;
224+ dam = dam * calc_hell_fire_damage_rate(target_ptr, CALC_MAX) / 100;
273225 break;
274226
275227 case GF_MIND_BLAST:
--- a/src/perception/identification.c
+++ b/src/perception/identification.c
@@ -82,6 +82,14 @@ bool screen_object(player_type *player_ptr, object_type *o_ptr, BIT_FLAGS mode)
8282 info[i++] = _("それは二刀流での命中率を向上させる。", "It affects your ability to hit when you are wielding two weapons.");
8383 }
8484
85+ if (has_flag(flgs, TR_INVULN_ARROW)) {
86+ info[i++] = _("それは視界がある限り物理的な飛び道具の一切をはねのける。", "It repels all physical missiles as long as there is visibility.");
87+ }
88+
89+ if (has_flag(flgs, TR_NO_AC)) {
90+ info[i++] = _("それは物理的防護の一切を奪う。", "It robs you of any physical protection.");
91+ }
92+
8593 if (has_flag(flgs, TR_EASY_SPELL)) {
8694 info[i++] = _("それは魔法の難易度を下げる。", "It affects your ability to cast spells.");
8795 }
--- a/src/player/player-damage.c
+++ b/src/player/player-damage.c
@@ -151,21 +151,13 @@ HIT_POINT acid_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int
151151 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
152152 bool double_resist = is_oppose_acid(creature_ptr);
153153
154- /* Total Immunity */
155- if (is_immune_acid(creature_ptr) || (dam <= 0)) {
154+ dam = dam * calc_acid_damage_rate(creature_ptr) / 100;
155+
156+ if (dam <= 0) {
156157 learn_spell(creature_ptr, monspell);
157158 return 0;
158159 }
159160
160- /* Vulnerability (Ouch!) */
161- dam = dam * calc_vuln_acid_rate(creature_ptr) / 100;
162-
163- /* Resist the damage */
164- if (creature_ptr->resist_acid)
165- dam = (dam + 2) / 3;
166- if (double_resist)
167- dam = (dam + 2) / 3;
168-
169161 if (aura || !check_multishadow(creature_ptr)) {
170162 if ((!(double_resist || creature_ptr->resist_acid)) && one_in_(HURT_CHANCE))
171163 (void)do_dec_stat(creature_ptr, A_CHR);
@@ -199,21 +191,13 @@ HIT_POINT elec_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int
199191 int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
200192 bool double_resist = is_oppose_elec(creature_ptr);
201193
202- /* Total immunity */
203- if (is_immune_elec(creature_ptr) || (dam <= 0)) {
194+ dam = dam * calc_elec_damage_rate(creature_ptr) / 100;
195+
196+ if (dam <= 0) {
204197 learn_spell(creature_ptr, monspell);
205198 return 0;
206199 }
207200
208- /* Vulnerability (Ouch!) */
209- dam = dam * calc_vuln_elec_rate(creature_ptr) / 100;
210-
211- /* Resist the damage */
212- if (creature_ptr->resist_elec)
213- dam = (dam + 2) / 3;
214- if (double_resist)
215- dam = (dam + 2) / 3;
216-
217201 if (aura || !check_multishadow(creature_ptr)) {
218202 if ((!(double_resist || creature_ptr->resist_elec)) && one_in_(HURT_CHANCE))
219203 (void)do_dec_stat(creature_ptr, A_DEX);
@@ -250,14 +234,7 @@ HIT_POINT fire_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int
250234 return 0;
251235 }
252236
253- /* Vulnerability (Ouch!) */
254- dam = dam * calc_vuln_fire_rate(creature_ptr) / 100;
255-
256- /* Resist the damage */
257- if (creature_ptr->resist_fire)
258- dam = (dam + 2) / 3;
259- if (double_resist)
260- dam = (dam + 2) / 3;
237+ dam = dam * calc_fire_damage_rate(creature_ptr) / 100;
261238
262239 if (aura || !check_multishadow(creature_ptr)) {
263240 if ((!(double_resist || creature_ptr->resist_fire)) && one_in_(HURT_CHANCE))
@@ -296,7 +273,7 @@ HIT_POINT cold_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int
296273 }
297274
298275 /* Vulnerability (Ouch!) */
299- dam = dam * calc_vuln_cold_rate(creature_ptr) / 100;
276+ dam = dam * calc_cold_damage_rate(creature_ptr) / 100;
300277
301278 /* Resist the damage */
302279 if (creature_ptr->resist_cold)
--- a/src/player/player-status-flags.c
+++ b/src/player/player-status-flags.c
@@ -236,6 +236,15 @@ BIT_FLAGS has_no_ac(player_type *creature_ptr)
236236 return result;
237237 }
238238
239+BIT_FLAGS has_invuln_arrow(player_type *creature_ptr)
240+{
241+ BIT_FLAGS result = 0L;
242+ if (creature_ptr->blind)
243+ return result;
244+ result |= check_equipment_flags(creature_ptr, TR_INVULN_ARROW);
245+ return result;
246+}
247+
239248 void has_no_flowed(player_type *creature_ptr)
240249 {
241250 object_type *o_ptr;
--- a/src/player/player-status-flags.h
+++ b/src/player/player-status-flags.h
@@ -42,6 +42,7 @@ BIT_FLAGS has_bless_blade(player_type *creature_ptr);
4242 BIT_FLAGS has_easy2_weapon(player_type *creature_ptr);
4343 BIT_FLAGS has_down_saving(player_type *creature_ptr);
4444 BIT_FLAGS has_no_ac(player_type *creature_ptr);
45+BIT_FLAGS has_invuln_arrow(player_type *creature_ptr);
4546 void has_no_flowed(player_type *creature_ptr);
4647 BIT_FLAGS has_mighty_throw(player_type *creature_ptr);
4748 BIT_FLAGS has_dec_mana(player_type *creature_ptr);
--- a/src/player/player-status-resist.c
+++ b/src/player/player-status-resist.c
@@ -1,4 +1,4 @@
1-#include "player/player-status-flags.h"
1+#include "player/player-status-resist.h"
22 #include "art-definition/art-sword-types.h"
33 #include "grid/grid.h"
44 #include "inventory/inventory-slot-types.h"
@@ -16,12 +16,14 @@
1616 #include "player/player-race-types.h"
1717 #include "player/player-race.h"
1818 #include "player/player-skill.h"
19+#include "player/player-status-flags.h"
1920 #include "player/player-status.h"
2021 #include "player/special-defense-types.h"
2122 #include "realm/realm-hex-numbers.h"
2223 #include "realm/realm-song-numbers.h"
2324 #include "realm/realm-types.h"
2425 #include "spell-realm/spells-hex.h"
26+#include "status/element-resistance.h"
2527 #include "sv-definition/sv-weapon-types.h"
2628 #include "system/floor-type-definition.h"
2729 #include "system/monster-type-definition.h"
@@ -30,10 +32,36 @@
3032 #include "util/quarks.h"
3133 #include "util/string-processor.h"
3234
33-PERCENTAGE calc_vuln_acid_rate(player_type *creature_ptr)
35+PERCENTAGE randrate(int dice, int fix, rate_calc_type_mode mode)
36+{
37+ switch (mode) {
38+ case CALC_RAND:
39+ return randint1(dice) * 100 + fix * 100;
40+ break;
41+ case CALC_AVERAGE:
42+ return (dice + 1) * 50 + fix * 100;
43+ break;
44+ case CALC_MIN:
45+ return (fix + 1) * 100;
46+ break;
47+ case CALC_MAX:
48+ return (dice + fix) * 100;
49+ break;
50+ default:
51+ return (fix + 1) * 100;
52+ break;
53+ }
54+}
55+
56+PERCENTAGE calc_acid_damage_rate(player_type *creature_ptr)
3457 {
3558 PERCENTAGE per = 100;
3659 int i;
60+
61+ if (is_immune_acid(creature_ptr)) {
62+ return 0;
63+ }
64+
3765 BIT_FLAGS flgs = is_vuln_acid(creature_ptr);
3866 for (i = 0; i < FLAG_CAUSE_MAX; i++) {
3967 if (flgs & (0x01 << i)) {
@@ -44,13 +72,24 @@ PERCENTAGE calc_vuln_acid_rate(player_type *creature_ptr)
4472 }
4573 }
4674 }
75+
76+ if (creature_ptr->resist_acid)
77+ per = (per + 2) / 3;
78+ if (is_oppose_acid(creature_ptr))
79+ per = (per + 2) / 3;
80+
4781 return per;
4882 }
4983
50-PERCENTAGE calc_vuln_elec_rate(player_type *creature_ptr)
84+PERCENTAGE calc_elec_damage_rate(player_type *creature_ptr)
5185 {
5286 PERCENTAGE per = 100;
5387 int i;
88+
89+ if (is_immune_elec(creature_ptr)) {
90+ return 0;
91+ }
92+
5493 BIT_FLAGS flgs = is_vuln_elec(creature_ptr);
5594 for (i = 0; i < FLAG_CAUSE_MAX; i++) {
5695 if (flgs & (0x01 << i)) {
@@ -61,10 +100,16 @@ PERCENTAGE calc_vuln_elec_rate(player_type *creature_ptr)
61100 }
62101 }
63102 }
103+
104+ if (creature_ptr->resist_elec)
105+ per = (per + 2) / 3;
106+ if (is_oppose_elec(creature_ptr))
107+ per = (per + 2) / 3;
108+
64109 return per;
65110 }
66111
67-PERCENTAGE calc_vuln_fire_rate(player_type *creature_ptr)
112+PERCENTAGE calc_fire_damage_rate(player_type *creature_ptr)
68113 {
69114 PERCENTAGE per = 100;
70115 int i;
@@ -78,10 +123,17 @@ PERCENTAGE calc_vuln_fire_rate(player_type *creature_ptr)
78123 }
79124 }
80125 }
126+
127+ /* Resist the damage */
128+ if (creature_ptr->resist_fire)
129+ per = (per + 2) / 3;
130+ if (is_oppose_fire(creature_ptr))
131+ per = (per + 2) / 3;
132+
81133 return per;
82134 }
83135
84-PERCENTAGE calc_vuln_cold_rate(player_type *creature_ptr)
136+PERCENTAGE calc_cold_damage_rate(player_type *creature_ptr)
85137 {
86138 PERCENTAGE per = 100;
87139 int i;
@@ -95,10 +147,38 @@ PERCENTAGE calc_vuln_cold_rate(player_type *creature_ptr)
95147 }
96148 }
97149 }
150+
151+ if (creature_ptr->resist_cold)
152+ per = (per + 2) / 3;
153+ if (is_oppose_cold(creature_ptr))
154+ per = (per + 2) / 3;
155+
156+ return per;
157+}
158+
159+PERCENTAGE calc_pois_damage_rate(player_type *creature_ptr)
160+{
161+ PERCENTAGE per = 100;
162+ if (creature_ptr->resist_pois)
163+ per = (per + 2) / 3;
164+ if (is_oppose_pois(creature_ptr))
165+ per = (per + 2) / 3;
166+
98167 return per;
99168 }
100169
101-PERCENTAGE calc_vuln_lite_rate(player_type *creature_ptr)
170+PERCENTAGE calc_nuke_damage_rate(player_type *creature_ptr)
171+{
172+ PERCENTAGE per = 100;
173+ if (creature_ptr->resist_pois)
174+ per = (per + 2) / 3;
175+ if (is_oppose_pois(creature_ptr))
176+ per = (per + 2) / 3;
177+
178+ return per;
179+}
180+
181+PERCENTAGE calc_lite_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode)
102182 {
103183 PERCENTAGE per = 100;
104184 if (is_specific_player_race(creature_ptr, RACE_VAMPIRE) || (creature_ptr->mimic_form == MIMIC_VAMPIRE)) {
@@ -107,8 +187,161 @@ PERCENTAGE calc_vuln_lite_rate(player_type *creature_ptr)
107187 per = per * 4 / 3;
108188 }
109189
190+ if (creature_ptr->resist_lite) {
191+ per *= 400;
192+ per /= randrate(4, 7, mode);
193+ }
194+
110195 if (creature_ptr->wraith_form)
111196 per *= 2;
112197
113198 return per;
114199 }
200+
201+PERCENTAGE calc_dark_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode)
202+{
203+ PERCENTAGE per = 100;
204+
205+ if (is_specific_player_race(creature_ptr, RACE_VAMPIRE) || (creature_ptr->mimic_form == MIMIC_VAMPIRE) || creature_ptr->wraith_form) {
206+ return 0;
207+ }
208+
209+ if (creature_ptr->resist_dark) {
210+ per *= 400;
211+ per /= randrate(4, 7, mode);
212+ }
213+
214+ return per;
215+}
216+
217+PERCENTAGE calc_shards_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode)
218+{
219+ PERCENTAGE per = 100;
220+
221+ if (creature_ptr->resist_shard) {
222+ per *= 600;
223+ per /= randrate(4, 7, mode);
224+ }
225+
226+ return per;
227+}
228+
229+PERCENTAGE calc_sound_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode)
230+{
231+ PERCENTAGE per = 100;
232+
233+ if (creature_ptr->resist_sound) {
234+ per *= 500;
235+ per /= randrate(4, 7, mode);
236+ }
237+
238+ return per;
239+}
240+
241+PERCENTAGE calc_conf_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode)
242+{
243+ PERCENTAGE per = 100;
244+
245+ if (creature_ptr->resist_conf) {
246+ per *= 500;
247+ per /= randrate(4, 7, mode);
248+ }
249+
250+ return per;
251+}
252+
253+PERCENTAGE calc_chaos_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode)
254+{
255+ PERCENTAGE per = 100;
256+
257+ if (creature_ptr->resist_chaos) {
258+ per *= 600;
259+ per /= randrate(4, 7, mode);
260+ }
261+
262+ return per;
263+}
264+
265+PERCENTAGE calc_disenchant_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode)
266+{
267+ PERCENTAGE per = 100;
268+
269+ if (creature_ptr->resist_disen) {
270+ per *= 600;
271+ per /= randrate(4, 7, mode);
272+ }
273+
274+ return per;
275+}
276+
277+PERCENTAGE calc_nexus_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode)
278+{
279+ PERCENTAGE per = 100;
280+
281+ if (creature_ptr->resist_disen) {
282+ per *= 600;
283+ per /= randrate(4, 7, mode);
284+ }
285+
286+ return per;
287+}
288+
289+PERCENTAGE calc_rocket_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode)
290+{
291+ (mode); // unused
292+ PERCENTAGE per = 100;
293+
294+ if (creature_ptr->resist_shard) {
295+ per /= 2;
296+ }
297+
298+ return per;
299+}
300+
301+PERCENTAGE calc_nether_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode)
302+{
303+ PERCENTAGE per = 100;
304+
305+ if (creature_ptr->resist_neth) {
306+ if (!is_specific_player_race(creature_ptr, RACE_SPECTRE))
307+ per *= 6;
308+ per *= 100;
309+ per /= randrate(4, 7, mode);
310+ }
311+
312+ return per;
313+}
314+
315+PERCENTAGE calc_time_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode)
316+{
317+ (mode); // unused
318+ PERCENTAGE per = 100;
319+
320+ if (creature_ptr->resist_time) {
321+ per *= 400;
322+ per /= randrate(4, 7, mode);
323+ return;
324+ }
325+
326+ return per;
327+}
328+
329+PERCENTAGE calc_holy_fire_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode)
330+{
331+ (mode); // unused
332+ PERCENTAGE per = 100;
333+ if (creature_ptr->align > 10)
334+ per /= 2;
335+ else if (creature_ptr->align < -10)
336+ per *= 2;
337+ return per;
338+}
339+
340+PERCENTAGE calc_hell_fire_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode)
341+{
342+ (mode); // unused
343+ PERCENTAGE per = 100;
344+ if (creature_ptr->align > 10)
345+ per *= 2;
346+ return per;
347+}
--- a/src/player/player-status-resist.h
+++ b/src/player/player-status-resist.h
@@ -1,7 +1,32 @@
1-#include "player/player-status.h"
1+#pragma once
22
3-PERCENTAGE calc_vuln_acid_rate(player_type *creature_ptr);
4-PERCENTAGE calc_vuln_elec_rate(player_type *creature_ptr);
5-PERCENTAGE calc_vuln_fire_rate(player_type *creature_ptr);
6-PERCENTAGE calc_vuln_cold_rate(player_type *creature_ptr);
7-PERCENTAGE calc_vuln_lite_rate(player_type *creature_ptr);
3+#include "system/angband.h"
4+#include "player/player-status.h"
5+
6+typedef enum rate_calc_type_mode {
7+ CALC_RAND = 0,
8+ CALC_AVERAGE = 1,
9+ CALC_MIN = 2,
10+ CALC_MAX = 3,
11+} rate_calc_type_mode;
12+
13+
14+PERCENTAGE calc_acid_damage_rate(player_type *creature_ptr);
15+PERCENTAGE calc_elec_damage_rate(player_type *creature_ptr);
16+PERCENTAGE calc_fire_damage_rate(player_type *creature_ptr);
17+PERCENTAGE calc_cold_damage_rate(player_type *creature_ptr);
18+PERCENTAGE calc_pois_damage_rate(player_type *creature_ptr);
19+PERCENTAGE calc_nuke_damage_rate(player_type *creature_ptr);
20+PERCENTAGE calc_lite_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode);
21+PERCENTAGE calc_dark_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode);
22+PERCENTAGE calc_shards_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode);
23+PERCENTAGE calc_sound_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode);
24+PERCENTAGE calc_conf_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode);
25+PERCENTAGE calc_chaos_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode);
26+PERCENTAGE calc_nether_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode);
27+PERCENTAGE calc_disenchant_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode);
28+PERCENTAGE calc_nexus_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode);
29+PERCENTAGE calc_time_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode);
30+PERCENTAGE calc_rocket_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode);
31+PERCENTAGE calc_holy_fire_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode);
32+PERCENTAGE calc_hell_fire_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode);
--- a/src/term/z-term.c
+++ b/src/term/z-term.c
@@ -2299,3 +2299,37 @@ errr term_putstr_v(TERM_LEN x, TERM_LEN y, int n, byte a, concptr s)
22992299 return 0;
23002300 }
23012301 #endif
2302+
2303+#ifndef WINDOWS
2304+errr term_nuke(term_type *t)
2305+{
2306+ TERM_LEN w = t->wid;
2307+ TERM_LEN h = t->hgt;
2308+ if (t->active_flag) {
2309+ if (t->nuke_hook)
2310+ (*t->nuke_hook)(t);
2311+
2312+ t->active_flag = FALSE;
2313+ t->mapped_flag = FALSE;
2314+ }
2315+
2316+ term_win_nuke(t->old, w, h);
2317+ KILL(t->old, term_win);
2318+ term_win_nuke(t->scr, w, h);
2319+ KILL(t->scr, term_win);
2320+ if (t->mem) {
2321+ term_win_nuke(t->mem, w, h);
2322+ KILL(t->mem, term_win);
2323+ }
2324+
2325+ if (t->tmp) {
2326+ term_win_nuke(t->tmp, w, h);
2327+ KILL(t->tmp, term_win);
2328+ }
2329+
2330+ C_KILL(t->x1, h, TERM_LEN);
2331+ C_KILL(t->x2, h, TERM_LEN);
2332+ C_KILL(t->key_queue, t->key_size, char);
2333+ return 0;
2334+}
2335+#endif
--- a/src/term/z-term.h
+++ b/src/term/z-term.h
@@ -137,49 +137,52 @@ typedef struct term_type {
137137 extern term_type *Term;
138138
139139 errr term_win_nuke(term_win *s, TERM_LEN w, TERM_LEN h);
140-extern errr term_user(int n);
141-extern errr term_xtra(int n, int v);
140+errr term_user(int n);
141+errr term_xtra(int n, int v);
142142
143-extern void term_queue_char(TERM_LEN x, TERM_LEN y, TERM_COLOR a, char c, TERM_COLOR ta, char tc);
144-extern void term_queue_bigchar(TERM_LEN x, TERM_LEN y, TERM_COLOR a, char c, TERM_COLOR ta, char tc);
143+void term_queue_char(TERM_LEN x, TERM_LEN y, TERM_COLOR a, char c, TERM_COLOR ta, char tc);
144+void term_queue_bigchar(TERM_LEN x, TERM_LEN y, TERM_COLOR a, char c, TERM_COLOR ta, char tc);
145145
146-extern void term_queue_line(TERM_LEN x, TERM_LEN y, int n, TERM_COLOR *a, char *c, TERM_COLOR *ta, char *tc);
146+void term_queue_line(TERM_LEN x, TERM_LEN y, int n, TERM_COLOR *a, char *c, TERM_COLOR *ta, char *tc);
147147
148-extern errr term_fresh(void);
149-extern errr term_set_cursor(int v);
150-extern errr term_gotoxy(TERM_LEN x, TERM_LEN y);
151-extern errr term_draw(TERM_LEN x, TERM_LEN y, TERM_COLOR a, char c);
152-extern errr term_addch(TERM_COLOR a, char c);
153-extern errr term_add_bigch(TERM_COLOR a, char c);
154-extern errr term_addstr(int n, TERM_COLOR a, concptr s);
155-extern errr term_putch(TERM_LEN x, TERM_LEN y, TERM_COLOR a, char c);
156-extern errr term_putstr(TERM_LEN x, TERM_LEN y, int n, TERM_COLOR a, concptr s);
157-extern errr term_erase(TERM_LEN x, TERM_LEN y, int n);
158-extern errr term_clear(void);
159-extern errr term_redraw(void);
160-extern errr term_redraw_section(TERM_LEN x1, TERM_LEN y1, TERM_LEN x2, TERM_LEN y2);
148+errr term_fresh(void);
149+errr term_set_cursor(int v);
150+errr term_gotoxy(TERM_LEN x, TERM_LEN y);
151+errr term_draw(TERM_LEN x, TERM_LEN y, TERM_COLOR a, char c);
152+errr term_addch(TERM_COLOR a, char c);
153+errr term_add_bigch(TERM_COLOR a, char c);
154+errr term_addstr(int n, TERM_COLOR a, concptr s);
155+errr term_putch(TERM_LEN x, TERM_LEN y, TERM_COLOR a, char c);
156+errr term_putstr(TERM_LEN x, TERM_LEN y, int n, TERM_COLOR a, concptr s);
157+errr term_erase(TERM_LEN x, TERM_LEN y, int n);
158+errr term_clear(void);
159+errr term_redraw(void);
160+errr term_redraw_section(TERM_LEN x1, TERM_LEN y1, TERM_LEN x2, TERM_LEN y2);
161161
162-extern errr term_get_cursor(int *v);
163-extern errr term_get_size(TERM_LEN *w, TERM_LEN *h);
164-extern errr term_locate(TERM_LEN *x, TERM_LEN *y);
165-extern errr term_what(TERM_LEN x, TERM_LEN y, TERM_COLOR *a, char *c);
162+errr term_get_cursor(int *v);
163+errr term_get_size(TERM_LEN *w, TERM_LEN *h);
164+errr term_locate(TERM_LEN *x, TERM_LEN *y);
165+errr term_what(TERM_LEN x, TERM_LEN y, TERM_COLOR *a, char *c);
166166
167-extern errr term_flush(void);
168-extern errr term_key_push(int k);
169-extern errr term_inkey(char *ch, bool wait, bool take);
167+errr term_flush(void);
168+errr term_key_push(int k);
169+errr term_inkey(char *ch, bool wait, bool take);
170170
171-extern errr term_save(void);
172-extern errr term_load(void);
171+errr term_save(void);
172+errr term_load(void);
173173
174-extern errr term_resize(TERM_LEN w, TERM_LEN h);
174+errr term_resize(TERM_LEN w, TERM_LEN h);
175175
176-extern errr term_activate(term_type *t);
176+errr term_activate(term_type *t);
177177
178-extern errr term_init(term_type *t, TERM_LEN w, TERM_LEN h, int k);
178+errr term_init(term_type *t, TERM_LEN w, TERM_LEN h, int k);
179179
180180 #ifdef JP
181-extern errr term_putstr_v(TERM_LEN x, TERM_LEN y, int n, byte a, concptr s);
181+errr term_putstr_v(TERM_LEN x, TERM_LEN y, int n, byte a, concptr s);
182182 #endif
183183
184+#ifndef WINDOWS
185+errr term_nuke(term_type *t);
184186 #endif
185187
188+#endif
Show on old repository browser