summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-09-22 23:32:29 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-09-22 23:32:29 +0000
commitaa252547717a360b48fbd22be19805faa78101d9 (patch)
tree08c024dbcf0ab5e8ee91c62ee1a187197fa74323
parent8ca9c3ccaae393d32e2c08dc5585daf64c839ed8 (diff)
downloadcrawl-ref-aa252547717a360b48fbd22be19805faa78101d9.tar.gz
crawl-ref-aa252547717a360b48fbd22be19805faa78101d9.zip
Fixed wand pricing in shops
Added debug command to create a shop by type for debugging further price stuff we may run into. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup@87 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/acr.cc4
-rw-r--r--crawl-ref/source/debug.cc74
-rw-r--r--crawl-ref/source/debug.h1
-rw-r--r--crawl-ref/source/dungeon.cc14
-rw-r--r--crawl-ref/source/dungeon.h6
-rw-r--r--crawl-ref/source/shopping.cc30
6 files changed, 101 insertions, 28 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 2f1a0c4652..e8b5d42c1e 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -595,6 +595,10 @@ static void handle_wizard_command( void )
debug_make_trap();
break;
+ case '\\':
+ debug_make_shop();
+ break;
+
case 'f':
debug_fight_statistics(false);
break;
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index 5682415d73..3bdde02b1a 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -2173,10 +2173,7 @@ void debug_make_trap()
return;
}
- env.trap[trap_slot].type = trap;
- env.trap[trap_slot].x = you.x_pos;
- env.trap[trap_slot].y = you.y_pos;
- grd[you.x_pos][you.y_pos] = DNGN_UNDISCOVERED_TRAP;
+ place_specific_trap(you.x_pos, you.y_pos, trap);
mprf("Created a %s trap, marked it undiscovered",
trap_name(trap));
@@ -2184,4 +2181,73 @@ void debug_make_trap()
// Also tell travel that its world-view must change.
travel_init_new_level();
}
+
+static const char *shop_types[] = {
+ "weapon",
+ "armour",
+ "antique weapon",
+ "antique armour",
+ "antiques",
+ "jewellery",
+ "wand",
+ "book",
+ "food",
+ "distillery",
+ "scroll",
+ "general"
+};
+
+void debug_make_shop()
+{
+ char requested_shop[80];
+ int gridch = grd[you.x_pos][you.y_pos];
+ bool have_shop_slots = false;
+ int new_shop_type = SHOP_UNASSIGNED;
+
+ if (gridch != DNGN_FLOOR)
+ {
+ mpr("Insufficient floor-space for new Wal-Mart.");
+ return;
+ }
+
+ for (int i = 0; i < MAX_SHOPS; ++i)
+ {
+ if (env.shop[i].type == SHOP_UNASSIGNED)
+ {
+ have_shop_slots = true;
+ break;
+ }
+ }
+
+ if (!have_shop_slots)
+ {
+ mpr("There are too many shops on this level.");
+ return;
+ }
+
+ mprf(MSGCH_PROMPT, "What kind of shop? ");
+ get_input_line( requested_shop, sizeof( requested_shop ) );
+ if (!*requested_shop)
+ return;
+
+ strlwr(requested_shop);
+ for (unsigned i = 0; i < sizeof(shop_types) / sizeof (*shop_types); ++i)
+ {
+ if (strstr(requested_shop, shop_types[i]))
+ {
+ new_shop_type = i;
+ break;
+ }
+ }
+
+ if (new_shop_type == SHOP_UNASSIGNED)
+ {
+ mprf("Bad shop type: \"%s\"", requested_shop);
+ return;
+ }
+
+ place_spec_shop(you.your_level, you.x_pos, you.y_pos, new_shop_type);
+ link_items();
+ mprf("Done.");
+}
#endif
diff --git a/crawl-ref/source/debug.h b/crawl-ref/source/debug.h
index 1a8a743916..8420046dd1 100644
--- a/crawl-ref/source/debug.h
+++ b/crawl-ref/source/debug.h
@@ -145,5 +145,6 @@ void debug_get_religion( void );
void debug_change_species( void );
void debug_fight_statistics( bool use_init_defaults );
void debug_make_trap( void );
+void debug_make_shop( void );
#endif
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index bfded837ef..e9c6cb690b 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -83,8 +83,6 @@ static void builder_items(int level_number, char level_type, int items_wanted);
static void builder_monsters(int level_number, char level_type, int mon_wanted);
static void place_specific_stair(unsigned char stair);
static void place_branch_entrances(int dlevel, char level_type);
-static bool place_specific_trap(unsigned char spec_x, unsigned char spec_y,
- unsigned char spec_type);
static void place_traps( int level_number );
static void prepare_swamp(void);
static void prepare_water( int level_number );
@@ -125,8 +123,6 @@ static void diamond_rooms(int level_number);
// ITEM & SHOP FUNCTIONS
static void place_shops(int level_number);
-static void place_spec_shop(int level_number, unsigned char shop_x,
- unsigned char shop_y, unsigned char force_s_type);
static unsigned char item_in_shop(unsigned char shop_type);
static bool treasure_area(int level_number, unsigned char ta1_x,
unsigned char ta2_x, unsigned char ta1_y,
@@ -6690,9 +6686,9 @@ static void place_shops(int level_number)
}
} // end place_shops()
-static void place_spec_shop( int level_number,
- unsigned char shop_x, unsigned char shop_y,
- unsigned char force_s_type )
+void place_spec_shop( int level_number,
+ unsigned char shop_x, unsigned char shop_y,
+ unsigned char force_s_type )
{
int orb = 0;
int i = 0;
@@ -8314,8 +8310,8 @@ static void jelly_pit(int level_number, spec_room &sr)
fill_monster_pit( sr, pit_list, 90, MONS_PROGRAM_BUG, lordx, lordy );
}
-static bool place_specific_trap(unsigned char spec_x, unsigned char spec_y,
- unsigned char spec_type)
+bool place_specific_trap(unsigned char spec_x, unsigned char spec_y,
+ unsigned char spec_type)
{
if (spec_type == TRAP_RANDOM)
spec_type = random2(NUM_TRAPS);
diff --git a/crawl-ref/source/dungeon.h b/crawl-ref/source/dungeon.h
index 2da0e50a0c..15e1938065 100644
--- a/crawl-ref/source/dungeon.h
+++ b/crawl-ref/source/dungeon.h
@@ -50,4 +50,10 @@ void define_zombie(int mid, int ztype, int cs, int power);
bool is_wall(int feature);
+bool place_specific_trap(unsigned char spec_x, unsigned char spec_y,
+ unsigned char spec_type);
+
+void place_spec_shop(int level_number, unsigned char shop_x,
+ unsigned char shop_y, unsigned char force_s_type);
+
#endif
diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc
index 54b857947f..206cebe063 100644
--- a/crawl-ref/source/shopping.cc
+++ b/crawl-ref/source/shopping.cc
@@ -1088,49 +1088,49 @@ unsigned int item_value( item_def item, id_arr id, bool ident )
{
switch (item.sub_type)
{
- case WAND_FIREBALL:
case WAND_HASTING:
- valued += 600;
+ case WAND_HEALING:
+ valued += 300;
break;
- case WAND_HEALING:
case WAND_TELEPORTATION:
- valued += 500;
+ valued += 250;
+ break;
+
+ case WAND_COLD:
+ case WAND_FIRE:
+ case WAND_FIREBALL:
+ valued += 200;
break;
case WAND_INVISIBILITY:
case WAND_DISINTEGRATION:
+ case WAND_DRAINING:
case WAND_LIGHTNING:
- valued += 400;
- break;
-
- case WAND_COLD:
- case WAND_FIRE:
- valued += 350;
+ valued += 175;
break;
case WAND_DIGGING:
- valued += 200;
+ valued += 100;
break;
case WAND_FLAME:
case WAND_FROST:
- case WAND_DRAINING:
case WAND_PARALYSIS:
- valued += 150;
+ valued += 75;
break;
case WAND_ENSLAVEMENT:
case WAND_POLYMORPH_OTHER:
case WAND_SLOWING:
- valued += 100;
+ valued += 50;
break;
case WAND_CONFUSION:
case WAND_MAGIC_DARTS:
case WAND_RANDOM_EFFECTS:
default:
- valued += 75;
+ valued += 45;
break;
}