Skip to content

Commit 8f0680a

Browse files
committed
New conduct: never acquired magic resistance.
This commit adds another conduct - never acquired magic resistance. Decided to add this conduct now that someone (hi tinklebear) recently ascended EvilHack without ever using MR. This conduct will not be easy, at all. Some roles will need to get creative to achieve this, such as if their quest artifact imparts MR just from holding it, or if their role starts with MR. There's only one role that can never achieve this conduct and win, and that's Infidel, as their quest artifact is required to win the game. There's some code formatting edits in here too.
1 parent c6950ab commit 8f0680a

13 files changed

+57
-35
lines changed

doc/evilhack-changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -3420,4 +3420,5 @@ The following changes to date are:
34203420
- New spells - burning hands, shocking grasp
34213421
- Fix: repair armor spell will not randomly target the Hand of Vecna
34223422
- Suppress livelogging whilst in explore mode
3423+
- New conduct: never acquired magic resistance
34233424

include/you.h

+1
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ struct u_conduct { /* number of times... */
130130
long artitouch; /* touched an artifact */
131131
long pets; /* obtained a pet */
132132
long forgedarti; /* forged an artifact */
133+
long antimagic; /* acquired magic resistance */
133134
/* genocides already listed at end of game */
134135
};
135136

src/artifact.c

+1
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,7 @@ long wp_mask;
825825
mask = &EShock_resistance;
826826
} else if (dtyp == AD_MAGM) {
827827
mask = &EAntimagic;
828+
u.uconduct.antimagic++;
828829
} else if (dtyp == AD_DISN) {
829830
mask = &EDisint_resistance;
830831
} else if (dtyp == AD_DRST) {

src/cmd.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -3150,7 +3150,6 @@ int final;
31503150
you_are("invulnerable", from_what(INVULNERABLE));
31513151
if (Antimagic)
31523152
you_are("magic-protected", from_what(ANTIMAGIC));
3153-
31543153
/* Partial intrinsic resistances */
31553154
Sprintf(buf, "%d%% fire resistant", how_resistant(FIRE_RES));
31563155
if (Fire_resistance)
@@ -3871,6 +3870,10 @@ int final;
38713870
you_have_never("forged an artifact");
38723871
}
38733872

3873+
if (!u.uconduct.antimagic) {
3874+
you_have_never("acquired magic resistance");
3875+
}
3876+
38743877
show_achievements(final);
38753878

38763879
/* Pop up the window and wait for a key */

src/do.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,10 @@ register struct obj *obj;
389389

390390
if (obj->oclass != COIN_CLASS) {
391391
/* KMH, conduct */
392-
if(!u.uconduct.gnostic++)
392+
if (!u.uconduct.gnostic++)
393393
livelog_printf(LL_CONDUCT,
394-
"eschewed atheism, by dropping %s on an altar",
395-
doname(obj));
394+
"eschewed atheism, by dropping %s on an altar",
395+
doname(obj));
396396
} else {
397397
/* coins don't have bless/curse status */
398398
obj->blessed = obj->cursed = 0;

src/engrave.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,7 @@ doengrave()
11211121

11221122
/* A single `x' is the traditional signature of an illiterate person */
11231123
if (len != 1 || (!index(ebuf, 'x') && !index(ebuf, 'X')))
1124-
if(!u.uconduct.literate++)
1124+
if (!u.uconduct.literate++)
11251125
livelog_printf(LL_CONDUCT,"became literate by engraving \"%s\"", ebuf);
11261126

11271127

src/polyself.c

+4
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,10 @@ int mntmp;
796796
if (nohands(youmonst.data))
797797
make_glib(0);
798798

799+
/* no magic resistance conduct */
800+
if (resists_mgc(youmonst.data))
801+
u.uconduct.antimagic++;
802+
799803
/*
800804
mlvl = adj_lev(&mons[mntmp]);
801805
* We can't do the above, since there's no such thing as an

src/potion.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2397,7 +2397,7 @@ dodip()
23972397
short save_dknown = obj->dknown;
23982398

23992399
/* KMH, conduct */
2400-
if(!u.uconduct.polypiles++)
2400+
if (!u.uconduct.polypiles++)
24012401
livelog_printf(LL_CONDUCT, "polymorphed %s first item", uhis());
24022402

24032403
obj = poly_obj(obj, STRANGE_OBJECT);

src/spell.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -498,9 +498,9 @@ register struct obj *spellbook;
498498

499499
if (read_tribute("books", tribtitle, 0, (char *) 0, 0,
500500
spellbook->o_id)) {
501-
if(!u.uconduct.literate++)
501+
if (!u.uconduct.literate++)
502502
livelog_printf(LL_CONDUCT,
503-
"became literate by reading %s", tribtitle);
503+
"became literate by reading %s", tribtitle);
504504
check_unpaid(spellbook);
505505
makeknown(booktype);
506506
if (!u.uevent.read_tribute) {

src/topten.c

+26-23
Original file line numberDiff line numberDiff line change
@@ -498,29 +498,30 @@ encode_extended_conducts()
498498
static char buf[BUFSZ];
499499

500500
buf[0] = '\0';
501-
add_achieveX(buf, "foodless", !u.uconduct.food);
502-
add_achieveX(buf, "vegan", !u.uconduct.unvegan);
503-
add_achieveX(buf, "vegetarian", !u.uconduct.unvegetarian);
504-
add_achieveX(buf, "atheist", !u.uconduct.gnostic);
505-
add_achieveX(buf, "weaponless", !u.uconduct.weaphit);
506-
add_achieveX(buf, "pacifist", !u.uconduct.killer);
507-
add_achieveX(buf, "illiterate", !u.uconduct.literate);
508-
add_achieveX(buf, "polyless", !u.uconduct.polypiles);
509-
add_achieveX(buf, "polyselfless", !u.uconduct.polyselfs);
510-
add_achieveX(buf, "wishless", !u.uconduct.wishes);
511-
add_achieveX(buf, "artiwishless", !u.uconduct.wisharti);
512-
add_achieveX(buf, "genocideless", !num_genocides());
513-
add_achieveX(buf, "never_had_a_pet", !u.uconduct.pets);
514-
add_achieveX(buf, "never_touched_an_artifact", !u.uconduct.artitouch);
515-
add_achieveX(buf, "elberethless", !u.uconduct.elbereth);
516-
add_achieveX(buf, "blindfolded", u.uroleplay.blind);
517-
add_achieveX(buf, "nudist", u.uroleplay.nudist);
518-
add_achieveX(buf, "hallucinating", u.uroleplay.hallu);
519-
add_achieveX(buf, "deaf", u.uroleplay.deaf);
520-
add_achieveX(buf, "bonesless", !u.uroleplay.numbones);
521-
add_achieveX(buf, "never_died", u.umortality == 0);
522-
add_achieveX(buf, "never_abused_alignment", u.ualign.abuse == 0);
523-
add_achieveX(buf, "never_forged_an_artifact", !u.uconduct.forgedarti);
501+
add_achieveX(buf, "foodless", !u.uconduct.food);
502+
add_achieveX(buf, "vegan", !u.uconduct.unvegan);
503+
add_achieveX(buf, "vegetarian", !u.uconduct.unvegetarian);
504+
add_achieveX(buf, "atheist", !u.uconduct.gnostic);
505+
add_achieveX(buf, "weaponless", !u.uconduct.weaphit);
506+
add_achieveX(buf, "pacifist", !u.uconduct.killer);
507+
add_achieveX(buf, "illiterate", !u.uconduct.literate);
508+
add_achieveX(buf, "polyless", !u.uconduct.polypiles);
509+
add_achieveX(buf, "polyselfless", !u.uconduct.polyselfs);
510+
add_achieveX(buf, "wishless", !u.uconduct.wishes);
511+
add_achieveX(buf, "artiwishless", !u.uconduct.wisharti);
512+
add_achieveX(buf, "genocideless", !num_genocides());
513+
add_achieveX(buf, "never_had_a_pet", !u.uconduct.pets);
514+
add_achieveX(buf, "never_touched_an_artifact", !u.uconduct.artitouch);
515+
add_achieveX(buf, "elberethless", !u.uconduct.elbereth);
516+
add_achieveX(buf, "blindfolded", u.uroleplay.blind);
517+
add_achieveX(buf, "nudist", u.uroleplay.nudist);
518+
add_achieveX(buf, "hallucinating", u.uroleplay.hallu);
519+
add_achieveX(buf, "deaf", u.uroleplay.deaf);
520+
add_achieveX(buf, "bonesless", !u.uroleplay.numbones);
521+
add_achieveX(buf, "never_died", u.umortality == 0);
522+
add_achieveX(buf, "never_abused_alignment", u.ualign.abuse == 0);
523+
add_achieveX(buf, "never_forged_an_artifact", !u.uconduct.forgedarti);
524+
add_achieveX(buf, "never_acquired_magic_resistance", !u.uconduct.antimagic);
524525

525526
return buf;
526527
}
@@ -594,6 +595,8 @@ encodeconduct()
594595
e |= 1L << 20;
595596
if (!u.uconduct.forgedarti)
596597
e |= 1L << 21;
598+
if (!u.uconduct.antimagic)
599+
e |= 1L << 22;
597600

598601
return e;
599602
}

src/u_init.c

+7-2
Original file line numberDiff line numberDiff line change
@@ -1630,8 +1630,13 @@ register struct trobj *origtrop;
16301630
}
16311631
}
16321632

1633-
/* nudist gets no armor */
1634-
if (u.uroleplay.nudist && obj->oclass == ARMOR_CLASS) {
1633+
/* nudist gets no armor. remove amulet for
1634+
wizards (giant and tortle races) in case
1635+
they want to try for the no magic resistance
1636+
conduct */
1637+
if (u.uroleplay.nudist
1638+
&& (obj->oclass == ARMOR_CLASS
1639+
|| (Role_if(PM_WIZARD) && obj->oclass == AMULET_CLASS))) {
16351640
dealloc_obj(obj);
16361641
origtrop++;
16371642
memcpy(&temptrop, origtrop, sizeof(struct trobj));

src/worn.c

+4
Original file line numberDiff line numberDiff line change
@@ -1645,6 +1645,10 @@ struct obj *armor;
16451645
if (!prop && Is_dragon_armor(armor))
16461646
return objects[Dragon_armor_to_scales(armor)].oc_oprop;
16471647

1648+
/* no magic resistance conduct */
1649+
if (prop == ANTIMAGIC)
1650+
u.uconduct.antimagic++;
1651+
16481652
return prop;
16491653
}
16501654

src/write.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,9 @@ register struct obj *pen;
227227
}
228228

229229
/* KMH, conduct */
230-
if(!u.uconduct.literate++)
230+
if (!u.uconduct.literate++)
231231
livelog_printf(LL_CONDUCT,
232-
"became literate by writing %s", an(typeword));
232+
"became literate by writing %s", an(typeword));
233233

234234
new_obj = mksobj(i, FALSE, FALSE);
235235
new_obj->bknown = (paper->bknown && pen->bknown);

0 commit comments

Comments
 (0)