変愚蛮怒のメインリポジトリです
Revision | 502f8f8d3b435af1f6984233b36c74a72b3d32c3 (tree) |
---|---|
Time | 2004-02-03 23:10:46 |
Author | nothere <nothere@0568...> |
Commiter | nothere |
プレイヤーのテレポート関数をteleport_player()とteleport_player_aux()
に分割. teleport_player_aux()で実際のテレポート処理を行い,
teleport_player()はteleport_player_aux()を呼んでからモンスターの追尾
処理を行う. これを利用し, 以下の変更と修正を行った.
* モンスターのテレポートアウェイでプレイヤーが飛ばされた際に, テレ
* spells3.c 1.134で, 広域マップまたは反テレポートでテレポートを禁止す
* アルコールで記憶が飛んで知らない場所に "歩いた" 場合のテレポートに
* テレポートしてプレイヤー位置が変わらない場合はupdateや効果音などの
@@ -884,11 +884,11 @@ static void do_cmd_quaff_potion_aux(int item) | ||
884 | 884 | ident = TRUE; |
885 | 885 | if (one_in_(3)) lose_all_info(); |
886 | 886 | else wiz_dark(); |
887 | - teleport_player(100, TRUE); | |
887 | + (void)teleport_player_aux(100, TRUE, TRUE); | |
888 | 888 | wiz_dark(); |
889 | 889 | #ifdef JP |
890 | -msg_print("知らない場所で目が醒めた。頭痛がする。"); | |
891 | -msg_print("何も思い出せない。どうやってここへ来たのかも分からない!"); | |
890 | + msg_print("知らない場所で目が醒めた。頭痛がする。"); | |
891 | + msg_print("何も思い出せない。どうやってここへ来たのかも分からない!"); | |
892 | 892 | #else |
893 | 893 | msg_print("You wake up somewhere with a sore head..."); |
894 | 894 | msg_print("You can't remember a thing, or how you got here!"); |
@@ -2294,7 +2294,7 @@ static void process_world_aux_mutation(void) | ||
2294 | 2294 | msg_print(NULL); |
2295 | 2295 | if (one_in_(3)) lose_all_info(); |
2296 | 2296 | else wiz_dark(); |
2297 | - teleport_player(100, TRUE); | |
2297 | + (void)teleport_player_aux(100, TRUE, TRUE); | |
2298 | 2298 | wiz_dark(); |
2299 | 2299 | #ifdef JP |
2300 | 2300 | msg_print("あなたは見知らぬ場所で目が醒めた...頭が痛い。"); |
@@ -1143,7 +1143,9 @@ extern void remove_all_mirrors(bool explode); | ||
1143 | 1143 | extern bool teleport_away(int m_idx, int dis, bool dec_valour, bool passive); |
1144 | 1144 | extern void teleport_monster_to(int m_idx, int ty, int tx, int power, bool passive); |
1145 | 1145 | extern bool cave_player_teleportable_bold(int y, int x, bool passive, bool nonmagical); |
1146 | +extern bool teleport_player_aux(int dis, bool passive, bool nonmagical); | |
1146 | 1147 | extern void teleport_player(int dis, bool passive); |
1148 | +extern void teleport_player_away(int m_idx, int dis); | |
1147 | 1149 | extern void teleport_player_to(int ny, int nx, bool no_tele, bool passive); |
1148 | 1150 | extern void teleport_away_followable(int m_idx); |
1149 | 1151 | extern void teleport_level(int m_idx); |
@@ -3636,7 +3636,7 @@ msg_format("%^s | ||
3636 | 3636 | #endif |
3637 | 3637 | |
3638 | 3638 | learn_spell(MS_TELE_AWAY); |
3639 | - teleport_player(100, TRUE); | |
3639 | + teleport_player_away(m_idx, 100); | |
3640 | 3640 | break; |
3641 | 3641 | } |
3642 | 3642 |
@@ -3342,7 +3342,7 @@ bool monst_spell_monst(int m_idx) | ||
3342 | 3342 | |
3343 | 3343 | if (!resists_tele) |
3344 | 3344 | { |
3345 | - if (t_idx == p_ptr->riding) teleport_player(MAX_SIGHT * 2 + 5, TRUE); | |
3345 | + if (t_idx == p_ptr->riding) teleport_player_away(m_idx, MAX_SIGHT * 2 + 5); | |
3346 | 3346 | else teleport_away(t_idx, MAX_SIGHT * 2 + 5, FALSE, TRUE); |
3347 | 3347 | } |
3348 | 3348 |
@@ -314,18 +314,30 @@ bool cave_player_teleportable_bold(int y, int x, bool passive, bool nonmagical) | ||
314 | 314 | |
315 | 315 | #define MAX_TELEPORT_DISTANCE 200 |
316 | 316 | |
317 | -void teleport_player(int dis, bool passive) | |
317 | +bool teleport_player_aux(int dis, bool passive, bool nonmagical) | |
318 | 318 | { |
319 | 319 | int candidates_at[MAX_TELEPORT_DISTANCE + 1]; |
320 | 320 | int total_candidates, cur_candidates; |
321 | 321 | int y = 0, x = 0, min, pick, i; |
322 | - int yy, xx, oy, ox; | |
323 | 322 | |
324 | 323 | int left = MAX(1, px - dis); |
325 | 324 | int right = MIN(cur_wid - 2, px + dis); |
326 | 325 | int top = MAX(1, py - dis); |
327 | 326 | int bottom = MIN(cur_hgt - 2, py + dis); |
328 | 327 | |
328 | + if (p_ptr->wild_mode) return FALSE; | |
329 | + | |
330 | + if (p_ptr->anti_tele && !nonmagical) | |
331 | + { | |
332 | +#ifdef JP | |
333 | + msg_print("不思議な力がテレポートを防いだ!"); | |
334 | +#else | |
335 | + msg_print("A mysterious force prevents you from teleporting!"); | |
336 | +#endif | |
337 | + | |
338 | + return FALSE; | |
339 | + } | |
340 | + | |
329 | 341 | /* Initialize counters */ |
330 | 342 | total_candidates = 0; |
331 | 343 | for (i = 0; i <= MAX_TELEPORT_DISTANCE; i++) |
@@ -342,7 +354,7 @@ void teleport_player(int dis, bool passive) | ||
342 | 354 | int d; |
343 | 355 | |
344 | 356 | /* Skip illegal locations */ |
345 | - if (!cave_player_teleportable_bold(y, x, passive, FALSE)) continue; | |
357 | + if (!cave_player_teleportable_bold(y, x, passive, nonmagical)) continue; | |
346 | 358 | |
347 | 359 | /* Calculate distance */ |
348 | 360 | d = distance(py, px, y, x); |
@@ -351,15 +363,15 @@ void teleport_player(int dis, bool passive) | ||
351 | 363 | if (d > dis) continue; |
352 | 364 | |
353 | 365 | /* Count the total number of candidates */ |
354 | - total_candidates++; | |
366 | + total_candidates++; | |
355 | 367 | |
356 | 368 | /* Count the number of candidates in this circumference */ |
357 | - candidates_at[d]++; | |
369 | + candidates_at[d]++; | |
358 | 370 | } |
359 | 371 | } |
360 | 372 | |
361 | 373 | /* No valid location! */ |
362 | - if (0 == total_candidates) return; | |
374 | + if (0 == total_candidates) return FALSE; | |
363 | 375 | |
364 | 376 | /* Fix the minimum distance */ |
365 | 377 | for (cur_candidates = 0, min = dis; min >= 0; min--) |
@@ -401,6 +413,8 @@ void teleport_player(int dis, bool passive) | ||
401 | 413 | if (!pick) break; |
402 | 414 | } |
403 | 415 | |
416 | + if (player_bold(y, x)) return FALSE; | |
417 | + | |
404 | 418 | /* Sound */ |
405 | 419 | sound(SOUND_TELEPORT); |
406 | 420 |
@@ -409,13 +423,22 @@ void teleport_player(int dis, bool passive) | ||
409 | 423 | msg_format("『こっちだぁ、%s』", player_name); |
410 | 424 | #endif |
411 | 425 | |
412 | - /* Save the old location */ | |
413 | - oy = py; | |
414 | - ox = px; | |
415 | - | |
416 | 426 | /* Move the player */ |
417 | 427 | (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP); |
418 | 428 | |
429 | + return TRUE; | |
430 | +} | |
431 | + | |
432 | +void teleport_player(int dis, bool passive) | |
433 | +{ | |
434 | + int yy, xx; | |
435 | + | |
436 | + /* Save the old location */ | |
437 | + int oy = py; | |
438 | + int ox = px; | |
439 | + | |
440 | + if (!teleport_player_aux(dis, passive, FALSE)) return; | |
441 | + | |
419 | 442 | /* Monsters with teleport ability may follow the player */ |
420 | 443 | for (xx = -1; xx < 2; xx++) |
421 | 444 | { |
@@ -424,7 +447,45 @@ void teleport_player(int dis, bool passive) | ||
424 | 447 | int tmp_m_idx = cave[oy+yy][ox+xx].m_idx; |
425 | 448 | |
426 | 449 | /* A monster except your mount may follow */ |
427 | - if (tmp_m_idx && p_ptr->riding != tmp_m_idx) | |
450 | + if (tmp_m_idx && (p_ptr->riding != tmp_m_idx)) | |
451 | + { | |
452 | + monster_type *m_ptr = &m_list[tmp_m_idx]; | |
453 | + monster_race *r_ptr = &r_info[m_ptr->r_idx]; | |
454 | + | |
455 | + /* | |
456 | + * The latter limitation is to avoid | |
457 | + * totally unkillable suckers... | |
458 | + */ | |
459 | + if ((r_ptr->flags6 & RF6_TPORT) && | |
460 | + !(r_ptr->flagsr & RFR_RES_TELE)) | |
461 | + { | |
462 | + if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, py, px, r_ptr->level, FALSE); | |
463 | + } | |
464 | + } | |
465 | + } | |
466 | + } | |
467 | +} | |
468 | + | |
469 | + | |
470 | +void teleport_player_away(int m_idx, int dis) | |
471 | +{ | |
472 | + int yy, xx; | |
473 | + | |
474 | + /* Save the old location */ | |
475 | + int oy = py; | |
476 | + int ox = px; | |
477 | + | |
478 | + if (!teleport_player_aux(dis, TRUE, FALSE)) return; | |
479 | + | |
480 | + /* Monsters with teleport ability may follow the player */ | |
481 | + for (xx = -1; xx < 2; xx++) | |
482 | + { | |
483 | + for (yy = -1; yy < 2; yy++) | |
484 | + { | |
485 | + int tmp_m_idx = cave[oy+yy][ox+xx].m_idx; | |
486 | + | |
487 | + /* A monster except your mount or caster may follow */ | |
488 | + if (tmp_m_idx && (p_ptr->riding != tmp_m_idx) && (m_idx != tmp_m_idx)) | |
428 | 489 | { |
429 | 490 | monster_type *m_ptr = &m_list[tmp_m_idx]; |
430 | 491 | monster_race *r_ptr = &r_info[m_ptr->r_idx]; |
@@ -436,7 +497,7 @@ void teleport_player(int dis, bool passive) | ||
436 | 497 | if ((r_ptr->flags6 & RF6_TPORT) && |
437 | 498 | !(r_ptr->flagsr & RFR_RES_TELE)) |
438 | 499 | { |
439 | - if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, y, x, r_ptr->level, FALSE); | |
500 | + if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, py, px, r_ptr->level, FALSE); | |
440 | 501 | } |
441 | 502 | } |
442 | 503 | } |