• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision8b426cf984f894ca86289e011addeb87fa6df614 (tree)
Time2019-02-23 19:39:24
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #37353 カオスパトロンの報酬処理を acquire_chaos_weapon() に分離. / Separate chaos weapon reward by patron to acquire_chaos_weapon().

Change Summary

Incremental Difference

--- a/src/patron.c
+++ b/src/patron.c
@@ -229,12 +229,9 @@ const int chaos_rewards[MAX_PATRON][20] =
229229
230230 void gain_level_reward(int chosen_reward)
231231 {
232- object_type *q_ptr;
233- object_type forge;
234232 char wrath_reason[32] = "";
235233 int nasty_chance = 6;
236234 OBJECT_TYPE_VALUE dummy = 0;
237- OBJECT_SUBTYPE_VALUE dummy2 = 0;
238235 int type, effect;
239236 concptr reward = NULL;
240237 GAME_TEXT o_name[MAX_NLEN];
@@ -340,104 +337,9 @@ void gain_level_reward(int chosen_reward)
340337 break;
341338
342339 case REW_CHAOS_WP:
343-
344340 msg_format(_("%sの声が響き渡った:", "The voice of %s booms out:"), chaos_patrons[p_ptr->chaos_patron]);
345341 msg_print(_("「汝の行いは貴き剣に値せり。」", "'Thy deed hath earned thee a worthy blade.'"));
346- q_ptr = &forge;
347- dummy = TV_SWORD;
348- switch (randint1(p_ptr->lev))
349- {
350- case 0: case 1:
351- dummy2 = SV_DAGGER;
352- break;
353- case 2: case 3:
354- dummy2 = SV_MAIN_GAUCHE;
355- break;
356- case 4:
357- dummy2 = SV_TANTO;
358- break;
359- case 5: case 6:
360- dummy2 = SV_RAPIER;
361- break;
362- case 7: case 8:
363- dummy2 = SV_SMALL_SWORD;
364- break;
365- case 9: case 10:
366- dummy2 = SV_BASILLARD;
367- break;
368- case 11: case 12: case 13:
369- dummy2 = SV_SHORT_SWORD;
370- break;
371- case 14: case 15:
372- dummy2 = SV_SABRE;
373- break;
374- case 16: case 17:
375- dummy2 = SV_CUTLASS;
376- break;
377- case 18:
378- dummy2 = SV_WAKIZASHI;
379- break;
380- case 19:
381- dummy2 = SV_KHOPESH;
382- break;
383- case 20:
384- dummy2 = SV_TULWAR;
385- break;
386- case 21:
387- dummy2 = SV_BROAD_SWORD;
388- break;
389- case 22: case 23:
390- dummy2 = SV_LONG_SWORD;
391- break;
392- case 24: case 25:
393- dummy2 = SV_SCIMITAR;
394- break;
395- case 26:
396- dummy2 = SV_NINJATO;
397- break;
398- case 27:
399- dummy2 = SV_KATANA;
400- break;
401- case 28: case 29:
402- dummy2 = SV_BASTARD_SWORD;
403- break;
404- case 30:
405- dummy2 = SV_GREAT_SCIMITAR;
406- break;
407- case 31:
408- dummy2 = SV_CLAYMORE;
409- break;
410- case 32:
411- dummy2 = SV_ESPADON;
412- break;
413- case 33:
414- dummy2 = SV_TWO_HANDED_SWORD;
415- break;
416- case 34:
417- dummy2 = SV_FLAMBERGE;
418- break;
419- case 35:
420- dummy2 = SV_NO_DACHI;
421- break;
422- case 36:
423- dummy2 = SV_EXECUTIONERS_SWORD;
424- break;
425- case 37:
426- dummy2 = SV_ZWEIHANDER;
427- break;
428- case 38:
429- dummy2 = SV_HAYABUSA;
430- break;
431- default:
432- dummy2 = SV_BLADE_OF_CHAOS;
433- }
434-
435- object_prep(q_ptr, lookup_kind(dummy, dummy2));
436- q_ptr->to_h = 3 + randint1(dun_level) % 10;
437- q_ptr->to_d = 3 + randint1(dun_level) % 10;
438- one_resistance(q_ptr);
439- q_ptr->name2 = EGO_CHAOTIC;
440- (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
342+ acquire_chaos_weapon(p_ptr);
441343 reward = _("(混沌)の武器を手に入れた。", "chaos weapon");
442344 break;
443345
--- a/src/spells-object.c
+++ b/src/spells-object.c
@@ -1,5 +1,6 @@
11 
22 #include "angband.h"
3+#include "artifact.h"
34 #include "spells-object.h"
45 #include "object-hook.h"
56 #include "player-status.h"
@@ -466,6 +467,108 @@ void acquirement(POSITION y1, POSITION x1, int num, bool great, bool special, bo
466467 }
467468 }
468469
470+void acquire_chaos_weapon(player_type *creature_ptr)
471+{
472+ object_type forge;
473+ object_type *q_ptr = &forge;
474+ OBJECT_TYPE_VALUE dummy = TV_SWORD;
475+ OBJECT_SUBTYPE_VALUE dummy2;
476+ switch (randint1(creature_ptr->lev))
477+ {
478+ case 0: case 1:
479+ dummy2 = SV_DAGGER;
480+ break;
481+ case 2: case 3:
482+ dummy2 = SV_MAIN_GAUCHE;
483+ break;
484+ case 4:
485+ dummy2 = SV_TANTO;
486+ break;
487+ case 5: case 6:
488+ dummy2 = SV_RAPIER;
489+ break;
490+ case 7: case 8:
491+ dummy2 = SV_SMALL_SWORD;
492+ break;
493+ case 9: case 10:
494+ dummy2 = SV_BASILLARD;
495+ break;
496+ case 11: case 12: case 13:
497+ dummy2 = SV_SHORT_SWORD;
498+ break;
499+ case 14: case 15:
500+ dummy2 = SV_SABRE;
501+ break;
502+ case 16: case 17:
503+ dummy2 = SV_CUTLASS;
504+ break;
505+ case 18:
506+ dummy2 = SV_WAKIZASHI;
507+ break;
508+ case 19:
509+ dummy2 = SV_KHOPESH;
510+ break;
511+ case 20:
512+ dummy2 = SV_TULWAR;
513+ break;
514+ case 21:
515+ dummy2 = SV_BROAD_SWORD;
516+ break;
517+ case 22: case 23:
518+ dummy2 = SV_LONG_SWORD;
519+ break;
520+ case 24: case 25:
521+ dummy2 = SV_SCIMITAR;
522+ break;
523+ case 26:
524+ dummy2 = SV_NINJATO;
525+ break;
526+ case 27:
527+ dummy2 = SV_KATANA;
528+ break;
529+ case 28: case 29:
530+ dummy2 = SV_BASTARD_SWORD;
531+ break;
532+ case 30:
533+ dummy2 = SV_GREAT_SCIMITAR;
534+ break;
535+ case 31:
536+ dummy2 = SV_CLAYMORE;
537+ break;
538+ case 32:
539+ dummy2 = SV_ESPADON;
540+ break;
541+ case 33:
542+ dummy2 = SV_TWO_HANDED_SWORD;
543+ break;
544+ case 34:
545+ dummy2 = SV_FLAMBERGE;
546+ break;
547+ case 35:
548+ dummy2 = SV_NO_DACHI;
549+ break;
550+ case 36:
551+ dummy2 = SV_EXECUTIONERS_SWORD;
552+ break;
553+ case 37:
554+ dummy2 = SV_ZWEIHANDER;
555+ break;
556+ case 38:
557+ dummy2 = SV_HAYABUSA;
558+ break;
559+ default:
560+ dummy2 = SV_BLADE_OF_CHAOS;
561+ }
562+
563+ object_prep(q_ptr, lookup_kind(dummy, dummy2));
564+ q_ptr->to_h = 3 + randint1(dun_level) % 10;
565+ q_ptr->to_d = 3 + randint1(dun_level) % 10;
566+ one_resistance(q_ptr);
567+ q_ptr->name2 = EGO_CHAOTIC;
568+ (void)drop_near(q_ptr, -1, creature_ptr->y, creature_ptr->x);
569+}
570+
571+
469572 /*!
470573 * @brief 防具呪縛処理 /
471574 * Curse the players armor
--- a/src/spells-object.h
+++ b/src/spells-object.h
@@ -4,6 +4,7 @@ extern bool create_ammo(void);
44 extern bool import_magic_device(void);
55 extern void amusement(POSITION y1, POSITION x1, int num, bool known);
66 extern void acquirement(POSITION y1, POSITION x1, int num, bool great, bool special, bool known);
7+extern void acquire_chaos_weapon(player_type *creature_ptr);
78 extern bool curse_armor(void);
89 extern bool curse_weapon_object(bool force, object_type *o_ptr);
910 extern bool curse_weapon(bool force, int slot);
Show on old repository browser