]> granicus.if.org Git - nethack/commitdiff
Conflict based off of charisma
authorPasi Kallinen <paxed@alt.org>
Wed, 19 May 2021 15:34:57 +0000 (18:34 +0300)
committerPasi Kallinen <paxed@alt.org>
Wed, 19 May 2021 15:35:00 +0000 (18:35 +0300)
Higher charisma will make it more likely for monsters to be affected.
Conflict will also now require the monster to see the hero.

Originally from SporkHack by Derek Ray.

doc/fixes37.0
include/extern.h
src/dogmove.c
src/mhitm.c
src/mon.c
src/mondata.c
src/monmove.c
src/priest.c
src/shk.c

index fffcfdf0958f7dabe1c3ee19854c8a5835776630..617c8d8f06fad6de2b511c6d6565a2f7aed8fdad 100644 (file)
@@ -524,6 +524,7 @@ knights get no metal armor penalty for clerical spells
 change touch of death from instadeath to maxhp reduction and damage
 dying from being level-drained below level 1 killed hero without saying so
        and jumped straight to "do you want your possessions identified?"
+conflict will now consider your charisma and requires line of sight
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index 5956b547d647e79489ddab363f5ff8906bc0f767..de1b834f7791c2939d90f34b994619c2037f4dee 100644 (file)
@@ -1494,6 +1494,7 @@ extern const struct permonst *raceptr(struct monst *);
 extern boolean olfaction(struct permonst *);
 unsigned long cvt_adtyp_to_mseenres(uchar);
 extern void monstseesu(unsigned long);
+extern boolean resist_conflict(struct monst *);
 
 /* ### monmove.c ### */
 
index 120f4156c110532bac0cabe1fe8048d257421179..fa5b0a38912af4c5a298a14e9ba77c8e7c49cda9 100644 (file)
@@ -885,7 +885,7 @@ dog_move(register struct monst *mtmp,
     udist = distu(omx, omy);
     /* Let steeds eat and maybe throw rider during Conflict */
     if (mtmp == u.usteed) {
-        if (Conflict && !resist(mtmp, RING_CLASS, 0, 0)) {
+        if (Conflict && !resist_conflict(mtmp)) {
             dismount_steed(DISMOUNT_THROWN);
             return 1;
         }
@@ -915,7 +915,7 @@ dog_move(register struct monst *mtmp,
     if (appr == -2)
         return 0;
 
-    if (Conflict && !resist(mtmp, RING_CLASS, 0, 0)) {
+    if (Conflict && !resist_conflict(mtmp)) {
         if (!has_edog) {
             /* Guardian angel refuses to be conflicted; rather,
              * it disappears, angrily, and sends in some nasties
index 6c046c9c0534ab63aa5feef891457f188fe0ac9f..13e36af1f3757e49440f8c93270c1e54c203eef5 100644 (file)
@@ -116,7 +116,7 @@ fightm(register struct monst *mtmp)
     nmon = 0;
 #endif
     /* perhaps the monster will resist Conflict */
-    if (resist(mtmp, RING_CLASS, 0, 0))
+    if (resist_conflict(mtmp))
         return 0;
 
     if (u.ustuck == mtmp) {
index 368d4c1ba6bd5cf835414f8e0d3b80b6372856da..80714d0525ef2db62bd1b9e54f1be78789f37b32 100644 (file)
--- a/src/mon.c
+++ b/src/mon.c
@@ -1019,7 +1019,7 @@ movemon(void)
         }
 
         /* continue if the monster died fighting */
-        if (Conflict && !mtmp->iswiz && mtmp->mcansee) {
+        if (Conflict && !mtmp->iswiz && m_canseeu(mtmp)) {
             /* Note:
              *  Conflict does not take effect in the first round.
              *  Therefore, A monster when stepping into the area will
@@ -1028,7 +1028,7 @@ movemon(void)
              *  The call to fightm() must be _last_.  The monster might
              *  have died if it returns 1.
              */
-            if (couldsee(mtmp->mx, mtmp->my)
+            if (cansee(mtmp->mx, mtmp->my)
                 && (distu(mtmp->mx, mtmp->my) <= BOLT_LIM * BOLT_LIM)
                 && fightm(mtmp))
                 continue; /* mon might have died */
@@ -1611,7 +1611,7 @@ mon_allowflags(struct monst* mtmp)
         allowflags |= ALLOW_SANCT | ALLOW_SSM;
     else
         allowflags |= ALLOW_U;
-    if (Conflict && !resist(mtmp, RING_CLASS, 0, 0))
+    if (Conflict && !resist_conflict(mtmp))
         allowflags |= ALLOW_U;
     if (mtmp->isshk)
         allowflags |= ALLOW_SSM;
index 2dc28bb0eb37703b41950a9b61b25f76c2a4389f..a85f4dea82966d42bddd1fab10f0f00d3c9ad19b 100644 (file)
@@ -1255,4 +1255,19 @@ monstseesu(unsigned long seenres)
             m_setseenres(mtmp, seenres);
 }
 
+/* Can monster resist conflict caused by hero?
+
+   High-CHA heroes will be able to 'convince' monsters
+   (through the magic of the ring, of course) to fight
+   for them much more easily than low-CHA ones.
+*/
+boolean
+resist_conflict(struct monst* mtmp)
+{
+    /* always a small chance at 19 */
+    int resist_chance = min(19, (ACURR(A_CHA) - mtmp->m_lev + u.ulevel));
+
+    return (rnd(20) > resist_chance);
+}
+
 /*mondata.c*/
index 4ba8b5acc60706375a1d607b9d78c298b4229048..7c9069820ba2cb35a0f0b2b74ca3b576b0764b5f 100644 (file)
@@ -544,7 +544,7 @@ dochug(register struct monst* mtmp)
         }
         pline("A wave of psychic energy pours over you!");
         if (mtmp->mpeaceful
-            && (!Conflict || resist(mtmp, RING_CLASS, 0, 0))) {
+            && (!Conflict || resist_conflict(mtmp))) {
             pline("It feels quite soothing.");
         } else if (!u.uinvulnerable) {
             int dmg;
@@ -710,7 +710,7 @@ dochug(register struct monst* mtmp)
      */
 
     if (tmp != 3 && (!mtmp->mpeaceful
-                     || (Conflict && !resist(mtmp, RING_CLASS, 0, 0)))) {
+                     || (Conflict && !resist_conflict(mtmp)))) {
         if (inrange && !scared && !noattacks(mdat)
             /* [is this hp check really needed?] */
             && (Upolyd ? u.mh : u.uhp) > 0) {
index a62ed76adc121471806dd6759f086ac7016a9cb3..f42743cf7f2a41f00356b9c818780d648bc05f90 100644 (file)
@@ -191,7 +191,7 @@ pri_move(struct monst *priest)
     gy += rn1(3, -1);
 
     if (!priest->mpeaceful
-        || (Conflict && !resist(priest, RING_CLASS, 0, 0))) {
+        || (Conflict && !resist_conflict(priest))) {
         if (monnear(priest, u.ux, u.uy)) {
             if (Displaced)
                 Your("displaced image doesn't fool %s!", mon_nam(priest));
index 9fe5399e361c91a5f83d12a4c1f2ab21a6f3b378..1f2f07c7548bbc5c572a36df0e45cba0a432cdd9 100644 (file)
--- a/src/shk.c
+++ b/src/shk.c
@@ -3757,7 +3757,7 @@ shk_move(struct monst* shkp)
 
     if ((udist = distu(omx, omy)) < 3 && (shkp->data != &mons[PM_GRID_BUG]
                                           || (omx == u.ux || omy == u.uy))) {
-        if (ANGRY(shkp) || (Conflict && !resist(shkp, RING_CLASS, 0, 0))) {
+        if (ANGRY(shkp) || (Conflict && !resist_conflict(shkp))) {
             if (Displaced)
                 Your("displaced image doesn't fool %s!", shkname(shkp));
             (void) mattacku(shkp);