X Tutup
Skip to content

Commit 43d331c

Browse files
committed
Nerf unicorn horn
Unicorn horns are just too good. Nerf it in similar way several other variants have done: don't let it restore attribute loss. This makes potion of restore ability more valuable, and the int loss from the (nerfed) mind flayers matter more.
1 parent a768507 commit 43d331c

File tree

5 files changed

+30
-77
lines changed

5 files changed

+30
-77
lines changed

doc/fixes37.0

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ male hero poly'd into nymph chooses charm vs seduce message based on being
135135
target and noticable if "<mon> finishes taking off his suit" is given
136136
hostile monsters with launcher and ammo try to stay away from melee range
137137
allow displacing peaceful creatures
138+
unicorn horns don't restore attribute loss anymore
138139

139140

140141
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

include/extern.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ E boolean FDECL(um_dist, (XCHAR_P, XCHAR_P, XCHAR_P));
4848
E boolean FDECL(snuff_candle, (struct obj *));
4949
E boolean FDECL(snuff_lit, (struct obj *));
5050
E boolean FDECL(catch_lit, (struct obj *));
51-
E void FDECL(use_unicorn_horn, (struct obj *));
51+
E void FDECL(use_unicorn_horn, (struct obj **));
5252
E boolean FDECL(tinnable, (struct obj *));
5353
E void NDECL(reset_trapset);
5454
E void FDECL(fig_transform, (ANY_P *, long));
@@ -994,6 +994,7 @@ E void FDECL(strbuf_empty, (strbuf_t *));
994994
E void FDECL(strbuf_nl_to_crlf, (strbuf_t *));
995995
E char *FDECL(nonconst, (const char *, char *));
996996
E int FDECL(swapbits, (int, int, int));
997+
E void FDECL(shuffle_int_array, (int *, int));
997998

998999
/* ### insight.c ### */
9991000

src/apply.c

Lines changed: 24 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1931,14 +1931,13 @@ struct obj *obj;
19311931
}
19321932

19331933
void
1934-
use_unicorn_horn(obj)
1935-
struct obj *obj;
1934+
use_unicorn_horn(optr)
1935+
struct obj **optr;
19361936
{
19371937
#define PROP_COUNT 7 /* number of properties we're dealing with */
1938-
#define ATTR_COUNT (A_MAX * 3) /* number of attribute points we might fix */
1939-
int idx, val, val_limit, trouble_count, unfixable_trbl, did_prop,
1940-
did_attr;
1941-
int trouble_list[PROP_COUNT + ATTR_COUNT];
1938+
int idx, val, val_limit, trouble_count, unfixable_trbl, did_prop;
1939+
int trouble_list[PROP_COUNT];
1940+
struct obj *obj = (optr ? *optr : (struct obj *) 0);
19421941

19431942
if (obj && obj->cursed) {
19441943
long lcount = (long) rn1(90, 10);
@@ -1962,7 +1961,10 @@ struct obj *obj;
19621961
make_stunned((HStun & TIMEOUT) + lcount, TRUE);
19631962
break;
19641963
case 4:
1965-
(void) adjattrib(rn2(A_MAX), -1, FALSE);
1964+
if (Vomiting)
1965+
vomit();
1966+
else
1967+
make_vomiting(14L, FALSE);
19661968
break;
19671969
case 5:
19681970
(void) make_hallucinated((HHallucination & TIMEOUT) + lcount,
@@ -1980,13 +1982,10 @@ struct obj *obj;
19801982
/*
19811983
* Entries in the trouble list use a very simple encoding scheme.
19821984
*/
1983-
#define prop2trbl(X) ((X) + A_MAX)
1984-
#define attr2trbl(Y) (Y)
1985-
#define prop_trouble(X) trouble_list[trouble_count++] = prop2trbl(X)
1986-
#define attr_trouble(Y) trouble_list[trouble_count++] = attr2trbl(Y)
1985+
#define prop_trouble(X) trouble_list[trouble_count++] = (X)
19871986
#define TimedTrouble(P) (((P) && !((P) & ~TIMEOUT)) ? ((P) & TIMEOUT) : 0L)
19881987

1989-
trouble_count = unfixable_trbl = did_prop = did_attr = 0;
1988+
trouble_count = unfixable_trbl = did_prop = 0;
19901989

19911990
/* collect property troubles */
19921991
if (TimedTrouble(Sick))
@@ -2006,44 +2005,11 @@ struct obj *obj;
20062005
if (TimedTrouble(HDeaf))
20072006
prop_trouble(DEAF);
20082007

2009-
unfixable_trbl = unfixable_trouble_count(TRUE);
2010-
2011-
/* collect attribute troubles */
2012-
for (idx = 0; idx < A_MAX; idx++) {
2013-
if (ABASE(idx) >= AMAX(idx))
2014-
continue;
2015-
val_limit = AMAX(idx);
2016-
/* this used to adjust 'val_limit' for A_STR when u.uhs was
2017-
WEAK or worse, but that's handled via ATEMP(A_STR) now */
2018-
if (Fixed_abil) {
2019-
/* potion/spell of restore ability override sustain ability
2020-
intrinsic but unicorn horn usage doesn't */
2021-
unfixable_trbl += val_limit - ABASE(idx);
2022-
continue;
2023-
}
2024-
/* don't recover more than 3 points worth of any attribute */
2025-
if (val_limit > ABASE(idx) + 3)
2026-
val_limit = ABASE(idx) + 3;
2027-
2028-
for (val = ABASE(idx); val < val_limit; val++)
2029-
attr_trouble(idx);
2030-
/* keep track of unfixed trouble, for message adjustment below */
2031-
unfixable_trbl += (AMAX(idx) - val_limit);
2032-
}
2033-
20342008
if (trouble_count == 0) {
20352009
pline1(nothing_happens);
20362010
return;
2037-
} else if (trouble_count > 1) { /* shuffle */
2038-
int i, j, k;
2039-
2040-
for (i = trouble_count - 1; i > 0; i--)
2041-
if ((j = rn2(i + 1)) != i) {
2042-
k = trouble_list[j];
2043-
trouble_list[j] = trouble_list[i];
2044-
trouble_list[i] = k;
2045-
}
2046-
}
2011+
} else if (trouble_count > 1)
2012+
shuffle_int_array(trouble_list, trouble_count);
20472013

20482014
/*
20492015
* Chances for number of troubles to be fixed
@@ -2060,60 +2026,47 @@ struct obj *obj;
20602026
idx = trouble_list[val];
20612027

20622028
switch (idx) {
2063-
case prop2trbl(SICK):
2029+
case SICK:
20642030
make_sick(0L, (char *) 0, TRUE, SICK_ALL);
20652031
did_prop++;
20662032
break;
2067-
case prop2trbl(BLINDED):
2033+
case BLINDED:
20682034
make_blinded((long) u.ucreamed, TRUE);
20692035
did_prop++;
20702036
break;
2071-
case prop2trbl(HALLUC):
2037+
case HALLUC:
20722038
(void) make_hallucinated(0L, TRUE, 0L);
20732039
did_prop++;
20742040
break;
2075-
case prop2trbl(VOMITING):
2041+
case VOMITING:
20762042
make_vomiting(0L, TRUE);
20772043
did_prop++;
20782044
break;
2079-
case prop2trbl(CONFUSION):
2045+
case CONFUSION:
20802046
make_confused(0L, TRUE);
20812047
did_prop++;
20822048
break;
2083-
case prop2trbl(STUNNED):
2049+
case STUNNED:
20842050
make_stunned(0L, TRUE);
20852051
did_prop++;
20862052
break;
2087-
case prop2trbl(DEAF):
2053+
case DEAF:
20882054
make_deaf(0L, TRUE);
20892055
did_prop++;
20902056
break;
20912057
default:
2092-
if (idx >= 0 && idx < A_MAX) {
2093-
ABASE(idx) += 1;
2094-
did_attr++;
2095-
} else
2096-
panic("use_unicorn_horn: bad trouble? (%d)", idx);
2058+
impossible("use_unicorn_horn: bad trouble? (%d)", idx);
20972059
break;
20982060
}
20992061
}
21002062

2101-
if (did_attr || did_prop)
2063+
if (did_prop)
21022064
g.context.botl = TRUE;
2103-
if (did_attr)
2104-
pline("This makes you feel %s!",
2105-
(did_prop + did_attr) == (trouble_count + unfixable_trbl)
2106-
? "great"
2107-
: "better");
2108-
else if (!did_prop)
2065+
else
21092066
pline("Nothing seems to happen.");
21102067

21112068
#undef PROP_COUNT
2112-
#undef ATTR_COUNT
2113-
#undef prop2trbl
2114-
#undef attr2trbl
21152069
#undef prop_trouble
2116-
#undef attr_trouble
21172070
#undef TimedTrouble
21182071
}
21192072

@@ -3809,7 +3762,7 @@ doapply()
38093762
use_figurine(&obj);
38103763
break;
38113764
case UNICORN_HORN:
3812-
use_unicorn_horn(obj);
3765+
use_unicorn_horn(&obj);
38133766
break;
38143767
case WOODEN_FLUTE:
38153768
case MAGIC_FLUTE:

src/cmd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ domonability(VOID_ARGS)
721721
} else
722722
There("is no fountain here.");
723723
} else if (is_unicorn(g.youmonst.data)) {
724-
use_unicorn_horn((struct obj *) 0);
724+
use_unicorn_horn((struct obj **) 0);
725725
return 1;
726726
} else if (g.youmonst.data->msound == MS_SHRIEK) {
727727
You("shriek.");

src/hacklib.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
void strbuf_nl_to_crlf (strbuf_t *)
7474
char * nonconst (const char *, char *)
7575
int swapbits (int, int, int)
76-
UNUSED void shuffle_int_array (int *, int)
76+
void shuffle_int_array (int *, int)
7777
=*/
7878
#ifdef LINT
7979
#define Static /* pacify lint */
@@ -1302,9 +1302,8 @@ int val, bita, bitb;
13021302
return (val ^ ((tmp << bita) | (tmp << bitb)));
13031303
}
13041304

1305-
#if 0
13061305
/* randomize the given list of numbers 0 <= i < count */
1307-
static void
1306+
void
13081307
shuffle_int_array(indices, count)
13091308
int *indices;
13101309
int count;
@@ -1319,6 +1318,5 @@ int count;
13191318
indices[iswap] = temp;
13201319
}
13211320
}
1322-
#endif
13231321

13241322
/*hacklib.c*/

0 commit comments

Comments
 (0)
X Tutup