Reroll patch question

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
1 year 8 months ago - 1 year 8 months ago #6515 by JTP
Reroll patch question was created by JTP
diff -BbuprN -x '*.o' /home/zizazat/tmp/glimblade/gen/src/class.c gen/src/class.c
--- /home/zizazat/tmp/glimblade/gen/src/class.c	2004-02-29 12:40:35.000000000 -0600
+++ gen/src/class.c	2004-05-10 19:31:02.000000000 -0500
@@ -1472,7 +1472,7 @@ void do_start(struct char_data *ch)
     SET_BIT_AR(AFF_FLAGS(ch), AFF_INFRAVISION);
 
   set_title(ch, NULL);
-  roll_real_abils(ch);
+  /* roll_real_abils(ch); */
 
   GET_MAX_HIT(ch)  = 10;
   GET_MAX_MANA(ch) = 100;
diff -BbuprN -x '*.o' /home/zizazat/tmp/glimblade/gen/src/constants.c gen/src/constants.c
--- /home/zizazat/tmp/glimblade/gen/src/constants.c	2004-05-01 18:16:18.000000000 -0500
+++ gen/src/constants.c	2004-05-10 19:16:21.000000000 -0500
@@ -342,6 +342,7 @@ const char *connected_types[] = {
   "Race help",
   "Class help",
   "Guild edit",
+  "Reroll stats",
   "\n"
 };
 
diff -BbuprN -x '*.o' /home/zizazat/tmp/glimblade/gen/src/db.c gen/src/db.c
--- /home/zizazat/tmp/glimblade/gen/src/db.c	2004-03-30 19:59:52.000000000 -0600
+++ gen/src/db.c	2004-05-10 19:40:44.000000000 -0500
@@ -3777,13 +3777,13 @@ void init_char(struct char_data *ch)
   for (i = 0; i < 5; i++)
     GET_SAVE(ch, i) = 0;
 
-  ch->real_abils.intel = 25;
+/*  ch->real_abils.intel = 25;
   ch->real_abils.wis = 25;
   ch->real_abils.dex = 25;
   ch->real_abils.str = 25;
   ch->real_abils.str_add = 100;
   ch->real_abils.con = 25;
-  ch->real_abils.cha = 25;
+  ch->real_abils.cha = 25; */
 
   for (i = 0; i < 3; i++)
     GET_COND(ch, i) = (GET_LEVEL(ch) == LVL_IMPL ? -1 : 24);
diff -BbuprN -x '*.o' /home/zizazat/tmp/glimblade/gen/src/interpreter.c gen/src/interpreter.c
--- /home/zizazat/tmp/glimblade/gen/src/interpreter.c	2004-05-01 18:16:04.000000000 -0500
+++ gen/src/interpreter.c	2004-05-10 19:34:53.000000000 -0500
@@ -72,6 +72,7 @@ extern const char *class_display[];
 extern const char *race_display[];
 void gedit_disp_menu(struct descriptor_data *d);
 void gedit_parse(struct descriptor_data *d, char *arg);
+void roll_real_abils(struct char_data *ch);
 
 /* local functions */
 int perform_dupe_check(struct descriptor_data *d);
@@ -1876,6 +1877,29 @@ void nanny(struct descriptor_data *d, ch
     } else
       GET_CLASS(d->character) = load_result;
 
+    write_to_output(d, "\r\nPress enter to roll your stats.");
+    STATE(d) = CON_QROLLSTATS;
+    break;
+
+  case CON_QROLLSTATS:
+    switch (*arg) {
+      case 'y':
+      case 'Y':
+        break;
+      case 'n':
+      case 'N':
+      default:
+        roll_real_abils(d->character);
+        write_to_output(d, "\r\nStr: [%d/%d] Int: [%d] Wis: [%d] Dex:"
+           " [%d] Con: [%d] Cha: [%d]",
+           GET_STR(d->character), GET_ADD(d->character),
+           GET_INT(d->character), GET_WIS(d->character),
+           GET_DEX(d->character), GET_CON(d->character),
+           GET_CHA(d->character));
+        write_to_output(d, "\r\n\r\nKeep these stats? (y/N)");
+        return;
+    }
+
     if (GET_PFILEPOS(d->character) < 0)
       GET_PFILEPOS(d->character) = create_entry(GET_PC_NAME(d->character));
     /* Now GET_NAME() will work properly. */
diff -BbuprN -x '*.o' /home/zizazat/tmp/glimblade/gen/src/structs.h gen/src/structs.h
--- /home/zizazat/tmp/glimblade/gen/src/structs.h	2004-05-01 18:10:59.000000000 -0500
+++ gen/src/structs.h	2004-05-10 19:16:02.000000000 -0500
@@ -321,6 +321,7 @@
 #define CON_CLASS_HELP   30	/* Class Help 				*/
 #define CON_QANSI		 31	/* Ask for ANSI support     */
 #define CON_GEDIT	 32	/* OLC mode - guild editor 		*/
+#define CON_QROLLSTATS	 33	/* OLC mode - guild editor 		*/
 
 /* Character equipment positions: used as index for char_data.equipment[] */
 /* NOTE: Don't confuse these constants with the ITEM_ bitvectors


I dont want stats above 18 on rerolling...Any other thoughts in the patch, you think should be written better then it is ?


Also how can i in race selection, give the possibility to go back, if they Picked elf, and dont like the class options for elf and wanna Pick a new race ?
Last edit: 1 year 8 months ago by JTP.

Please Log in or Create an account to join the conversation.

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
1 year 8 months ago - 1 year 8 months ago #6517 by JTP
Replied by JTP on topic Reroll patch question
I added it to my code....compiled. But first testchar i make i rolled and rolled and rolled 30 times got dex 19, and it didnt set to 18 after save or save quit. So its still 19.

How can that be prevented.



And how can i add a redo of selecting race ?
Last edit: 1 year 8 months ago by JTP.

Please Log in or Create an account to join the conversation.

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
1 year 8 months ago - 1 year 8 months ago #6518 by JTP
Replied by JTP on topic Reroll patch question
Ok actually when char quits, then stat file name shows dex 18...BUT when i log the char back on, its back to 19 dex ?

No items on char.




As this picture shows, i also rolled str 19 and str 20/24 way over 18 that should be max...what to do ?

The immortal wiz command reroll, does not seem to give anything above 18.
Attachments:
Last edit: 1 year 8 months ago by JTP.

Please Log in or Create an account to join the conversation.

More
1 year 8 months ago #6523 by thomas
Replied by thomas on topic Reroll patch question
how does your roll_real_abils() look like? Have you added any races?

Please Log in or Create an account to join the conversation.

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
1 year 8 months ago #6526 by JTP
Replied by JTP on topic Reroll patch question
roll_real_abils and races:
void roll_real_abils(struct char_data *ch)
{
  int i, j, k, temp;
  ubyte table[6];
  ubyte rolls[4];

  for (i = 0; i < 6; i++)
    table[i] = 0;

  for (i = 0; i < 6; i++) {

    for (j = 0; j < 4; j++)
      rolls[j] = rand_number(1, 6);

    temp = rolls[0] + rolls[1] + rolls[2] + rolls[3] -
      MIN(rolls[0], MIN(rolls[1], MIN(rolls[2], rolls[3])));

    for (k = 0; k < 6; k++)
      if (table[k] < temp) {
	temp ^= table[k];
	table[k] ^= temp;
	temp ^= table[k];
      }
  }

  ch->real_abils.str_add = 0;

  switch (GET_CLASS(ch)) {
  case CLASS_MAGIC_USER:
    ch->real_abils.intel = table[0];
    ch->real_abils.wis = table[1];
    ch->real_abils.dex = table[2];
    ch->real_abils.str = table[3];
    ch->real_abils.con = table[4];
    ch->real_abils.cha = table[5];
    break;
  case CLASS_CLERIC:
    ch->real_abils.wis = table[0];
    ch->real_abils.intel = table[1];
    ch->real_abils.str = table[2];
    ch->real_abils.dex = table[3];
    ch->real_abils.con = table[4];
    ch->real_abils.cha = table[5];
    break;
  case CLASS_ROGUE:
    ch->real_abils.dex = table[0];
    ch->real_abils.str = table[1];
    ch->real_abils.con = table[2];
    ch->real_abils.intel = table[3];
    ch->real_abils.wis = table[4];
    ch->real_abils.cha = table[5];
    break;
  case CLASS_WARRIOR:
    ch->real_abils.str = table[0];
    ch->real_abils.dex = table[1];
    ch->real_abils.con = table[2];
    ch->real_abils.wis = table[3];
    ch->real_abils.intel = table[4];
    ch->real_abils.cha = table[5];
    if (ch->real_abils.str == 18)
      ch->real_abils.str_add = rand_number(0, 100);
    break;
  case CLASS_BARBARIAN:
    ch->real_abils.str = table[0];
    ch->real_abils.dex = table[1];
    ch->real_abils.con = table[2];
    ch->real_abils.wis = table[3];
    ch->real_abils.intel = table[4];
    ch->real_abils.cha = table[5];
    if (ch->real_abils.str == 18)
      ch->real_abils.str_add = rand_number(0, 100);
    break;
  case CLASS_MONK:
    ch->real_abils.dex = table[0];
    ch->real_abils.str = table[1];
    ch->real_abils.con = table[2];
    ch->real_abils.intel = table[3];
    ch->real_abils.wis = table[4];
    ch->real_abils.cha = table[5];
    break;
  case CLASS_NECROMANCER:
    ch->real_abils.intel = table[0];
    ch->real_abils.wis = table[1];
    ch->real_abils.dex = table[2];
    ch->real_abils.str = table[3];
    ch->real_abils.con = table[4];
    ch->real_abils.cha = table[5];
    break;
  case CLASS_ANTI_PALADIN:
  case CLASS_PALADIN:
    ch->real_abils.str = table[0];
    ch->real_abils.dex = table[1];
    ch->real_abils.con = table[2];
    ch->real_abils.wis = table[3];
    ch->real_abils.intel = table[4];
    ch->real_abils.cha = table[5];
    if (ch->real_abils.str == 18)
      ch->real_abils.str_add = rand_number(0, 100);
    break;
  case CLASS_DRUID:
    ch->real_abils.wis = table[0];
    ch->real_abils.intel = table[1];
    ch->real_abils.str = table[2];
    ch->real_abils.dex = table[3];
    ch->real_abils.con = table[4];
    ch->real_abils.cha = table[5];
    break;
      case CLASS_RANGER:
    ch->real_abils.dex = table[0];
    ch->real_abils.str = table[1];
    ch->real_abils.con = table[2];
    ch->real_abils.intel = table[3];
    ch->real_abils.wis = table[4];
    ch->real_abils.cha = table[5];
    break;
  case CLASS_PSIONIST:
    ch->real_abils.intel = table[0];
    ch->real_abils.wis = table[1];
    ch->real_abils.dex = table[2];
    ch->real_abils.str = table[3];
    ch->real_abils.con = table[4];
    ch->real_abils.cha = table[5];
    break;
      case CLASS_AVATAR:
    ch->real_abils.str = table[0];
    ch->real_abils.dex = table[1];
    ch->real_abils.con = table[2];
    ch->real_abils.wis = table[3];
    ch->real_abils.intel = table[4];
    ch->real_abils.cha = table[5];
    if (ch->real_abils.str == 18)
      ch->real_abils.str_add = rand_number(0, 100);
    break;
  }

  switch (GET_RACE(ch)) {
  case RACE_HUMAN:
    break;
  case RACE_ELF:
    ch->real_abils.intel += 1;
    ch->real_abils.wis += 1;
    ch->real_abils.con -= 1;
    break;
  case RACE_GNOME:
    ch->real_abils.intel += 1;
    ch->real_abils.wis -= 1;
    break;
  case RACE_DWARF:
    ch->real_abils.con += 1;
    ch->real_abils.cha -= 1;
    break;
  case RACE_HALFLING:
    ch->real_abils.dex += 2;
    ch->real_abils.str -= 1;
    break;
  case RACE_HALF_GIANT:
    ch->real_abils.dex += 2;
    ch->real_abils.con += 2;    
    ch->real_abils.str += 3;
    ch->real_abils.intel -= 3;
    ch->real_abils.wis -= 3;
    ch->real_abils.cha -= 3;
    break;
  case RACE_ORC:
    ch->real_abils.str += 1;
    ch->real_abils.con += 1;
    ch->real_abils.wis -= 1;
    ch->real_abils.intel -= 1;
    ch->real_abils.cha -= 1;
    break;
  case RACE_OGRE:
    ch->real_abils.str += 2;
    ch->real_abils.con += 1;
    ch->real_abils.wis -= 1;
    ch->real_abils.intel -= 1;
    ch->real_abils.dex -= 1;
    ch->real_abils.cha -= 1;
    break;
  case RACE_TROLL:
    ch->real_abils.str += 1;
    ch->real_abils.con += 2;
    ch->real_abils.wis -= 2;
    ch->real_abils.intel -= 1;
    ch->real_abils.dex -= 1;
    break;
  case RACE_GOBLIN:
    ch->real_abils.dex += 1;
    ch->real_abils.intel -= 1;
    ch->real_abils.cha -= 1;
    break;

  }

  ch->aff_abils = ch->real_abils;
}

Please Log in or Create an account to join the conversation.

More
1 year 8 months ago #6527 by thomas
Replied by thomas on topic Reroll patch question
Allow me to guess - the character you were testing with were an ogre?

If the roll is 18 on the strength roll, you calculate a strength add (XX). Then you add 2 for the race and it ends up with 20/XX in strength.

Please Log in or Create an account to join the conversation.

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
1 year 8 months ago - 1 year 8 months ago #6528 by JTP
Replied by JTP on topic Reroll patch question
Yes it was.

If orc has str 18 and you cast strength spell.. Then strength will be 18/10 if strength is +1 and 18/20 if strength is +2

So how can i prevent it from going to 19 or 20 in str and con or what ever stat ?


Several races has +1 +2 or +3

Main reason for racial benefits, if to ensure that stat to be high but not over 18.
Last edit: 1 year 8 months ago by JTP.

Please Log in or Create an account to join the conversation.

More
1 year 8 months ago #6530 by thomas
Replied by thomas on topic Reroll patch question
Some things you can do:

- Make sure you use "MIN(.., 18)".
- Whereever you add to strength, make sure you add to the str_add if you get over 18:

Example from one race, adjust to fit the others:
  case RACE_HALF_GIANT:
    ch->real_abils.dex = MIN(ch->real_abils.dex + 2, 18);
    ch->real_abils.con = MIN(real_abils.con + 2, 18);    
    ch->real_abils.intel -= 3;
    ch->real_abils.wis -= 3;
    ch->real_abils.cha -= 3;
    ch->real_abils.str += 3;
    break;


// before returning
    if (ch->real_abils.str >= 18 && ch->real_abils.str_add == 0)
      ch->real_abils.str_add = rand_number(0, 100);

    while (ch->real_abils.str > 18) {
       ch->real_abils.str--;
       ch->real_abils.str_add = MIN(ch->real_abils.str_add + 10, 100);
    }

Please Log in or Create an account to join the conversation.

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
1 year 8 months ago #6532 by JTP
Replied by JTP on topic Reroll patch question
Each class that can get up to 18/100 already have:
  case CLASS_WARRIOR:
    ch->real_abils.str = table[0];
    ch->real_abils.dex = table[1];
    ch->real_abils.con = table[2];
    ch->real_abils.wis = table[3];
    ch->real_abils.intel = table[4];
    ch->real_abils.cha = table[5];
    if (ch->real_abils.str == 18)
      ch->real_abils.str_add = rand_number(0, 100);  <<--
    break;

Should i remove that, and use your version for str_add ? Or do i need both ?

Please Log in or Create an account to join the conversation.

More
1 year 8 months ago #6533 by thomas
Replied by thomas on topic Reroll patch question
You can keep or remove the existing assignment to str_add - the new line is checking if it needs to be called.

Please Log in or Create an account to join the conversation.

Time to create page: 1.464 seconds