diff options
-rw-r--r-- | crawl-ref/source/chardump.cc | 46 | ||||
-rw-r--r-- | crawl-ref/source/clua.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/enum.h | 6 | ||||
-rw-r--r-- | crawl-ref/source/externs.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/items.cc | 1 | ||||
-rw-r--r-- | crawl-ref/source/mon-data.h | 11 | ||||
-rw-r--r-- | crawl-ref/source/religion.cc | 1 | ||||
-rw-r--r-- | crawl-ref/source/shopping.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/tags.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/transfor.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/traps.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/view.cc | 2 |
12 files changed, 77 insertions, 7 deletions
diff --git a/crawl-ref/source/chardump.cc b/crawl-ref/source/chardump.cc index c02ecac128..155168a3db 100644 --- a/crawl-ref/source/chardump.cc +++ b/crawl-ref/source/chardump.cc @@ -65,6 +65,7 @@ static void _sdump_burden(dump_params &); static void _sdump_hunger(dump_params &); static void _sdump_transform(dump_params &); static void _sdump_visits(dump_params &); +static void _sdump_gold(dump_params &); static void _sdump_misc(dump_params &); static void _sdump_turns_by_place(dump_params &); static void _sdump_notes(dump_params &); @@ -118,6 +119,7 @@ static dump_section_handler dump_handlers[] = { { "hunger", _sdump_hunger }, { "transform", _sdump_transform }, { "visits", _sdump_visits }, + { "gold", _sdump_gold }, { "misc", _sdump_misc }, { "turns_by_place", _sdump_turns_by_place}, { "notes", _sdump_notes }, @@ -329,6 +331,49 @@ static void _sdump_visits(dump_params &par) text += "\n"; } +static void _sdump_gold(dump_params &par) +{ + std::string &text(par.text); + + int lines = 0; + + const char* have = "have "; + if (par.se) // you died -> past tense + have = ""; + + if (you.attribute[ATTR_GOLD_FOUND] > 0) + { + lines++; + text += make_stringf("You %scollected %d gold pieces.\n", have, + you.attribute[ATTR_GOLD_FOUND]); + } + + if (you.attribute[ATTR_PURCHASES] > 0) + { + lines++; + text += make_stringf("You %sspent %d gold pieces at shops.\n", have, + you.attribute[ATTR_PURCHASES]); + } + + if (you.attribute[ATTR_DONATIONS] > 0) + { + lines++; + text += make_stringf("You %sdonated %d gold pices.\n", have, + you.attribute[ATTR_DONATIONS]); + } + + if (you.attribute[ATTR_MISC_SPENDING] > 0) + { + lines++; + text += make_stringf("You %sused %d gold pieces for miscellaneous " + "purposes.\n", have, + you.attribute[ATTR_MISC_SPENDING]); + } + + if (lines > 0) + text += "\n"; +} + static void _sdump_misc(dump_params &par) { _sdump_location(par); @@ -337,6 +382,7 @@ static void _sdump_misc(dump_params &par) _sdump_hunger(par); _sdump_transform(par); _sdump_visits(par); + _sdump_gold(par); } #define TO_PERCENT(x, y) (100.0f * ((float) (x)) / ((float) (y))) diff --git a/crawl-ref/source/clua.cc b/crawl-ref/source/clua.cc index a2cd62d2c4..84b164d97b 100644 --- a/crawl-ref/source/clua.cc +++ b/crawl-ref/source/clua.cc @@ -824,8 +824,13 @@ static int _you_gold(lua_State *ls) { ASSERT_DLUA; const int new_gold = luaL_checkint(ls, 1); + const int old_gold = you.gold; you.gold = std::max(new_gold, 0); you.redraw_gold = true; + if (new_gold > old_gold) + you.attribute[ATTR_GOLD_FOUND] += new_gold - old_gold; + else if (old_gold > new_gold) + you.attribute[ATTR_MISC_SPENDING] += old_gold - new_gold; } PLUARET(number, you.gold); } diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index c6a9b6b2b6..4019dffced 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -161,6 +161,10 @@ enum attribute_type ATTR_ABYSSAL_RUNES, ATTR_RUNES_IN_ZOT, ATTR_WEAPON_SWAP_INTERRUPTED, + ATTR_GOLD_FOUND, + ATTR_PURCHASES, // Gold amount spent at shops. + ATTR_DONATIONS, // Gold amount donated to Zin. + ATTR_MISC_SPENDING, // Spending for things like ziggurats. NUM_ATTRIBUTES }; @@ -1896,7 +1900,7 @@ enum monster_type // (int) menv[].type MONS_ORB_OF_FIRE, // Swords renamed to fit -- bwr MONS_QUOKKA, // Quokka are a type of wallaby, returned -- bwr 382 MONS_TRAPDOOR_SPIDER, - // 384 + MONS_CHAOS_SPAWN, MONS_EYE_OF_DEVASTATION = 385, // 385 MONS_MOTH_OF_WRATH, MONS_DEATH_COB, diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index c5d620147d..d1f48cd3e1 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -801,7 +801,7 @@ public: int berserk_penalty; // penalty for moving while berserk - FixedVector<unsigned char, NUM_ATTRIBUTES> attribute; + FixedVector<unsigned long, NUM_ATTRIBUTES> attribute; FixedVector<unsigned char, NUM_QUIVER> quiver; // default items for quiver FixedVector<long, NUM_OBJECT_CLASSES> sacrifice_value; diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index eb02b355bd..75151e4d9e 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -1515,6 +1515,7 @@ int move_item_to_player( int obj, int quant_got, bool quiet ) // Gold has no mass, so we handle it first. if (mitm[obj].base_type == OBJ_GOLD) { + you.attribute[ATTR_GOLD_FOUND] += quant_got; you.gold += quant_got; dec_mitm_item_quantity( obj, quant_got ); you.redraw_gold = true; diff --git a/crawl-ref/source/mon-data.h b/crawl-ref/source/mon-data.h index dc20a5f3ec..a40cff23a1 100644 --- a/crawl-ref/source/mon-data.h +++ b/crawl-ref/source/mon-data.h @@ -3427,6 +3427,17 @@ static monsterentry mondata[] = { HT_LAND, 11, DEFAULT_ENERGY, MONUSE_OPEN_DOORS, SIZE_SMALL }, +{ + MONS_CHAOS_SPAWN, '3', EC_RANDOM, "chaos spawn", + M_SEE_INVIS | M_EVIL, + MR_NO_FLAGS, + 0, 10, MONS_CHAOS_SPAWN, MONS_CHAOS_SPAWN, MH_NATURAL, -3, + { AT_NO_ATK, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK }, + { 0, 0, 0, 0 }, + 0, 0, MST_NO_SPELLS, CE_MUTAGEN_RANDOM, Z_NOZOMBIE, S_RANDOM, I_NORMAL, + HT_LAND, 0, DEFAULT_ENERGY, MONUSE_NOTHING, SIZE_BIG +}, + // reaper etc. ('2') { MONS_SUN_DEMON, '2', YELLOW, "sun demon", diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 67d4a821ea..a949d74a73 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -5832,6 +5832,7 @@ void offer_items() // Take a note of the donation. take_note(Note(NOTE_DONATE_MONEY, you.gold)); + you.attribute[ATTR_DONATIONS] += you.gold; you.gold = 0; you.redraw_gold = true; diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc index 7df3d83fef..33ca97f4f9 100644 --- a/crawl-ref/source/shopping.cc +++ b/crawl-ref/source/shopping.cc @@ -483,6 +483,8 @@ static bool _purchase( int shop, int item_got, int cost, bool id ) { you.gold -= cost; + you.attribute[ATTR_PURCHASES] += cost; + item_def& item = mitm[item_got]; origin_purchased(item); diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc index 89642b4ce8..88e68d9120 100644 --- a/crawl-ref/source/tags.cc +++ b/crawl-ref/source/tags.cc @@ -958,7 +958,7 @@ static void tag_construct_you(writer &th) // how many attributes? marshallByte(th, NUM_ATTRIBUTES); for (j = 0; j < NUM_ATTRIBUTES; ++j) - marshallByte(th, you.attribute[j]); + marshallLong(th, you.attribute[j]); // Was: remembered quiver items. marshallByte(th, 0); @@ -1373,7 +1373,7 @@ static void tag_read_you(reader &th, char minorVersion) // how many attributes? count_c = unmarshallByte(th); for (j = 0; j < count_c; ++j) - you.attribute[j] = unmarshallByte(th); + you.attribute[j] = unmarshallLong(th); // old: quiver info. Discard it. count_c = unmarshallByte(th); diff --git a/crawl-ref/source/transfor.cc b/crawl-ref/source/transfor.cc index 1fb46961d4..757cd78b3e 100644 --- a/crawl-ref/source/transfor.cc +++ b/crawl-ref/source/transfor.cc @@ -386,7 +386,7 @@ bool transform(int pow, transformation_type which_trans, bool quiet) } // This must occur before the untransform() and the is_undead check. - if (you.attribute[ATTR_TRANSFORMATION] == which_trans) + if (you.attribute[ATTR_TRANSFORMATION] == (unsigned long) which_trans) { if (you.duration[DUR_TRANSFORMATION] < 100) { diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc index 7963073cf2..3ef7b250f4 100644 --- a/crawl-ref/source/traps.cc +++ b/crawl-ref/source/traps.cc @@ -1022,7 +1022,7 @@ void free_self_from_net() else { // You try to escape (takes at least 3 turns, and at most 10). - int escape = do_what; + unsigned int escape = do_what; if (you.duration[DUR_HASTE]) // extra bonus, also Berserk escape++; diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 187f507354..9e63c2b43a 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -1240,7 +1240,7 @@ void monster_grid(bool do_updates) void fire_monster_alerts() { - int num_hostile = 0; + unsigned int num_hostile = 0; for (int s = 0; s < MAX_MONSTERS; s++) { |