Calculate initiative every round of battle
This commit is contained in:
parent
f23ee96cac
commit
ca370dce26
@ -11,6 +11,9 @@ func Battle(hero, enemy Character) {
|
|||||||
heroDamage := hero.Damage + hero.Weapons[hero.Gear.Weapon.Name].Damage
|
heroDamage := hero.Damage + hero.Weapons[hero.Gear.Weapon.Name].Damage
|
||||||
enemyDamage := enemy.Damage + enemy.Weapons[enemy.Gear.Weapon.Name].Damage
|
enemyDamage := enemy.Damage + enemy.Weapons[enemy.Gear.Weapon.Name].Damage
|
||||||
|
|
||||||
|
damage := 0
|
||||||
|
|
||||||
|
for {
|
||||||
heroInitiative := rand.Intn(7) + hero.Initiative
|
heroInitiative := rand.Intn(7) + hero.Initiative
|
||||||
enemyInitiative := rand.Intn(7) + enemy.Initiative
|
enemyInitiative := rand.Intn(7) + enemy.Initiative
|
||||||
|
|
||||||
@ -21,9 +24,6 @@ func Battle(hero, enemy Character) {
|
|||||||
enemyInitiative -= 1
|
enemyInitiative -= 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
damage := 0
|
|
||||||
|
|
||||||
for {
|
|
||||||
printCombatantStats(&hero, &enemy, heroInitiative, enemyInitiative)
|
printCombatantStats(&hero, &enemy, heroInitiative, enemyInitiative)
|
||||||
|
|
||||||
if heroInitiative > enemyInitiative {
|
if heroInitiative > enemyInitiative {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user