summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-pick.cc
Commit message (Collapse)AuthorAgeFilesLines
* allow iterating over branches in a non-enum order (8742)Jesse Luehrs2014-08-021-10/+10
| | | | | | | | | | | | This allows us to have a consistent and logical ordering of branches without requiring the branch enum itself to be reordered (which could have save compatibility implications). The new ordering of branches just moves Depths to the place in the ordering that it already is planned to go on the next major save compat bump, but other changes are possible, if desired. All places in the code that iterate over branches have been updated to use the new iterator except for code dealing with save files, which still uses enum order, so that we can change the display ordering without affecting saves.
* Remove stuffNicholas Feinberg2014-07-291-0/+1
| | | | | | | .cc, moving its contents into the new stepdown.cc and strings.cc. (The latter also got many donations from libutil.h.) Down with stuff! Up the new flesh!
* Simplify.Neil Moore2014-07-051-4/+1
|
* Formatting fixes (add braces).Neil Moore2014-05-121-0/+2
| | | | This fixes all the instances caught by unbrace.
* Don't crash when checking veto of MONS_NO_MONSTER (gammafunk)Neil Moore2014-01-311-1/+1
| | | | | | | | | | Now pick_monster with a veto function rejects invalid monster types, including the MONS_NO_MONSTER introduced in 0.14-a0-2238-g1766415 and later to dilute monster spawning. Ordinary spawns without the veto are unaffected. This fixes a crash with "place:Shoals:3 zombie", and casting Shadow Creatures in Shoals etc.
* Functionality for branch zombie lists (currently unused).Steve Melenchuk2014-01-301-0/+7
| | | | | | | | | | | This is designed with the Hell zombie problem in mind, though recent tweaks have also caused, say, Crypt to have problems with generating zombies outside of _place_assorted_zombies() - right now it only naturally generates deep dwarf zombies and elf zombies. If you don't want to use it for a branch, just set the zombie list to the basic monster list and the current behaviour is retained. That's the case for all branches currently.
* Somewhat un-nerf D:9-16 OODs/vaults, change OOD-only D spawnsJason Van2013-12-031-1/+1
| | | | | | | | | | | | | | | | | | | | | When dungeon-split was first started, it cut off a large part of D out-of-depth spawns both due to obsolescence and helping distinguish Depths from D, but this (inadvertently?) heavily nerfed any of the many, many traditional vaults using 098, as well as out-of-depth spawns per floor. For the most obvious example, the four most common spawns of the lowest OODs for D:14-16 were yaktaur captain, stone giant, glowing shapeshifter, and ettin, but in the interim period between before the creation of Depths and this patch the same tier has four most-common spawns of zombies, hill giants, ugly things, and centaur warriors. This expands the ood-cap to make the super-ood 8s for D:8-16 dangerous again, but not going far enough to spawn some (now) Depths and Vaults only terrors like titans and golden dragons, thus still distinctly splitting D, Vaults, and Depths from each other. The old-D:1-27 monster set was thus rebased around that ood-cap, adjusted for monsters that mostly only spawn as oods, and then edited further for organization purposes. The patch also has some experimental rare new super-ood spawns to compensate for the biggest danger cut-offs.
* Don't recompile world when random-pick.h gets changed.Adam Borowski2013-11-251-0/+11
| | | | Also, drop one copy of monster distribution data.
* Transform the lower half of D into a new branch: the Depths.Steve Melenchuk2013-11-121-1/+3
| | | | | | | | | | | | D is now 16 levels (the unsealed part was 14 levels previously), and the Depths are six levels. Vaults is enterable from Depths:2-5; Abyss, Hell, and Pan portals are available for the entire length of the branch. Right now the monster set is identical to Vaults except for the absence of Vaults-specific humans. D's monster set has also been truncated, mainly on the out-of-depth front. It's my intent that this serve as a starting point for figuring out what monsters we want to split between the two branches.
* Shorten branch enums.Adam Borowski2013-11-031-2/+2
| | | | | Seriously, even preparing this commit gave me a pain in the triangle between the thumb and index finger's bases and the wrist.
* Provide more information in an assert.Adam Borowski2013-10-311-1/+4
|
* Reinstate veto parameter for pick_monsterPete Hurst2013-06-231-2/+2
|
* Add missing call to positional monster vetoPete Hurst2013-06-231-0/+2
|
* Refactor random-pick eliminating two globals from mon-place.ccPete Hurst2013-06-231-8/+42
| | | | | | | | | This provides support for using custom subclasses of monster_picker in the main mon-pick routines. It could perhaps be cleaned up further by refactoring a few places where it's used, but this avoids having to change any old code, whilst support a couple of new scenarios.
* Rework mon-pick algorithm as a class templatePete Hurst2013-06-231-74/+23
| | | | | | | | | | This enables the distributions to be easily used for picking over enums other than monster_type, and even for arbitrary objects. The new template is contained in random_pick. It can be used simply by creating a random_picker<T> and calling its pick method, or can be subclassed if more complex veto behaviour is required.
* Allow mon-pick to be used with arbitrary pop_entry listsPete Hurst2013-06-211-23/+9
| | | | | | The pick_monster_from function can now be called with a pop_entry table and a depth to allow reuse of the mon-pick algorithm in other situations (e.g. spawn lists for summoning effects).
* Be forgiving for single-level SEMI ranges.Adam Borowski2013-03-231-2/+4
|
* Use even less ambiguous wording (Grunt)Adam Borowski2013-03-231-1/+1
|
* Use start/end instead of top/bottom in the documentation of mon-pick ↵Adam Borowski2013-03-231-2/+2
| | | | | | distribution. The old wording was ambiguous, as it could be taken for shallowest/deepest.
* Unbreak Vaults branch OODs.Adam Borowski2013-03-231-1/+1
| | | | Especially Vaults:$ heavily relies on those.
* An off-by-one error.Adam Borowski2013-03-211-1/+1
|
* No need to look for zombies at other depths anymore.Adam Borowski2013-03-211-0/+32
| | | | | | Add a --test case to check that. Ziggurats had nothing reasonable, use deep D instead.
* Rewrite zombie selection.Adam Borowski2013-03-201-29/+83
| | | | | | | | | | | | | | | It now uses regular mon_pick instead of an extremely quirky loop that spins around with a low chance of success, relaxing requirements slowly. If there are no zombifiables for the given branch, monsters from parallel branches get allowed too. Note that there are two code paths for zombie selection, the other one being requesting a zombie via mapdef. REAL CHANGE: depth is actually obeyed now, rather than merely kind of. This gets rid of all those rat and kobold zombies later on, at the cost of severely reducing variety in some cases. The base depth is current level+4, like before.
* Update the compat functions for UP and DOWN distributions.Adam Borowski2013-03-181-1/+7
| | | | | | Their focus is not in the center. In existing data, all UPs are at the high end of the range, all DOWNs at the low (shallowest) end, so they can be thought of as trimmed PEAKs.
* Two extra distributions: UP and DOWN triangles.Adam Borowski2013-03-181-0/+10
| | | | Unlike PEAK and SEMI, their peak is at one of ends of the range.
* The main workhorse for mon-pick.Adam Borowski2013-03-181-0/+56
| | | | | Unlike the old code, it doesn't need to retry over and over, there is just one roll. It also accepts and arbitrary vetoer function.
* Cap OODs at the branch end.Adam Borowski2013-03-181-0/+19
| | | | | | | | | | | | | | | | | | | | | | | This changes behaviour: before, except for a short range after the end of data, monster picking code would loop failing until it decides to stop caring about depth altogether, and pick a monster eligible for the current branch using nothing but its rarity. Now, it will simply pick one from Branch:$. With four exceptions: * D/Vaults: these rely heavily on the cap being at D:31; this is pretty much the entire monster set for Vaults:$. * Elf, Tomb: they had OODs defined past the branch's end. They'd pop up for "mild" OODs but not for "super" OODs which would degenerate into fully random search (and thus be usually weaker). A bunch of other branches had data for a single level or so past the end, but it doesn't appear to be meaningful. Hells and Zot had OODs broken due to the old cap being shallower than around half of the branch. This rewrite preserves monsters totally ineligible to spawn but doesn't try to make the distribution identical. All real threat comes from hell effects / Zot:5 vault anyway.
* Constify.Adam Borowski2013-01-121-2/+2
|
* Merge branch 'master' into mon-pickAdam Borowski2012-11-041-1/+1
|\ | | | | | | | | Merge commits instead of rerere suck, but not being able to comfortably use the test rig sucks even more.
| * Remove bumblebeesChris Campbell2012-09-291-4/+0
| | | | | | | | | | | | Killer/queen bees and wasps already cover pretty much all the bases in terms of flying poisonous things - bumblebees almost never showed up and when they did they didn't do anything interesting.
| * Enable moths of suppression, for testing.Michael Gagno2012-09-041-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This monster isn't completely finished... a couple of effects are still missing from the suppression effect. Enough is covered to make this monster usable for testing, though, and if I delay any longer Wensley will probably go even crazier than he already is (this is his monster)... Right now these guys are a rare spawn in Spider (maybe too rare). With the mon-pick.cc rewrite pending, this isn't such a big deal, since the monster lists for short branches should be redone anyway. Currently no vaults place these monsters, since they have a large aura that goes through walls (this is the sort of monster vaults need to be designed with in mind). So, they're just a random spawn for now.
| * Use std namespace.Raphael Langella2012-08-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | I had to rename distance() (in coord.h) to distance2() because it conflicts with the STL function to compare 2 iterators. Not a bad change given how it returns the square of the distance anyway. I also had to rename the message global variable (in message.cc) to buffer. I tried to fix and improve the coding style has much as I could, but I probably missed a few given how huge and tedious it is. I also didn't touch crawl-gdb.py, and the stuff in prebuilt, rltiles/tool and util/levcomp.*, because I have no clue about those.
* | Rename mons_level() to mons_depth().Adam Borowski2012-09-051-2/+2
| | | | | | | | Rationale: http://www.giantitp.com/comics/oots0012.html
* | Remove an outdated comment.Adam Borowski2012-09-051-3/+1
| |
* | Don't go through inappropriate monsters during arena selection.Adam Borowski2012-08-271-0/+8
| |
* | Don't pretend pick_monster_no_rarity() uses depth, either.Adam Borowski2012-08-271-3/+3
| |
* | Convert mon-pick data to a more readable scheme.Adam Borowski2012-08-271-2869/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of a base level and a rarity, which then use a ridiculously obscure algorithm to accept or reject monsters, the new data includes: * minimal depth the monster can be found on * maximal depth * rarity at the center of the range * distribution type (flat, a linear triangle, something halfway between the two) * the monster's enum The results should be the same, with very minor differences: * distributions within allowed range are approximated by one of three shapes (FLAT, SEMI, PEAK), this shouldn't produce noticeable differences * effective rarity has been shoehorned into a 0..1000 range (out of 0..10201), using div_rand_round(). There's a number of monsters with 35/10201 rarity which ends up as 3 or 4, and strings of monsters of the same rarity end up randomly perturbed. * the once-in-the-life-of-universe chance to generate a monster outside the -5..+5 range is gone, you can now set arbitrary ranges and they're absolute. There's no actual code to use this data yet, merely an emulation of the old functions. It looks like ZotDef applies some complex rules to the monster's depth, it may take some thinking about how to convert it.
* | Don't pretend mons_{rarity,level}() use anything but place.branch.Adam Borowski2012-08-271-7/+7
| | | | | | | | | | We'd want them to, but that code is getting overhauled anyway, so let's not cloud things.
* | Don't use internal data of mon-pick from the outside.Adam Borowski2012-08-261-0/+18
|/
* Purge the remnants of Hive.Adam Borowski2012-07-241-33/+0
|
* Remove mummies from Gehenna.Michael Gagno2012-07-181-4/+0
| | | | It makes no sense for a rF- monster to be in a fire branch.
* Do not randomly spawn butterflies anywhere.Michael Gagno2012-07-061-6/+0
| | | | | They still can be placed by vaults, summoned, etc. But they won't spawn as regular monsters in branches now.
* Prune the Swamp monster list.Michael Gagno2012-07-061-30/+12
| | | | | | Removed some useless monsters, and moved weights around to compensate. There are still a few popcorn monsters, but they are greatly diminished. Also, I gave ravens a tiny chance of spawning here.
* Drop parentheses around scalar values in "return".Adam Borowski2012-07-051-2/+2
|
* Some more tweaks to the Swamp monster set.Michael Gagno2012-07-041-5/+3
| | | | | | Increase variety, decrease vampire mosquito spam. Swamp worms are still extremely common. Not sure if it should stay that way or be changed... it's not like we have many other water enemies to choose from.
* Whitespace fix.Michael Gagno2012-07-031-1/+0
|
* Tweak mons_swamp_level()Michael Gagno2012-07-031-2/+5
| | | | | Plants and fungi have a depth of 1 instead of 2. This has only a tiny effect.
* Rename bog mummies to bog bodies.Michael Gagno2012-07-031-2/+2
| | | | | | | | | Without the death curses, calling them mummies (and putting them on 'M') is confusing. "Bog body" is good name for this monster (it's synonymous with bog mummy). I've put it on 'z' and made it lightgreen. They've also been removed from one ossuary. Thanks to |amethyst for suggesting this change.
* Move around some Swamp monster weights.Michael Gagno2012-07-031-16/+12
| | | | | | Trivial monsters are now uncommon. Vampire mosquitos are also less common (they already spawn with bands, and do not need to have the highest weight of any enemy in the branch).
* Remove midgesChris Campbell2012-06-261-2/+0
| | | | Lemure, crimson imp, ufetubus are plenty in terms of boring popcorn 5s.