Fix medit issues with parsing

This commit is contained in:
kinther 2025-12-18 14:04:12 -08:00
parent 1278c31e89
commit 9b01f484f1
4 changed files with 43 additions and 8 deletions

View file

@ -13,6 +13,8 @@ B
~
6218 0 0 0 0 0 0 0 0 E
1 3d20+40
@ -58,6 +60,8 @@ B
~
6218 0 0 0 0 0 0 0 0 E
1 3d20+40
@ -100,6 +104,8 @@ B
~
10 0 0 0 0 0 0 0 0 E
1 3d12+60
@ -124,6 +130,8 @@ B
~
10 0 0 0 0 0 0 0 0 E
1 3d8+60
@ -151,10 +159,19 @@ Its tail is four, perhaps five inches long and grey in color. Both hindlings
appear thick and ready to propel the animal if it feels threatened.
~
B
It's a rat.
~
8 0 0 0 0 0 0 0 0 E
1 0d0+10
8 8 2
Str: 6
Dex: 10
Int: 4
Wis: 4
Con: 6
Cha: 3
AtkT 4
E
$

View file

@ -1733,7 +1733,6 @@ static void parse_enhanced_mob(FILE *mob_f, int i, int nr)
exit(1);
}
/* --- Begin NPC Skill Extension --- */
else if (!strncmp(line, "Skill", 5)) {
int snum = 0, sval = 0;
if (sscanf(line, "Skill %d %d", &snum, &sval) == 2) {
@ -1745,7 +1744,22 @@ static void parse_enhanced_mob(FILE *mob_f, int i, int nr)
log("SYSERR: Malformed Skill line in mob #%d: '%s'", nr, line);
continue;
}
/* --- End NPC Skill Extension --- */
else if (!strncmp(line, "AtkT", 4)) {
int atkt = 0;
if (sscanf(line, "AtkT %d", &atkt) == 1) {
/* If stored as TYPE_* (e.g., 304), convert to index (e.g., 4). */
if (atkt >= TYPE_HIT && atkt < (TYPE_HIT + NUM_ATTACK_TYPES))
atkt -= TYPE_HIT;
/* Store only the index. */
if (atkt >= 0 && atkt < NUM_ATTACK_TYPES)
mob_proto[i].mob_specials.attack_type = atkt;
}
continue;
}
else
parse_espec(line, i, nr); /* interpret Str:, Dex:, Save*, etc. */

View file

@ -465,6 +465,10 @@ int write_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd)
fprintf(fd, "Skill %d %d\n", s, mob->mob_specials.skills[s]);
}
/* Write attack type (if set) */
if (mob->mob_specials.attack_type > 0)
fprintf(fd, "AtkT %d\n", mob->mob_specials.attack_type);
/* Single proper terminator */
fprintf(fd, "E\n");

View file

@ -1265,37 +1265,37 @@ void medit_parse(struct descriptor_data *d, char *arg)
return;
case MEDIT_STR:
GET_STR(OLC_MOB(d)) = LIMIT(i, 11, 25);
GET_STR(OLC_MOB(d)) = LIMIT(i, 1, 25);
OLC_VAL(d) = TRUE;
medit_disp_stats_menu(d);
return;
case MEDIT_INT:
GET_INT(OLC_MOB(d)) = LIMIT(i, 11, 25);
GET_INT(OLC_MOB(d)) = LIMIT(i, 1, 25);
OLC_VAL(d) = TRUE;
medit_disp_stats_menu(d);
return;
case MEDIT_WIS:
GET_WIS(OLC_MOB(d)) = LIMIT(i, 11, 25);
GET_WIS(OLC_MOB(d)) = LIMIT(i, 1, 25);
OLC_VAL(d) = TRUE;
medit_disp_stats_menu(d);
return;
case MEDIT_DEX:
GET_DEX(OLC_MOB(d)) = LIMIT(i, 11, 25);
GET_DEX(OLC_MOB(d)) = LIMIT(i, 1, 25);
OLC_VAL(d) = TRUE;
medit_disp_stats_menu(d);
return;
case MEDIT_CON:
GET_CON(OLC_MOB(d)) = LIMIT(i, 11, 25);
GET_CON(OLC_MOB(d)) = LIMIT(i, 1, 25);
OLC_VAL(d) = TRUE;
medit_disp_stats_menu(d);
return;
case MEDIT_CHA:
GET_CHA(OLC_MOB(d)) = LIMIT(i, 11, 25);
GET_CHA(OLC_MOB(d)) = LIMIT(i, 1, 25);
OLC_VAL(d) = TRUE;
medit_disp_stats_menu(d);
return;