Page 1 of 1

Scarf of Repulsion vs +2 Generic Cloak

PostPosted: Monday, 16th October 2017, 14:39
by charlatan
I'm wondering how these two compare. One one hand you're looking at 3 or 4 additional AC, which is of course nothing to sneeze at, but rMissles is also very nice to have. I'm not sure how the math works out and don't know of a very reliable way to test it, unlike using fsim for weapons. In addition, should your decision to use one or the other vary depending on whether you are a heavy armor/trog worshipper or someone in robes? Obviously the scarf is useless if you have access to deflect missiles, or are some other niche case, but for the sake of the question let's assume the scarf is the only potential source of repel missiles. I'm hoping for advice in more generic terms if possible for characters as a whole, but the question was prompted by a NaFi^Trog having access to both by mid-vaults (http://crawl.akrasiac.org/rawdata/charl ... rlatan.txt)

Re: Scarf of Repulsion vs +2 Generic Cloak

PostPosted: Monday, 16th October 2017, 15:11
by Shtopit
Related question: what does rMiss exactly do?

Re: Scarf of Repulsion vs +2 Generic Cloak

PostPosted: Monday, 16th October 2017, 16:41
by Blobbo
Probably depends on the branch. I like permanent rMsl for branches with a lot of missiles - snake, shoals, vaults, depths. Less useful in extended and zot.

Re: Scarf of Repulsion vs +2 Generic Cloak

PostPosted: Monday, 16th October 2017, 18:06
by Siegurt
Shtopit wrote:Related question: what does rMiss exactly do?

rMsl gives you a bonus to avoid "missiles" which are most any ranged attack that is dodgable.

rMiss lets you dodge the question of when you will propose to your long time girlfriend.

Re: Scarf of Repulsion vs +2 Generic Cloak

PostPosted: Tuesday, 17th October 2017, 06:33
by svendre
I prefer cloaks over the repel missiles scarf in general. I prefer cloaks over scarves in general as well.
The only scarves that interest me are sometimes resistance for rF+ an rC+, or artifact ones with ample properties/stats.

If repel missiles works at all like the spell used to, then it's more effective when you have high EV. This to me seems somewhat redundant. I'd rather not play in a manner where I constantly dodge everything then occasionally get splattered or one-shotted. Having better AC with some EV that you can easily manage seems to be a more multiplicative defense, and one which allows you to both more easily gauge the danger of situations, but with reduced changes of being insta-splattered, and have stronger overall stamina by making more even use of regenerative properties.

Re: Scarf of Repulsion vs +2 Generic Cloak

PostPosted: Tuesday, 17th October 2017, 07:59
by nago
Difficult to say overall: repel missiles is very good, but also 4 AC - and actually a +2 cloak is more like 5/6 AC if you have a good heavy armor and some armor skill.

What's more, most of ranged attacks are avoidable with good tactics (aka lure monsters to melee range) and rmsl isn't *so* good against spell\breath attack, while 4 AC is universal.

My rule of thumb is: I use rmsl scarf if I have decent EV (I'd say 15ish but it is totally by fee), I don't have a scarf of spirit shield (which is the very best by far missing the amulet) and an amount of AC that is more of than "enough" for the deep I am or somehow I have very big trouble with ranged attacks (e.g. naga, cheidude).

Re: Scarf of Repulsion vs +2 Generic Cloak

PostPosted: Tuesday, 17th October 2017, 14:44
by NhorianScum
It's a lategame naga. Rmsl is gonna do more than the smidge of ac from the cloak. Not a huge difference in tabbing with 50 ac and tabbing with 54 ac.

Re: Scarf of Repulsion vs +2 Generic Cloak

PostPosted: Tuesday, 17th October 2017, 17:43
by Ok Shitbug ACTIVATES
If you don't need more AC, lie you have 40 or higher, then you should take the scarf.

Re: Scarf of Repulsion vs +2 Generic Cloak

PostPosted: Wednesday, 18th October 2017, 12:21
by watertreatmentRL
You should take the 4 ac. The kind of effects I would worry about with a character like this are high damage bolt spells, as from an OOF or electric golem. You have good resistances though, so I would not worry too much. Other sorts of missiles will have to get through your SH value, which is pretty good, and will be reduced by a full AC roll. Marginal ac remains good no matter what your current ac value is. Don't listen to anyone who tells you otherwise.

Re: Scarf of Repulsion vs +2 Generic Cloak

PostPosted: Wednesday, 18th October 2017, 16:29
by duvessa
watertreatmentRL wrote:You should take the 4 ac. The kind of effects I would worry about with a character like this are high damage bolt spells, as from an OOF or electric golem.
Bolt spells are affected by rMsl. Don't listen to anyone who doesn't know that.

Re: Scarf of Repulsion vs +2 Generic Cloak

PostPosted: Wednesday, 18th October 2017, 22:18
by watertreatmentRL
I am well aware of that. The character has low evasion and will be hit by a lot of bolts with or without rmsl.

e: I don't know why I'm doing this, but the relevance of bolt spells to my comment was that they would not be affected by SH. For this 16 ev character, the effect of rmsl on rolls vs. bolts is similar to an additional 5 ev, which still puts you in the range where you're going to get hit by them a lot. There are few characters that I'd rather have rmsl than 4 ac on, but I'd definitely want to see a higher effective bonus than that to consider rmsl.

Re: Scarf of Repulsion vs +2 Generic Cloak

PostPosted: Friday, 20th October 2017, 04:08
by Rast
Is rMsl significantly more effective with high EV than with low EV?

Re: Scarf of Repulsion vs +2 Generic Cloak

PostPosted: Friday, 20th October 2017, 04:32
by VeryAngryFelid
Yes. It is almost useless with EV 3, for example.

Re: Scarf of Repulsion vs +2 Generic Cloak

PostPosted: Friday, 20th October 2017, 15:08
by watertreatmentRL
The way I like to deal with crawl math is to make really shitty approximations. For example, in this case: rMsl works by applying a multiplier to the hitrolls of monster missile attacks. For a bolt spell, the multiplier is between .5 and 1.0, uniformly distributed I believe. So the shitty approximation you do is replace that factor with its average, 3/4. Now you think of the hitroll process as an inequality, you multiply both sides by 4/3. The player's side of the inequality is nearly directly proportional with EV, so you just multiply your EV by 4/3 to get what I called "effective bonus" vs. bolt spells. The same approximation is probably worse for the non-bolt case, but there the factor is between 0 and 1.0.

Of course, this isn't quite right, but I don't think it's that far off.

Re: Scarf of Repulsion vs +2 Generic Cloak

PostPosted: Friday, 20th October 2017, 16:36
by duvessa
It's that far off

Like seriously, you have no idea what you're talking about here. That's not how to-hit works and even if it was, the algebra wouldn't work that way.

Re: Scarf of Repulsion vs +2 Generic Cloak

PostPosted: Saturday, 21st October 2017, 02:15
by watertreatmentRL
You're so insistent, you got me curious so I simulated this with a couple lines of python. My little study shows that indeed, the chance of getting hit by a bolt spell at 21 ev is extremely similar to the chance of getting hit by a bolt spell with 16 ev and rmsl across a wide range of realistic accuracy numbers, always within 1% for the high end. Maybe I have something wrong, I just took formulas from a famously unreliable source.

edit: I guess there are some aspects of the computation where I made assumptions that I didn't verify by code diving, for example whether my source material means to multiply the result of the to-hit roll or the base of the hit roll by the .5-1.0 factor, but the difference between these is insignificant, mostly a question of integer division effects. I didn't check for recent commits that would change how this works mechanically either.

I don't know what your problem is with the algebra. Again, unless my source material is very wrong about how to resolve hit rolls vs. evasion, it's all a question of whether you accept the approximation of the randomized rmsl factor by a constant factor in this calculation. In my judgement, I felt this would be close enough for the tolerances I want to hit thinking about video game math and empirically this seems to be the case.

Re: Scarf of Repulsion vs +2 Generic Cloak

PostPosted: Saturday, 21st October 2017, 03:38
by duvessa
Okay, let's ignore backlit, invisibility, umbra, and SH for now and just think about EV and rMsl. The relevant function is test_beam_hit:
  Code:
static bool _test_beam_hit(int attack, int defence, bool pierce,
                           int defl, defer_rand &r)
{
    if (attack == AUTOMATIC_HIT)
        return true;

    if (pierce)
    {
        if (defl > 1)
            attack = r[0].random2(attack * 2) / 3;
        else if (defl && attack >= 2) // don't increase acc of 0
            attack = r[0].random_range((attack + 1) / 2 + 1, attack);
    }
    else if (defl)
        attack = r[0].random2(attack / defl);

    dprf(DIAG_BEAM, "Beam attack: %d, defence: %d", attack, defence);

    attack = r[1].random2(attack);
    defence = r[2].random2avg(defence, 2);

    dprf(DIAG_BEAM, "Beam new attack: %d, defence: %d", attack, defence);

    return attack >= defence;
}
attack is the beam's to-hit, which itself may have already had a random component but let's ignore that part too because for most beams, it probably didn't.
defence is the player's EV.
pierce is whether the attack is a penetrating beam, which it is.
defl is 0 for no rMsl, 1 for rMsl, and 2 or more for dMsl.
The defer_rand is just for messaging.

Here's an ultra-lazy Lua script:
  Code:
function test_beam_hit(attack, defence, pierce, defl)
        if pierce then
                if defl > 1 then
                        attack = math.floor(random2(attack*2)/3)
                elseif defl > 0 and attack >= 2 then
                        attack = random_range(math.floor((attack+1)/2)+1,attack)
                end
        elseif defl > 0 then
                attack = random2(math.floor(attack/defl))
        end

        attack = random2(attack)
        defence = random2avg2(defence)
        return attack >= defence
end

function random2(n)
        return math.random(1,n)-1
end
function random2avg2(n)
        return math.floor((random2(n)+random2(n+1))/2)
end
function random_range(a,b)
        return a+random2(b-a+1)
end

print("hit\t21 EV\t16 EV+rMsl")
print("===\t=====\t==========")
local trials = 1000000
for tohit=1,50 do
        local hits21 = 0
        local hits16 = 0
        for i=1,trials do
                if test_beam_hit(tohit,21,true,0) then
                        hits21 = hits21+1
                end
                if test_beam_hit(tohit,16,true,1) then
                        hits16 = hits16+1
                end
        end
        print(string.format("%2d\t%4.1f%%\t%4.1f%%",tohit,hits21/trials*100,hits16/trials*100))
end


And the output (with luajit's PRNG which is good enough for our purposes):
  Code:
hit   21 EV   16 EV+rMsl
===   =====   ==========
 1    0.7%    1.1%
 2    1.4%    2.4%
 3    2.5%    4.2%
 4    3.8%    5.3%
 5    5.4%    7.8%
 6    7.3%    9.3%
 7    9.5%   12.6%
 8   12.0%   14.5%
 9   14.8%   18.5%
10   17.8%   20.6%
11   21.2%   25.1%
12   24.7%   27.3%
13   28.2%   31.8%
14   31.6%   33.8%
15   35.1%   38.1%
16   38.4%   40.0%
17   41.6%   43.8%
18   44.7%   45.4%
19   47.3%   48.8%
20   49.9%   50.2%
21   52.4%   53.2%
22   54.5%   54.4%
23   56.5%   57.0%
24   58.4%   58.0%
25   60.0%   60.3%
26   61.5%   61.0%
27   63.0%   63.1%
28   64.2%   63.8%
29   65.5%   65.6%
30   66.6%   66.1%
31   67.8%   67.7%
32   68.8%   68.2%
33   69.7%   69.5%
34   70.6%   70.1%
35   71.4%   71.3%
36   72.3%   71.7%
37   72.9%   72.8%
38   73.7%   73.1%
39   74.3%   74.2%
40   75.1%   74.4%
41   75.5%   75.4%
42   76.2%   75.6%
43   76.8%   76.5%
44   77.3%   76.7%
45   77.7%   77.5%
46   78.3%   77.7%
47   78.7%   78.4%
48   79.2%   78.6%
49   79.6%   79.3%
50   80.0%   79.5%


TL;DR I thought you were underselling rMsl by saying it didn't apply to beam attacks, but you corrected that misinterpretation. However, in the course of that correction, you undersold going from 16 to 21 EV at low to-hit values, so I totally got you. semicolon p


Basically the fact that EV uses random2avg() whereas to-hit uses random2() makes to-hit values below EV miss more often than you'd expect. A lot more often when the difference is big. Your approximation does work reasonably well if the to-hit value is equal to or greater than the EV.


(And yes, this is kind of stupid, but you know what they say, don't shoot the messenger. Even though she's kind of an asshole.)

Re: Scarf of Repulsion vs +2 Generic Cloak

PostPosted: Saturday, 21st October 2017, 04:00
by watertreatmentRL
Yeah, I know the approximation is bad on the low end, this is what my simulation showed as well, I just didn't look at values as low as you went. Since I mentioned high spellpower in my original comment and the character is high enough level not to worry about to worry about low damage attacks, I think I covered myself there. I think the interesting range of to-hit values starts around 20 or 25, but you would know better than me.

edit: I'm actually surprised how close the numbers you got were. The way I do these computations, I make an exhaustive enumeration of possible rolls in a list comprehension and do logical tests against that to compute "exact" probabilities (assuming the code is correct, natch). I was getting values around .6 to .8% as the difference on the high end.

Actually this is something I definitely don't know: What is the base to-hit number for a monster beam? You say it can be randomized, but I assumed it would be based on HD only similar to melee to-hit. I've tried code diving this before but it was sufficiently convoluted that I decided I didn't care enough to finish tracing through things.

Re: Scarf of Repulsion vs +2 Generic Cloak

PostPosted: Saturday, 21st October 2017, 05:24
by CanOfWorms
base to-hit is in zap-data.h stored as <a,b,c> (the second one is used for monsters). the value is derived using the formula

a + 12*HD*b/c

for the purposes of beam spells. here are some example values (for reference, if your EV = to-hit you have slightly less than 50% chance of dodging the attack). from what I've seen the game rounds down the decimals but I've left them in just in case:

throw frost/flame: 25 + HD*3/10

bolt of cold/fire: 17 + HD*12/25 (~17 + HD/2)
  Code:
harold: 21.32
hell knight: 21.8
deep elf annihilator: 24.2
frost/fire giant: 24.68
margery: 27.56
ancient lich: 29.96
orb of fire: 31


lightning bolt: 16 + HD*3/10
  Code:
spriggan air mage: 20.2
electric golem: 20.5
draconian: 20.8
tengu reaver: 21.5
titan: 22
ancient lich: 24.1


iron shot: 20 + HD*12/25 (~20 + HD/2)
  Code:
frances/ancient champion: 26.72
hell sentinel: 29.12
frederick: 30.08


crystal spear: 22 + HD*3/5
  Code:
deep elf annihilator: 31
draconian annihilator: 31.6
jory: 32.8
lich: 34
ancient lich: 38.2

Re: Scarf of Repulsion vs +2 Generic Cloak

PostPosted: Saturday, 21st October 2017, 05:32
by duvessa
To clarify, monster spellpower is HD*12 by default, with exceptions for some spells (mostly enchantments, nothing dodgeable that I know of).

Other fun to-hits: Bolt of electricitiy (from electric eels) always has a to-hit of 35. Flash freeze gets 5+floor(power/3), resulting in Antaeus's having a to-hit of 93.

Re: Scarf of Repulsion vs +2 Generic Cloak

PostPosted: Saturday, 21st October 2017, 05:53
by watertreatmentRL
Thanks for the numbers, guys.

A final thought on my approximation methods -- though I didn't say so, my reasoning is also based on passing to continuous uniform distributions and ignoring effects of discretization. I think the higher error on the low end of to-hit is caused by the actual discrete distributions becoming less like the continuous analogues I have in mind and integer rounding effects having a larger impact on the numbers. The multiplication thing should be fine, you're just distributing over sums of random variables, outside of the effects of integer arithmetic.

late edit: I've checked this "4/3 rule" for a wide variety of player EV-monster accuracy values. Multiplying your EV by 4/3 rounding down to approximate the effect of rMsl on penetrating beam attacks is accurate to within 2.7% chance of getting hit for EV between 10 and 35 and monster beam accuracy between 15 and 40. The difference is usually less than 1.5% in chance to hit. It's a reasonable rule of thumb in my opinion.

Re: Scarf of Repulsion vs +2 Generic Cloak

PostPosted: Saturday, 21st October 2017, 15:14
by bel
nvm