aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_stats.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-06-19 02:08:55 -0400
committerhistoria <[not public]>2026-06-19 02:08:55 -0400
commit458916fb78dcef3ff77cb29b7ba98d9f646819fc (patch)
tree19cd8b8eef41a1aa00d155bf7953ad2770f91a4c /internal/game/cmd_stats.go
parent97a1a908b9e6e6d3516628c139c9b64262b4fe08 (diff)
downloadthehouseoficarus-458916fb78dcef3ff77cb29b7ba98d9f646819fc.tar.gz
feat: rough pharmacy skill added
Diffstat (limited to 'internal/game/cmd_stats.go')
-rw-r--r--internal/game/cmd_stats.go70
1 files changed, 70 insertions, 0 deletions
diff --git a/internal/game/cmd_stats.go b/internal/game/cmd_stats.go
new file mode 100644
index 0000000..0dc963e
--- /dev/null
+++ b/internal/game/cmd_stats.go
@@ -0,0 +1,70 @@
+package game
+
+import (
+ "fmt"
+
+ "thehouseoficarus/internal/combat"
+ "thehouseoficarus/internal/net"
+ "thehouseoficarus/internal/object"
+ "thehouseoficarus/internal/player"
+)
+
+func (g *Game) doStats(sess *net.Session) {
+ p := sess.Player.(*player.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),
+ )
+}