From 70d2f6b18e7e0525668b795206b0a07352fc42a5 Mon Sep 17 00:00:00 2001 From: Erik Lunna Date: Wed, 1 Nov 2023 09:06:47 +0100 Subject: [PATCH] Giant turtles count as tortles. This enables turtle/tortle cannibalism, but as an interesting side effect, it also allows giant turtles to use the #monster ability to retreat into a shell. I was a bit hesitant to make this change, but it does clean up some code and simplifies the checks for tortles and turtles. --- include/mondata.h | 6 +++--- src/mhitm.c | 3 +-- src/mhitu.c | 3 +-- src/mondata.c | 2 ++ src/monst.c | 4 ++-- src/mthrowu.c | 3 +-- src/uhitm.c | 3 +-- 7 files changed, 11 insertions(+), 13 deletions(-) diff --git a/include/mondata.h b/include/mondata.h index 7757dd275..0c87c6b2c 100644 --- a/include/mondata.h +++ b/include/mondata.h @@ -542,9 +542,9 @@ /* various monsters move faster underwater vs on land */ #define is_fast_underwater(ptr) \ - (is_tortle(ptr) || (ptr) == &mons[PM_WATER_TROLL] \ - || (ptr) == &mons[PM_GIANT_TURTLE] || (ptr) == &mons[PM_BABY_CROCODILE] \ - || (ptr) == &mons[PM_CROCODILE] || (ptr) == &mons[PM_GIANT_CROCODILE] \ + (is_tortle(ptr) \ + || (ptr) == &mons[PM_WATER_TROLL] || (ptr) == &mons[PM_BABY_CROCODILE] \ + || (ptr) == &mons[PM_CROCODILE] || (ptr) == &mons[PM_GIANT_CROCODILE] \ || (ptr) == &mons[PM_BABY_SEA_DRAGON] || (ptr) == &mons[PM_SEA_DRAGON]) /* return TRUE if the monster tends to revive */ diff --git a/src/mhitm.c b/src/mhitm.c index c93a168cf..1a0933817 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -206,8 +206,7 @@ int target, roll; fmt = "%s %s %s"; Sprintf(buf, fmt, s_suffix(Monnam(mdef)), (is_dragon(mdef->data) ? "scaly hide" - : (mdef->data == &mons[PM_GIANT_TURTLE] - || is_tortle(mdef->data)) + : is_tortle(mdef->data) ? "protective shell" : "thick hide"), (rn2(2) ? "blocks" : "deflects")); diff --git a/src/mhitu.c b/src/mhitu.c index ab8c2cdd0..cc5948810 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -239,8 +239,7 @@ struct attack *mattk; && rn2(2)) { Your("%s %s %s attack.", (is_dragon(youmonst.data) ? "scaly hide" - : (youmonst.data == &mons[PM_GIANT_TURTLE] - || Race_if(PM_TORTLE)) + : is_tortle(youmonst.data) ? "protective shell" : "thick hide"), (rn2(2) ? "blocks" : "deflects"), diff --git a/src/mondata.c b/src/mondata.c index ada97d018..3713c741d 100644 --- a/src/mondata.c +++ b/src/mondata.c @@ -822,6 +822,8 @@ struct permonst *pm1, *pm2; /* other creatures are less precise */ if (is_giant(pm1)) return is_giant(pm2); /* open to quibbling here */ + if (is_tortle(pm1)) + return (is_tortle(pm2)); if (is_gnoll(pm1)) return is_gnoll(pm2); if (is_golem(pm1)) diff --git a/src/monst.c b/src/monst.c index 8ffda4c73..82b77814d 100644 --- a/src/monst.c +++ b/src/monst.c @@ -7323,7 +7323,7 @@ struct permonst _mons2[] = { M1_ANIMAL | M1_THICK_HIDE | M1_NOHANDS | M1_HERBIVORE | M1_AMPHIBIOUS | M1_SWIM, M2_HOSTILE | M2_STRONG, 0, - M4_VULNERABLE_COLD, 0, 8, CLR_BRIGHT_GREEN), + M4_VULNERABLE_COLD, MH_TORTLE, 8, CLR_BRIGHT_GREEN), MON("gila monster", S_LIZARD, /* Slash'EM */ LVL(6, 6, 6, 10, 0), (G_NOHELL | G_GENO | 1), A(ATTK(AT_BITE, AD_DRST, 2, 6), @@ -7469,7 +7469,7 @@ struct permonst _mons2[] = { SIZ(WT_HUMAN, 400, MS_HUMANOID, MZ_HUMAN), 0, 0, M1_HUMANOID | M1_OMNIVORE, M2_NOPOLY | M2_STRONG | M2_COLLECT | M2_HOSTILE, - M3_INFRAVISIBLE, 0, MH_HUMAN, 12, HI_DOMESTIC), + M3_INFRAVISIBLE, 0, MH_HUMAN, 12, HI_DOMESTIC), MON("caveman", S_HUMAN, LVL(10, 12, 10, 0, 1), (1), A(ATTK(AT_WEAP, AD_PHYS, 2, 4), diff --git a/src/mthrowu.c b/src/mthrowu.c index c3ab3d909..35fc4c463 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -92,8 +92,7 @@ const char *name; /* if null, then format `*objp' */ || (!Upolyd && Race_if(PM_TORTLE))) && rn2(2)) { Your("%s %s %s.", (is_dragon(youmonst.data) ? "scaly hide" - : (youmonst.data == &mons[PM_GIANT_TURTLE] - || Race_if(PM_TORTLE)) + : is_tortle(youmonst.data) ? "protective shell" : "thick hide"), (rn2(2) ? "blocks" : "deflects"), onm); diff --git a/src/uhitm.c b/src/uhitm.c index 14533b768..4df2b22a6 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -4216,8 +4216,7 @@ boolean wouldhavehit; pline("%s %s %s your attack.", s_suffix(Monnam(mdef)), (is_dragon(mdef->data) ? "scaly hide" - : (mdef->data == &mons[PM_GIANT_TURTLE] - || is_tortle(mdef->data)) + : is_tortle(mdef->data) ? "protective shell" : "thick hide"), (rn2(2) ? "blocks" : "deflects"));