diff options
author | Adam Borowski <kilobyte@angband.pl> | 2012-11-18 03:00:41 +0100 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2012-11-18 03:02:54 +0100 |
commit | 1cf98099138f1dedabd883d335b7534993eaee1f (patch) | |
tree | 6ca771afe7aebaf6c748059fcfd6bdc1bdd52516 /crawl-ref/source/test | |
parent | 0dc2f91267476e06bce890355df6e74a10a3811f (diff) | |
download | crawl-ref-1cf98099138f1dedabd883d335b7534993eaee1f.tar.gz crawl-ref-1cf98099138f1dedabd883d335b7534993eaee1f.zip |
Let the Abyss stress test bot cast any spell in an uppercase slot.
If there are multiple, choose one randomly.
Diffstat (limited to 'crawl-ref/source/test')
-rw-r--r-- | crawl-ref/source/test/stress/abyss.rc | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/crawl-ref/source/test/stress/abyss.rc b/crawl-ref/source/test/stress/abyss.rc index d405c8f51e..29b45faf0c 100644 --- a/crawl-ref/source/test/stress/abyss.rc +++ b/crawl-ref/source/test/stress/abyss.rc @@ -60,16 +60,24 @@ function ready() command = 1 last_turn = you.turns() - -- every 50 turns, cast a spell assigned to 'T' if there is one + -- every 50 turns, cast a spell assigned to an uppercase slot if there is one if you.turns() % 50 == 0 then local sp = you.spell_letters() + local to_cast = 0 + local count = 0 for i = 1, 52 do - if sp[i] == 'T' then - command = 0 - crawl.sendkeys("ZT" .. eol .. esc) - return + if sp[i] ~= nil and sp[i] >= 'A' and sp[i] <= 'Z' then + count = count + 1 + if crawl.one_chance_in(count) then + to_cast = sp[i] + end end end + if to_cast ~= 0 then + command = 0 + crawl.sendkeys("Z" .. to_cast .. eol .. esc) + return + end end else command = command + 1 |