Scusa se ti risp solo ora Ros ma l'ho visto ora >.<.
C'è scritto nel punto (2) sotto al diagramma
When an enemy it's in the Range Zone of a Co.R's weapon, the Co.R. can shoot at the enemy.
In that moment, combat system comes into play.
It's composed by 3 phases:
1) Probability Phase: draw of the probability to hit the enemy
In this phase the system calculate if the enemy will be hit or miss.
It's calculated by the function:
Random(0,100)=x
- if 0<=x<=weaponHitRate => The shoot hit the enemy
- if weaponHitRate <x<=100 => The shoot miss the enemy => EXIT
NOTE: Not all the weapons need this calculation. Some weapons have 100% hit rate!
2) Calculating Phase: the damage is calculated in base of the enemy resistance and weapon's type
In this second phase, the system takes the following stats from the weapon:
damage, critProbability, typeOfWeapon (L || M || B || W)
2.1) First of all, the range of the weapon damage is calculated by the system having a base value that depends from the weapon. (ex: 2 + d6 => 2 + Random(0,6) )
2.2) It's calculated if the damage is critical:
Random(0,100)=x
- if 0<=x<=critProbability => The weapon cause critical damage => damage*(Random(1.3, 2)) (previous ex: (2+ d6)*1.5)
- if critProbability <x<=100 => The weapon cause normal damage
2.3) Then, is taken in consideration the ArmorResistance for the typeOfWeapon get in this phase of the target.
2.4) At this point, the damage is reduced by the armorResistance of the enemy (simply multiply the percentage with the damage).
For example:
weapon stats: damage= 50, typeOfWeapon=Balistic
enemy stats: Armor(ballistic)=8%
realDamage=damage*(1-Armor)= 50*(1-0.08)= 46
3) Calculating Phase: the damage is subtracted by the enemy's HP
EnemyHP - realDamage
let's see a complete example:
Data:
weapon stats: damage= 100 + d20, typeOfWeapon=Balistic, weaponHitRate=90%, criticProbability=5%
enemy stats: HP(t0)= 120, Armor(laser)=10%, Armor(missile)=7%, Armor(ballistic)=15%, Armor(white)=2%
1) Random(0,100)=56 => 56<weaponHitRate=90 => Hit!
2.1) Random(0,20)=12 => damage=112
2.2) typeOfWeapon=Balistic => Armor=15% (=0.15)
2.3) Random(0,100)= 34 => 34>criticProbability=5 => No Critical
2.4) realDamage= 112*(1-0.15) = 112*0.85 = 95,2 = 95
3) HP(t1) = HP(t0) - realDamage = 120 - 95 = 25