diff -uwr nethack-3.4.3-org/include/config.h nethack-3.4.3/include/config.h --- nethack-3.4.3-org/include/config.h Sat Oct 14 21:34:03 2006 +++ nethack-3.4.3/include/config.h Sun Oct 15 02:04:31 2006 @@ -351,6 +351,8 @@ /*#define GOLDOBJ */ /* Gold is kept on obj chains - Helge Hafting */ /*#define AUTOPICKUP_EXCEPTIONS */ /* exceptions to autopickup */ +#define SEPPUKU /* Samurai Ritual Suicide - Tars Tarkas */ + /* End of Section 5 */ #include "global.h" /* Define everything else according to choices above */ diff -uwr nethack-3.4.3-org/include/hack.h nethack-3.4.3/include/hack.h --- nethack-3.4.3-org/include/hack.h Sat Oct 14 21:34:03 2006 +++ nethack-3.4.3/include/hack.h Sun Oct 15 02:20:27 2006 @@ -74,12 +74,22 @@ #define CRUSHING 7 #define STONING 8 #define TURNED_SLIME 9 +#ifdef SEPPUKU +#define SAM_SUICIDE 10 +#define GENOCIDED 11 +#define PANICKED 12 +#define TRICKED 13 +#define QUIT 14 +#define ESCAPED 15 +#define ASCENDED 16 +#else #define GENOCIDED 10 #define PANICKED 11 #define TRICKED 12 #define QUIT 13 #define ESCAPED 14 #define ASCENDED 15 +#endif /* SEPPUKU */ #include "align.h" #include "dungeon.h" diff -uwr nethack-3.4.3-org/src/apply.c nethack-3.4.3/src/apply.c --- nethack-3.4.3-org/src/apply.c Sat Oct 14 21:34:03 2006 +++ nethack-3.4.3/src/apply.c Sun Oct 15 02:04:16 2006 @@ -34,6 +34,9 @@ STATIC_PTR int NDECL(set_trap); /* occupation callback */ STATIC_DCL int FDECL(use_whip, (struct obj *)); STATIC_DCL int FDECL(use_pole, (struct obj *)); +#ifdef SEPPUKU +STATIC_DCL int FDECL(use_samsword, (struct obj *)); +#endif STATIC_DCL int FDECL(use_cream_pie, (struct obj *)); STATIC_DCL int FDECL(use_grapple, (struct obj *)); STATIC_DCL int FDECL(do_break_wand, (struct obj *)); @@ -2430,6 +2433,59 @@ return (1); } +#ifdef SEPPUKU +/* Samurai Seppuku */ +STATIC_OVL int +use_samsword (obj) + struct obj *obj; +{ + int res = 0; + char rit_weapon[BUFSZ]; + register char *bp = xname(obj); + + /* Are you allowed to commit Seppuku? */ + if (strcmp(urole.name.m,"Samurai")) { + pline("You, as a %s, can't commit seppuku.",(flags.female && urole.name.f) ? urole.name.f : urole.name.m); + return (0); + } + + /* are you wielding the sword? */ + if (obj != uwep) { + if (!wield_tool(obj, "wield")) { + You("can't wield that."); + return(0); + } + else res = 1; + } + + /* "The ritual for disenbowlment was to be performed calmly and without flinching" */ + if (yn("Are you really sure you want to commit seppuku?") == 'n') { + u.ualign.record -= 10; + return 0; + } + + /* you commit seppuku */ + + if (obj_is_pname(obj) || the_unique_obj(obj)) { + if (!strncmpi(bp, "the ", 4)) + bp += 4; + Strcpy(rit_weapon, "the "); + } else + Strcpy(rit_weapon, "a "); + Strcat(rit_weapon,xname(obj)); + + killer_format = KILLED_BY; + killer = rit_weapon; + + u.uconduct.weaphit = 1; /* maybe also break pacifist conduct... */ + + You("commit seppuku with your %s.",xname(obj)); + done(SAM_SUICIDE); + /* not reached */ + return (1); +} +#endif /* SEPPUKU */ + STATIC_OVL int use_cream_pie(obj) struct obj *obj; @@ -2765,6 +2821,19 @@ return FALSE; } +#ifdef SEPPUKU +STATIC_OVL boolean +uhave_sword() +{ + register struct obj *otmp; + + for(otmp = invent; otmp; otmp = otmp->nobj) + if(is_sword(otmp)) + return TRUE; + return FALSE; +} +#endif /* SEPPUKU */ + STATIC_OVL void add_class(cl, class) char *cl; @@ -2785,7 +2854,12 @@ if(check_capacity((char *)0)) return (0); - if (carrying(POT_OIL) || uhave_graystone()) + if (carrying(POT_OIL) + || uhave_graystone() +#ifdef SEPPUKU + || uhave_sword() +#endif + ) Strcpy(class_list, tools_too); else Strcpy(class_list, tools); @@ -3009,6 +3083,11 @@ } else if (is_pick(obj) || is_axe(obj)) { res = use_pick_axe(obj); break; +#ifdef SEPPUKU + } else if (is_sword(obj)) { /* commit seppuku... */ + res = use_samsword(obj); + break; +#endif } pline("Sorry, I don't know how to use that."); xit: diff -uwr nethack-3.4.3-org/src/end.c nethack-3.4.3/src/end.c --- nethack-3.4.3-org/src/end.c Sat Oct 14 21:34:03 2006 +++ nethack-3.4.3/src/end.c Sun Oct 15 03:10:36 2006 @@ -72,7 +72,11 @@ "died", "choked", "poisoned", "starvation", "drowning", "burning", "dissolving under the heat and pressure", "crushed", "turned to stone", "turned into slime", - "genocided", "panic", "trickery", +#ifdef SEPPUKU + "commited seppuku", +#endif + "genocided", + "panic", "trickery", "quit", "escaped", "ascended" }; @@ -80,7 +84,11 @@ "died", "choked", "were poisoned", "starved", "drowned", "burned", "dissolved in the lava", "were crushed", "turned to stone", "turned into slime", - "were genocided", "panicked", "were tricked", +#ifdef SEPPUKU + "commited seppuku", +#endif + "were genocided", + "panicked", "were tricked", "quit", "escaped", "ascended" }; @@ -586,6 +594,38 @@ if (how == GENOCIDED) pline("Unfortunately you are still genocided..."); else { +#ifdef SEPPUKU + /* cheating at ritual suicide... + * Amaterasu Omikami doesn't like it, + * Raijin doesn't care, + * Susanowo likes it */ + if (how == SAM_SUICIDE) { + int align_adjust, luck_adjust; + switch(u.ualign.type) { + case A_LAWFUL: + pline("%s is not amused by your trickery!\n", u_gname()); + align_adjust = -10; + You("feel your luck decrease."); + luck_adjust = -5; + break; + case A_NEUTRAL: + align_adjust = 0; + luck_adjust = 0; + break; + case A_CHAOTIC: + pline("%s is much amused by your trickery!\n", u_gname()); + align_adjust = 10; + You("feel your luck increase."); + luck_adjust = 5; + break; + default: + You("are not aligned???"); + break; + } + u.ualign.record += align_adjust; + u.uluck += luck_adjust; + } +#endif killer = 0; killer_format = 0; return; @@ -605,6 +645,25 @@ killer_format = 0; return; } +#ifdef SEPPUKU + /* Commiting Seppuku restores your honor (alignement) + * and since you followed Bushido, you're (now) lawful */ + if (how == SAM_SUICIDE) { + int switch_align = 0; + if (u.ualign.type != A_LAWFUL) { + u.ualign.type = A_LAWFUL; + switch_align = 1; + You("returned to the path of Bushido."); + } + u.ualign.record = ALIGNLIM; + u.ugangr = 0; + if (switch_align) { + pline("%s welcomes you back.", u_gname()); + } else if (u.ugangr) { + pline("%s is mollified by your action.", u_gname()); + } + } +#endif /* * The game is now over... @@ -714,7 +773,13 @@ if (tmp < 0L) tmp = 0L; +#ifndef SEPPUKU if (how < PANICKED) +#else + /* Commiting Sepukku is quiting by roleplaying your Samurai, + * so don't reduce the score here, as a kind of reward */ + if ((how < PANICKED) && (how != SAM_SUICIDE)) +#endif tmp -= tmp / 10L; u.urexp += tmp; u.urexp += 50L * (long)(deepest - 1); diff -uwr nethack-3.4.3-org/src/topten.c nethack-3.4.3/src/topten.c --- nethack-3.4.3-org/src/topten.c Sat Oct 14 21:34:03 2006 +++ nethack-3.4.3/src/topten.c Sun Oct 15 02:34:50 2006 @@ -79,7 +79,12 @@ NEARDATA const char * const killed_by_prefix[] = { "killed by ", "choked on ", "poisoned by ", "died of ", "drowned in ", "burned by ", "dissolved in ", "crushed to death by ", "petrified by ", - "turned to slime by ", "killed by ", "", "", "", "", "" + "turned to slime by ", +#ifdef SEPPUKU + "commited seppuku with ", +#endif + "killed by ", + "", "", "", "", "" }; static winid toptenwin = WIN_ERR;