summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/clua.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-12 06:55:11 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-12 06:55:11 +0000
commit7142a710d849f6b0ad566c691278d524578b3a6a (patch)
treecbd29c164eceaccc412d254b5b95dd96d2ab9e78 /crawl-ref/source/clua.cc
parent3369ae23fda553c05f6fc48c177f517503cb51ea (diff)
downloadcrawl-ref-7142a710d849f6b0ad566c691278d524578b3a6a.tar.gz
crawl-ref-7142a710d849f6b0ad566c691278d524578b3a6a.zip
Improve performance by only checking whether there are lava or deep
water grids nearby if the player recently moved (or restarted a game) and if a non-adjacent monster tries to reach the player. Remove now unneeded lua code (was used for the old pickup.lua) and make monsters switch away from ranged weapons when engaging you in melee. If a monster will still insist on hitting you with a sling it's a sure sign said sling is cursed (doesn't autoID, though). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5755 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/clua.cc')
-rw-r--r--crawl-ref/source/clua.cc69
1 files changed, 0 insertions, 69 deletions
diff --git a/crawl-ref/source/clua.cc b/crawl-ref/source/clua.cc
index 149aeb44fa..23828d33f8 100644
--- a/crawl-ref/source/clua.cc
+++ b/crawl-ref/source/clua.cc
@@ -1269,73 +1269,6 @@ static int l_item_subtype(lua_State *ls)
return (2);
}
-// Used to divide a given potion into one of four categories:
-// 0 : unknown potion
-// 1 : always beneficial
-// 2 : always bad
-// 3 : depends on species etc.
-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)
- {
- // good potions:
- case POT_HEALING:
- case POT_HEAL_WOUNDS:
- case POT_SPEED:
- case POT_MIGHT:
- case POT_LEVITATION:
- case POT_INVISIBILITY:
- case POT_EXPERIENCE:
- case POT_MAGIC:
- case POT_RESTORE_ABILITIES:
- case POT_RESISTANCE:
- val = 1;
- break;
-
- // bad potions:
- case POT_POISON:
- case POT_STRONG_POISON:
- case POT_SLOWING:
- case POT_PARALYSIS:
- case POT_CONFUSION:
- case POT_DEGENERATION:
- case POT_DECAY:
- case POT_MUTATION:
- val = 2;
- break;
-
- // Need more refined handling:
- // for eating habits
- case POT_BLOOD:
- case POT_BLOOD_COAGULATED:
- 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;
- }
- }
- }
- lua_pushnumber(ls, val);
- return (1);
-}
-
static int l_item_cursed(lua_State *ls)
{
LUA_ITEM(item, 1);
@@ -1345,7 +1278,6 @@ static int l_item_cursed(lua_State *ls)
return (1);
}
-
static int l_item_worn(lua_State *ls)
{
LUA_ITEM(item, 1);
@@ -1526,7 +1458,6 @@ static const struct luaL_reg item_lib[] =
{ "branded", l_item_branded },
{ "class", l_item_class },
{ "subtype", l_item_subtype },
- { "potion_type", l_item_potion_type },
{ "cursed", l_item_cursed },
{ "worn", l_item_worn },
{ "name", l_item_name },