Tuesday, 10 September 2013

Damage and Defence

Took a bit of a detour and decided to work on some of the equations for calculating damage and armour :D

Its still a bit of a prototype and we are just using some placeholder numbers here but the basic idea of these stats is that pure damage of the attacker is first calculated and then a seperate calculation for the armour rating of the person receiving the damage. And then we do damage - armour to get the amount of reduced damage of the armoured target.

Damage Calculation
Private Sub BtnTest_Click(sender As System.Object, e As System.EventArgs) Handles BtnTest.Click

Randomize()

Dim Attribute, Strength, Power, Damage As Integer

Attribute = 30
Strength = 30
Power = 350
 


Dim PhyDmgV As Integer = CInt(Int((((Attribute * 1.7) - (Attribute / 2.5)) * Rnd()) + 1))

Damage = Strength * Power * PhyDmgV
MsgBox(
"Damage equals " & Damage)

End Sub
 Defence Calculation
 

PrivateSub BtnTest_Click(sender As System.Object, e As System.EventArgs) Handles BtnTest.Click
Randomize()

Dim Attribute, Strength, Armour, Defence As Integer


Attribute = 30

Strength = 30

Armour = 180

Dim PhysDefV As Integer = CInt(Int((((Attribute * 1.5) - (Attribute / 2)) * Rnd()) + 1))


Defence = Attribute * Strength * PhysDefV

MsgBox(
"Defence value is " & Defence)


End Sub

No comments:

Post a Comment