• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision999d5cf7ce1b78177ee475b16cc8820196e870d6 (tree)
Time2014-02-24 19:00:38
Authordis- <dis.rogue@gmai...>
Commiterdis-

Log Message

enable to get mon_spell_damage by race

Change Summary

Incremental Difference

--- a/src/externs.h
+++ b/src/externs.h
@@ -1599,6 +1599,7 @@ extern bool spell_learnable(int m_idx);
15991599 extern int monspell_to_player(int SPELL_NUM, int y, int x, int m_idx);
16001600 extern int monspell_to_monster(int SPELL_NUM, int y, int x, int m_idx, int t_idx);
16011601 extern int monspell_damage(int SPELL_NUM, int m_idx, int TYPE);
1602+extern int monspell_race_damage(int SPELL_NUM, int r_idx, int TYPE);
16021603
16031604 /* hissatsu.c */
16041605 extern void hissatsu_info(char *p, int power);
--- a/src/monster1.c
+++ b/src/monster1.c
@@ -178,7 +178,7 @@ static void roff_aux(int r_idx, int mode)
178178 int vn = 0;
179179 byte color[96];
180180 cptr vp[96];
181- char shoot_power[96];
181+ char tmp_msg[96][96];
182182
183183 bool know_everything = FALSE;
184184
@@ -721,15 +721,22 @@ static void roff_aux(int r_idx, int mode)
721721 /* Collect inate attacks */
722722 vn = 0;
723723 if (flags4 & RF4_SHRIEK) { vp[vn] = _("悲鳴で助けを求める", "shriek for help"); color[vn++] = TERM_L_WHITE; }
724- if (flags4 & RF4_ROCKET) { vp[vn] = _("ロケットを発射する", "shoot a rocket"); color[vn++] = TERM_UMBER; }
724+ if (flags4 & RF4_ROCKET)
725+ {
726+ int dam = monspell_race_damage(monspell_num(RF4_SPELL_START, RF4_ROCKET), r_idx, DAM_MAX);
727+ sprintf(tmp_msg[vn], _("ロケット(%d)を発射する", "shoot a rocket(%d)"), dam);
728+ vp[vn] = tmp_msg[vn];
729+ color[vn++] = TERM_UMBER;
730+ }
731+
725732 if (flags4 & RF4_SHOOT)
726733 {
727734 for (r = 0, m = 0; m < 4; m++)
728735 {
729736 if (r_ptr->blow[m].method == RBM_SHOOT)
730737 {
731- sprintf(shoot_power, _("威力 %dd%d の射撃をする","fire an arrow (Power:%dd%d)"), r_ptr->blow[m].d_side, r_ptr->blow[m].d_dice);
732- vp[vn] = shoot_power; color[vn++] = TERM_UMBER;
738+ sprintf(tmp_msg[vn], _("威力 %dd%d の射撃をする","fire an arrow (Power:%dd%d)"), r_ptr->blow[m].d_side, r_ptr->blow[m].d_dice);
739+ vp[vn] = tmp_msg[vn]; color[vn++] = TERM_UMBER;
733740 break;
734741 }
735742 }
--- a/src/mspells4.c
+++ b/src/mspells4.c
@@ -3678,25 +3678,17 @@ int monspell_to_monster(int SPELL_NUM, int y, int x, int m_idx, int t_idx)
36783678
36793679 /*!
36803680 * @brief モンスターの使う呪文の威力を返す /
3681-* @param m_idx 呪文を唱えるモンスターID
3681+* @param SPELL_NUM 呪文番号
3682+* @param hp 呪文を唱えるモンスターの体力
3683+* @param rlev 呪文を唱えるモンスターのレベル
3684+* @param powerful 呪文を唱えるモンスターのpowerfulフラグ
3685+* @param r_ptr 呪文を唱えるモンスターの種族ポインタ
36823686 * @param TYPE DAM_MAXで最大値を返し、DAM_MINで最小値を返す。DAM_ROLLはダイスを振って値を決定する。
36833687 * @return 攻撃呪文のダメージを返す。攻撃呪文以外は-1を返す。
36843688 */
3685-int monspell_damage(int SPELL_NUM, int m_idx, int TYPE)
3689+int monspell_damage_base(int SPELL_NUM, int hp, int rlev, bool powerful, monster_race* r_ptr, int TYPE)
36863690 {
3687- monster_type *m_ptr = &m_list[m_idx];
3688- monster_race *r_ptr = &r_info[m_ptr->r_idx];
3689- int hp, dam = 0, dice_num = 0, dice_side = 0, mult = 1, div = 1;
3690- int rlev = monster_level_idx(m_idx);
3691-
3692- if (TYPE == DAM_MAX)
3693- {
3694- hp = m_ptr->max_maxhp;
3695- }
3696- else if (TYPE == DAM_ROLL)
3697- {
3698- hp = m_ptr->hp;
3699- }
3691+ int dam = 0, dice_num = 0, dice_side = 0, mult = 1, div = 1;
37003692
37013693 switch (SPELL_NUM)
37023694 {
@@ -3802,7 +3794,7 @@ int monspell_damage(int SPELL_NUM, int m_idx, int TYPE)
38023794
38033795 /* RF4_BA_NUKE */
38043796 case RF4_SPELL_START + 28:
3805- mult = monster_is_powerful(m_idx) ? 2 : 1;
3797+ mult = powerful ? 2 : 1;
38063798 dam = rlev * (mult / div);
38073799 dice_num = 10;
38083800 dice_side = 6;
@@ -3815,7 +3807,7 @@ int monspell_damage(int SPELL_NUM, int m_idx, int TYPE)
38153807
38163808 /* RF4_BA_CHAO */
38173809 case RF4_SPELL_START + 30:
3818- dam = (monster_is_powerful(m_idx) ? (rlev * 3) : (rlev * 2));
3810+ dam = (powerful ? (rlev * 3) : (rlev * 2));
38193811 dice_num = 10;
38203812 dice_side = 10;
38213813 break;
@@ -3827,7 +3819,7 @@ int monspell_damage(int SPELL_NUM, int m_idx, int TYPE)
38273819
38283820 /* RF5_BA_ACID */
38293821 case RF5_SPELL_START + 0:
3830- if (monster_is_powerful(m_idx))
3822+ if (powerful)
38313823 {
38323824 dam = (rlev * 4) + 50;
38333825 dice_num = 10;
@@ -3843,7 +3835,7 @@ int monspell_damage(int SPELL_NUM, int m_idx, int TYPE)
38433835
38443836 /* RF5_BA_ELEC */
38453837 case RF5_SPELL_START + 1:
3846- if (monster_is_powerful(m_idx))
3838+ if (powerful)
38473839 {
38483840 dam = (rlev * 4) + 50;
38493841 dice_num = 10;
@@ -3859,7 +3851,7 @@ int monspell_damage(int SPELL_NUM, int m_idx, int TYPE)
38593851
38603852 /* RF5_BA_FIRE */
38613853 case RF5_SPELL_START + 2:
3862- if (monster_is_powerful(m_idx))
3854+ if (powerful)
38633855 {
38643856 dam = (rlev * 4) + 50;
38653857 dice_num = 10;
@@ -3875,7 +3867,7 @@ int monspell_damage(int SPELL_NUM, int m_idx, int TYPE)
38753867
38763868 /* RF5_BA_COLD */
38773869 case RF5_SPELL_START + 3:
3878- if (monster_is_powerful(m_idx))
3870+ if (powerful)
38793871 {
38803872 dam = (rlev * 4) + 50;
38813873 dice_num = 10;
@@ -3891,14 +3883,14 @@ int monspell_damage(int SPELL_NUM, int m_idx, int TYPE)
38913883
38923884 /* RF5_BA_POIS */
38933885 case RF5_SPELL_START + 4:
3894- mult = monster_is_powerful(m_idx) ? 2 : 1;
3886+ mult = powerful ? 2 : 1;
38953887 dice_num = 12;
38963888 dice_side = 2;
38973889 break;
38983890
38993891 /* RF5_BA_NETH */
39003892 case RF5_SPELL_START + 5:
3901- dam = 50 + (rlev * (monster_is_powerful(m_idx) ? 2 : 1));
3893+ dam = 50 + (rlev * powerful ? 2 : 1);
39023894 dice_num = 10;
39033895 dice_side = 10;
39043896 break;
@@ -3907,7 +3899,7 @@ int monspell_damage(int SPELL_NUM, int m_idx, int TYPE)
39073899 case RF5_SPELL_START + 6:
39083900 dam = 50;
39093901 dice_num = 1;
3910- dice_side = (monster_is_powerful(m_idx) ? (rlev * 3) : (rlev * 2));
3902+ dice_side = powerful ? (rlev * 3) : (rlev * 2);
39113903 break;
39123904
39133905 /* RF5_BA_MANA */
@@ -3965,7 +3957,7 @@ int monspell_damage(int SPELL_NUM, int m_idx, int TYPE)
39653957
39663958 /* RF5_BO_ACID */
39673959 case RF5_SPELL_START + 16:
3968- mult = monster_is_powerful(m_idx) ? 2 : 1;
3960+ mult = powerful ? 2 : 1;
39693961 dam = rlev / 3 * (mult / div);
39703962 dice_num = 7;
39713963 dice_side = 8;
@@ -3973,7 +3965,7 @@ int monspell_damage(int SPELL_NUM, int m_idx, int TYPE)
39733965
39743966 /* RF5_BO_ELEC */
39753967 case RF5_SPELL_START + 17:
3976- mult = monster_is_powerful(m_idx) ? 2 : 1;
3968+ mult = powerful ? 2 : 1;
39773969 dam = rlev / 3 * (mult / div);
39783970 dice_num = 4;
39793971 dice_side = 8;
@@ -3981,7 +3973,7 @@ int monspell_damage(int SPELL_NUM, int m_idx, int TYPE)
39813973
39823974 /* RF5_BO_FIRE */
39833975 case RF5_SPELL_START + 18:
3984- mult = monster_is_powerful(m_idx) ? 2 : 1;
3976+ mult = powerful ? 2 : 1;
39853977 dam = rlev / 3 * (mult / div);
39863978 dice_num = 9;
39873979 dice_side = 8;
@@ -3989,7 +3981,7 @@ int monspell_damage(int SPELL_NUM, int m_idx, int TYPE)
39893981
39903982 /* RF5_BO_COLD */
39913983 case RF5_SPELL_START + 19:
3992- mult = monster_is_powerful(m_idx) ? 2 : 1;
3984+ mult = powerful ? 2 : 1;
39933985 dam = rlev / 3 * (mult / div);
39943986 dice_num = 6;
39953987 dice_side = 8;
@@ -4004,14 +3996,14 @@ int monspell_damage(int SPELL_NUM, int m_idx, int TYPE)
40043996
40053997 /* RF5_BO_NETH */
40063998 case RF5_SPELL_START + 21:
4007- dam = 30 + (rlev * 4) / (monster_is_powerful(m_idx) ? 2 : 3);
3999+ dam = 30 + (rlev * 4) / (powerful ? 2 : 3);
40084000 dice_num = 5;
40094001 dice_side = 5;
40104002 break;
40114003
40124004 /* RF5_BO_WATE */
40134005 case RF5_SPELL_START + 22:
4014- dam = (rlev * 3 / (monster_is_powerful(m_idx) ? 2 : 3));
4006+ dam = (rlev * 3 / (powerful ? 2 : 3));
40154007 dice_num = 10;
40164008 dice_side = 10;
40174009 break;
@@ -4025,14 +4017,14 @@ int monspell_damage(int SPELL_NUM, int m_idx, int TYPE)
40254017
40264018 /* RF5_BO_PLAS */
40274019 case RF5_SPELL_START + 24:
4028- dam = 10 + (rlev * 3 / (monster_is_powerful(m_idx) ? 2 : 3));
4020+ dam = 10 + (rlev * 3 / (powerful ? 2 : 3));
40294021 dice_num = 8;
40304022 dice_side = 7;
40314023 break;
40324024
40334025 /* RF5_BO_ICEE */
40344026 case RF5_SPELL_START + 25:
4035- dam = (rlev * 3 / (monster_is_powerful(m_idx) ? 2 : 3));
4027+ dam = (rlev * 3 / (powerful ? 2 : 3));
40364028 dice_num = 6;
40374029 dice_side = 6;
40384030 break;
@@ -4072,9 +4064,9 @@ int monspell_damage(int SPELL_NUM, int m_idx, int TYPE)
40724064
40734065 /* RF6_PSY_SPEAR */
40744066 case RF6_SPELL_START + 11:
4075- dam = monster_is_powerful(m_idx) ? 150 : 100;
4067+ dam = powerful ? 150 : 100;
40764068 dice_num = 1;
4077- dice_side = monster_is_powerful(m_idx) ? (rlev * 2) : (rlev * 3 / 2);
4069+ dice_side = powerful ? (rlev * 2) : (rlev * 3 / 2);
40784070 break;
40794071
40804072 case RF6_SPELL_START + 12: return -1; /* RF6_DARKNESS */
@@ -4108,3 +4100,46 @@ int monspell_damage(int SPELL_NUM, int m_idx, int TYPE)
41084100
41094101 return dam;
41104102 }
4103+
4104+
4105+/*!
4106+* @brief モンスターの使う呪文の威力を返す /
4107+* @param SPELL_NUM 呪文番号
4108+* @param m_idx 呪文を唱えるモンスターID
4109+* @param TYPE DAM_MAXで最大値を返し、DAM_MINで最小値を返す。DAM_ROLLはダイスを振って値を決定する。
4110+* @return 攻撃呪文のダメージを返す。攻撃呪文以外は-1を返す。
4111+*/
4112+int monspell_damage(int SPELL_NUM, int m_idx, int TYPE)
4113+{
4114+ monster_type *m_ptr = &m_list[m_idx];
4115+ monster_race *r_ptr = &r_info[m_ptr->r_idx];
4116+ int hp;
4117+ int rlev = monster_level_idx(m_idx);
4118+
4119+ if (TYPE == DAM_MAX)
4120+ {
4121+ hp = m_ptr->max_maxhp;
4122+ }
4123+ else if (TYPE == DAM_ROLL)
4124+ {
4125+ hp = m_ptr->hp;
4126+ }
4127+ return monspell_damage_base(SPELL_NUM, hp, rlev, monster_is_powerful(m_idx), r_ptr, TYPE);
4128+}
4129+
4130+/*!
4131+* @brief モンスターの使う呪文の威力を返す /
4132+* @param SPELL_NUM 呪文番号
4133+* @param r_idx 呪文を唱えるモンスターの種族ID
4134+* @param TYPE DAM_MAXで最大値を返し、DAM_MINで最小値を返す。DAM_ROLLはダイスを振って値を決定する。
4135+* @return 攻撃呪文のダメージを返す。攻撃呪文以外は-1を返す。
4136+*/
4137+int monspell_race_damage(int SPELL_NUM, int r_idx, int TYPE)
4138+{
4139+ monster_race *r_ptr = &r_info[r_idx];
4140+ int rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
4141+ bool powerful = r_ptr->flags2 & RF2_POWERFUL;
4142+ u32b hp = r_ptr->hdice * (ironman_nightmare ? 2 : 1) * r_ptr->hside;
4143+
4144+ return monspell_damage_base(SPELL_NUM, MIN(30000, hp), rlev, powerful, r_ptr, TYPE);
4145+}
\ No newline at end of file
Show on old repository browser