A basic version of starting character rerolling

This adds a "reroll" option that lets players reroll their
character's attributes and starting inventory. Although I generally
think doing this makes the game worse, a) some players are going to
do it regardless and b) if a player is going for a challenge game,
rather than to win, it may be required. So in the absence of an
option like this, players repeatedly start and quit games instead,
creating a large number of junk logfile entries and generally
causing problems for other players on the same shared machine
(because repeatedly reloading the game is very CPU-intensive).

This should in theory be windowport-agnostic (although in practice
it may not be). Tested on tty, X11 and curses; on tty and X11 it
works fine (although X11 treats the change in attributes as
something that needs a status highlight), on curses it is slightly
jankier in terms of what other windows are drawn in the background
(but still plays correctly and I suspect this is a pre-existing
bug).

To form a complete implementation, we will need to consider the
following:

- Should there be a delay on a) starting the game and/or b)
  rerolling? If so, what should it be (maybe configurable via
  sysconf?)

- Should we take more steps to discourage players from rerolling?
  It would be bad if players see the option exists and turn it on
  just because it exists, or (worse) treat it as condoning the
  particular style of play.

- Should we take steps to detect that players are rerolling
  manually and a) tell them to use the option instead, b) tell them
  that this is not an intended way to play (and may make the game
  less enjoyable and/or prevent them getting the practice they need
  to eventually win)?

Breaks save and bones files.
This commit is contained in:
Alex Smith
2025-11-30 06:49:14 +00:00
parent e428046ffa
commit 656f58b099
11 changed files with 117 additions and 10 deletions

View File

@@ -258,6 +258,7 @@ extern void free_ebones(struct monst *) NONNULLARG1;
/* ### botl.c ### */
extern char *get_strength_str(void);
extern char *do_statusline1(void);
extern void check_gold_symbol(void);
extern char *do_statusline2(void);
@@ -2406,6 +2407,7 @@ extern int query_category(const char *, struct obj *, int, menu_item **, int) NO
/* dotypeinv() call query_objlist with NULL arg1 */
extern int query_objlist(const char *, struct obj **, int, menu_item **, int,
boolean(*)(struct obj *)) NONNULLARG24;
extern boolean reroll_menu(void);
extern struct obj *pick_obj(struct obj *) NONNULLARG1;
extern void encumber_msg(void);
extern int container_at(coordxy, coordxy, boolean);

View File

@@ -608,6 +608,9 @@ static int optfn_##a(int, int, boolean, char *, char *);
Off, No, No, No, NoAlias, (boolean *) 0, Term_False,
(char *)0)
#endif
NHOPTB(reroll, Advanced, 0, opt_in, set_in_config,
Off, Yes, No, No, NoAlias, &u.uroleplay.reroll, Term_False,
"allow rerolling of starting inventory and items")
NHOPTB(rest_on_space, Advanced, 0, opt_in, set_in_game, Off,
Yes, No, No, NoAlias, &flags.rest_on_space, Term_False,
"space bar is bound to the rest-command")

View File

@@ -17,7 +17,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files.
*/
#define EDITLEVEL 131
#define EDITLEVEL 132
/*
* Development status possibilities.

View File

@@ -163,11 +163,13 @@ struct u_conduct { /* number of times... */
};
struct u_roleplay {
boolean blind; /* permanently blind */
boolean nudist; /* has not worn any armor, ever */
boolean deaf; /* permanently deaf */
boolean pauper; /* no starting inventory */
long numbones; /* # of bones files loaded */
boolean blind; /* permanently blind */
boolean nudist; /* has not worn any armor, ever */
boolean deaf; /* permanently deaf */
boolean pauper; /* no starting inventory */
boolean reroll; /* starting inventory/attr rerolling enabled */
long numbones; /* # of bones files loaded */
long numrerolls; /* # of rerolls used */
};
/*** Unified structure containing role information ***/