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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
package game
import (
"fmt"
"thehouseoficarus/internal/combat"
"thehouseoficarus/internal/net"
"thehouseoficarus/internal/object"
"thehouseoficarus/internal/player"
)
func (g *Game) executeStats(sess *net.Session, args []string, rawInput string) {
g.doStats(sess)
}
func (g *Game) doStats(sess *net.Session) {
p := sess.Player
totals := g.playerEquipBonuses(p)
attackType := "crush"
weaponName := "unarmed"
var weaponType object.WeaponType
if itemID, ok := p.Equipment[object.SlotMainHand]; ok {
if def, err := g.ItemStore.Load(itemID); err == nil {
weaponName = def.Name
weaponType = def.WeaponType
if def.AttackType != "" {
attackType = def.AttackType
} else if def.WeaponType == object.WeaponRanged {
attackType = "ranged"
} else if def.WeaponType == object.WeaponScience {
attackType = "science"
}
}
}
sess.WriteLines(
"",
fmt.Sprintf("Weapon: %s (attack type: %s)", weaponName, attackType),
"",
"Attack bonuses: Defense bonuses:",
fmt.Sprintf(" Stab: %+4d Stab: %+4d", totals.StabAttack, totals.StabDefense),
fmt.Sprintf(" Slash: %+4d Slash: %+4d", totals.SlashAttack, totals.SlashDefense),
fmt.Sprintf(" Crush: %+4d Crush: %+4d", totals.CrushAttack, totals.CrushDefense),
fmt.Sprintf(" Science:%+4d Science:%+4d", totals.ScienceAttack, totals.ScienceDefense),
fmt.Sprintf(" Ranged: %+4d Ranged: %+4d", totals.RangedAttack, totals.RangedDefense),
"",
"Other bonuses:",
fmt.Sprintf(" Melee strength: %+d", totals.StrengthBonus),
fmt.Sprintf(" Ranged strength: %+d", totals.RangedStrength),
fmt.Sprintf(" Science damage: %+d", totals.ScienceDamage),
fmt.Sprintf(" Technology: %+d", totals.TechnologyBonus),
)
var attRoll, maxHitVal int
if weaponType == object.WeaponRanged {
rangedBonus, _ := combat.RangedStyleBonus(string(p.AttackStyle))
attRoll = combat.AttackRoll(p.Level(player.Ranged), rangedBonus, totals.RangedAttack)
maxHitVal = combat.MaxHit(p.Level(player.Ranged), rangedBonus, totals.RangedStrength)
} else {
attBonus, strBonus, _ := combat.AttackStyleBonus(string(p.AttackStyle))
equipAtt := combat.SelectAttackBonus(attackType,
totals.StabAttack, totals.SlashAttack, totals.CrushAttack,
totals.ScienceAttack, totals.RangedAttack)
attRoll = combat.AttackRoll(p.Level(player.Attack), attBonus, equipAtt)
maxHitVal = combat.MaxHit(p.Level(player.Strength), strBonus, totals.StrengthBonus)
}
sess.WriteLines(
"",
fmt.Sprintf("Style: %s Attack roll: %d Max hit: %d",
p.AttackStyle, attRoll, maxHitVal),
)
}
|