- Show value of objects based on your skills

- Morningstar should also deal piercing damage
- potion of greed modified to detect objects based on value
- Two-hand weapons are now usable one-handed with very high STR
- Gain skill points faster
- Scimitar is now AGI based, not STR
- No eating when nauseated
This commit is contained in:
Rob Pearce 2023-10-10 21:30:16 +11:00
parent 54980b6cc1
commit 17461f9c24
8 changed files with 533 additions and 352 deletions

17
data.c
View File

@ -8729,7 +8729,8 @@ void initobjects(void) {
addflag(lastot->flags, F_VALUE, 300, NA, NA, NULL); addflag(lastot->flags, F_VALUE, 300, NA, NA, NULL);
addot(OT_RING_GREED, "ring of greed", "Much sought after by treasure hunters, this ring detects the presence of any nearby objects.", MT_METAL, 0.1, OC_RING, SZ_MINI); addot(OT_RING_GREED, "ring of greed", "Much sought after by treasure hunters, this ring detects the presence of any nearby objects.", MT_METAL, 0.1, OC_RING, SZ_MINI);
addflag(lastot->flags, F_RARITY, H_ALL, 75, RR_UNCOMMON, ""); addflag(lastot->flags, F_RARITY, H_ALL, 75, RR_UNCOMMON, "");
addflag(lastot->flags, F_EQUIPCONFER, F_DETECTOBS, 10, NA, NULL); addflag(lastot->flags, F_EQUIPCONFER, F_DETECTOBS, 10, NA, "50");
addflag(lastot->flags, F_EQUIPCONFER, F_DETECTMETAL, NA, NA, NULL);
addflag(lastot->flags, F_VALUE, 250, NA, NA, NULL); addflag(lastot->flags, F_VALUE, 250, NA, NA, NULL);
addot(OT_RING_SIGHT, "ring of sight", "Allows the caster to see the invisible, and in the dark.", MT_METAL, 0.1, OC_RING, SZ_MINI); addot(OT_RING_SIGHT, "ring of sight", "Allows the caster to see the invisible, and in the dark.", MT_METAL, 0.1, OC_RING, SZ_MINI);
addflag(lastot->flags, F_RARITY, H_ALL, 75, RR_UNCOMMON, ""); addflag(lastot->flags, F_RARITY, H_ALL, 75, RR_UNCOMMON, "");
@ -9657,7 +9658,7 @@ void initobjects(void) {
addflag(lastot->flags, F_ALTDAM, DT_BASH, 3, NA, "hilt bash"); // with the hilt addflag(lastot->flags, F_ALTDAM, DT_BASH, 3, NA, "hilt bash"); // with the hilt
addflag(lastot->flags, F_ACCURACY, 80, NA, NA, NULL); addflag(lastot->flags, F_ACCURACY, 80, NA, NA, NULL);
addflag(lastot->flags, F_USESSKILL, SK_LONGBLADES, NA, NA, NULL); addflag(lastot->flags, F_USESSKILL, SK_LONGBLADES, NA, NA, NULL);
addflag(lastot->flags, F_ATTREQ, A_STR, 40, 60, "3"); addflag(lastot->flags, F_ATTREQ, A_AGI, 40, 60, "3");
addflag(lastot->flags, F_CRITCHANCE, 7, NA, NA, NULL); addflag(lastot->flags, F_CRITCHANCE, 7, NA, NA, NULL);
addflag(lastot->flags, F_CANBLOCK, DT_SLASH, NA, NA, NULL); addflag(lastot->flags, F_CANBLOCK, DT_SLASH, NA, NA, NULL);
@ -9984,7 +9985,8 @@ void initobjects(void) {
addflag(lastot->flags, F_RARITY, H_DUNGEON, 70, NA, NULL); addflag(lastot->flags, F_RARITY, H_DUNGEON, 70, NA, NULL);
addflag(lastot->flags, F_RARITY, H_CAVE, 70, NA, NULL); addflag(lastot->flags, F_RARITY, H_CAVE, 70, NA, NULL);
addflag(lastot->flags, F_OBATTACKDELAY, 150, NA, NA, NULL); addflag(lastot->flags, F_OBATTACKDELAY, 150, NA, NA, NULL);
addflag(lastot->flags, F_DAM, DT_BASH, 12, NA, NULL); addflag(lastot->flags, F_DAM, DT_BASH, 9, NA, NULL);
addflag(lastot->flags, F_EXTRADAM, DT_PIERCE, NA, NA, "1d4");
addflag(lastot->flags, F_ARMOURPIERCE, 6, NA, NA, ""); addflag(lastot->flags, F_ARMOURPIERCE, 6, NA, NA, "");
addflag(lastot->flags, F_ACCURACY, 80, NA, NA, NULL); addflag(lastot->flags, F_ACCURACY, 80, NA, NA, NULL);
addflag(lastot->flags, F_TWOHANDED, SZ_HUMAN, NA, NA, NULL); addflag(lastot->flags, F_TWOHANDED, SZ_HUMAN, NA, NA, NULL);
@ -20769,6 +20771,7 @@ void initskills(void) {
addskilldesc(SK_ARMOUR, PR_NOVICE, "^gReduces armour penalties by 10%.^n", B_FALSE); addskilldesc(SK_ARMOUR, PR_NOVICE, "^gReduces armour penalties by 10%.^n", B_FALSE);
addskilldesc(SK_ARMOUR, PR_NOVICE, "^gYou can now recognise the quality of armour.^n", B_FALSE); addskilldesc(SK_ARMOUR, PR_NOVICE, "^gYou can now recognise the quality of armour.^n", B_FALSE);
addskilldesc(SK_ARMOUR, PR_BEGINNER, "^gReduces armour penalties by 20%.^n", B_FALSE); addskilldesc(SK_ARMOUR, PR_BEGINNER, "^gReduces armour penalties by 20%.^n", B_FALSE);
addskilldesc(SK_ARMOUR, PR_BEGINNER, "^gYou can determine the value of armour.^n", B_FALSE);
addskilldesc(SK_ARMOUR, PR_ADEPT, "^gReduces armour penalties by 30%.^n", B_FALSE); addskilldesc(SK_ARMOUR, PR_ADEPT, "^gReduces armour penalties by 30%.^n", B_FALSE);
addskilldesc(SK_ARMOUR, PR_SKILLED, "^gReduces armour penalties by 40%.^n", B_FALSE); addskilldesc(SK_ARMOUR, PR_SKILLED, "^gReduces armour penalties by 40%.^n", B_FALSE);
addskilldesc(SK_ARMOUR, PR_EXPERT, "^gReduces armour penalties by 50%.^n", B_FALSE); addskilldesc(SK_ARMOUR, PR_EXPERT, "^gReduces armour penalties by 50%.^n", B_FALSE);
@ -20835,6 +20838,7 @@ void initskills(void) {
addskilldesc(SK_COOKING, PR_BEGINNER, "^gYou now recognise bad food.^n", B_TRUE); addskilldesc(SK_COOKING, PR_BEGINNER, "^gYou now recognise bad food.^n", B_TRUE);
addskilldesc(SK_COOKING, PR_BEGINNER, "^gYou can now cook recipes using up to 2 ingredients.^n", B_TRUE); addskilldesc(SK_COOKING, PR_BEGINNER, "^gYou can now cook recipes using up to 2 ingredients.^n", B_TRUE);
addskilldesc(SK_COOKING, PR_BEGINNER, "^gYou can now cook up to Small sized corpses.^n", B_TRUE); addskilldesc(SK_COOKING, PR_BEGINNER, "^gYou can now cook up to Small sized corpses.^n", B_TRUE);
addskilldesc(SK_COOKING, PR_BEGINNER, "^gYou can determine the value of all food.^n", B_FALSE);
addskilldesc(SK_COOKING, PR_ADEPT, "^gYou can now cook recipes using up to 3 ingredients.^n", B_TRUE); addskilldesc(SK_COOKING, PR_ADEPT, "^gYou can now cook recipes using up to 3 ingredients.^n", B_TRUE);
addskilldesc(SK_COOKING, PR_ADEPT, "^gYou can now cook up to Medium sized corpses.^n", B_TRUE); addskilldesc(SK_COOKING, PR_ADEPT, "^gYou can now cook up to Medium sized corpses.^n", B_TRUE);
addskilldesc(SK_COOKING, PR_SKILLED, "^gYou can now cook recipes using up to 4 ingredients.^n", B_TRUE); addskilldesc(SK_COOKING, PR_SKILLED, "^gYou can now cook recipes using up to 4 ingredients.^n", B_TRUE);
@ -20925,6 +20929,7 @@ void initskills(void) {
addskilldesc(SK_SHIELDS, PR_NOVICE, "^gYou can now recognise the quality of shields.^n", B_FALSE); addskilldesc(SK_SHIELDS, PR_NOVICE, "^gYou can now recognise the quality of shields.^n", B_FALSE);
addskilldesc(SK_SHIELDS, PR_BEGINNER, "^gShield accuracy penalties are reduced by 2.^n", B_FALSE); addskilldesc(SK_SHIELDS, PR_BEGINNER, "^gShield accuracy penalties are reduced by 2.^n", B_FALSE);
addskillabil(SK_SHIELDS, PR_BEGINNER, OT_A_SHIELDBASH, NA, NULL, B_TRUE); addskillabil(SK_SHIELDS, PR_BEGINNER, OT_A_SHIELDBASH, NA, NULL, B_TRUE);
addskilldesc(SK_SHIELDS, PR_BEGINNER, "^gYou can determine the value of shields.^n", B_FALSE);
addskilldesc(SK_SHIELDS, PR_ADEPT, "^gShield accuracy penalties are reduced by 3.^n", B_FALSE); addskilldesc(SK_SHIELDS, PR_ADEPT, "^gShield accuracy penalties are reduced by 3.^n", B_FALSE);
addskillabil(SK_SHIELDS, PR_ADEPT, OT_A_FULLSHIELD, NA, NULL, B_TRUE); addskillabil(SK_SHIELDS, PR_ADEPT, OT_A_FULLSHIELD, NA, NULL, B_TRUE);
addskilldesc(SK_SHIELDS, PR_SKILLED, "^gShield accuracy penalties are reduced by 4.^n", B_FALSE); addskilldesc(SK_SHIELDS, PR_SKILLED, "^gShield accuracy penalties are reduced by 4.^n", B_FALSE);
@ -21012,6 +21017,7 @@ void initskills(void) {
addskilldesc(SK_LORE_ARCANA, PR_NOVICE, "^gYou can attempt to identify wands with the 'inspect' ability.^n", B_FALSE); addskilldesc(SK_LORE_ARCANA, PR_NOVICE, "^gYou can attempt to identify wands with the 'inspect' ability.^n", B_FALSE);
addskillabil(SK_LORE_ARCANA, PR_NOVICE, OT_A_INSPECT, NA, NULL, B_FALSE); addskillabil(SK_LORE_ARCANA, PR_NOVICE, OT_A_INSPECT, NA, NULL, B_FALSE);
addskilldesc(SK_LORE_ARCANA, PR_BEGINNER, "^gYou can now recognise very common wands.", B_TRUE); addskilldesc(SK_LORE_ARCANA, PR_BEGINNER, "^gYou can now recognise very common wands.", B_TRUE);
addskilldesc(SK_LORE_ARCANA, PR_BEGINNER, "^gYou can determine the value of all wands.^n", B_FALSE);
addskilldesc(SK_LORE_ARCANA, PR_ADEPT, "^gYou can now recognise common wands.", B_TRUE); addskilldesc(SK_LORE_ARCANA, PR_ADEPT, "^gYou can now recognise common wands.", B_TRUE);
addskilldesc(SK_LORE_ARCANA, PR_EXPERT, "^gYou can now recognise uncommon wands.", B_TRUE); addskilldesc(SK_LORE_ARCANA, PR_EXPERT, "^gYou can now recognise uncommon wands.", B_TRUE);
addskilldesc(SK_LORE_ARCANA, PR_MASTER, "^gYou can now recognise rare wands.", B_TRUE); addskilldesc(SK_LORE_ARCANA, PR_MASTER, "^gYou can now recognise rare wands.", B_TRUE);
@ -21021,6 +21027,7 @@ void initskills(void) {
addskillabil(SK_LORE_CHEMISTRY, PR_NOVICE, OT_A_INSPECT, NA, NULL, B_FALSE); addskillabil(SK_LORE_CHEMISTRY, PR_NOVICE, OT_A_INSPECT, NA, NULL, B_FALSE);
addskilldesc(SK_LORE_CHEMISTRY, PR_NOVICE, "^gYou can now mix venom sacs into potions to create poison.^n", B_TRUE); addskilldesc(SK_LORE_CHEMISTRY, PR_NOVICE, "^gYou can now mix venom sacs into potions to create poison.^n", B_TRUE);
addskilldesc(SK_LORE_CHEMISTRY, PR_BEGINNER, "^gYou can now recognise very common potions.^n", B_TRUE); addskilldesc(SK_LORE_CHEMISTRY, PR_BEGINNER, "^gYou can now recognise very common potions.^n", B_TRUE);
addskilldesc(SK_LORE_CHEMISTRY, PR_BEGINNER, "^gYou can determine the value of all potions.^n", B_FALSE);
addskilldesc(SK_LORE_CHEMISTRY, PR_ADEPT, "^gYou can now recognise common potions.^n", B_TRUE); addskilldesc(SK_LORE_CHEMISTRY, PR_ADEPT, "^gYou can now recognise common potions.^n", B_TRUE);
addskilldesc(SK_LORE_CHEMISTRY, PR_SKILLED, "^gYou can now bottle the blood of all creatures.^n", B_TRUE); addskilldesc(SK_LORE_CHEMISTRY, PR_SKILLED, "^gYou can now bottle the blood of all creatures.^n", B_TRUE);
addskilldesc(SK_LORE_CHEMISTRY, PR_EXPERT, "^gYou can now recognise uncommon potions.^n", B_TRUE); addskilldesc(SK_LORE_CHEMISTRY, PR_EXPERT, "^gYou can now recognise uncommon potions.^n", B_TRUE);
@ -21036,16 +21043,19 @@ void initskills(void) {
addskillabil(SK_LORE_LANGUAGE, PR_NOVICE, OT_A_INSPECT, NA, NULL, B_FALSE); addskillabil(SK_LORE_LANGUAGE, PR_NOVICE, OT_A_INSPECT, NA, NULL, B_FALSE);
addskillabil(SK_LORE_LANGUAGE, PR_ADEPT, OT_A_STUDYSCROLL, NA, NULL, B_TRUE); addskillabil(SK_LORE_LANGUAGE, PR_ADEPT, OT_A_STUDYSCROLL, NA, NULL, B_TRUE);
addskilldesc(SK_LORE_LANGUAGE, PR_BEGINNER, "^gYou can now recognise very common scrolls and books.", B_TRUE); addskilldesc(SK_LORE_LANGUAGE, PR_BEGINNER, "^gYou can now recognise very common scrolls and books.", B_TRUE);
addskilldesc(SK_LORE_LANGUAGE, PR_BEGINNER, "^gYou can determine the value of all scrolls and books.^n", B_FALSE);
addskilldesc(SK_LORE_LANGUAGE, PR_ADEPT, "^gYou can now recognise common scrolls and books.", B_TRUE); addskilldesc(SK_LORE_LANGUAGE, PR_ADEPT, "^gYou can now recognise common scrolls and books.", B_TRUE);
addskilldesc(SK_LORE_LANGUAGE, PR_EXPERT, "^gYou can now recognise uncommon scrolls and books.", B_TRUE); addskilldesc(SK_LORE_LANGUAGE, PR_EXPERT, "^gYou can now recognise uncommon scrolls and books.", B_TRUE);
addskilldesc(SK_LORE_LANGUAGE, PR_MASTER, "^gYou can now recognise rare scrolls and books.", B_TRUE); addskilldesc(SK_LORE_LANGUAGE, PR_MASTER, "^gYou can now recognise rare scrolls and books.", B_TRUE);
addskill(SK_LORE_NATURE, "Lore:Nature", "Determines your knowledge of plants, animals and insects.", 5); addskill(SK_LORE_NATURE, "Lore:Nature", "Determines your knowledge of plants, animals and insects.", 5);
addskilldesc(SK_LORE_NATURE, PR_BEGINNER, "^gYou can determine the value of all flora.^n", B_FALSE);
addskill(SK_LORE_UNDEAD, "Lore:Undead", "Determines your knowledge of the undead.", 5); addskill(SK_LORE_UNDEAD, "Lore:Undead", "Determines your knowledge of the undead.", 5);
addskill(SK_LORE_DRAGONS, "Lore:Wyrms", "Determines your knowledge about wryms.", 5); addskill(SK_LORE_DRAGONS, "Lore:Wyrms", "Determines your knowledge about wryms.", 5);
addskill(SK_LORE_RELICS, "Lore:Relics", "Allows you a chance of recognising rings and amulets.", 5); addskill(SK_LORE_RELICS, "Lore:Relics", "Allows you a chance of recognising rings and amulets.", 5);
addskilldesc(SK_LORE_RELICS, PR_NOVICE, "^gYou can attempt to identify rings/amulets with the 'inspect' ability.^n", B_FALSE); addskilldesc(SK_LORE_RELICS, PR_NOVICE, "^gYou can attempt to identify rings/amulets with the 'inspect' ability.^n", B_FALSE);
addskillabil(SK_LORE_RELICS, PR_NOVICE, OT_A_INSPECT, NA, NULL, B_FALSE); addskillabil(SK_LORE_RELICS, PR_NOVICE, OT_A_INSPECT, NA, NULL, B_FALSE);
addskilldesc(SK_LORE_RELICS, PR_BEGINNER, "^gYou can now recognise very common rings and amulets.", B_TRUE); addskilldesc(SK_LORE_RELICS, PR_BEGINNER, "^gYou can now recognise very common rings and amulets.", B_TRUE);
addskilldesc(SK_LORE_RELICS, PR_BEGINNER, "^gYou can determine the value of all rings and amulets.^n", B_FALSE);
addskilldesc(SK_LORE_RELICS, PR_ADEPT, "^gYou can now recognise common rings and amulets.", B_TRUE); addskilldesc(SK_LORE_RELICS, PR_ADEPT, "^gYou can now recognise common rings and amulets.", B_TRUE);
addskilldesc(SK_LORE_RELICS, PR_EXPERT, "^gYou can now recognise uncommon rings and amulets.", B_TRUE); addskilldesc(SK_LORE_RELICS, PR_EXPERT, "^gYou can now recognise uncommon rings and amulets.", B_TRUE);
addskilldesc(SK_LORE_RELICS, PR_MASTER, "^gYou can now recognise rare rings and amulets.", B_TRUE); addskilldesc(SK_LORE_RELICS, PR_MASTER, "^gYou can now recognise rare rings and amulets.", B_TRUE);
@ -21208,6 +21218,7 @@ void initskills(void) {
addskilldesc(sk->id, PR_NOVICE, "^gEliminates accuracy penalties with matching weapons.^n", B_FALSE); addskilldesc(sk->id, PR_NOVICE, "^gEliminates accuracy penalties with matching weapons.^n", B_FALSE);
addskilldesc(sk->id, PR_BEGINNER, "^g+1 accuracy.^n", B_FALSE); addskilldesc(sk->id, PR_BEGINNER, "^g+1 accuracy.^n", B_FALSE);
addskilldesc(sk->id, PR_BEGINNER, "^gYou gain the 'wild strike' ability.^n", B_FALSE); addskilldesc(sk->id, PR_BEGINNER, "^gYou gain the 'wild strike' ability.^n", B_FALSE);
addskilldesc(sk->id, PR_BEGINNER, "^gYou can determine the value of matching weapons.^n", B_FALSE);
addskilldesc(sk->id, PR_ADEPT, "^g+10% damage bonus.^n", B_FALSE); addskilldesc(sk->id, PR_ADEPT, "^g+10% damage bonus.^n", B_FALSE);
addskilldesc(sk->id, PR_ADEPT, "^g+2 accuracy.^n", B_FALSE); addskilldesc(sk->id, PR_ADEPT, "^g+2 accuracy.^n", B_FALSE);
if (sk->id == SK_UNARMED) { if (sk->id == SK_UNARMED) {

15
defs.h
View File

@ -401,7 +401,8 @@
#define SPEEDUNIT 5 #define SPEEDUNIT 5
// experience // experience
#define SKILLXPPERPOINT 150 //#define SKILLXPPERPOINT 150
#define SKILLXPPERPOINT 100
// speed settings (lower is faster) // speed settings (lower is faster)
#define SPEED_ATTACK SP_NORMAL #define SPEED_ATTACK SP_NORMAL
@ -3440,8 +3441,10 @@ enum FLAG {
// damage dealt to less than v0. // damage dealt to less than v0.
// if v0 = b_true (or less than 0) it will // if v0 = b_true (or less than 0) it will
// pierce ALL armour // pierce ALL armour
F_TWOHANDED, // weapon uses two hands to weild, if lf is size v0 F_TWOHANDED, // weapon uses two hands to weild, unless:
// or smaller. // lf size is greater than v0
// _OR_
// lf str is >= getonehandedstr(o)
F_NEEDSSPACE, // weapon needs space to swing - 75% chance of hitting F_NEEDSSPACE, // weapon needs space to swing - 75% chance of hitting
// a wall if used with < 3 empty cells around you // a wall if used with < 3 empty cells around you
// gun flags // gun flags
@ -4227,9 +4230,10 @@ enum FLAG {
// if v1 is true, actual lf glyphs are shown. // if v1 is true, actual lf glyphs are shown.
// otherwise just an indicative size is shown // otherwise just an indicative size is shown
F_DETECTMAGIC, // autodetect magic/special objects F_DETECTMAGIC, // autodetect magic/special objects
F_DETECTMETAL, // autodetect nearby metal F_DETECTMETAL, // autodetect nearby metal within orthog distance v0
F_DETECTOBS, // autodetect nearby obs of type v1 in orthog dist v0 F_DETECTOBS, // autodetect nearby obs of type v1 & value >= txt in orthog dist v0
// v1 = NA means everything. // v1 = NA means everything.
// txt = NULL means everything.
F_DISEASEIMMUNE, // lf can't be diseased F_DISEASEIMMUNE, // lf can't be diseased
F_DRUNK, // v0 is drunknness - 1-5. F_DRUNK, // v0 is drunknness - 1-5.
F_ENHANCESEARCH, // gives v0 bonus on search checks. F_ENHANCESEARCH, // gives v0 bonus on search checks.
@ -4703,6 +4707,7 @@ enum ERROR {
E_VEGETARIAN, E_VEGETARIAN,
E_PARTVEGETARIAN, E_PARTVEGETARIAN,
E_CARNIVORE, E_CARNIVORE,
E_NAUSEATED,
E_NOOB, E_NOOB,
E_LEVITATING, E_LEVITATING,
E_PRONE, E_PRONE,

169
io.c
View File

@ -1,6 +1,7 @@
#define _GNU_SOURCE #define _GNU_SOURCE
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
#include <fcntl.h>
#include <locale.h> #include <locale.h>
#include <math.h> #include <math.h>
#include <signal.h> #include <signal.h>
@ -1739,7 +1740,18 @@ int announceflaggain(lifeform_t *lf, flag_t *f) {
break; break;
case F_DETECTOBS: case F_DETECTOBS:
if (isplayer(lf)) { // don't know if monsters get it if (isplayer(lf)) { // don't know if monsters get it
msg("You can now detect nearby objects."); objecttype_t *ot;
char *p = NULL;
if (f->val[1] != NA && (ot = findot(f->val[1]))) {
p = strdup(ot->name);
makeplural(&p);
}
if (f->text) {
msg("You can now detect nearby %s worth at least $%s.", p ? p : "objects", f->text);
} else {
msg("You can now detect nearby %s.", p ? p : "objects");
}
if (p) free(p);
donesomething = B_TRUE; donesomething = B_TRUE;
} }
break; break;
@ -6265,11 +6277,12 @@ char *makedesc_ob(object_t *o, char *retbuf) {
char buf3[BUFLEN]; char buf3[BUFLEN];
recipe_t *rec; recipe_t *rec;
flag_t *f; flag_t *f;
objecttype_t *ot;
int obknown,i,throwrange, b; int obknown,i,throwrange, b;
flag_t *retflag[MAXCANDIDATES]; flag_t *retflag[MAXCANDIDATES];
int nretflags; int nretflags;
object_t *compareob = NULL; object_t *compareob = NULL;
char *loctext,*p; char *loctext,*p = NULL;
char retalname[BUFLEN],dicetext[BUFLEN]; char retalname[BUFLEN],dicetext[BUFLEN];
// do we need to compare this object with an equipped on? // do we need to compare this object with an equipped on?
@ -6328,6 +6341,7 @@ char *makedesc_ob(object_t *o, char *retbuf) {
strncat(retbuf, "It is very poorly crafted.\n", HUGEBUFLEN); strncat(retbuf, "It is very poorly crafted.\n", HUGEBUFLEN);
} }
// weight // weight
if (o->material->id != MT_NOTHING) { if (o->material->id != MT_NOTHING) {
float obw; float obw;
@ -6434,9 +6448,11 @@ char *makedesc_ob(object_t *o, char *retbuf) {
// unknown items? // unknown items?
if (isknown(o)) { if (isknown(o)) {
int showvalue = B_FALSE;
// weapons? // weapons?
if (isfirearm(o)) { if (isfirearm(o)) {
flag_t *ff, *ff2,*twohandf; flag_t *ff, *ff2,*twohandf;
int ohs;
twohandf = hasflag(o->flags, F_TWOHANDED); twohandf = hasflag(o->flags, F_TWOHANDED);
sprintf(buf, "It is a %s firearm.\n", twohandf ? "two-handed" : "single handed"); sprintf(buf, "It is a %s firearm.\n", twohandf ? "two-handed" : "single handed");
@ -6446,7 +6462,11 @@ char *makedesc_ob(object_t *o, char *retbuf) {
char sizebuf[BUFLEN]; char sizebuf[BUFLEN];
sprintf(sizebuf, "%s", getsizetext(twohandf->val[0] + 1)); sprintf(sizebuf, "%s", getsizetext(twohandf->val[0] + 1));
capitalise(sizebuf); capitalise(sizebuf);
snprintf(buf2, BUFLEN, "@%s creatures can weild it in one hand.\n", sizebuf); snprintf(buf2, BUFLEN, "@%s creatures can wield it in one hand.\n", sizebuf);
strncat(retbuf, buf2, HUGEBUFLEN);
}
if ((ohs = getonehandedstr(o)) != IMPOSSIBLE) {
snprintf(buf2, BUFLEN, "@Creatures with a Strength of at least %d can wield it in one hand.\n", ohs);
strncat(retbuf, buf2, HUGEBUFLEN); strncat(retbuf, buf2, HUGEBUFLEN);
} }
@ -6505,8 +6525,7 @@ char *makedesc_ob(object_t *o, char *retbuf) {
} else if (isweapon(o) && isknown(o)) { } else if (isweapon(o) && isknown(o)) {
flag_t *damflag,*twohandf; flag_t *damflag,*twohandf;
float stamcost = STAMTOATTACK; float stamcost = STAMTOATTACK;
int delay; int delay,critchance,ohs;
int critchance;
twohandf = hasflag(o->flags, F_TWOHANDED); twohandf = hasflag(o->flags, F_TWOHANDED);
@ -6557,6 +6576,10 @@ char *makedesc_ob(object_t *o, char *retbuf) {
snprintf(buf2, BUFLEN, "@%s creatures can weild it in one hand.\n", sizebuf); snprintf(buf2, BUFLEN, "@%s creatures can weild it in one hand.\n", sizebuf);
strcat(buf, buf2 ); strcat(buf, buf2 );
} }
if ((ohs = getonehandedstr(o)) != IMPOSSIBLE) {
snprintf(buf2, BUFLEN, "@Creatures with a Strength of at least %d can wield it in one hand.\n", ohs);
strncat(buf, buf2, HUGEBUFLEN);
}
snprintf(buf2, BUFLEN, "@It has a base Damage Rating of %d",dr); snprintf(buf2, BUFLEN, "@It has a base Damage Rating of %d",dr);
strcat(buf, buf2); strcat(buf, buf2);
@ -7034,6 +7057,90 @@ char *makedesc_ob(object_t *o, char *retbuf) {
strncat(retbuf, buf, HUGEBUFLEN); strncat(retbuf, buf, HUGEBUFLEN);
} }
} }
// item value
if (getskill(player, SK_PERCEPTION) >= PR_EXPERT) {
showvalue = B_TRUE;
}
if (!showvalue) {
f = hasflag(o->flags, F_USESSKILL);
if (f && (f->val[0] != SK_NONE)) {
if (getskill(player, f->val[0]) >= PR_BEGINNER) {
showvalue = B_TRUE;
}
}
}
if (!showvalue && !hasflag(o->flags, F_SHIELD)) {
if (getskill(player, SK_SHIELDS) >= PR_BEGINNER) {
showvalue = B_TRUE;
}
}
if (!showvalue && o->type->obclass->id == OC_ARMOUR &&
!hasflag(o->flags, F_SHIELD)) {
if (getskill(player, SK_ARMOUR) >= PR_BEGINNER) {
showvalue = B_TRUE;
}
}
if (!showvalue &&
(o->type->obclass->id == OC_RING ||
o->type->obclass->id == OC_AMULET)
) {
if (getskill(player, SK_LORE_RELICS) >= PR_BEGINNER) {
showvalue = B_TRUE;
}
}
if (!showvalue &&
(o->type->obclass->id == OC_BOOK ||
o->type->obclass->id == OC_SCROLL)
) {
if (getskill(player, SK_LORE_LANGUAGE) >= PR_BEGINNER) {
showvalue = B_TRUE;
}
}
if (!showvalue && o->type->obclass->id == OC_WAND) {
if (getskill(player, SK_LORE_ARCANA) >= PR_BEGINNER) {
showvalue = B_TRUE;
}
}
if (!showvalue && o->type->obclass->id == OC_POTION) {
if (getskill(player, SK_LORE_CHEMISTRY) >= PR_BEGINNER) {
showvalue = B_TRUE;
}
}
if (!showvalue && o->type->obclass->id == OC_TECH) {
if (getskill(player, SK_TECHUSAGE) >= gettechlevel(o->type->id)) {
showvalue = B_TRUE;
}
}
if (!showvalue && o->type->obclass->id == OC_FOOD) {
if (getskill(player, SK_COOKING) >= PR_BEGINNER) {
showvalue = B_TRUE;
}
}
if (!showvalue && o->type->obclass->id == OC_FLORA) {
if (getskill(player, SK_LORE_NATURE) >= PR_BEGINNER) {
showvalue = B_TRUE;
}
}
if (!showvalue) {
enum MATERIAL repairablemats[MAXCANDIDATES];
int nmats = 0;
getworkablematerials(player, SK_METALWORK, repairablemats, NULL, &nmats);
getworkablematerials(player, SK_SEWING, repairablemats, NULL, &nmats);
for (i = 0; i < nmats; i++) {
if (o->material->id == repairablemats[i]) {
showvalue = B_TRUE;
break;
}
}
}
if (showvalue) {
int value;
value = getobvalue(o);
snprintf(buf, BUFLEN, "It is worth roughly $%d.\n", value);
strncat(retbuf, buf, HUGEBUFLEN);
}
} // end if isknown } // end if isknown
// charges remaining // charges remaining
@ -7243,7 +7350,6 @@ char *makedesc_ob(object_t *o, char *retbuf) {
for (f = o->flags->first[b] ; f ; f = f->next) { for (f = o->flags->first[b] ; f ; f = f->next) {
if ((f->id == F_HOLDCONFER) || (f->id == F_EQUIPCONFER) || (f->id == F_ACTIVATECONFER)) { if ((f->id == F_HOLDCONFER) || (f->id == F_EQUIPCONFER) || (f->id == F_ACTIVATECONFER)) {
if (obknown && f->known) { if (obknown && f->known) {
objecttype_t *ot;
if (f->id == F_HOLDCONFER) strcpy(buf, "When held, it"); if (f->id == F_HOLDCONFER) strcpy(buf, "When held, it");
else if (f->id == F_ACTIVATECONFER) strcpy(buf, "When activated, it"); else if (f->id == F_ACTIVATECONFER) strcpy(buf, "When activated, it");
else if (f->id == F_HITCONFER) strcpy(buf, "When hit by it, it"); else if (f->id == F_HITCONFER) strcpy(buf, "When hit by it, it");
@ -7321,8 +7427,20 @@ char *makedesc_ob(object_t *o, char *retbuf) {
strncat(retbuf, buf2, HUGEBUFLEN); strncat(retbuf, buf2, HUGEBUFLEN);
break; break;
case F_DETECTOBS: case F_DETECTOBS:
snprintf(buf2, BUFLEN, "%s lets you detect nearby objects.\n", buf); if (f->val[2] != NA) {
ot = findot(f->val[2]);
if (ot) {
p = strdup(ot->name);
makeplural(&p);
}
}
if (f->text) {
snprintf(buf2, BUFLEN, "%s lets you detect nearby %s worth at least $%s.\n", buf, p ? p : "objects", f->text);
} else {
snprintf(buf2, BUFLEN, "%s lets you detect nearby %s.\n", buf, p ? p : "objects");
}
strncat(retbuf, buf2, HUGEBUFLEN); strncat(retbuf, buf2, HUGEBUFLEN);
if (p) free(p);
break; break;
case F_DETECTMAGIC: case F_DETECTMAGIC:
snprintf(buf2, BUFLEN, "%s will detect magical enchantments on objects.\n", buf); snprintf(buf2, BUFLEN, "%s will detect magical enchantments on objects.\n", buf);
@ -10058,14 +10176,24 @@ void initgfx(void) {
int i; int i;
short r,g,b; short r,g,b;
struct winsize ws; struct winsize ws;
int w,h; //int w = 0,h = 0,rv;
int rv;
ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws); ws.ws_col = 0;
w = ws.ws_col; ws.ws_row = 0;
h = ws.ws_row;
if ((w < 80) || (h < 25)) { rv = ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws);
printf("Error - Terminal size must be at least 80x25 (current: %d x %d).\n", w, h); if (rv != -1 || ws.ws_col == 0 || ws.ws_row == 0) {
// handle lldb dumbness
int fd = open("/dev/tty", O_RDONLY);
if (fd != -1) {
ioctl(fd, TIOCGWINSZ, &ws);
close(fd);
}
}
if ((ws.ws_col < 80) || (ws.ws_row < 25)) {
printf("Error - Terminal size must be at least 80x25 (current: %d x %d).\n", ws.ws_col, ws.ws_row);
exit(1); exit(1);
} }
@ -14611,9 +14739,20 @@ void showlfstats(lifeform_t *lf, int showall) {
} }
f = lfhasknownflag(lf, F_DETECTOBS); f = lfhasknownflag(lf, F_DETECTOBS);
if (f) { if (f) {
getflagsourcetext(f,source); objecttype_t *ot;
effectline(&stopnow, &count, offset, &nextoffset, headinglines, mainwin, &y, &x, 0, "%s automatically detect nearby objects.%s", you(lf),source); char *p = NULL;
if (f->val[1] != NA && (ot = findot(f->val[1]))) {
p = strdup(ot->name);
makeplural(&p);
}
getflagsourcetext(f,source);
if (f->text) {
effectline(&stopnow, &count, offset, &nextoffset, headinglines, mainwin, &y, &x, 0, "%s automatically detect nearby %s worth at least $%s.%s", you(lf), p ? p : "objects", f->text, source);
} else {
effectline(&stopnow, &count, offset, &nextoffset, headinglines, mainwin, &y, &x, 0, "%s automatically detect nearby %s.%s", you(lf), p ? p : "objects", source);
}
if (p) free(p);
} }
f = lfhasknownflag(lf, F_ENHANCESEARCH); f = lfhasknownflag(lf, F_ENHANCESEARCH);
if (f) { if (f) {

7
lf.c
View File

@ -1011,6 +1011,10 @@ int caneat(lifeform_t *lf, object_t *o) {
reason = E_CARNIVORE; reason = E_CARNIVORE;
return B_FALSE; return B_FALSE;
} }
if (lfhasflag(lf, F_NAUSEATED)) {
reason = E_NAUSEATED;
return B_FALSE;
}
} }
if (lfhasflag(lf, F_PARTVEGETARIAN) && hasflag(o->flags, F_ISMEAT)) { if (lfhasflag(lf, F_PARTVEGETARIAN) && hasflag(o->flags, F_ISMEAT)) {
@ -5078,6 +5082,9 @@ int eat(lifeform_t *lf, object_t *o) {
getobname(oo,buf, 1); getobname(oo,buf, 1);
msg("You can't eat through your %s!", noprefix(buf)); msg("You can't eat through your %s!", noprefix(buf));
break; break;
case E_NAUSEATED:
msg("You are too nauseated to eat.");
break;
case E_WRONGOBTYPE: case E_WRONGOBTYPE:
default: default:
msg("You can't eat that!"); msg("You can't eat that!");

5
map.c
View File

@ -9153,7 +9153,10 @@ int isinscanrange(cell_t *c, void **thing, char *desc, glyph_t *glyph) {
if (getcelldistorth(player->cell, c) <= f->val[0]) { if (getcelldistorth(player->cell, c) <= f->val[0]) {
object_t *o; object_t *o;
for (o = c->obpile->first ; o ; o = o->next) { for (o = c->obpile->first ; o ; o = o->next) {
if ((f->id == F_DETECTOBS) && ((f->val[1] == NA) || (o->type->id == f->val[1]))) { if ((f->id == F_DETECTOBS) &&
((f->val[1] == NA) || (o->type->id == f->val[1])) &&
(!f->text || getobvalue(o) >= atoi(f->text) ))
{
if (!hasflag(o->flags, F_NOPICKUP) && !hasflag(o->flags, F_DOOR)) { if (!hasflag(o->flags, F_NOPICKUP) && !hasflag(o->flags, F_DOOR)) {
*thing = o; *thing = o;
if (glyph) { if (glyph) {

View File

@ -5089,6 +5089,16 @@ int real_getobvalue(object_t *o, int amt) {
return (int) price; return (int) price;
} }
int getonehandedstr(object_t *o) {
flag_t *ff;
if ((ff = hasflagval(o->flags, F_ATTREQ, A_STR, NA, NA, NULL))) {
if (ff->val[1] != NA) {
return floor(((float)ff->val[1] * 1.3));
}
}
return IMPOSSIBLE;
}
char *getoperateverb(object_t *o) { char *getoperateverb(object_t *o) {
if (hasflag(o->flags, F_SHOP)) { if (hasflag(o->flags, F_SHOP)) {
return "enter"; return "enter";
@ -8733,10 +8743,15 @@ int istwohandedfor(object_t *o, lifeform_t *lf) {
flag_t *f; flag_t *f;
f = hasflag(o->flags, F_TWOHANDED); f = hasflag(o->flags, F_TWOHANDED);
if (f) { if (f) {
// twohanded for everyone if (lf) {
if (f->val[0] <= 0) return B_TRUE; // large lf
if (!lf) return B_TRUE; if (f->val[0] > 0 && getlfsize(lf) > f->val[0]) return B_FALSE;
if (getlfsize(lf) <= f->val[0]) return B_TRUE; // strong lf
if (getattr(lf, A_STR) >= getonehandedstr(o)) {
return B_FALSE;
}
}
return B_TRUE;
} }
return B_FALSE; return B_FALSE;
} }

View File

@ -108,6 +108,7 @@ enum LFSIZE getobsize(object_t *o);
int getobspellpower(object_t *o, lifeform_t *lf); int getobspellpower(object_t *o, lifeform_t *lf);
int getobvalue(object_t *o); int getobvalue(object_t *o);
int real_getobvalue(object_t *o, int amt); int real_getobvalue(object_t *o, int amt);
int getonehandedstr(object_t *o);
char *getoperateverb(object_t *o); char *getoperateverb(object_t *o);
object_t *getoutercontainer(object_t *o); object_t *getoutercontainer(object_t *o);
object_t *getoutercontainerop(obpile_t *op); object_t *getoutercontainerop(obpile_t *op);

View File

@ -15422,18 +15422,18 @@ int getworkablematerials(lifeform_t *lf, enum SKILL skid , enum MATERIAL *repair
if (cutoff < 100) { if (cutoff < 100) {
if (skid == SK_METALWORK) { if (skid == SK_METALWORK) {
repairablemats[*nmats] = MT_METAL; repairablemats[*nmats] = MT_METAL;
cutoffpct[*nmats] = cutoff; if (cutoffpct) cutoffpct[*nmats] = cutoff;
(*nmats)++; (*nmats)++;
nworkable++; nworkable++;
} else if (skid == SK_SEWING) { } else if (skid == SK_SEWING) {
repairablemats[*nmats] = MT_CLOTH; repairablemats[*nmats] = MT_CLOTH;
cutoffpct[*nmats] = cutoff; if (cutoffpct) cutoffpct[*nmats] = cutoff;
(*nmats)++; (*nmats)++;
repairablemats[*nmats] = MT_LEATHER; repairablemats[*nmats] = MT_LEATHER;
cutoffpct[*nmats] = cutoff; if (cutoffpct) cutoffpct[*nmats] = cutoff;
(*nmats)++; (*nmats)++;
repairablemats[*nmats] = MT_FLESH; repairablemats[*nmats] = MT_FLESH;
cutoffpct[*nmats] = cutoff; if (cutoffpct) cutoffpct[*nmats] = cutoff;
(*nmats)++; (*nmats)++;
nworkable += 2; nworkable += 2;
} }