Unify revealing hiding monsters for mvm attacks
Whether the monster-vs-monster hits or misses, hiders are revealed the same way. Unify that part of the code. Use git show --patience to have a better view of the changes.
This commit is contained in:
+20
-34
@@ -22,6 +22,7 @@ static int FDECL(mdamagem, (struct monst *, struct monst *,
|
|||||||
static void FDECL(mswingsm, (struct monst *, struct monst *,
|
static void FDECL(mswingsm, (struct monst *, struct monst *,
|
||||||
struct obj *));
|
struct obj *));
|
||||||
static void FDECL(noises, (struct monst *, struct attack *));
|
static void FDECL(noises, (struct monst *, struct attack *));
|
||||||
|
static void FDECL(pre_mm_attack, (struct monst *, struct monst *));
|
||||||
static void FDECL(missmm, (struct monst *, struct monst *,
|
static void FDECL(missmm, (struct monst *, struct monst *,
|
||||||
struct attack *));
|
struct attack *));
|
||||||
static int FDECL(passivemm, (struct monst *, struct monst *,
|
static int FDECL(passivemm, (struct monst *, struct monst *,
|
||||||
@@ -44,14 +45,10 @@ register struct attack *mattk;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static void
|
||||||
void
|
pre_mm_attack(magr, mdef)
|
||||||
missmm(magr, mdef, mattk)
|
struct monst *magr, *mdef;
|
||||||
register struct monst *magr, *mdef;
|
|
||||||
struct attack *mattk;
|
|
||||||
{
|
{
|
||||||
const char *fmt;
|
|
||||||
char buf[BUFSZ];
|
|
||||||
boolean showit = FALSE;
|
boolean showit = FALSE;
|
||||||
|
|
||||||
/* unhiding or unmimicking happens even if hero can't see it
|
/* unhiding or unmimicking happens even if hero can't see it
|
||||||
@@ -80,7 +77,21 @@ struct attack *mattk;
|
|||||||
map_invisible(mdef->mx, mdef->my);
|
map_invisible(mdef->mx, mdef->my);
|
||||||
else if (showit)
|
else if (showit)
|
||||||
newsym(mdef->mx, mdef->my);
|
newsym(mdef->mx, mdef->my);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
void
|
||||||
|
missmm(magr, mdef, mattk)
|
||||||
|
register struct monst *magr, *mdef;
|
||||||
|
struct attack *mattk;
|
||||||
|
{
|
||||||
|
const char *fmt;
|
||||||
|
char buf[BUFSZ];
|
||||||
|
|
||||||
|
pre_mm_attack(magr, mdef);
|
||||||
|
|
||||||
|
if (g.vis) {
|
||||||
fmt = (could_seduce(magr, mdef, mattk) && !magr->mcan)
|
fmt = (could_seduce(magr, mdef, mattk) && !magr->mcan)
|
||||||
? "%s pretends to be friendly to"
|
? "%s pretends to be friendly to"
|
||||||
: "%s misses";
|
: "%s misses";
|
||||||
@@ -530,39 +541,14 @@ struct attack *mattk;
|
|||||||
boolean weaponhit = ((mattk->aatyp == AT_WEAP
|
boolean weaponhit = ((mattk->aatyp == AT_WEAP
|
||||||
|| (mattk->aatyp == AT_CLAW && g.otmp))),
|
|| (mattk->aatyp == AT_CLAW && g.otmp))),
|
||||||
silverhit = (weaponhit && g.otmp
|
silverhit = (weaponhit && g.otmp
|
||||||
&& objects[g.otmp->otyp].oc_material == SILVER),
|
&& objects[g.otmp->otyp].oc_material == SILVER);
|
||||||
showit = FALSE;
|
|
||||||
|
|
||||||
/* unhiding or unmimicking happens even if hero can't see it
|
pre_mm_attack(magr, mdef);
|
||||||
because the formerly concealed monster is now in action */
|
|
||||||
if (M_AP_TYPE(mdef)) {
|
|
||||||
seemimic(mdef);
|
|
||||||
showit |= g.vis;
|
|
||||||
} else if (mdef->mundetected) {
|
|
||||||
mdef->mundetected = 0;
|
|
||||||
showit |= g.vis;
|
|
||||||
}
|
|
||||||
if (M_AP_TYPE(magr)) {
|
|
||||||
seemimic(magr);
|
|
||||||
showit |= g.vis;
|
|
||||||
} else if (magr->mundetected) {
|
|
||||||
magr->mundetected = 0;
|
|
||||||
showit |= g.vis;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g.vis) {
|
if (g.vis) {
|
||||||
int compat;
|
int compat;
|
||||||
char buf[BUFSZ];
|
char buf[BUFSZ];
|
||||||
|
|
||||||
if (!canspotmon(magr))
|
|
||||||
map_invisible(magr->mx, magr->my);
|
|
||||||
else if (showit)
|
|
||||||
newsym(magr->mx, magr->my);
|
|
||||||
if (!canspotmon(mdef))
|
|
||||||
map_invisible(mdef->mx, mdef->my);
|
|
||||||
else if (showit)
|
|
||||||
newsym(mdef->mx, mdef->my);
|
|
||||||
|
|
||||||
if ((compat = could_seduce(magr, mdef, mattk)) && !magr->mcan) {
|
if ((compat = could_seduce(magr, mdef, mattk)) && !magr->mcan) {
|
||||||
Sprintf(buf, "%s %s", Monnam(magr),
|
Sprintf(buf, "%s %s", Monnam(magr),
|
||||||
mdef->mcansee ? "smiles at" : "talks to");
|
mdef->mcansee ? "smiles at" : "talks to");
|
||||||
|
|||||||
Reference in New Issue
Block a user