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

Function uasmon_maxStr

src/polyself.c:1076–1119  ·  view source on GitHub ↗

determine hero's temporary strength value used while polymorphed; hero poly'd into M2_STRONG monster usually gets 18/100 strength but there are exceptions; non-M2_STRONG get maximum strength set to 18 */

Source from the content-addressed store, hash-verified

1074 hero poly'd into M2_STRONG monster usually gets 18/100 strength but
1075 there are exceptions; non-M2_STRONG get maximum strength set to 18 */
1076schar
1077uasmon_maxStr(void)
1078{
1079 const struct Race *R;
1080 int newMaxStr;
1081 int mndx = u.umonnum;
1082 struct permonst *ptr = &mons[mndx];
1083
1084 if (is_orc(ptr)) {
1085 if (mndx != PM_URUK_HAI && mndx != PM_ORC_CAPTAIN)
1086 mndx = PM_ORC;
1087 } else if (is_elf(ptr)) {
1088 mndx = PM_ELF;
1089 } else if (is_dwarf(ptr)) {
1090 mndx = PM_DWARF;
1091 } else if (is_gnome(ptr)) {
1092 mndx = PM_GNOME;
1093#if 0 /* use the mons[] value for humans */
1094 } else if (is_human(ptr)) {
1095 mndx = PM_HUMAN;
1096#endif
1097 }
1098 R = character_race(mndx);
1099
1100 if (strongmonst(ptr)) {
1101 /* ettins, titans and minotaurs don't pass the is_giant() test;
1102 giant mummies and giant zombies do but we throttle those */
1103 boolean live_H = is_giant(ptr) && !is_undead(ptr);
1104
1105 /* hero orcs are limited to 18/50 for maximum strength, so treat
1106 hero poly'd into an orc the same; goblins, orc shamans, and orc
1107 zombies don't have strongmonst() attribute so won't get here;
1108 hobgoblins and orc mummies do get here and are limited to 18/50
1109 like normal orcs; however, orc captains and Uruk-hai retain 18/100
1110 strength; hero gnomes are also limited to 18/50; hero elves are
1111 limited to 18/00 regardless of whether they're strongmonst, but
1112 the two strongmonst types (monarchs and nobles) have current
1113 strength set to 18 [by polymon()], the others don't */
1114 newMaxStr = R ? R->attrmax[A_STR] : live_H ? STR19(19) : STR18(100);
1115 } else {
1116 newMaxStr = R ? R->attrmax[A_STR] : 18; /* 18 is same as STR18(0) */
1117 }
1118 return (schar) newMaxStr;
1119}
1120
1121/* dropx() jacket for break_armor() */
1122staticfn void

Callers 1

polymonFunction · 0.85

Calls 1

character_raceFunction · 0.85

Tested by

no test coverage detected