returns 0 if seduction impossible, * 1 if fine, * 2 if wrong gender for nymph */
| 1931 | * 2 if wrong gender for nymph |
| 1932 | */ |
| 1933 | int |
| 1934 | could_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) */ |
| 1984 | int |
no test coverage detected