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

Function mon_reflects

src/muse.c:2794–2833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2792}
2793
2794DISABLE_WARNING_FORMAT_NONLITERAL
2795
2796boolean
2797mon_reflects(struct monst *mon, const char *str)
2798{
2799 struct obj *orefl = which_armor(mon, W_ARMS);
2800
2801 if (orefl && orefl->otyp == SHIELD_OF_REFLECTION) {
2802 if (str) {
2803 pline(str, s_suffix(mon_nam(mon)), "shield");
2804 makeknown(SHIELD_OF_REFLECTION);
2805 }
2806 return TRUE;
2807 } else if (arti_reflects(MON_WEP(mon))) {
2808 /* due to wielded artifact weapon */
2809 if (str)
2810 pline(str, s_suffix(mon_nam(mon)), "weapon");
2811 return TRUE;
2812 } else if ((orefl = which_armor(mon, W_AMUL))
2813 && orefl->otyp == AMULET_OF_REFLECTION) {
2814 if (str) {
2815 pline(str, s_suffix(mon_nam(mon)), "amulet");
2816 makeknown(AMULET_OF_REFLECTION);
2817 }
2818 return TRUE;
2819 } else if ((orefl = which_armor(mon, W_ARM))
2820 && (orefl->otyp == SILVER_DRAGON_SCALES
2821 || orefl->otyp == SILVER_DRAGON_SCALE_MAIL)) {
2822 if (str)
2823 pline(str, s_suffix(mon_nam(mon)), "armor");
2824 return TRUE;
2825 } else if (mon->data == &mons[PM_SILVER_DRAGON]
2826 || mon->data == &mons[PM_CHROMATIC_DRAGON]) {
2827 /* Silver dragons only reflect when mature; babies do not */
2828 if (str)
2829 pline(str, s_suffix(mon_nam(mon)), "scales");
2830 return TRUE;
2831 }
2832 return FALSE;
2833}
2834
2835boolean
2836ureflects(const char *fmt, const char *str)

Callers 7

gazemmFunction · 0.85
passivemmFunction · 0.85
dog_moveFunction · 0.85
dobuzzFunction · 0.85
gazemuFunction · 0.85
passiveumFunction · 0.85
use_mirrorFunction · 0.85

Calls 5

which_armorFunction · 0.85
s_suffixFunction · 0.85
mon_namFunction · 0.85
arti_reflectsFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected