Skip to content

Commit

Permalink
Ported the ring of carrying from xNetHack.
Browse files Browse the repository at this point in the history
From d70ba212dabc10ab3d08977a123ffdabbd76caa1.

Instead of granting +/- 5% per level of enchantment, I've bumped it up to 10%.
  • Loading branch information
elunna committed Oct 1, 2023
1 parent 52ef33c commit 4bb5fe7
Show file tree
Hide file tree
Showing 5 changed files with 506 additions and 461 deletions.
1 change: 1 addition & 0 deletions include/extern.h
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ E int FDECL(destroy_arm, (struct obj *, BOOLEAN_P));
E void FDECL(adj_abon, (struct obj *, SCHAR_P));
E boolean
FDECL(inaccessible_equipment, (struct obj *, const char *, BOOLEAN_P));
E int FDECL(ringbon, (SHORT_P));

/* ### dog.c ### */

Expand Down
21 changes: 20 additions & 1 deletion src/do_wear.c
Original file line number Diff line number Diff line change
Expand Up @@ -4177,5 +4177,24 @@ toggle_armor_light(struct obj *armor, boolean on)
}
}


/* Computes magical bonus from worn rings of a specific type.
* Intended for things that give numerical bonuses; could theoretically be
* extended later if other equipment confers a similar bonus. */
int
ringbon(ring_typ)
short ring_typ;
{
int bon = 0;
if (!objects[ring_typ].oc_charged) {
impossible("ringbon: called with non-chargeable ring?");
return 0;
}
if (uleft && uleft->otyp == ring_typ) {
bon += uleft->spe;
}
if (uright && uright->otyp == ring_typ) {
bon += uright->spe;
}
return bon;
}
/*do_wear.c*/
5 changes: 5 additions & 0 deletions src/hack.c
Original file line number Diff line number Diff line change
Expand Up @@ -3696,6 +3696,11 @@ weight_cap()
float_vs_flight();
}

/* final adjustment: ring of carrying lets you carry more than usual and go
* over the normal carrycap */
int pct_increase = ringbon(RIN_CARRYING) * 10;
carrcap = (carrcap * (100 + pct_increase)) / 100;

return (int) carrcap;
}

Expand Down
1 change: 1 addition & 0 deletions src/objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,7 @@ RING("protection", "black onyx", PROTECTION, 100,
regardless of ring's enchantment; wearing a second ring of
protection (or even one ring of protection combined with
cloak of protection) doesn't give a second MC boost */
RING("carrying", "glittery", 0, 200, 1, 1, 1, 7, GEMSTONE, CLR_WHITE),
RING("regeneration", "moonstone", REGENERATION, 200, 1, 1, 0, 6, MINERAL, HI_MINERAL),
RING("searching", "tiger eye", SEARCHING, 200, 1, 1, 0, 6, GEMSTONE, CLR_BROWN),
RING("stealth", "jade", STEALTH, 100, 1, 1, 0, 6, GEMSTONE, CLR_GREEN),
Expand Down
Loading

0 comments on commit 4bb5fe7

Please sign in to comment.