diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-08-24 11:39:43 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-08-24 11:39:43 +0000 |
commit | cb76f80426af8941a42b7346aacba92529e41338 (patch) | |
tree | ae73182eb6be8c941aaef6683c5a539124b83552 /crawl-ref/source | |
parent | a42cf252322e22af17e24e3f5e8f2f7a35cc0bd7 (diff) | |
download | crawl-ref-cb76f80426af8941a42b7346aacba92529e41338.tar.gz crawl-ref-cb76f80426af8941a42b7346aacba92529e41338.zip |
Finally fixed pickup.lua to work as intended (I hope).
Other small changes:
- default yesno for renouncing religion to 'n'
- plants and fungi aren't "interesting", even when OOD
- added WIZ designator to listed saved characters
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2031 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/abl-show.cc | 6 | ||||
-rw-r--r-- | crawl-ref/source/acr.cc | 3 | ||||
-rw-r--r-- | crawl-ref/source/clua.cc | 26 | ||||
-rw-r--r-- | crawl-ref/source/lua/pickup.lua | 47 | ||||
-rw-r--r-- | crawl-ref/source/monplace.cc | 17 | ||||
-rw-r--r-- | crawl-ref/source/player.cc | 5 |
6 files changed, 64 insertions, 40 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc index 3dfe627c57..dfcfa80aba 100644 --- a/crawl-ref/source/abl-show.cc +++ b/crawl-ref/source/abl-show.cc @@ -1699,8 +1699,10 @@ static bool do_ability(const ability_def& abil) break; case ABIL_RENOUNCE_RELIGION: - if (yesno("Really renounce your faith, foregoing its fabulous benefits?") - && yesno( "Are you sure you won't change your mind later?" )) + if (yesno("Really renounce your faith, foregoing its fabulous benefits?", + false, 'n') + && yesno("Are you sure you won't change your mind later?", + false, 'n' )) { excommunication(); } diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 12d395d6a2..7f01edd703 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -380,8 +380,7 @@ static void handle_wizard_command( void ) mpr( "If you continue, your game will not be scored!", MSGCH_WARN ); #endif - if (!yesno( "Do you really want to enter wizard mode?", - false, 'n' )) + if (!yesno( "Do you really want to enter wizard mode?", false, 'n' )) return; you.wizard = true; diff --git a/crawl-ref/source/clua.cc b/crawl-ref/source/clua.cc index f6f9c07f2f..85e73b20df 100644 --- a/crawl-ref/source/clua.cc +++ b/crawl-ref/source/clua.cc @@ -1180,12 +1180,18 @@ static int l_item_subtype(lua_State *ls) { if (item->sub_type == POT_BLOOD) s = "blood"; - else if (item->sub_type == POT_BERSERK_RAGE) - s = "berserk"; else if (item->sub_type == POT_WATER) s = "water"; else if (item->sub_type == POT_PORRIDGE) s = "porridge"; + else if (item->sub_type == POT_BERSERK_RAGE) + s = "berserk"; + else if (item->sub_type == POT_GAIN_STRENGTH + || item->sub_type == POT_GAIN_DEXTERITY + || item->sub_type == POT_GAIN_INTELLIGENCE) + s = "gain ability"; + else if (item->sub_type == POT_CURE_MUTATION) + s = "cure mutation"; } if (s) @@ -1207,11 +1213,13 @@ static int l_item_potion_type(lua_State *ls) { LUA_ITEM(item, 1); int val = 99; - + if (item && item->base_type == OBJ_POTIONS) { if (!item_type_known(*item)) + { val = 0; + } else { switch(item->sub_type) @@ -1221,15 +1229,11 @@ static int l_item_potion_type(lua_State *ls) case POT_HEAL_WOUNDS: case POT_SPEED: case POT_MIGHT: - case POT_GAIN_STRENGTH: - case POT_GAIN_DEXTERITY: - case POT_GAIN_INTELLIGENCE: case POT_LEVITATION: case POT_INVISIBILITY: case POT_EXPERIENCE: case POT_MAGIC: case POT_RESTORE_ABILITIES: - case POT_CURE_MUTATION: case POT_RESISTANCE: val = 1; break; @@ -1247,10 +1251,16 @@ static int l_item_potion_type(lua_State *ls) break; // need more refined handling: - case POT_BERSERK_RAGE: + // for eating habits case POT_BLOOD: case POT_WATER: case POT_PORRIDGE: + // for undead + case POT_BERSERK_RAGE: + case POT_GAIN_STRENGTH: + case POT_GAIN_DEXTERITY: + case POT_GAIN_INTELLIGENCE: + case POT_CURE_MUTATION: default: val = 3; } diff --git a/crawl-ref/source/lua/pickup.lua b/crawl-ref/source/lua/pickup.lua index 452ef0b965..26f68efec1 100644 --- a/crawl-ref/source/lua/pickup.lua +++ b/crawl-ref/source/lua/pickup.lua @@ -1,16 +1,18 @@ ----------------------------------------------------------------------------
+------------------------------------------------------------
-- pickup.lua:
--- Smarter autopickup handling that takes into account the item type
--- in combination with your character's race, religion, knowledge,
--- and eating habits.
+-- Smarter autopickup handling that takes into account the
+-- item type in combination with your character's race,
+-- religion, knowledge, and eating habits.
--
-- To use this, add this line to your init.txt:
-- lua_file = lua/pickup.lua
--
-- Notes:
--- * This script only handles items of classes with autopickup on.
--- * Any result can still be overridden using autopickup_exceptions.
----------------------------------------------------------------------------
+-- * This script only handles items of classes with
+-- autopickup on.
+-- * Any result can still be overridden using
+-- autopickup_exceptions.
+------------------------------------------------------------
function make_hash(ls)
local h = { }
@@ -21,7 +23,8 @@ function make_hash(ls) end
function you_undead()
- return you.race() == "Mummy" or you.race() == "Ghoul" or you.race() == "Vampire"
+ return you.race() == "Mummy" or you.race() == "Ghoul"
+ or you.race() == "Vampire"
end
-- not identified
@@ -33,12 +36,12 @@ function good_potion(type) return type == 1
end
-function bad_potion(it)
+function bad_potion(type)
return type == 2
end
-- special cases
-function spec_potion(it)
+function spec_potion(type)
return type == 3
end
@@ -54,7 +57,8 @@ function ch_autopickup(it) return true
end
- -- no potions for Mummies, also: no bad potions for anyone else
+ -- no potions for Mummies
+ -- also: no bad potions for anyone else
if you.race() == "Mummy" or bad_potion(type) then
return false
end
@@ -68,7 +72,10 @@ function ch_autopickup(it) if spec_potion(type) then
-- undead cannot use berserk
- if item.subtype(it) == "berserk" then
+ -- or anything involving mutations
+ if item.subtype(it) == "berserk"
+ or item.subtype(it) == "gain ability"
+ or item.subtype(it) == "cure mutation" then
if you_undead() then
return false
else
@@ -77,7 +84,8 @@ function ch_autopickup(it) end
-- special cases for blood, water, and porridge
- if item.subtype(it) == "blood" or item.subtype(it) == "water"
+ if item.subtype(it) == "blood"
+ or item.subtype(it) == "water"
or item.subtype(it) == "porridge" then
return food.can_eat(it, false)
end
@@ -87,20 +95,23 @@ function ch_autopickup(it) return true
end
- if item.class(it) == "Carrion" or item.class(it) == "Comestibles" then
+ if item.class(it) == "Carrion"
+ or item.class(it) == "Comestibles" then
return food.can_eat(it, false)
end
- if item.class(it) == "Books" and you.god() == "Trog" then
- return false
+ if item.class(it) == "Books" and you.god() == "Trog"
+ then return false
end
if item.class(it) == "Jewellery" then
- if item.subtype == "hunger" or item.subtype == "inaccuracy" then
+ if item.subtype(it) == "hunger"
+ or item.subtype(it) == "inaccuracy" then
return false
end
if you_undead() and
- (item.subtype(it) == "regeneration" or item.subtype(it) == "rage") then
+ (item.subtype(it) == "regeneration"
+ or item.subtype(it) == "rage") then
return false
end
end
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc index 3e0c01ac01..4d80b20520 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -334,8 +334,6 @@ bool place_monster(int &id, int mon_type, int power, beh_type behaviour, int lev_mons = power; // final 'power' int i; - // player shoved out of the way? - bool shoved = false; unsigned char stair_gfx = 0; int tries = 0; int pval = 0; @@ -365,11 +363,6 @@ bool place_monster(int &id, int mon_type, int power, beh_type behaviour, continue; } - // Is the monster happy where we want to put it? - unsigned char grid_wanted = monster_habitat(mon_type); - if (!grid_compatible(grid_wanted, grd[px][py], true)) - continue; - // Is the grid verboten? if (!unforbidden( coord_def(px, py), mmask )) continue; @@ -408,8 +401,6 @@ bool place_monster(int &id, int mon_type, int power, beh_type behaviour, if (lev_mons <= 0) { proximity = PROX_AWAY_FROM_PLAYER; - // or maybe allow 1st level monsters, having visited the - // surface, to re-enter the dungeon // in that case lev_mons stays as it is } else @@ -462,9 +453,13 @@ bool place_monster(int &id, int mon_type, int power, beh_type behaviour, bool proxOK; bool close_to_player; + // player shoved out of the way? + bool shoved = false; + if (!summoned) { tries = 0; + // try to pick px, py that is // a) not occupied // b) compatible @@ -1419,7 +1414,9 @@ void mark_interesting_monst(struct monsters* monster, beh_type behaviour) mons_level(monster->type) >= you.your_level + ood_limit() && mons_level(monster->type) < 99 && !(monster->type >= MONS_EARTH_ELEMENTAL && - monster->type <= MONS_AIR_ELEMENTAL) ) + monster->type <= MONS_AIR_ELEMENTAL) + && (!Options.safe_zero_exp || + !mons_class_flag( monster->type, M_NO_EXP_GAIN ))) interesting = true; if ( interesting ) diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index be70ca81cd..0aa2a822bf 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -4964,6 +4964,11 @@ std::string player::short_desc() const desc += " "; desc += class_name; +#ifdef WIZARD + if (wizard) + desc += " (WIZ)"; +#endif + return (desc); } |