From f1bf488367462f7b24391dd3c6cfc6885ade23c6 Mon Sep 17 00:00:00 2001 From: cohrs Date: Mon, 14 Mar 2005 15:27:53 +0000 Subject: [PATCH] passive damage As From a bug report, twice. Change max_passive_dmg to multiply the result by the number of direct attacks the aggressor can make. This way, a tame mind flayer, for example, will avoid pounding on a spotted jelly and dying as a result of the Nth passive response. --- doc/fixes35.0 | 1 + src/mondata.c | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 0d8520f9a..d3c77291a 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -78,6 +78,7 @@ message order when swapping places with a pet (e.g. into a trap), also use flyers can get out of pits more easily than non-flyers allow use of the < command to try to exit a pit clean up messages when you stop levitation while riding a flying steed +account for all attacks when determining max_passive_dmg Platform- and/or Interface-Specific Fixes diff --git a/src/mondata.c b/src/mondata.c index 0b58b45cc..80513a959 100644 --- a/src/mondata.c +++ b/src/mondata.c @@ -370,9 +370,20 @@ int max_passive_dmg(mdef, magr) register struct monst *mdef, *magr; { - int i, dmg = 0; + int i, dmg = 0, multi = 0; uchar adtyp; + /* each attack by magr can result in passive damage */ + for(i = 0; i < NATTK; i++) + switch (magr->data->mattk[i].aatyp) { + case AT_CLAW: case AT_BITE: case AT_KICK: case AT_BUTT: case AT_TUCH: + case AT_STNG: case AT_HUGS: case AT_ENGL: case AT_TENT: case AT_WEAP: + multi++; + break; + default: + break; + } + for(i = 0; i < NATTK; i++) if(mdef->data->mattk[i].aatyp == AT_NONE || mdef->data->mattk[i].aatyp == AT_BOOM) { @@ -387,7 +398,7 @@ max_passive_dmg(mdef, magr) dmg *= mdef->data->mattk[i].damd; } else dmg = 0; - return dmg; + return dmg * multi; } return 0; }