From e72b287ac5cdb287c541bdc052d13823afe4930d Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Sun, 7 Apr 2013 11:44:06 +0200 Subject: [PATCH] Hugging angers monsters that don't like you enough. Fix some bugs that were preventing the scoreboard from working. --- rip.c | 37 ++++++++++++++++++------------------- rogue.h | 2 ++ romance.c | 55 ++++++++++++++++++++++++++++++++++++++++++------------- 3 files changed, 62 insertions(+), 32 deletions(-) diff --git a/rip.c b/rip.c index 7d39621..e7c8edb 100644 --- a/rip.c +++ b/rip.c @@ -38,8 +38,6 @@ static char *rip[] = { 0 }; -char *killname(); - /* * death: * Do something really fun when he dies @@ -103,7 +101,7 @@ char monst; "killed", "quit", "A total loner", - "left for a date", + "left for a cuddle", "got the amulet and left" }; char scoreline[100]; @@ -118,7 +116,7 @@ char monst; strcpy(score_file, md_getroguedir()); if (*score_file) - strcat(score_file,"\\"); + strcat(score_file,"/"); strcat(score_file, "rogue36.scr"); @@ -211,6 +209,15 @@ char monst; putchar('n'); printf(" %s", killer); } + else if (scp->sc_flags >= 3) + { + printf(" with a"); + killer = killname(scp->sc_monster); + if (*killer == 'a' || *killer == 'e' || *killer == 'i' || + *killer == 'o' || *killer == 'u') + putchar('n'); + printf(" %s", killer); + } if (prflags == 1) { printf(" (%s)", scp->sc_login); @@ -233,15 +240,6 @@ char monst; scp--; } } - else if (prflags >= 3) - { - printf(" with a"); - killer = killname(scp->sc_monster); - if (*killer == 'a' || *killer == 'e' || *killer == 'i' || - *killer == 'o' || *killer == 'u') - putchar('n'); - printf(" %s", killer); - } else printf(".\n"); } @@ -268,10 +266,9 @@ total_loner(monster) char monster; { clear(); - standout(); addstr(" \n"); addstr(" You escaped from the caverns, but alone. \n"); - standend(); + addstr(" \n"); addstr("\nYou have joined the elite ranks of those who have escaped the\n"); addstr("Cavern of Cuties alive, but failed to meet anyone while there.\n"); addstr("You journey home and sell all your loot at a great profit and\n"); @@ -283,10 +280,11 @@ total_winner(monster) char monster; { clear(); - standout(); addstr(" \n"); addstr(" You got the amulet and a hot date. \n"); - standend(); + addstr(" \n"); + addstr(" @ <3 "); + addch(monster); total_something(4, monster); } @@ -294,10 +292,11 @@ mostly_winner(monster) char monster; { clear(); - standout(); addstr(" \n"); addstr(" You got a hot date. \n"); - standend(); + addstr(" \n"); + addstr(" @ <3 "); + addch(monster); total_something(3, monster); } diff --git a/rogue.h b/rogue.h index 674be73..b433321 100644 --- a/rogue.h +++ b/rogue.h @@ -73,6 +73,7 @@ #define ISMULT(type) (type == POTION || type == SCROLL || type == FOOD) #define rndchoice(a) (a[rnd(sizeof(a)/sizeof((a)[0]))]) #define hash(i) ((unsigned)(i)*2654435761u) + /* * Things that appear on the screens */ @@ -516,6 +517,7 @@ char *ctime(), *num(), *ring_num(); int readchar(WINDOW *win); int md_readchar(WINDOW *win); int wait_for(WINDOW *win, register char ch); +char *killname(register char monst); struct room *roomin(); diff --git a/romance.c b/romance.c index 3c5c2e1..7d92edc 100644 --- a/romance.c +++ b/romance.c @@ -63,7 +63,7 @@ int ydelta, xdelta; "You catch the %s staring at you out of the corner of eir eye.", "The %s blushes and waves cautiously.", }; - msg(rndchoice(msgs), monsters[tp->t_type - 'A'].m_name); + msg(rndchoice(msgs), killname(tp->t_type)); } else if (attr <= 0) { @@ -73,7 +73,7 @@ int ydelta, xdelta; "The %s tells you to stop it.", "The %s is sick of your crap.", }; - msg(rndchoice(msgs), monsters[tp->t_type - 'A'].m_name); + msg(rndchoice(msgs), killname(tp->t_type)); } else { @@ -83,7 +83,7 @@ int ydelta, xdelta; "The %s acts like it can't hear you.", "The %s doesn't care.", }; - msg(rndchoice(msgs), monsters[tp->t_type - 'A'].m_name); + msg(rndchoice(msgs), killname(tp->t_type)); } } } @@ -119,8 +119,7 @@ int ydelta, xdelta; "The %s ignores %s", "The %s isn't interested in %s", }; - msg(rndchoice(msgs), monsters[tp->t_type - 'A'].m_name, - inv_name(op, TRUE)); + msg(rndchoice(msgs), killname(tp->t_type), inv_name(op, TRUE)); return; } else if (liking > 0) @@ -129,8 +128,7 @@ int ydelta, xdelta; "The %s accepts %s.", "The %s takes %s.", }; - msg(rndchoice(msgs), monsters[tp->t_type - 'A'].m_name, - inv_name(op, TRUE)); + msg(rndchoice(msgs), killname(tp->t_type), inv_name(op, TRUE)); tp->t_stats.s_int += liking * 10; } else if (liking < 0) @@ -140,8 +138,7 @@ int ydelta, xdelta; "The %s breaks %s.", "The %s hates %s.", }; - msg(rndchoice(msgs), monsters[tp->t_type - 'A'].m_name, - inv_name(op, TRUE)); + msg(rndchoice(msgs), killname(tp->t_type), inv_name(op, TRUE)); tp->t_stats.s_int -= liking * 2; } @@ -166,14 +163,46 @@ int ydelta, xdelta; embrace() { - // Figure out if the player is near something w/ enough interest. - // Otherwise, hug something random, and make things worse. + register struct thing *tp = NULL; + register int liking; + register int dx, dy; + + for (dx = -1; dx <= 1; ++dx) + { + for (dy = -1; dy <= 1; ++dy) + { + register struct linked_list *mob; + if ((mob = find_mons(hero.y + dy, hero.x + dx))) + { + register struct thing *atp = (struct thing *)ldata(mob); + if (!tp || atp->t_stats.s_int > tp->t_stats.s_int) + tp = atp; + } + } + } + + + if (tp == NULL) + { + msg("You wrap your arms around yourself."); + return; + } + else if (tp->t_stats.s_int < INTERESTED) + { + if (tp->t_stats.s_int > 0) + tp->t_stats.s_int /= 2; + else + tp->t_stats.s_int--; + msg("The %s dodges out of the way.", killname(tp->t_type)); + return; + } + if (amulet) { - total_winner('K'); + total_winner(tp->t_type); } else { - mostly_winner('K'); + mostly_winner(tp->t_type); } } -- 2.30.2