diff options
| author | historia <[not public]> | 2026-07-01 22:30:31 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-07-01 22:30:31 -0400 |
| commit | c14c2e403c75a913e1a6d962fb6fe64f013adae5 (patch) | |
| tree | 75070293fe2535b594ac72e501cbf08a3f1146e0 /internal/game/cmd_stats.go | |
| parent | 8eec7b75ff9c8c368b252373db45fb891732d2ca (diff) | |
| download | thehouseoficarus-c14c2e403c75a913e1a6d962fb6fe64f013adae5.tar.gz | |
fix: combat formulas and mob attack types (mobs switch attack styles if safespotting)
Diffstat (limited to 'internal/game/cmd_stats.go')
| -rw-r--r-- | internal/game/cmd_stats.go | 29 |
1 files changed, 6 insertions, 23 deletions
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( |
