Spell success, Str/Int, and Armour skill


Ask fellow adventurers how to stay alive in the deep, dark, dangerous dungeon below, or share your own accumulated wisdom.

Tomb Titivator

Posts: 856

Joined: Friday, 31st October 2014, 10:03

Post Sunday, 21st June 2015, 10:24

Spell success, Str/Int, and Armour skill

I originally posted this to a CIP thread, but it was suggested to me that not everybody browses that forum and the results might be of some interest.

Copy-pasta follows:

I took a look at the source code re: spellcasting fail rate. According to the function int raw_spell_fail(spell_type spell) in spl-cast.cc the breakpoint is when one raises Str and the value returned by function player_armour_shield_spell_penalty() doesn't decrease by more than two points, because raising Int always decreases fail chance by 2 points.

Assuming this is correct, I wrote a little script to calculate the breakpoints where raising Int becomes better than Str in armour. There may be some rounding issues. Also this assumes that the player is not wearing a shield.

  Code:
# Calculate player adjusted body armour penalty
def player_abap(er, armr, st_str):
    return 2.0 * er * er * (45 - armr) / (5 * (st_str + 3)) / 45

def player_armour_shield_spell_penalty(er, armr, st_str):
    abap = player_abap(er, armr, st_str)
    bap = max(19 * abap, 0)
    bsp = 0 # XXX ignore shield penalty for now
    return max(bap + bsp, 0)

def print_str_armr_breakpoints(er):
    print("Minimum Str in ER %d armour when raising Int decreases spell fail%% more" % er)
    print("Armr\tStr")
    for armr in range(0, 28):
        print("%d" % armr, end="\t")
        assp0 = player_armour_shield_spell_penalty(er, armr, 1)
        for str1 in range(2, 51):
            assp = player_armour_shield_spell_penalty(er, armr, str1)
            diff = assp0 - assp
            if diff <= 2:
                # print("Armr %d: Str %d, assp %d, assp0 %d, diff %d" % (armr, str1, assp, assp0, diff))
                print("%d" % str1)
                break
            assp0 = assp
    print()

if __name__ == '__main__':
    for er in (4, 5, 7, 10, 11, 15, 18, 23):
        print_str_armr_breakpoints(er)


Output:

  Code:
Minimum Str in ER 4 armour when raising Int decreases spell fail% more
Armr   Str
0   6
1   6
2   6
3   6
4   5
5   5
6   5
7   5
8   5
9   5
10   5
11   5
12   5
13   5
14   4
15   4
16   4
17   4
18   4
19   4
20   4
21   4
22   4
23   3
24   3
25   3
26   3
27   3

Minimum Str in ER 5 armour when raising Int decreases spell fail% more
Armr   Str
0   8
1   8
2   8
3   7
4   7
5   7
6   7
7   7
8   7
9   7
10   7
11   6
12   6
13   6
14   6
15   6
16   6
17   6
18   6
19   5
20   5
21   5
22   5
23   5
24   5
25   5
26   4
27   4

Minimum Str in ER 7 armour when raising Int decreases spell fail% more
Armr   Str
0   12
1   12
2   11
3   11
4   11
5   11
6   11
7   11
8   10
9   10
10   10
11   10
12   10
13   10
14   9
15   9
16   9
17   9
18   9
19   8
20   8
21   8
22   8
23   8
24   7
25   7
26   7
27   7

Minimum Str in ER 10 armour when raising Int decreases spell fail% more
Armr   Str
0   18
1   17
2   17
3   17
4   17
5   16
6   16
7   16
8   16
9   15
10   15
11   15
12   15
13   14
14   14
15   14
16   14
17   13
18   13
19   13
20   13
21   12
22   12
23   12
24   11
25   11
26   11
27   10

Minimum Str in ER 11 armour when raising Int decreases spell fail% more
Armr   Str
0   19
1   19
2   19
3   19
4   18
5   18
6   18
7   18
8   17
9   17
10   17
11   17
12   16
13   16
14   16
15   16
16   15
17   15
18   15
19   14
20   14
21   14
22   13
23   13
24   13
25   12
26   12
27   12

Minimum Str in ER 15 armour when raising Int decreases spell fail% more
Armr   Str
0   27
1   27
2   27
3   26
4   26
5   26
6   25
7   25
8   25
9   24
10   24
11   23
12   23
13   23
14   22
15   22
16   21
17   21
18   21
19   20
20   20
21   19
22   19
23   18
24   18
25   18
26   17
27   16

Minimum Str in ER 18 armour when raising Int decreases spell fail% more
Armr   Str
0   33
1   33
2   32
3   32
4   31
5   31
6   31
7   30
8   30
9   29
10   29
11   29
12   28
13   28
14   27
15   27
16   26
17   26
18   25
19   25
20   24
21   24
22   23
23   23
24   22
25   21
26   21
27   20

Minimum Str in ER 23 armour when raising Int decreases spell fail% more
Armr   Str
0   43
1   42
2   42
3   41
4   41
5   40
6   40
7   39
8   39
9   38
10   38
11   37
12   36
13   36
14   35
15   35
16   34
17   33
18   33
19   32
20   31
21   31
22   30
23   29
24   29
25   28
26   27
27   26
Spellcasting penalties, Armour skill, and strength
15 runes: 2x HuSk, Op(Mo,Tm,Wn,Fi,Wr,EE,AM,Wz,Ne), VSTm, DsTm, Dg(Sk,Tm), MuGl, GhMo, Fe(En,EE,Ar,Wn,IE)
3 runes: FoFi, OgSk, KoHu, SpCj, 2x DgGl, MiBe, Fe(Fi,Tm,Mo,Su)

For this message the author ThreeInvisibleDucks has received thanks: 9
Berder, byrel, dowan, duvessa, emikaela, hannobal, rockygargoyle, Sandman25, Sprucery

Tartarus Sorceror

Posts: 1774

Joined: Tuesday, 23rd December 2014, 23:39

Post Monday, 22nd June 2015, 05:57

Re: Spell success, Str/Int, and Armour skill

edit: nevermind.
streaks: 5 fifteen rune octopodes. 15 diverse chars. 13 random chars. 24 NaWn^gozag.
251 total wins Berder hyperborean + misc
83/108 recent wins (76%)
guides: safe tactics value of ac/ev/sh forum toxicity

Blades Runner

Posts: 546

Joined: Saturday, 7th May 2011, 02:43

Post Monday, 22nd June 2015, 06:55

Re: Spell success, Str/Int, and Armour skill

Note that this is python3, not python2. That's good, but you do need to be aware of it when running the code.

(That is one reason that including a shbang line, like '#!/usr/bin/env python3', at the start of your code, is helpful even if you are running Windows: it signposts which version your code is written for.)

A few suggestions:

* This message, "Minimum Str in ER 4 armour when raising Int decreases spell fail% more", perhaps needs a comma or rephrasing.
Consider 'In ER 4 armour, raising Int decreases spell fail more when Str >= '.

* You can improve the formatting using field width codes:
  Code:
print("%-6s %-6s" % ('Armor', 'Str'))
    for armr in range(0, 28):
        print("%-6d" % armr, end="")
        assp0 = player_armour_shield_spell_penalty(er, armr, 1)
        for str1 in range(2, 51):
            assp = player_armour_shield_spell_penalty(er, armr, str1)
            diff = assp0 - assp
            if diff <= 2:
                # print("Armr %d: Str %d, assp %d, assp0 %d, diff %d" % (armr, str1, assp, assp0, diff))
                print(" %-6d" % str1)
                break
            assp0 = assp

Tartarus Sorceror

Posts: 1694

Joined: Tuesday, 31st March 2015, 20:34

Post Monday, 22nd June 2015, 15:08

Re: Spell success, Str/Int, and Armour skill

Wow, I thought those str numbers would be lower, str is even more useful than I realized for lowering fail%. That's a very interesting chart.

Return to Dungeon Crawling Advice

Who is online

Users browsing this forum: No registered users and 125 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.