• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

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


Commit MetaInfo

修訂77e2c6684cd68bfea687737591be5ace8e66e35e (tree)
時間2020-03-15 12:45:28
作者deskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #40256 get_mon_num()に 新しく optionを追加し GMN_ARENA を追加. / Add option argument to get_mon_num() and define GMN_ARENA.

Change Summary

差異

--- a/src/birth.c
+++ b/src/birth.c
@@ -2274,7 +2274,7 @@ void player_outfit(player_type *creature_ptr)
22742274 for (i = rand_range(3, 4); i > 0; i--)
22752275 {
22762276 object_prep(q_ptr, lookup_kind(TV_CORPSE, SV_CORPSE));
2277- q_ptr->pval = get_mon_num(creature_ptr, 2);
2277+ q_ptr->pval = get_mon_num(creature_ptr, 2, 0);
22782278 if (q_ptr->pval)
22792279 {
22802280 q_ptr->number = 1;
--- a/src/bldg.c
+++ b/src/bldg.c
@@ -1542,7 +1542,6 @@ void update_gambling_monsters(player_type *player_ptr)
15421542 int mon_level;
15431543 int power[4];
15441544 bool tekitou;
1545- bool old_inside_battle = player_ptr->phase_out;
15461545
15471546 for (i = 0; i < current_world_ptr->max_d_idx; i++)
15481547 {
@@ -1573,9 +1572,7 @@ void update_gambling_monsters(player_type *player_ptr)
15731572 while (TRUE)
15741573 {
15751574 get_mon_num_prep(player_ptr, monster_can_entry_arena, NULL);
1576- player_ptr->phase_out = TRUE;
1577- r_idx = get_mon_num(player_ptr, mon_level);
1578- player_ptr->phase_out = old_inside_battle;
1575+ r_idx = get_mon_num(player_ptr, mon_level, GMN_ARENA);
15791576 if (!r_idx) continue;
15801577
15811578 if ((r_info[r_idx].flags1 & RF1_UNIQUE) || (r_info[r_idx].flags7 & RF7_UNIQUE2))
@@ -2253,14 +2250,14 @@ static void castle_quest(player_type *player_ptr)
22532250
22542251 if (q_ptr->r_idx == 0)
22552252 {
2256- q_ptr->r_idx = get_mon_num(player_ptr, q_ptr->level + 4 + randint1(6));
2253+ q_ptr->r_idx = get_mon_num(player_ptr, q_ptr->level + 4 + randint1(6), 0);
22572254 }
22582255
22592256 monster_race *r_ptr;
22602257 r_ptr = &r_info[q_ptr->r_idx];
22612258 while ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->rarity != 1))
22622259 {
2263- q_ptr->r_idx = get_mon_num(player_ptr, q_ptr->level) + 4 + randint1(6);
2260+ q_ptr->r_idx = get_mon_num(player_ptr, q_ptr->level + 4 + randint1(6), 0);
22642261 r_ptr = &r_info[q_ptr->r_idx];
22652262 }
22662263
@@ -4015,7 +4012,6 @@ void do_cmd_bldg(player_type *player_ptr)
40154012 */
40164013 void determine_daily_bounty(player_type *player_ptr, bool conv_old)
40174014 {
4018- bool old_inside_battle = player_ptr->phase_out;
40194015 int max_dl = 3, i;
40204016 if (!conv_old)
40214017 {
@@ -4030,12 +4026,11 @@ void determine_daily_bounty(player_type *player_ptr, bool conv_old)
40304026 max_dl = MAX(max_dlv[DUNGEON_ANGBAND], 3);
40314027 }
40324028
4033- player_ptr->phase_out = TRUE;
40344029 get_mon_num_prep(player_ptr, NULL, NULL);
40354030
40364031 while (TRUE)
40374032 {
4038- today_mon = get_mon_num(player_ptr, max_dl);
4033+ today_mon = get_mon_num(player_ptr, max_dl, GMN_ARENA);
40394034 monster_race *r_ptr;
40404035 r_ptr = &r_info[today_mon];
40414036
@@ -4047,9 +4042,6 @@ void determine_daily_bounty(player_type *player_ptr, bool conv_old)
40474042 if (r_ptr->rarity > 10) continue;
40484043 break;
40494044 }
4050-
4051- player_ptr->today_mon = 0;
4052- player_ptr->phase_out = old_inside_battle;
40534045 }
40544046
40554047
@@ -4065,7 +4057,7 @@ void determine_bounty_uniques(player_type *player_ptr)
40654057 {
40664058 while (TRUE)
40674059 {
4068- current_world_ptr->bounty_r_idx[i] = get_mon_num(player_ptr, MAX_DEPTH - 1);
4060+ current_world_ptr->bounty_r_idx[i] = get_mon_num(player_ptr, MAX_DEPTH - 1, GMN_ARENA);
40694061 monster_race *r_ptr;
40704062 r_ptr = &r_info[current_world_ptr->bounty_r_idx[i]];
40714063
--- a/src/core.c
+++ b/src/core.c
@@ -3611,7 +3611,7 @@ static void process_fishing(player_type *creature_ptr)
36113611 MONRACE_IDX r_idx;
36123612 bool success = FALSE;
36133613 get_mon_num_prep(creature_ptr, monster_is_fishing_target, NULL);
3614- r_idx = get_mon_num(creature_ptr, creature_ptr->current_floor_ptr->dun_level ? creature_ptr->current_floor_ptr->dun_level : wilderness[creature_ptr->wilderness_y][creature_ptr->wilderness_x].level);
3614+ r_idx = get_mon_num(creature_ptr, creature_ptr->current_floor_ptr->dun_level ? creature_ptr->current_floor_ptr->dun_level : wilderness[creature_ptr->wilderness_y][creature_ptr->wilderness_x].level, 0);
36153615 msg_print(NULL);
36163616 if (r_idx && one_in_(2))
36173617 {
--- a/src/monster.h
+++ b/src/monster.h
@@ -345,7 +345,10 @@ extern void compact_monsters(player_type *player_ptr, int size);
345345 extern void wipe_monsters_list(player_type *player_ptr);
346346 extern MONSTER_IDX m_pop(player_type *player_ptr);
347347 extern errr get_mon_num_prep(player_type *player_ptr, monsterrace_hook_type monster_hook, monsterrace_hook_type monster_hook2);
348-extern MONRACE_IDX get_mon_num(player_type *player_ptr, DEPTH level);
348+
349+#define GMN_ARENA 0x00000001 //!< 賭け闘技場向け生成
350+extern MONRACE_IDX get_mon_num(player_type *player_ptr, DEPTH level, BIT_FLAGS option);
351+
349352 extern int lore_do_probe(player_type *player_ptr, MONRACE_IDX r_idx);
350353 extern void lore_treasure(player_type *player_ptr, MONSTER_IDX m_idx, ITEM_NUMBER num_item, ITEM_NUMBER num_gold);
351354 extern void update_monster(player_type *subject_ptr, MONSTER_IDX m_idx, bool full);
--- a/src/monster2.c
+++ b/src/monster2.c
@@ -989,7 +989,7 @@ errr get_mon_num_prep(player_type *player_ptr, monsterrace_hook_type monster_hoo
989989 * Note that if no monsters are "appropriate", then this function will
990990 * fail, and return zero, but this should *almost* never happen.
991991 */
992-MONRACE_IDX get_mon_num(player_type *player_ptr, DEPTH level)
992+MONRACE_IDX get_mon_num(player_type *player_ptr, DEPTH level, BIT_FLAGS option)
993993 {
994994 int delay = mysqrt(level * 10000L) + 400L;
995995 int reinforcement_possibility = MAX(NASTY_MON_MAX, NASTY_MON_BASE - ((current_world_ptr->dungeon_turn / (TURNS_PER_TICK * 5000L) - delay / 10)));
@@ -1003,7 +1003,7 @@ MONRACE_IDX get_mon_num(player_type *player_ptr, DEPTH level)
10031003 level += 3;
10041004 }
10051005
1006- if (!player_ptr->phase_out && !(d_info[player_ptr->dungeon_idx].flags1 & DF1_BEGINNER))
1006+ if (!(option & GMN_ARENA) && !(d_info[player_ptr->dungeon_idx].flags1 & DF1_BEGINNER))
10071007 {
10081008 if (ironman_nightmare && !randint0(reinforcement_possibility))
10091009 {
@@ -1032,7 +1032,7 @@ MONRACE_IDX get_mon_num(player_type *player_ptr, DEPTH level)
10321032 MONRACE_IDX r_idx = table[i].index;
10331033 monster_race *r_ptr;
10341034 r_ptr = &r_info[r_idx];
1035- if (!player_ptr->phase_out && !chameleon_change_m_idx)
1035+ if (!(option & GMN_ARENA) && !chameleon_change_m_idx)
10361036 {
10371037 if (((r_ptr->flags1 & (RF1_UNIQUE)) ||
10381038 (r_ptr->flags7 & (RF7_NAZGUL))) &&
@@ -2007,7 +2007,7 @@ void choose_new_monster(player_type *player_ptr, MONSTER_IDX m_idx, bool born, M
20072007
20082008 if (d_info[player_ptr->dungeon_idx].flags1 & DF1_CHAMELEON) level += 2 + randint1(3);
20092009
2010- r_idx = get_mon_num(player_ptr, level);
2010+ r_idx = get_mon_num(player_ptr, level, 0);
20112011 r_ptr = &r_info[r_idx];
20122012
20132013 chameleon_change_m_idx = 0;
@@ -2116,7 +2116,7 @@ static MONRACE_IDX initial_r_appearance(player_type *player_ptr, MONRACE_IDX r_i
21162116 DEPTH min = MIN(floor_ptr->base_level - 5, 50);
21172117 while (--attempts)
21182118 {
2119- MONRACE_IDX ap_r_idx = get_mon_num(player_ptr, floor_ptr->base_level + 10);
2119+ MONRACE_IDX ap_r_idx = get_mon_num(player_ptr, floor_ptr->base_level + 10, 0);
21202120 if (r_info[ap_r_idx].level >= min) return ap_r_idx;
21212121 }
21222122
@@ -2711,7 +2711,7 @@ bool place_monster_aux(player_type *player_ptr, MONSTER_IDX who, POSITION y, POS
27112711 if (!is_cave_empty_bold2(player_ptr, ny, nx)) continue;
27122712
27132713 get_mon_num_prep(player_ptr, place_monster_can_escort, get_monster_hook2(player_ptr, ny, nx));
2714- z = get_mon_num(player_ptr, r_ptr->level);
2714+ z = get_mon_num(player_ptr, r_ptr->level, 0);
27152715 if (!z) break;
27162716
27172717 (void)place_monster_one(player_ptr, place_monster_m_idx, ny, nx, z, mode);
@@ -2738,7 +2738,7 @@ bool place_monster(player_type *player_ptr, POSITION y, POSITION x, BIT_FLAGS mo
27382738 {
27392739 MONRACE_IDX r_idx;
27402740 get_mon_num_prep(player_ptr, get_monster_hook(player_ptr), get_monster_hook2(player_ptr, y, x));
2741- r_idx = get_mon_num(player_ptr, player_ptr->current_floor_ptr->monster_level);
2741+ r_idx = get_mon_num(player_ptr, player_ptr->current_floor_ptr->monster_level, 0);
27422742 if (!r_idx) return FALSE;
27432743
27442744 if ((one_in_(5) || (player_ptr->current_floor_ptr->base_level == 0)) &&
@@ -2770,7 +2770,7 @@ bool alloc_horde(player_type *player_ptr, POSITION y, POSITION x)
27702770 monster_race *r_ptr = NULL;
27712771 while (--attempts)
27722772 {
2773- r_idx = get_mon_num(player_ptr, floor_ptr->monster_level);
2773+ r_idx = get_mon_num(player_ptr, floor_ptr->monster_level, 0);
27742774 if (!r_idx) return FALSE;
27752775
27762776 r_ptr = &r_info[r_idx];
@@ -2996,7 +2996,7 @@ bool summon_specific(player_type *player_ptr, MONSTER_IDX who, POSITION y1, POSI
29962996 summon_unique_okay = (mode & PM_ALLOW_UNIQUE) ? TRUE : FALSE;
29972997 get_mon_num_prep(player_ptr, summon_specific_okay, get_monster_hook2(player_ptr, y, x));
29982998
2999- MONRACE_IDX r_idx = get_mon_num(player_ptr, (floor_ptr->dun_level + lev) / 2 + 5);
2999+ MONRACE_IDX r_idx = get_mon_num(player_ptr, (floor_ptr->dun_level + lev) / 2 + 5, 0);
30003000 if (!r_idx)
30013001 {
30023002 summon_specific_type = 0;
--- a/src/monsterrace-hook.c
+++ b/src/monsterrace-hook.c
@@ -30,7 +30,7 @@ void vault_prep_clone(player_type *player_ptr)
3030 get_mon_num_prep(player_ptr, vault_aux_simple, NULL);
3131
3232 /* Pick a race to clone */
33- vault_aux_race = get_mon_num(player_ptr, player_ptr->current_floor_ptr->dun_level + 10);
33+ vault_aux_race = get_mon_num(player_ptr, player_ptr->current_floor_ptr->dun_level + 10, 0);
3434
3535 /* Remove the monster restriction */
3636 get_mon_num_prep(player_ptr, NULL, NULL);
@@ -50,7 +50,7 @@ void vault_prep_symbol(player_type *player_ptr)
5050 get_mon_num_prep(player_ptr, vault_aux_simple, NULL);
5151
5252 /* Pick a race to clone */
53- r_idx = get_mon_num(player_ptr, player_ptr->current_floor_ptr->dun_level + 10);
53+ r_idx = get_mon_num(player_ptr, player_ptr->current_floor_ptr->dun_level + 10, 0);
5454
5555 /* Remove the monster restriction */
5656 get_mon_num_prep(player_ptr, NULL, NULL);
--- a/src/object2.c
+++ b/src/object2.c
@@ -2899,7 +2899,7 @@ static void a_m_aux_4(player_type *owner_ptr, object_type *o_ptr, int power)
28992899 get_mon_num_prep(owner_ptr, item_monster_okay, NULL);
29002900 while (TRUE)
29012901 {
2902- i = get_mon_num(owner_ptr, floor_ptr->dun_level);
2902+ i = get_mon_num(owner_ptr, floor_ptr->dun_level, 0);
29032903 r_ptr = &r_info[i];
29042904 check = (floor_ptr->dun_level < r_ptr->level) ? (r_ptr->level - floor_ptr->dun_level) : 0;
29052905 if (!r_ptr->rarity) continue;
--- a/src/player-status.c
+++ b/src/player-status.c
@@ -4645,7 +4645,7 @@ void sanity_blast(player_type *creature_ptr, monster_type *m_ptr, bool necro)
46454645 GAME_TEXT m_name[MAX_NLEN];
46464646 concptr desc;
46474647 get_mon_num_prep(creature_ptr, get_nightmare, NULL);
4648- r_ptr = &r_info[get_mon_num(creature_ptr, MAX_DEPTH)];
4648+ r_ptr = &r_info[get_mon_num(creature_ptr, MAX_DEPTH, 0)];
46494649 power = r_ptr->level + 10;
46504650 desc = r_name + r_ptr->name;
46514651 get_mon_num_prep(creature_ptr, NULL, NULL);
--- a/src/quest.c
+++ b/src/quest.c
@@ -55,7 +55,7 @@ void determine_random_questor(player_type *player_ptr, quest_type *q_ptr)
5555 * Random monster 5 - 10 levels out of depth
5656 * (depending on level)
5757 */
58- r_idx = get_mon_num(player_ptr, q_ptr->level + 5 + randint1(q_ptr->level / 10));
58+ r_idx = get_mon_num(player_ptr, q_ptr->level + 5 + randint1(q_ptr->level / 10), GMN_ARENA);
5959 monster_race *r_ptr;
6060 r_ptr = &r_info[r_idx];
6161
--- a/src/rooms-pitnest.c
+++ b/src/rooms-pitnest.c
@@ -319,7 +319,7 @@ bool build_type5(player_type *player_ptr)
319319 while (attempts--)
320320 {
321321 /* Get a (hard) monster type */
322- r_idx = get_mon_num(player_ptr, floor_ptr->dun_level + 11);
322+ r_idx = get_mon_num(player_ptr, floor_ptr->dun_level + 11, 0);
323323 r_ptr = &r_info[r_idx];
324324
325325 /* Decline incorrect alignment */
@@ -529,7 +529,7 @@ bool build_type6(player_type *player_ptr)
529529 while (attempts--)
530530 {
531531 /* Get a (hard) monster type */
532- r_idx = get_mon_num(player_ptr, floor_ptr->dun_level + 11);
532+ r_idx = get_mon_num(player_ptr, floor_ptr->dun_level + 11, 0);
533533 r_ptr = &r_info[r_idx];
534534
535535 /* Decline incorrect alignment */
@@ -839,7 +839,7 @@ bool build_type13(player_type *player_ptr)
839839 while (attempts--)
840840 {
841841 /* Get a (hard) monster type */
842- r_idx = get_mon_num(player_ptr, floor_ptr->dun_level + 0);
842+ r_idx = get_mon_num(player_ptr, floor_ptr->dun_level + 0, 0);
843843 r_ptr = &r_info[r_idx];
844844
845845 /* Decline incorrect alignment */
--- a/src/rooms-special.c
+++ b/src/rooms-special.c
@@ -86,7 +86,7 @@ bool build_type15(player_type *player_ptr)
8686 /* Place fixed lite berathers */
8787 for (dir1 = 4; dir1 < 8; dir1++)
8888 {
89- MONRACE_IDX r_idx = get_mon_num(player_ptr, floor_ptr->dun_level);
89+ MONRACE_IDX r_idx = get_mon_num(player_ptr, floor_ptr->dun_level, 0);
9090
9191 y = yval + 2 * ddy_ddd[dir1];
9292 x = xval + 2 * ddx_ddd[dir1];
@@ -150,7 +150,7 @@ bool build_type15(player_type *player_ptr)
150150 g_ptr->feat = feat_glass_wall;
151151 get_mon_num_prep(player_ptr, vault_aux_lite, NULL);
152152
153- r_idx = get_mon_num(player_ptr, floor_ptr->dun_level);
153+ r_idx = get_mon_num(player_ptr, floor_ptr->dun_level, 0);
154154 if (r_idx) place_monster_aux(player_ptr, 0, yval, xval, r_idx, 0L);
155155
156156 /* Walls around the breather */
@@ -217,7 +217,7 @@ bool build_type15(player_type *player_ptr)
217217 /* Place shard berathers */
218218 for (dir1 = 4; dir1 < 8; dir1++)
219219 {
220- MONRACE_IDX r_idx = get_mon_num(player_ptr, floor_ptr->dun_level);
220+ MONRACE_IDX r_idx = get_mon_num(player_ptr, floor_ptr->dun_level, 0);
221221
222222 y = yval + ddy_ddd[dir1];
223223 x = xval + ddx_ddd[dir1];
--- a/src/spells3.c
+++ b/src/spells3.c
@@ -2395,7 +2395,7 @@ static MONRACE_IDX poly_r_idx(player_type *caster_ptr, MONRACE_IDX r_idx)
23952395 MONRACE_IDX r;
23962396 for (int i = 0; i < 1000; i++)
23972397 {
2398- r = get_mon_num(caster_ptr, (caster_ptr->current_floor_ptr->dun_level + r_ptr->level) / 2 + 5);
2398+ r = get_mon_num(caster_ptr, (caster_ptr->current_floor_ptr->dun_level + r_ptr->level) / 2 + 5, 0);
23992399 if (!r) break;
24002400
24012401 r_ptr = &r_info[r];