Auto spellcasting RC file

My RC file has a lua macro that automatically selects and casts an appropriate direct damage spell.

It is currently capable of choosing between starburst, foxfire, stone arrow, bombard, scorch, airstrike, shock, flame wave, irradiate, fireball, ignition, firestorm, IOOD, LCS, and LRD.

It is designed to select the spell and the targeting point to deal maximum damage to the enemies that deserve it most - those that are high threat or low on health are priority targeted.

There are three ways to invoke it. There is the “cast” function, and the “cast_efficient” function. The difference is that “cast_efficient” takes into account the MP cost of the spell, unless threatening enemies are nearby. “cast” just deals the most damage possible (roughly speaking) without regard for MP. There is also the “cast_quiet” function that is like “cast_efficient” but avoids the loudest spells (LRD, fireball, ignition, firestorm) which you might want in certain situations, e.g. you’ve been shafted. I have bound “cast” and “cast_efficient” to keys 3 and 4, as follows:

macros += M 4 ===cast
macros += M 3 ===cast_efficient

So that, in combat, I mostly just press 3 repeatedly to cast various spells until things die. If I feel that cast_efficient isn’t getting the job done, I press 4 instead. If the situation is getting too dangerous (or I want to use a spell that “cast” doesn’t handle) then I will switch to manually selecting spells.

Feel free to give it a try. The rcfile can be found here: https://cbro.berotato.org/rcfiles/crawl-git/Berder.rc

2 Thanks

Looks quite impressive. Do you write the functions for fun? Do you use some kind of macro to construct parts of the rc file?

Yeah I just like to play Vehumet mages but it is a bit slow and tedious to repeatedly target fireball/firestorm to hit the maximum amount of enemies every single turn, so I wrote this to do it automatically with 1 keypress. The “monster_ac” variable is the only part that was auto generated.

Made many bugfixes and spell selection improvements in the past couple days. Also added LCS.

1 Thank

Added finer control over which spells get cast based on which keys the spells are bound to. There are now 4 additional ways to call it. cast_1, cast_2, cast_3, and cast_4. cast_1 will select and cast an appropriate efficient spell provided that spell is bound to a, b, c, or d. cast_2 will select and cast an appropriate efficient spell provided that spell is bound to e, f, g, or h.

So now I have

macros += M 3 ===cast_1
macros += M 4 ===cast_2

So if you think it is casting too much of a particular spell, or casting that spell badly, you can change the key binding for that spell so it will skip it.

A reasonable way to use it is to put cheap/low level damage spells on abcd and high level spells on efgh.

These specific keys abcd/efgh are controlled near the top of the code, with these lines:

c_persist["cast_1"] = "abcd"
c_persist["cast_2"] = "efgh"

cast_3 and cast_4 are the same as cast_1 and cast_2, except cast_3 and cast_4 don’t care about MP efficiency and just go for the max damage.

2 Thanks