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

Function could_seduce

src/mhitu.c:1933–1981  ·  view source on GitHub ↗

returns 0 if seduction impossible, * 1 if fine, * 2 if wrong gender for nymph */

Source from the content-addressed store, hash-verified

1931 * 2 if wrong gender for nymph
1932 */
1933int
1934could_seduce(
1935 struct monst *magr, struct monst *mdef,
1936 struct attack *mattk) /* non-Null: current atk; Null: genrl capability */
1937{
1938 struct permonst *pagr;
1939 boolean agrinvis, defperc;
1940 xint16 genagr, gendef;
1941 int adtyp;
1942
1943 if (is_animal(magr->data))
1944 return 0;
1945 if (magr == &gy.youmonst) {
1946 pagr = gy.youmonst.data;
1947 agrinvis = (Invis != 0);
1948 genagr = poly_gender();
1949 } else {
1950 pagr = magr->data;
1951 agrinvis = magr->minvis;
1952 genagr = gender(magr);
1953 }
1954 if (mdef == &gy.youmonst) {
1955 defperc = (See_invisible != 0);
1956 gendef = poly_gender();
1957 } else {
1958 defperc = perceives(mdef->data);
1959 gendef = gender(mdef);
1960 }
1961
1962 adtyp = mattk ? mattk->adtyp
1963 : dmgtype(pagr, AD_SSEX) ? AD_SSEX
1964 : dmgtype(pagr, AD_SEDU) ? AD_SEDU
1965 : AD_PHYS;
1966 if (adtyp == AD_SSEX && !SYSOPT_SEDUCE)
1967 adtyp = AD_SEDU;
1968
1969 if (agrinvis && !defperc && adtyp == AD_SEDU)
1970 return 0;
1971
1972 /* nymphs have two attacks, one for steal-item damage and the other
1973 for seduction, both pass the could_seduce() test;
1974 incubi/succubi have three attacks, their claw attacks for damage
1975 don't pass the test */
1976 if ((pagr->mlet != S_NYMPH && pagr != &mons[PM_AMOROUS_DEMON])
1977 || (adtyp != AD_SEDU && adtyp != AD_SSEX && adtyp != AD_SITM))
1978 return 0;
1979
1980 return (genagr == 1 - gendef) ? 1 : (pagr->mlet == S_NYMPH) ? 2 : 0;
1981}
1982
1983/* returns 1 if monster teleported (or hero leaves monster's vicinity) */
1984int

Callers 10

steal_itFunction · 0.85
mhitm_ad_ssexFunction · 0.85
missumFunction · 0.85
hmonasFunction · 0.85
domonnoiseFunction · 0.85
missmmFunction · 0.85
hitmmFunction · 0.85
hitmsgFunction · 0.85
missmuFunction · 0.85
wildmissFunction · 0.85

Calls 3

poly_genderFunction · 0.85
genderFunction · 0.85
dmgtypeFunction · 0.85

Tested by

no test coverage detected