From c14c2e403c75a913e1a6d962fb6fe64f013adae5 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Wed, 1 Jul 2026 22:30:31 -0400 Subject: fix: combat formulas and mob attack types (mobs switch attack styles if safespotting) --- internal/game/cmd_stats.go | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) (limited to 'internal/game/cmd_stats.go') diff --git a/internal/game/cmd_stats.go b/internal/game/cmd_stats.go index 0430c6e..6942272 100644 --- a/internal/game/cmd_stats.go +++ b/internal/game/cmd_stats.go @@ -17,27 +17,10 @@ func (g *Game) doStats(sess *net.Session) { p := sess.Player totals := g.playerEquipBonuses(p) - attackType := "crush" weaponName := "unarmed" - var weaponType item.EquipmentType - var weaponDef *item.ItemDef - if itemID, ok := p.Equipment[item.SlotMainHand]; ok { - if def, err := g.ItemStore.Load(itemID); err == nil { - weaponDef = def - weaponName = def.Name - weaponType = def.EquipmentType() - if def.AttackType() != "" { - attackType = def.AttackType() - } else if def.EquipmentType() == item.EquipRangedWeapon { - attackType = "ranged" - } else if def.EquipmentType() == item.EquipScienceWeapon { - attackType = "science" - } - } - } - + attackType, weaponType, weaponDef := g.resolvePlayerAttackType(p) if weaponDef != nil { - weaponName = g.itemColorize(sess, weaponDef, weaponName) + weaponName = g.itemColorize(sess, weaponDef, weaponDef.Name) } sess.WriteLines( "", @@ -60,15 +43,15 @@ func (g *Game) doStats(sess *net.Session) { var attRoll, maxHitVal int if weaponType == item.EquipRangedWeapon { rangedBonus, _ := combat.RangedStyleBonus(string(p.AttackStyle)) - attRoll = combat.EffectiveRoll(p.Level(player.Ranged), rangedBonus, totals.RangedAttack) - maxHitVal = combat.MaxHit(p.Level(player.Ranged), rangedBonus, totals.RangedStrength) + attRoll = combat.AttackRoll(combat.PlayerEffective(p.Level(player.Ranged), rangedBonus), totals.RangedAttack) + maxHitVal = combat.MaxHit(combat.PlayerEffective(p.Level(player.Ranged), rangedBonus), totals.RangedStrength) } else { attBonus, strBonus, _ := combat.AttackStyleBonus(string(p.AttackStyle)) equipAtt := combat.SelectBonus(attackType, totals.StabAttack, totals.SlashAttack, totals.CrushAttack, totals.ScienceAttack, totals.RangedAttack) - attRoll = combat.EffectiveRoll(p.Level(player.Accuracy), attBonus, equipAtt) - maxHitVal = combat.MaxHit(p.Level(player.Strength), strBonus, totals.StrengthBonus) + attRoll = combat.AttackRoll(combat.PlayerEffective(p.Level(player.Accuracy), attBonus), equipAtt) + maxHitVal = combat.MaxHit(combat.PlayerEffective(p.Level(player.Strength), strBonus), totals.StrengthBonus) } sess.WriteLines( -- cgit v1.2.3