- Dagger of Revenge had incorrect F_LINKGOD.

- Prevent obtaining key items via wishes.
This commit is contained in:
Rob Pearce 2016-06-02 15:46:30 +10:00
parent 986f9306ce
commit 562f3d082b
6 changed files with 65 additions and 16 deletions

33
data.c
View File

@ -2162,6 +2162,7 @@ void initobjects(void) {
addflag(lastobjectclass->flags, F_OPERWITHOUTID, B_TRUE, NA, NA, NULL);
addflag(lastobjectclass->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
addflag(lastobjectclass->flags, F_GODSTONE, B_TRUE, NA, B_TRUE, NULL);
addflag(lastobjectclass->flags, F_NOWISH, B_TRUE, NA, NA, NULL);
addoc(OC_CORPSE, "Corpses", "Dead flesh which was once living.", '%', C_GREY, RR_NEVER);
addflag(lastobjectclass->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
@ -3305,7 +3306,7 @@ void initobjects(void) {
addflag(lastot->flags, F_RECHARGE, 1, NA, NA, NULL);
addflag(lastot->flags, F_AIBOOSTITEM, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_REPLENISHABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_LINKGOD, R_GODPURITY, NA, NA, NULL);
addflag(lastot->flags, F_LINKGOD, R_GODTHIEVES, NA, NA, NULL);
addflag(lastot->flags, F_DAM, DT_PIERCE, 10, NA, NULL);
addflag(lastot->flags, F_OBATTACKDELAY, 50, NA, NA, NULL);
addflag(lastot->flags, F_ACCURACY, 85, NA, NA, NULL);
@ -5558,6 +5559,14 @@ void initobjects(void) {
addflag(lastot->flags, F_TARGETTEDSPELL, TT_MONSTER, NA, NA, NULL);
addflag(lastot->flags, F_MAXPOWER, 8, NA, NA, NULL);
addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_DONTNEED, NA, NULL);
addot(OT_S_TELEPORT, "teleportation", "Teleports the caster (and Power-1 adjacent allies) to a new location within the same level.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "At power V, you can choose the general direction to teleport in.");
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "At power VII, you can choose exactly where to teleport to.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_TRANSLOCATION, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 3, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOFLEE, ST_SELF, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOATTACK, ST_SELF, NA, NA, NULL);
addflag(lastot->flags, F_LOSLOF, B_FALSE, LOF_DONTNEED, NA, NULL);
// l4
addot(OT_S_BLINKASS, "assassin blink", "Teleports the caster behind an enemy, ready for a sneak attack.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_SPELLSCHOOL, SS_TRANSLOCATION, NA, NA, NULL);
@ -5566,14 +5575,6 @@ void initobjects(void) {
addflag(lastot->flags, F_AICASTTOATTACK, ST_VICTIM, NA, NA, NULL);
addflag(lastot->flags, F_TARGETTEDSPELL, TT_MONSTER, NA, NA, NULL);
addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_DONTNEED, NA, NULL);
addot(OT_S_TELEPORT, "teleportation", "Teleports the caster (and Power-1 adjacent allies) to a new location within the same level.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "At power V, you can choose the general direction to teleport in.");
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "At power VII, you can choose exactly where to teleport to.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_TRANSLOCATION, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 4, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOFLEE, ST_SELF, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOATTACK, ST_SELF, NA, NA, NULL);
addflag(lastot->flags, F_LOSLOF, B_FALSE, LOF_DONTNEED, NA, NULL);
addot(OT_S_CONFISCATE, "yoink", "Transports one random object directly from the target to the caster.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "At power level II, the target object can be selected.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_DIVINE, NA, NA, NULL);
@ -6180,13 +6181,16 @@ void initobjects(void) {
addflag(lastot->flags, F_INVULNERABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_OPERWITHOUTHANDS, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_NOWISH, B_TRUE, NA, NA, NULL);
// opens vaults
addot(OT_KEYIRON, "ancient iron key", "An ancient key made from iron. It looks important.", MT_METAL, 2, OC_TOOLS, SZ_SMALL);
addflag(lastot->flags, F_GLYPH, C_METAL, '[', NA, NULL);
addflag(lastot->flags, F_UNIQUE, NA, NA, NA, NULL);
addflag(lastot->flags, F_INVULNERABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_VAULTKEY, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_NOWISH, B_TRUE, NA, NA, NULL);
addot(OT_KEYMOSS, "ancient mossy key", "An ancient key covered with moss. It looks important.", MT_METAL, 2, OC_TOOLS, SZ_SMALL);
addflag(lastot->flags, F_GLYPH, C_MOSS, '[', NA, NULL);
@ -6194,6 +6198,7 @@ void initobjects(void) {
addflag(lastot->flags, F_INVULNERABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_VAULTKEY, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_NOWISH, B_TRUE, NA, NA, NULL);
addot(OT_KEYSTONE, "ancient stone key", "An ancient key made of stone. It looks important.", MT_METAL, 2, OC_TOOLS, SZ_SMALL);
addflag(lastot->flags, F_GLYPH, C_GREY, '[', NA, NULL);
@ -6201,6 +6206,7 @@ void initobjects(void) {
addflag(lastot->flags, F_INVULNERABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_VAULTKEY, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_NOWISH, B_TRUE, NA, NA, NULL);
// tools
addot(OT_BANDAGE, "bandage", "A small medical bandage. When worn, it will counteract bleeding.", MT_CLOTH, 0.5, OC_TOOLS, SZ_SMALL);
@ -11513,6 +11519,7 @@ void initrace(void) {
addflag(lastrace->flags, F_GODNOBATTLE, NA, NA, NA, "purifying food");
addflag(lastrace->flags, F_GODNOBATTLE, NA, NA, NA, "blessing your items");
// text
addflag(lastrace->flags, F_GODNOWISHTEXT, NA, NA, NA, "That shall not be done, mortal!");
addflag(lastrace->flags, F_GODBONUSTEXT, NA, NA, NA, "You have impressed me, mortal!");
addflag(lastrace->flags, F_GODNOBONUSTEXT, NA, NA, NA, "Your service is lacking, mortal.");
addflag(lastrace->flags, F_GODGIFTTEXT, NA, NA, NA, "I bestow a gift upon you, mortal!");
@ -11594,6 +11601,7 @@ void initrace(void) {
addflag(lastrace->flags, F_GODNOBATTLE, NA, NA, NA, "detecting enemies");
addflag(lastrace->flags, F_GODNOBATTLE, NA, NA, NA, "blessing your weapon");
// text
addflag(lastrace->flags, F_GODNOWISHTEXT, NA, NA, NA, "Request denied!");
addflag(lastrace->flags, F_GODBONUSTEXT, NA, NA, NA, "Onwards to victory!");
addflag(lastrace->flags, F_GODNOBONUSTEXT, NA, NA, NA, "Your slothfulness has earned you a demotion, soldier.");
addflag(lastrace->flags, F_GODGIFTTEXT, NA, NA, NA, "Gather up the spoils of battle!");
@ -11675,6 +11683,7 @@ void initrace(void) {
addflag(lastrace->flags, F_GODBONUS, PL_DELIGHTED, GB_FLAG, F_DISEASEIMMUNE, "1,NA,NA");
addflag(lastrace->flags, F_GODBONUS, PL_ECSTATIC, GB_FLAG, F_AUTOTANGLE, "20,5,NA");
// text
addflag(lastrace->flags, F_GODNOWISHTEXT, NA, NA, NA, "That would violate nature's laws!");
addflag(lastrace->flags, F_GODBONUSTEXT, NA, NA, NA, "You are progressing in nature's path...");
addflag(lastrace->flags, F_GODNOBONUSTEXT, NA, NA, NA, "Nature will not tolerate the lazy.");
addflag(lastrace->flags, F_GODGIFTTEXT, NA, NA, NA, "Harvest nature's bounty!");
@ -11751,6 +11760,7 @@ void initrace(void) {
sprintf(buf, "%d,40,NA", SC_SEARCH);
addflag(lastrace->flags, F_GODBONUS, PL_ECSTATIC, GB_FLAG, F_SKILLCHECKMOD, buf);
// text
addflag(lastrace->flags, F_GODNOWISHTEXT, NA, NA, NA, "Nice try!");
addflag(lastrace->flags, F_GODBONUSTEXT, NA, NA, NA, "Very impressive...");
addflag(lastrace->flags, F_GODNOBONUSTEXT, NA, NA, NA, "I expect more results, mortal.");
addflag(lastrace->flags, F_GODGIFTTEXT, NA, NA, NA, "Loyalty has its rewards...");
@ -11818,6 +11828,7 @@ void initrace(void) {
addflag(lastrace->flags, F_GODBONUS, PL_DELIGHTED, GB_FLAG, F_HOLYTOUCH, "1");
addflag(lastrace->flags, F_GODBONUS, PL_ECSTATIC, GB_FLAG, F_REGENERATES, "1,NA,NA");
// text
addflag(lastrace->flags, F_GODNOWISHTEXT, NA, NA, NA, "Patience, my child...");
addflag(lastrace->flags, F_GODBONUSTEXT, NA, NA, NA, "A good life has its rewards!");
addflag(lastrace->flags, F_GODNOBONUSTEXT, NA, NA, NA, "You must be more proactive, my child.");
addflag(lastrace->flags, F_GODGIFTTEXT, NA, NA, NA, "Use this gift to spread the joy of life!");
@ -11884,6 +11895,7 @@ void initrace(void) {
addflag(lastrace->flags, F_GODBATTLE, NA, NA, NA, "slaying a nearby enemy");
addflag(lastrace->flags, F_GODBATTLE, NA, NA, NA, "animating the dead");
// text
addflag(lastrace->flags, F_GODNOWISHTEXT, NA, NA, NA, "I think not, mortal.");
addflag(lastrace->flags, F_GODBONUSTEXT, NA, NA, NA, "Your kills are impressive...");
addflag(lastrace->flags, F_GODNOBONUSTEXT, NA, NA, NA, "Lazy servants can easily be removed...");
addflag(lastrace->flags, F_GODGIFTTEXT, NA, NA, NA, "Your service has impressed me...");
@ -11939,6 +11951,7 @@ void initrace(void) {
addflag(lastrace->flags, F_GODBONUS, PL_DELIGHTED, GB_DTIMMUNE, DT_FIRE, NULL);
// e = burning body. hardcoded.
// text
addflag(lastrace->flags, F_GODNOWISHTEXT, NA, NA, NA, "FORBIDDEN!");
addflag(lastrace->flags, F_GODBONUSTEXT, NA, NA, NA, "DESTROY IN MY NAME!");
addflag(lastrace->flags, F_GODNOBONUSTEXT, NA, NA, NA, "PAY ATTENTION!");
addflag(lastrace->flags, F_GODGIFTTEXT, NA, NA, NA, "TAKE AND DESTROY!");
@ -12007,6 +12020,7 @@ void initrace(void) {
addflag(lastrace->flags, F_GODBONUS, PL_ECSTATIC, GB_MAGICBOOST, 1, NULL);
addflag(lastrace->flags, F_GODBONUS, PL_ECSTATIC, GB_FLAG, F_MPREGEN, "1,0,0");
// text
addflag(lastrace->flags, F_GODNOWISHTEXT, NA, NA, NA, "One must earn a prize such as this!");
addflag(lastrace->flags, F_GODBONUSTEXT, NA, NA, NA, "One is on the right path!");
addflag(lastrace->flags, F_GODNOBONUSTEXT, NA, NA, NA, "One must always strive towards the path!");
addflag(lastrace->flags, F_GODGIFTTEXT, NA, NA, NA, "One has earned a reward!");
@ -12072,6 +12086,7 @@ void initrace(void) {
addflag(lastrace->flags, F_GODBONUS, PL_DELIGHTED, GB_FLAG, F_DETECTLIFE, "5,0,NA");
// e = save life. hardcoded.
// text
addflag(lastrace->flags, F_GODNOWISHTEXT, NA, NA, NA, "Regretfully, this must not be so.");
addflag(lastrace->flags, F_GODBONUSTEXT, NA, NA, NA, "Your devoutness is impressive.");
addflag(lastrace->flags, F_GODNOBONUSTEXT, NA, NA, NA, "Your lack of proactiveness is disappointing...");
addflag(lastrace->flags, F_GODGIFTTEXT, NA, NA, NA, "As you have shown mercy, so shall you receive it!");

2
defs.h
View File

@ -2896,6 +2896,7 @@ enum FLAG {
F_SHRINKSTO, // used for spells. v0=new oid or celltype.
// v1 = VT_OB or VT_CELL
F_NOSHATTER, // object will not shatter, even if it's material should.
F_NOWISH, // you cannot obtain this object via a wish
F_NUMCONVERT, // if o->amt is >= v0, object type changes into either
// f->text (if given), or obtype v1.
F_STACKABLE, // can stack multiple objects togethr
@ -3981,6 +3982,7 @@ enum FLAG {
// text = arg2
F_GODBONUSTEXT, // text = what the god says when you get a bonus
F_GODNOBONUSTEXT, // text = what the god says when you lose a bonus
F_GODNOWISHTEXT, // text = what the god says when you wish for something forbidden
F_GODGIFTTEXT, // text = what the god says when you get a gift
F_GODASK1, // text = how the god asks you to join them
F_GODASK2, // text = how the god asks you to join them (2nd line)

2
god.c
View File

@ -1756,7 +1756,7 @@ void godstone_pickup_effects(lifeform_t *god, lifeform_t *opposegod, object_t *o
wprintw(mainwin, "weapon must not fall into the hands of enemies, and only in\n");
wprintw(mainwin, "my possession can we be sure of its safety.\n\n");
wprintw(mainwin, "Your first waypoint is the portal atop the dungeon. This will\n");
wprintw(mainwin, "to the Realm of Gods, where both of your objectives can be\n");
wprintw(mainwin, "lead to the Realm of Gods, where both of your objectives can be\n");
wprintw(mainwin, "achieved.\"\n");
break;
case R_GODDEATH:

View File

@ -426,8 +426,6 @@ int main(int argc, char **argv) {
addflag(o->flags, F_MAPLINK, surfmap->id, c->x, c->y, NULL);
// get player name from environment vars
user = getenv("USER");
if (user) {

View File

@ -11334,7 +11334,6 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) {
return B_TRUE;
}
} else if (o->type->obclass->id == OC_GODSTONE) {
if (isfullycharged(o)) {
int i;
object_t *oo;

41
spell.c
View File

@ -14347,7 +14347,9 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
if (isplayer(caster)) {
char lfname[BUFLEN];
char question[BUFLEN];
int i;
int i,nbad = 0;
obpile_t *tempop = NULL;
object_t *badob = NULL;
if (seenbyplayer) *seenbyplayer = B_TRUE;
// ask for target
if (spellid == OT_S_GIFT) {
@ -14365,8 +14367,37 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
snprintf(question, BUFLEN, "For what do you wish");
}
askstring(question, '?', buf, BUFLEN, NULL);
addob(target->cell->obpile, buf);
if (nretobs) {
tempop = addobpile(NULL, NULL, NULL);
addob(tempop, buf);
// remove any invalid objects
badob = hasobwithflag(tempop, F_NOWISH);
while (badob) {
flag_t *f;
lifeform_t *rndgod;
f = hasflag(badob->flags, F_LINKGOD);
if (f) {
rndgod = findgod(f->val[0]);
} else {
rndgod = getrandomgod();
}
assert(rndgod);
godsay(rndgod->race->id, B_TRUE, getflagtext(rndgod->flags, F_GODNOWISHTEXT));
more();
killob(badob);
nbad++;
badob = hasobwithflag(tempop, F_NOWISH);
}
nretobs -= nbad;
//addob(target->cell->obpile, buf);
if (nretobs > 0) {
int ncreated = 0;
for (i = 0; i < nretobs; i++) {
char obname[BUFLEN];
@ -14395,6 +14426,9 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
newloc = real_getrandomadjcell(target->cell, &ccwalkable, B_ALLOWEXPAND, LOF_DONTNEED,
NULL, target);
o = relinkob(o, newloc->obpile);
} else {
// move to target cell under the lf
o = relinkob(o, target->cell->obpile);
}
if (o) {
noise(caster->cell, NULL, NC_OTHER, SV_WHISPER, "something hitting the ground.", NULL);
@ -14418,6 +14452,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
// couldn't make it appear - ob doesn't exist
msg("The air in front of %s seems to ripple for a while.", lfname);
}
if (tempop) killobpile(tempop);
// now age the caster
if (!isgod(caster)) {