summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/clua.cc
Commit message (Collapse)AuthorAgeFilesLines
* Add a function x_chance_in_y(x,y) to replace the variousj-p-e-g2008-07-061-1/+1
| | | | | | | | random2(y) < x checks, e.g. x_chance_in_y(weight, totalweight). This should make things a bit more readable. Apply it to a number of files. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6428 c06c8d41-db1a-0410-9941-cceddc491573
* Disallow vampires from draining summoned creatures to be consistent withj-p-e-g2008-07-041-2/+2
| | | | | | | | | | | | | summoned creatures being incapable of bleeding on the floor. This makes things more difficult for Vampires; on the other hand there was a (more or less) recent change that lets them regain 1 hp *per turn* when draining corpses. We might also increase the duration of blood potions... Apart from that, various clean-ups. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6393 c06c8d41-db1a-0410-9941-cceddc491573
* Misc. minor cleanups. (Yes, a huge amount of them but still...)j-p-e-g2008-06-261-1/+1
| | | | git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6146 c06c8d41-db1a-0410-9941-cceddc491573
* Really fix pickup.lua not to search for a butchering tool if you'rej-p-e-g2008-06-211-1/+16
| | | | | | | | wielding a cursed sharp-edged weapon. (My previous "fix" was preventing auto-picking up a butchering tool, at all!) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6031 c06c8d41-db1a-0410-9941-cceddc491573
* Bug 1992619: if the player hit '>' on a labyrinth entracnce right before itzelgadis2008-06-141-0/+6
| | | | | | | | | | | timed out, then the entrance *would* time out during the stair climbing delay, removing the marker before the delay ended and thus preventing the player from entering. Now timed feature markers check for this, in which case the marker isn't deleted and a message of "The foo vanishes just as you enter it!" is given. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5809 c06c8d41-db1a-0410-9941-cceddc491573
* Improve performance by only checking whether there are lava or deepj-p-e-g2008-06-121-69/+0
| | | | | | | | | | | | | 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
* Clean-up (renaming static methods and comments) in a number of files.j-p-e-g2008-06-101-26/+28
| | | | git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5703 c06c8d41-db1a-0410-9941-cceddc491573
* Move pickup_butcher_tool.txt into (the recently freed) pickup.lua, j-p-e-g2008-06-101-31/+33
| | | | | | | re-enable it (whoops) and clean up its code. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5698 c06c8d41-db1a-0410-9941-cceddc491573
* Added some C lua functions to simplify pickup_butcher_tool.txt. Also,zelgadis2008-06-101-1/+30
| | | | | | | | pickup_butcher_tool.txt now takes claws mutation and whether or not your god likes butchery into account. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5692 c06c8d41-db1a-0410-9941-cceddc491573
* Yikes, so many files! And all I did was add more item evaluationj-p-e-g2008-06-091-7/+10
| | | | | | | | | | | | | | | | | | | | | | | functions for menu colouring and pickup... Added: emergency_item, good_item, dangerous_item, bad_item, and useless_item, all taking into account player species and mutations, so e.g. =see invisible is useless for Naga, and !poison is always bad but only useless if you don't know Evaporate. Never autopickup useless, dangerous (e.g. ?immolation) or inedible items, and simplify the item colour/pickup options accordingly. I'll have to see if pickup.lua is still even needed after this. Removed the menu_colour_prefix_id option as I can't see any reason to turn it off. Oh, and fixed a bug where Kenku were unable to stop levitating if they gained level 15 while levitating. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5658 c06c8d41-db1a-0410-9941-cceddc491573
* For stash searching, annotate dropped items with {dropped} ifzelgadis2008-06-041-0/+12
| | | | | | | annotate_item_dropped is set to true. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5466 c06c8d41-db1a-0410-9941-cceddc491573
* Can now conditionalize settings based on menu_colour_prefix_class andzelgadis2008-06-011-0/+4
| | | | | | | | | menu_colour_prefix_id being set. Used this to make it so that if both are set that identified ego items are colored light blue, not just runed/glowing/etc non-identified items. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5398 c06c8d41-db1a-0410-9941-cceddc491573
* Better support for settings files that include other files:dshaligram2008-05-261-12/+1
| | | | | | | | | | | | | | | | | | | | | | | - Files can be included as "include foo" in .crawlrc instead of using the Lua call: : crawl.read_options('foo'). include foo and the Lua crawl.read_options('foo') are not equivalent - Lua only runs after the start of a new game, which is too late for some option settings. - Crawl searches for included files in this sequence: - Absolute paths: use the path directly (but not if DATA_DIR_PATH is set, since we don't want Crawl to read arbitrary files on multiuser systems). - Search relative to the including file. - Search relative to any -rcdir(s) provided. - Search in the data file search path. - The data file search path now includes settings/ for when we move rc stuff to settings/ .gitignore: ignore saves and morgue dirs correctly. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5256 c06c8d41-db1a-0410-9941-cceddc491573
* Allow Troggies to autopickup manuals, and change the message whenj-p-e-g2008-05-251-0/+7
| | | | | | | | | gaining the "Book Burn" ability (only when you first join Trog) to explicitly refer to spellbooks. I like the alliteration in the ability name, so kept that as is. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5232 c06c8d41-db1a-0410-9941-cceddc491573
* Pushing some dungeon-related lua functions back into C++.ennewalker2008-05-221-0/+53
| | | | git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5176 c06c8d41-db1a-0410-9941-cceddc491573
* Allow vampires to mutate when Satiated or higher, and make non-physicalj-p-e-g2008-04-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | mutations only apply at these hunger levels, too. Differentiated mutations into physical (affecting a character's appearance and stuff: scales, hooves, wings, ...) and internal (resistances etc.). I guess this is what people usually refer to as "cosmetic", which I think is an inaccurate description since it makes it sound like they were completely superficial and had no real effect. Here's a list of arbitrarily chosen "physical" mutations: * tough skin, all scales, and fur * strong/clever/agile, and weak/dopey/clumsy * deformed * strong but stiff, and flexible but weak * frail, and robust * claws, fangs, hooves, talons, and horns * stinger, wings * blue/green marks Mutations currently not applying are still listed on the 'A' screen, though in darkgrey and in (brackets). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4246 c06c8d41-db1a-0410-9941-cceddc491573
* Apply Horst von Brand's (first) patch 1887488: gcc-4.3 compile failures.j-p-e-g2008-04-141-51/+53
| | | | | | | I'm not sure what to do about the rest of that tracker item. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4233 c06c8d41-db1a-0410-9941-cceddc491573
* Split potions of blood and potions of coagulated blood into twoj-p-e-g2008-03-261-0/+5
| | | | | | | | | | | | | | | | distinct potion types to make stacking easier. Coagulated blood is not created randomly, and aging potions of blood turn into potions of coagulated blood, so none of that changed. Well, except the name: congealed -> coagulated. This also means that they now have distinct descriptions, though seeing potions in your inventory coagulate will identify both of them. And I checked: potions in shops will coagulate as well and disappear. Coagulated blood is cheaper, but if you need it you won't want to wait around, right? git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3884 c06c8d41-db1a-0410-9941-cceddc491573
* Fix some link errors and a few remaining compile warnings (thepauldubois2008-03-101-2/+0
| | | | | | | | | | | | | ones that aren't bugs) - if static const int foo=VALUE; is in header, don't need to have a definition in a .cc file. The definition goes into every .cc file with "vague linkage" - add sqlite and lua to the sln/vcproj git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3576 c06c8d41-db1a-0410-9941-cceddc491573
* Fix bug caught by MSVC compiler.pauldubois2008-03-101-1/+1
| | | | | | | (!expr == foo) is not the same as (expr != foo) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3569 c06c8d41-db1a-0410-9941-cceddc491573
* Fix crash on shutdown caused by bad order of static destruction (ugh).pauldubois2008-03-091-2/+0
| | | | | | | | | | | | crawl_environment's destructor uses dlua, but dlua was getting destroyed first. Rather than mess with stupidly complicated singleton patterns, I've moved the definition of clua and dlua into acr.cc, to just before crawl_environment. This makes the order of construction/destruction well-defined and should be a workable long-term solution. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3559 c06c8d41-db1a-0410-9941-cceddc491573
* [Bug 1907221] Add "Modified for Crawl Reference" statement and author to aj-p-e-g2008-03-081-0/+3
| | | | | | | | huge number of files. Also correct file name comments. No coding changes. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3539 c06c8d41-db1a-0410-9941-cceddc491573
* Make Options.race and Options.class translate correctly, no matter whether j-p-e-g2008-03-021-0/+1
| | | | | | | | | | | | the old or new species/classes order is used. Entails some more unborking of newgame.cc. Also: make Esc leave the species selection screen (synonym for 'X', quit the game), and use it to jump back to species selection from all other selection possibilities (class, book, weapon, god) as a synonym for Bksp. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3505 c06c8d41-db1a-0410-9941-cceddc491573
* Apply Paul's patch 1901939: including files in init.txtj-p-e-g2008-02-271-0/+22
| | | | | | | | | | | | | with some clean-up and fix in acr.cc to make the results apply at once (instead of only after a screen redraw). I've tested it and everything works fine. Recursive inclusion, e.g. read_options('init.txt'), prints a stack overflow error but doesn't crash the game, so I think that's fine for now. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3469 c06c8d41-db1a-0410-9941-cceddc491573
* 'DD' is now an alias for 'Dy'.haranp2008-01-161-1/+1
| | | | | | | | Clean up some corpse handling, add food_is_rotten() function instead of manually checking special < 100 everywhere. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3283 c06c8d41-db1a-0410-9941-cceddc491573
* Database entries fetched with getLongDescription() can contain embededzelgadis2007-12-061-0/+2
| | | | | | | | | Lua code. The code will be replaced with its return value before being displayed to the user. The Lua code has no access to the thing being described, and so can only rely on global data. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3011 c06c8d41-db1a-0410-9941-cceddc491573
* Nemelex abandonment now shuffles and unmarks all decks.haranp2007-12-011-1/+1
| | | | git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2962 c06c8d41-db1a-0410-9941-cceddc491573
* Removed: safe_autopickup, safe_zero_exp, lowercase_invocations,haranp2007-11-161-9/+0
| | | | | | | | always_greet, terse_hand, increasing_skill_progress, use_notes, confirm_self_target. (default_autoprayer still exists.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2859 c06c8d41-db1a-0410-9941-cceddc491573
* Added an option, always_confirm_butcher.haranp2007-11-151-0/+1
| | | | git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2857 c06c8d41-db1a-0410-9941-cceddc491573
* 'q' (or Escape) when prompted for food on the floor now cancels out ofharanp2007-11-131-4/+8
| | | | | | | eating completely, rather than moving to inventory. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2847 c06c8d41-db1a-0410-9941-cceddc491573
* Applied bobbens' patch: you.skills("foo") gets skill level of foo from Lua.dshaligram2007-11-021-0/+4
| | | | git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2721 c06c8d41-db1a-0410-9941-cceddc491573
* Added you.good_god() and you.evil_god() to check if the player is ↵dshaligram2007-11-011-1/+8
| | | | | | worshipping a good/evil god. Passing a god name is optional, and will check if that god is good/evil (you.good_god("Elyvilon") == true). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2715 c06c8d41-db1a-0410-9941-cceddc491573
* [1821098] Fixed bat transform not conferring flight. Fixed ↵dshaligram2007-10-271-2/+2
| | | | | | player_is_levitating and renamed it to player_is_airborne to describe the function better. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2613 c06c8d41-db1a-0410-9941-cceddc491573
* Fixed bug that would allow Lua dofile on arbitrary files using absolute paths.dshaligram2007-10-251-1/+5
| | | | git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2578 c06c8d41-db1a-0410-9941-cceddc491573
* Use a safer macro for clua ret (doy).dshaligram2007-10-251-2/+2
| | | | git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2572 c06c8d41-db1a-0410-9941-cceddc491573
* [1819634] Fixed filenames missing in Lua file-not-found error messages.dshaligram2007-10-251-1/+3
| | | | git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2549 c06c8d41-db1a-0410-9941-cceddc491573
* [1800206] Ghoul food cleanup (dolorous).dshaligram2007-10-211-0/+2
| | | | git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2504 c06c8d41-db1a-0410-9941-cceddc491573
* Moved position information Lua functions to luadgn.cc.dshaligram2007-10-201-7/+0
| | | | git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2496 c06c8d41-db1a-0410-9941-cceddc491573
* Lua accessors for you.x_pos, you.y_pos and you.poszelgadis2007-10-181-1/+9
| | | | git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2488 c06c8d41-db1a-0410-9941-cceddc491573
* [1810484] Fixed Lua userdata leak - shouldn't use luaL_checkudata from __gc ↵dshaligram2007-10-101-4/+4
| | | | | | metamethod. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2406 c06c8d41-db1a-0410-9941-cceddc491573
* Moved all of the bazaar specific logic/code to dat/bazaar (or turned thezelgadis2007-10-041-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | code into Lua utility functions which can be reused by things other than bazaars). Related changes: * Portal vault entrances now work if they have destinations ("dst" property) besides "bazaar" (though it still causes an assert if no matchng maps for the destination can be found). * The floor and rock colour for a level are generated once and then stored in the save file, rather than being constantly regenerated (which means that bazaar floor colours are now truly random, rather than being tied to the depth of the bazaar entrance). * The floor and rock colour for a portal vault (or for any level containing any vault) can be set with ROCKCOL and FLOORCOL (which currently only accepts a single colour, unlike COLOUR); there are also Lua functions for querying and setting the colours. * Each portal vault level_type_name can have an associated Lua callback which is called when level generation is complete; it can be used for things like stair fixup. I also moved the Halls of Zot rock/floor colour special casing to the dat/zot.des file, since it was easy once ROCKCOL and FLOORCOL had been implemented. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2314 c06c8d41-db1a-0410-9941-cceddc491573
* Fixed bad species name (eg: deep elves with the bows title) in dump because ↵dshaligram2007-10-011-1/+2
| | | | | | of reuse of static buffers (Iaido). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2288 c06c8d41-db1a-0410-9941-cceddc491573
* This change moves the logic for when a level or branch prohibitszelgadis2007-09-191-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | teleport control from the C++ code into the vault .des files. This is done with the additions of two things: * Changeable, persistent per-level and per-branch flags which affect game play. * Dungeon events for the killing of monsters, picking up of objects and changing of features. The current level and branch flags are for teleport control prevention, making a level unmappable (like the Abyss or a Labyrinth), and preventing magic mapping from working (like the Abyss or a Labyrinth). Some related changes: * The new .des header KMASK allows for dungeon grid masks like no_monster_gen to be applied to specific symbols rather than the entire vault. * If the wizard mapping command (&{) is used in a place which is unmappable, it will ask if you wish to force the area to be mappable (so you can see what an entire Labyrinth or Abyss level looks like without having to hack the source). * A new wizard-mode level-map command, 'T', will teleport the player to wherever the cursor is pointing. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2146 c06c8d41-db1a-0410-9941-cceddc491573
* Introduces three new wall types, translucent versions of the normalzelgadis2007-09-191-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rock wall, stone wall and permanent rock wall. These are for use in vaults, and are never randomly generated. Magically translucent versions of the normal wall types are used, rather than glass, so we don't have to figure out how glass would react to things like digging and Shatter, but can re-use the code for the normal wall types. I've tried to fix all the places where the old code assumes that any square which is visible to the player has no walls between it and the player, but I've probably missed lots; this will require a lot of play testing before its ready for non-developers. viewwindow() now has two calls to losight(), the second one determining what squares would be visible if all translucent walls were made transparent, so that there's a quick way to see if there's any translucent walls between the player and a square. This second call to losight() doesn't cause any noticeable slowdown for me, but it might on an older system. Other than viewwindow() making a second call to losight(), there shouldn't be any changes to game-play or game-logic if there aren't any translucent walls around. The wizard blinking command (&b) has been changed so that it ignores all normal restrictions except for needing to see the target square and not landing on monsters; if the player lands on a wall square it's changed to floor. Wizard blinking also doesn't increase magical contamination. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2145 c06c8d41-db1a-0410-9941-cceddc491573
* Split off portions of externs.h and enum.h into other files. Thezelgadis2007-09-151-0/+3
| | | | | | | | | | | | | crawl_environment, player and monsters classes have been left in externs.h, which necessitates that all of the enums references by those classes stay in enums.h, since you can't forward declare an enum. However, it's a start. Also, portions of misc.{cc,h} have been split off into traps.{cc,h}, place.{cc,h} and terrain.{cc,h} git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2095 c06c8d41-db1a-0410-9941-cceddc491573
* Applying patches by dolorous:j-p-e-g2007-09-151-4/+2
| | | | | | | | | | 1795373: level-2 carnivorous mutation gets another description to differentiate the levels 1795116: more levitation cleanups (using you.flies()) 1794858: cleanup for vampires and fangs mutation git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2092 c06c8d41-db1a-0410-9941-cceddc491573
* Another change to how bazaars look.j-p-e-g2007-09-121-0/+5
| | | | | | | | | | All floor squares around shops (in bazaars) get coloured yellow. (David likened this to light flooding the street.) Lava on red floor get converted to water, and deep water on blue floor is substituted by lava or shallow water. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2074 c06c8d41-db1a-0410-9941-cceddc491573
* Reintroducing Throwing.j-p-e-g2007-09-111-1/+1
| | | | | | | | | | | | | | s/SK_RANGED_COMBAT/SK_THROWING Only thrown weapons, darts and slings train Throwing and benefit from this skill. Added Slings/Throwing and Darts/Throwing to the cross training pairs in skill2.cc. For most cases ranged combat could be simply replaced with throwing. For some, such as effSkill in item_use.cc or starting skills I tried to choose reasonable replacements. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2070 c06c8d41-db1a-0410-9941-cceddc491573
* Finally fixed pickup.lua to work as intended (I hope).j-p-e-g2007-08-241-8/+18
| | | | | | | | | | 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
* Type-safety on mpr() and friends channel argument.haranp2007-08-041-1/+1
| | | | git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1970 c06c8d41-db1a-0410-9941-cceddc491573