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

Function max_mon_load

src/mon.c:1926–1954  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1924}
1925
1926int
1927max_mon_load(struct monst *mtmp)
1928{
1929 long maxload;
1930
1931 /* Base monster carrying capacity is equal to human maximum
1932 * carrying capacity, or half human maximum if not strong.
1933 * (for a polymorphed player, the value used would be the
1934 * non-polymorphed carrying capacity instead of max/half max).
1935 * This is then modified by the ratio between the monster weights
1936 * and human weights. Corpseless monsters are given a capacity
1937 * proportional to their size instead of weight.
1938 */
1939 if (!mtmp->data->cwt)
1940 maxload = (MAX_CARR_CAP * (long) mtmp->data->msize) / MZ_HUMAN;
1941 else if (!strongmonst(mtmp->data)
1942 || (strongmonst(mtmp->data) && (mtmp->data->cwt > WT_HUMAN)))
1943 maxload = (MAX_CARR_CAP * (long) mtmp->data->cwt) / WT_HUMAN;
1944 else
1945 maxload = MAX_CARR_CAP; /*strong monsters w/cwt <= WT_HUMAN*/
1946
1947 if (!strongmonst(mtmp->data))
1948 maxload /= 2;
1949
1950 if (maxload < 1)
1951 maxload = 1;
1952
1953 return (int) maxload;
1954}
1955
1956/* can monster touch object safely? */
1957boolean

Callers 2

can_carryFunction · 0.85
mon_would_take_itemFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected