MCPcopy Create free account
hub / github.com/NetHack/NetHack / gcrownu

Function gcrownu

src/pray.c:804–996  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

802}
803
804staticfn void
805gcrownu(void)
806{
807 struct obj *obj;
808 const char *what;
809 boolean already_exists, in_hand;
810 short class_gift;
811#define ok_wep(o) ((o) && ((o)->oclass == WEAPON_CLASS || is_weptool(o)))
812
813 HSee_invisible |= FROMOUTSIDE;
814 HFire_resistance |= FROMOUTSIDE;
815 HCold_resistance |= FROMOUTSIDE;
816 HShock_resistance |= FROMOUTSIDE;
817 HSleep_resistance |= FROMOUTSIDE;
818 HPoison_resistance |= FROMOUTSIDE;
819 godvoice(u.ualign.type, (char *) 0);
820
821 class_gift = STRANGE_OBJECT;
822 /* 3.3.[01] had this in the A_NEUTRAL case,
823 preventing chaotic wizards from receiving a spellbook */
824 if (Role_if(PM_WIZARD)
825 && !u_wield_art(ART_VORPAL_BLADE)
826 && !u_wield_art(ART_STORMBRINGER)
827 && !carrying(SPE_FINGER_OF_DEATH)) {
828 class_gift = SPE_FINGER_OF_DEATH;
829 } else if (Role_if(PM_MONK) && (!uwep || !uwep->oartifact)
830 && !carrying(SPE_RESTORE_ABILITY)) {
831 /* monks rarely wield a weapon */
832 class_gift = SPE_RESTORE_ABILITY;
833 }
834
835 obj = ok_wep(uwep) ? uwep : 0;
836 already_exists = in_hand = FALSE; /* lint suppression */
837 switch (u.ualign.type) {
838 case A_LAWFUL:
839 u.uevent.uhand_of_elbereth = 1;
840 SetVoice((struct monst *) 0, 0, 80, voice_deity);
841 verbalize("I crown thee... The Hand of Elbereth!");
842 livelog_printf(LL_DIVINEGIFT,
843 "was crowned \"The Hand of Elbereth\" by %s",
844 u_gname());
845 break;
846 case A_NEUTRAL:
847 u.uevent.uhand_of_elbereth = 2;
848 in_hand = u_wield_art(ART_VORPAL_BLADE);
849 already_exists = exist_artifact(LONG_SWORD,
850 artiname(ART_VORPAL_BLADE));
851 SetVoice((struct monst *) 0, 0, 80, voice_deity);
852 verbalize("Thou shalt be my Envoy of Balance!");
853 livelog_printf(LL_DIVINEGIFT, "became %s Envoy of Balance",
854 s_suffix(u_gname()));
855 break;
856 case A_CHAOTIC:
857 u.uevent.uhand_of_elbereth = 3;
858 in_hand = u_wield_art(ART_STORMBRINGER);
859 already_exists = exist_artifact(RUNESWORD,
860 artiname(ART_STORMBRINGER));
861 what = (((already_exists && !in_hand) || class_gift != STRANGE_OBJECT)

Callers 1

pleasedFunction · 0.85

Calls 15

godvoiceFunction · 0.85
carryingFunction · 0.85
verbalizeFunction · 0.85
livelog_printfFunction · 0.85
u_gnameFunction · 0.85
exist_artifactFunction · 0.85
artinameFunction · 0.85
s_suffixFunction · 0.85
mksobjFunction · 0.85
actualonameFunction · 0.85
blessFunction · 0.85
observe_objectFunction · 0.85

Tested by

no test coverage detected