aboutsummaryrefslogtreecommitdiff
path: root/internal/game/equip_stats.go
blob: 559671fc1dc5a747cc39542ee52fb8914ed1fe94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package game

import (
	"thehouseoficarus/internal/object"
	"thehouseoficarus/internal/player"
)

func (g *Game) playerEquipBonuses(p *player.Player) object.ItemStats {
	var totals object.ItemStats
	for _, itemID := range p.Equipment {
		def, err := g.ItemStore.Load(itemID)
		if err != nil {
			continue
		}
		totals.StabAttack += def.Stats.StabAttack
		totals.SlashAttack += def.Stats.SlashAttack
		totals.CrushAttack += def.Stats.CrushAttack
		totals.ScienceAttack += def.Stats.ScienceAttack
		totals.RangedAttack += def.Stats.RangedAttack
		totals.StabDefense += def.Stats.StabDefense
		totals.SlashDefense += def.Stats.SlashDefense
		totals.CrushDefense += def.Stats.CrushDefense
		totals.ScienceDefense += def.Stats.ScienceDefense
		totals.RangedDefense += def.Stats.RangedDefense
		totals.StrengthBonus += def.Stats.StrengthBonus
		totals.RangedStrength += def.Stats.RangedStrength
		totals.ScienceDamage += def.Stats.ScienceDamage
		totals.TechnologyBonus += def.Stats.TechnologyBonus
	}
	return totals
}