Template talk:Spell probability table

From Heroes 3 wiki
Revision as of 05:22, 7 October 2024 by 31.0.55.21 (talk) (→‎Hopefully I am mistaken?)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Tried to find any ingame proof for strange 1-2% inequalities kind of 88/89% for Magic Arrow in Dungeon/Necropolis. The only source I've found was SPTRAITS.TXT file and the whole picture there looks like:

		% Chance to gain	Rampart		Inferno		Dungeon		Fortress							
Name			Level	Castle		Tower		Necropolis	Stronghold	Conflux
Bless			1	10	5	5	0	0	3	3	5	5
Bloodlust		1	0	0	0	10	5	5	10	5	5
Cure			1	10	10	5	5	0	5	5	10	5
Curse			1	0	0	3	5	10	5	0	0	0
Dispel			1	10	10	10	10	10	10	10	10	10
Haste			1	5	10	5	5	5	10	5	10	10
Magic Arrow		1	30	30	30	30	30	30	30	30	30
Prot. from Water	1	3	3	3	3	3	3	3	3	3
Protection from Fire	1	3	3	3	3	3	3	3	3	3
Shield			1	10	3	5	3	10	5	5	5	5
Slow			1	5	10	10	10	5	5	5	5	10
Stone Skin		1	5	5	10	5	10	5	10	5	5
Summon Boat		1	3	5	5	5	3	5	5	3	3
View Air		1	3	3	3	3	3	3	3	3	3
View Earth		1	3	3	3	3	3	3	3	3	3
Blind			2	4	6	2	12	4	4	4	6	8
Death Ripple		2	0	0	0	0	50	0	0	0	0
Disguise		2	2	2	2	4	2	2	2	0	2
Disrupting Ray		2	6	4	6	12	4	6	6	6	8
Fire Wall		2	4	4	4	12	4	4	4	4	8
Fortune			2	4	6	4	4	2	2	4	4	2
Ice Bolt		2	50	50	6	0	6	6	4	50	25
Lightning Bolt		2	4	4	50	20	6	50	50	4	25
Precision		2	6	6	4	8	2	6	4	4	2
Protection from Air	2	2	2	2	4	2	2	2	2	2
Quicksand		2	4	4	6	4	4	4	6	6	4
Remove Obstacle	2	4	4	6	4	4	4	4	4	4
Scuttle Boat		2	6	4	4	4	4	4	4	4	4
Visions			2	2	2	2	4	2	2	2	2	2
Weakness		2	2	2	2	8	4	4	4	4	4
Air Shield		3	4	8	8	2	4	4	8	4	4
Animate Dead		3	0	0	0	0	16	0	0	0	0
Anti-Magic		3	12	8	8	4	8	8	12	10	12
Destroy Undead		3	12	8	8	2	0	4	4	2	4
Earthquake		3	4	8	4	6	4	4	4	50	4
Fireball		3	8	8	8	50	12	16	12	2	12
Force Field		3	4	4	8	2	8	8	4	4	8
Forgetfulness		3	8	8	4	4	4	4	4	4	8
Frost Ring		3	16	16	16	0	12	12	12	4	12
Hypnotize		3	4	4	8	6	0	8	4	4	12
Land Mine		3	8	8	8	6	8	12	8	2	4
Mirth			3	4	4	4	2	4	4	12	2	4
Misfortune		3	4	4	4	6	8	4	4	2	4
Prot. from Earth	3	4	4	4	2	4	4	4	0	4
Teleport		3	8	8	8	8	8	8	8	10	8
Armageddon		4	0	0	0	5	5	10	0	0	0
Berserk			4	5	5	5	5	10	5	0	0	5
Chain Lightning		4	10	10	10	10	10	10	0	0	10
Clone			4	5	5	10	5	5	5	0	0	10
Counterstrike		4	5	10	5	5	5	5	0	0	5
Fire Shield		4	5	5	5	5	5	5	0	0	5
Frenzy			4	5	5	5	5	5	5	0	0	5
Inferno			4	5	5	5	10	5	5	0	0	10
Meteor Shower		4	10	10	10	10	10	10	0	0	10
Prayer			4	10	5	5	0	0	0	0	0	5
Resurrection		4	10	10	10	10	10	10	0	0	5
Slayer			4	5	5	5	5	5	5	0	0	5
Sorrow			4	5	5	5	5	5	5	0	0	5
Town Portal		4	10	10	10	10	10	10	0	0	10
Water Walk		4	10	10	10	10	10	10	0	0	10
Air Elemental		5	0	0	14	0	16	0	0	0	12
Dimension Door		5	0	20	14	16	16	16	0	0	13
Earth Elemental		5	0	16	14	16	16	12	0	0	12
Fire Elemental		5	0	0	0	16	0	12	0	0	12
Fly			5	0	16	16	16	16	12	0	0	13
Implosion		5	0	16	14	16	20	12	0	0	13
Magic Mirror		5	0	16	14	0	0	12	0	0	13
Sacrifice		5	0	0	0	20	16	12	0	0	0
Titan's Lightning Bolt	5	0	0	0	0	0	0	0	0	0
Water Elemental		5	0	16	14	0	0	12	0	0	12

So I think it will be more correct to use this 100%-per-level form in this tab as well. (Also it will allow us to get rid of 'tower with/without library' ugliness). --ShushMaster (talk) 05:48, 31 May 2018 (CEST) Besides, the current numbers are not totally correct: for example we have total 503% instead of 500% for tower without library' 1st lelel spells. --ShushMaster (talk) 06:07, 31 May 2018 (CEST)

I'm fine with that. I'll leave it up to your discretion. ―imahero 08:25, 31 May 2018 (CEST)

The real chances

"The values in this table are based on the rough, simplistic formula (1-(1-(x/100))y). The real values will be slightly higher. If someone wants to calculate the real values and edit this table, go for it!" I believe you, but why is that? I was certain that we can graph it as following:

c% chance for spell to appear in slot 1
(1-c%) * c% chance to appear in slot 2, given it did not appear in slot 1 (since spells cant repeat)
(1-c%)^2 * c% chance to appear in slot 3, given it did not appear in slots 1 and 2 (since spells can't repeat)
. . .
(1-c%)^k-1 * c% chance to appear in slot k, given it did not appear in slots [1:k] (since spells can't repeat and if it did appear in slot 1, it wouldn't in 2 and so on).

This can be written as SUM(i=0 to i=k) [(1-c%)^i-1 * c%), and simplified to 1 - (1-c%)^k (since probabilities always add up to 1). But apparently this formula is incorrect - why? Csaros (talk)

Hopefully I am mistaken?

  • The problem with this formula is that it assumes spells CAN reappear in subsequent spell slots. If we are looking at a Castle Bless spell (10/100), the chance of it appearing in spell slot 2 depends on which spell was selected for slot 1 (and is not equal to the chance of it appearing in slot 1).
    • For example, if the spell selected for slot 1 was Magic Arrow (30/100), the chance for bless to be in slot 2 is 10/70 (since Magic Arrow has already been selected and can't be repeated).
    • If instead View Air was selected for slot 1 (3/100), the chance for bless to be in slot 2 is 10/97 (since View Air has already been selected and can't be repeated).

Unless I am misunderstanding this or overcomplicating it, I think the only way to calculate the chance for Bless to be in spell slot 2 would be to sum all the possible ways this could happen...i.e. (x/(100-y1)*(y1/100) + (x/(100-y2)*(y2/100) + ... where x is the Bless chance and the ywhatevers are the chances for all the other spells. This is not bad to calculate for the 2nd spell slot, but gets worse for every additional spell slot that need calculating (as then you need to sum the probabilities for every possible combination of spells in previous slots.

  • NOTE: Using this method, the chance for Bless to appear in slot 2 is ~11.94% (given it did not appear in slot 1)

Hopefully I am just overcomplicating this and there is some easy trick to come up with the total percentage for a spell to appear (as that is all we really care about) or we cheat and just Monte Carlo this sucker. :)

--Legate (talk) 01:47, 7 October 2024 (UTC)

IMPORTANT NOTE: If we are going to really math this out we should use the actual game values. I believe the table above is just an approximation for what appears in the game files?

P.S. I suppose we could also suck it up and write a quick program to figure this out...probably pretty easy and/or there is one that already does this somewhere on the web.

  • These values are from sptraits