Make a small donation to Ye Olde Inn!
Every cent received goes toward Ye Olde Inn's maintenance and allows us to continue providing the best resources for HeroQuest and Fantasy Gaming fans.
Make a small donation to Ye Olde Inn!
Every cent received goes toward Ye Olde Inn's maintenance and allows us to continue providing the best resources for HeroQuest and Fantasy Gaming fans.
Public Sub SimulateAverageStdDevBadVsGoodDamage()
'Sets the LP of the good to 100 to measure the real potential of each attacking monster.
'Then, the LP of each participant get reset to full before the next fight is started.
'Otherwise, the measurement will always be cut as soon as the good one is dead; thus,
'producing wrong results.
HerosDamage = True
HerosDamageStdDev = True
AverageCompleteFightDamageStdDev = 0
ReDim singleCompleteFightDamage(amount) 'redim the array to have enough spaces for all the fight results
Dim SumForStdDev As Double
SumForStdDev = 0
'Standard deviation gets calculated by:
'Square root of (
'Sum of (
'(average - current value)^2
')
'Divided by amount - 1
')
TheGood.LP = 100
AverageCompleteFightDamage = 0
threeStrikes = 0 ' If the bad generates 100 LP of damage, 3 times, interrupt simulation and proceed with next pair in order to save time.
For i = 0 To amount
TheGood.CurLP = TheGood.LP
TheBad.CurLP = TheBad.LP
FightOneMonster
singleCompleteFightDamage(i) = TheGood.LP - TheGood.CurLP
If singleCompleteFightDamage(i) >= 100 Then
threeStrikes = threeStrikes + 1
If threeStrikes > 3 Then
AverageCompleteFightDamage = 100
Exit For
End If
End If
If (i Mod 1000) = 0 Then
DoEvents
End If
Next i
If AverageCompleteFightDamage < 100 Then
AverageCompleteFightDamage = SumCompleteFightDamage / CountCompleteFightDamage
Else
AverageCompleteFightDamageStdDev = 0
Exit Sub
End If
For i = 1 To amount
SumForStdDev = SumForStdDev + (AverageCompleteFightDamage - singleCompleteFightDamage(i)) ^ 2
Next i
SumForStdDev = SumForStdDev / (amount - 1)
AverageCompleteFightDamageStdDev = Sqr(SumForStdDev)
End Sub
Return to General HeroQuest Discussion
Users browsing this forum: CommonCrawl [Bot], Daedalus and 0 guests