diff --git a/rogueviz/ru/classes.cpp b/rogueviz/ru/classes.cpp index 87ca86a5..468eb1c0 100644 --- a/rogueviz/ru/classes.cpp +++ b/rogueviz/ru/classes.cpp @@ -1003,7 +1003,7 @@ struct item : public located_entity { }; struct shopitem : public item { - int qty1; + int pre_owned, pre_filled, post_owned, post_filled; int price; bool bought; string glyph() override; @@ -1012,15 +1012,20 @@ struct shopitem : public item { void act() override { kino(); bool next_intersect = intersect(get_pixel_bbox(), m.get_pixel_bbox()); - if(next_intersect && !last_intersect) { - addMessage("This costs " + its(price) + " gold."); + if(next_intersect && !last_intersect && !bought) { + addMessage("This costs " + its(price) + " gold: " + get_name()); } last_intersect = next_intersect; } string get_name() override { if(bought) return its(price) + " gold"; return item::get_name(); } string get_help() override { if(bought) return "You have bought something from this shop. The trader has stored the gold here."; return item::get_help() + "\n\nPrice: " + its(price); } shopitem* as_shopitem() override { return this; } - virtual void hs(stater& s) override { item::hs(s); s.act("bought", bought, false).act("last_intersect", last_intersect, 0); } + virtual void hs(stater& s) override { + item::hs(s); + s.act("bought", bought, false).act("last_intersect", last_intersect, 0) + .act("pre_owned", pre_owned, 0).act("pre_filled", pre_filled, 0) + .act("post_owned", pre_owned, 0).act("post_filled", pre_filled, 0); + } }; struct non_spatial_entity : public entity { diff --git a/rogueviz/ru/load-world.cpp b/rogueviz/ru/load-world.cpp index 72f97f72..9623cc19 100644 --- a/rogueviz/ru/load-world.cpp +++ b/rogueviz/ru/load-world.cpp @@ -227,7 +227,6 @@ void load_room(fhstream& f, cell *c) { b->respawn = get_xy(); b->price = get_int(); b->qty = param == "" ? 1 : get_int(); - b->qty1 = param == "" ? 0 : get_int(); b->p = &find_power(scanline_noblank(f)); b->id = unspace(b->pickup_message = scanline_noblank(f)); r.entities.emplace_back(std::move(b)); diff --git a/rogueviz/ru/map.ru b/rogueviz/ru/map.ru index 839e166f..d3f45c96 100644 --- a/rogueviz/ru/map.ru +++ b/rogueviz/ru/map.ru @@ -1349,15 +1349,21 @@ Why is there always gold lying in these mazes... ITEM 308 261 toughness You find a beautiful ring. -SHOPITEM 421 238 50 1 0 -toughness -You find a beautiful ring in this store. -SHOPITEM 420 200 50 1 0 +SHOPITEM 421 238 50 1 +dexterity +This ring is definitely beatiful. +SHOPITEM 420 200 50 1 wisdom -You find another beautiful ring in this store. +This ring will be beatiful after you clean it. +SHOPITEM 444 200 50 1 +toughness +This ring is probably magical. +SHOPITEM 444 168 50 1 +strength +This ring looks very well-made. TRADER 458 247 -John the trader -Hello here! Please buy something from my shop! +Jeweller +Hello here! Please buy something beautiful from my jewelry shop! OK MOVE 2 Mazes of Menace @@ -1726,9 +1732,21 @@ MAP #b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b TIMEORB 30 117 3.9 TIMEORB 560 79 20 +SHOPITEM 250 45 80 1 +heavy armor +You get a part of warrior outfit. +SHOPITEM 280 45 80 1 +wizard attire +You get a part of wizard outfit. +SHOPITEM 314 45 80 1 +thief garments +You get a part of thief outfit. +SHOPITEM 345 45 80 1 +druid outfit +You get a part of druid outfit. TRADER 236 67 -Jack the trader -Do you want to buy anthing?\n\nSorry for the traps, last week a thief stole my stuff and escaped through some secret door. So I installed some for protection.\n\nNo idea where it is... +Outfitter +Hello, do you want anything to wear? welcome to my shop.\n\nSorry for the traps, last week a thief stole my stuff and escaped through some secret door. So I installed some for protection. OK MOVE 4 Timed Passage @@ -3102,6 +3120,8 @@ $ shop door . air / right slope \ left slope +^ spike +| column MAP ################################################################################ ################################################################################ @@ -3120,9 +3140,9 @@ MAP ################################################################################ ################################################################################ ################################################################################ -#############################################.................################## -##################......................#####.................################## -#################.......................#####.................################## +#############################################.......|.........################## +##################......................#####.......|.........################## +#################.......................#####.......^.........################## ################........................#####.................################## ###############......./###########\........$..................################## ##############.......//###########\\.......$..................################## @@ -3144,11 +3164,20 @@ MAP ################################################################################ #b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b FIGHTTRADER 470 170 -Rick the trader -Keep your axes away from the shop! -SHOPITEM 420 170 50 1 0 -wisdom -"It is wise to wear magical rings in your travels!" +Apothecary +Keep your axes away from my apothecary! +SHOPITEM 360 170 150 1 +health +You take the first bottle. +SHOPITEM 385 170 50 1 +mystery +You take the second bottle. +SHOPITEM 410 170 50 1 +surprise +You take the third bottle. +SHOPITEM 435 170 50 1 +enigma +You take the fourth bottle. OK MOVE 3 Central Cavern Bottom Left @@ -3374,10 +3403,16 @@ MAP #b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b TRADER 516 90 Kelly the trader -Hey! We have some nice rings for sale! -SHOPITEM 557 24 50 1 0 -toughness -This shop sells some nice rings. +Hey! We have some nice general stuff for sale! +SHOPITEM 557 24 50 1 +dagger +You pick up a simple dagger. +SHOPITEM 557 40 80 1 +strange cyan crystal ball +You pick up a crystal ball. +SHOPITEM 510 40 20 1 +furry ring +You pick up a furry ring. ITEM 240 230 polymorph You find some alchemical ingredients. diff --git a/rogueviz/ru/powers.cpp b/rogueviz/ru/powers.cpp index 03fd3ed4..ee996d26 100644 --- a/rogueviz/ru/powers.cpp +++ b/rogueviz/ru/powers.cpp @@ -668,7 +668,9 @@ void gen_powers() { done_something = true; addMessage(si->pickup_message); power_death_revert(*si->p); - si->p->qty_owned += si->qty; si->p->qty_filled += si->qty1; + si->pre_owned = si->p->qty_owned; si->pre_filled = si->p->qty_filled; + si->p->picked_up(si->qty); + si->post_owned = si->p->qty_owned; si->post_filled = si->p->qty_filled; add_revert(death_revert, {"EXIST", si->id}); si->existing = false; } @@ -682,11 +684,14 @@ void gen_powers() { } else if((it ? !done_something : on) && !si->existing && !si->bought) { done_something = true; - addMessage("You rethink your purchase."); - power_death_revert(*si->p); - si->p->qty_owned -= si->qty; si->p->qty_filled -= si->qty1; - add_revert(death_revert, {"UNEXIST", si->id}); - si->existing = true; + if(si->p->qty_owned == si->post_owned && si->p->qty_filled == si->post_filled) { + addMessage("You rethink your purchase."); + power_death_revert(*si->p); + si->p->qty_owned = si->pre_owned; si->p->qty_filled = si->pre_filled; + add_revert(death_revert, {"UNEXIST", si->id}); + si->existing = true; + } + else addMessage("Cannot return this anymore, in the current state!"); } else if((it ? !done_something : on) && !si->existing && si->bought) { done_something = true;