aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_trigger_combat.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-06-24 22:55:35 -0400
committerhistoria <[not public]>2026-06-24 22:55:35 -0400
commit15b7e221b799ef107dec44ecdb294026dfd3d059 (patch)
tree3748e464a77f0f082bea1567e9d6990052054961 /internal/game/cmd_trigger_combat.go
parent9d4b799db4868bcab291b83599ff088763cd4ed6 (diff)
downloadthehouseoficarus-15b7e221b799ef107dec44ecdb294026dfd3d059.tar.gz
refactor: pulled techs out to yaml files, unified numerous combat functions, broke up game object
Diffstat (limited to 'internal/game/cmd_trigger_combat.go')
-rw-r--r--internal/game/cmd_trigger_combat.go14
1 files changed, 4 insertions, 10 deletions
diff --git a/internal/game/cmd_trigger_combat.go b/internal/game/cmd_trigger_combat.go
index 2086235..8ad585a 100644
--- a/internal/game/cmd_trigger_combat.go
+++ b/internal/game/cmd_trigger_combat.go
@@ -24,10 +24,11 @@ func (g *Game) scienceAttack(sess *net.Session, p *player.Player, mob *world.Mob
g.consumeJunkCost(p, mod)
equipSciBonus := g.totalScienceAttack(p)
- attRoll := (p.Level(player.Science) + g.buffLevelBonus(p, "science") + 8) * (equipSciBonus + 64)
+ effectiveScience := p.Level(player.Science) + g.techLevelBonus(p, "science") + g.buffLevelBonus(p, "science")
+ attRoll := combat.EffectiveRoll(effectiveScience, 0, equipSciBonus)
mobSciDef := mob.ScienceDefense
- defRoll := (mob.Defense + 9) * (mobSciDef + 64)
+ defRoll := combat.EffectiveRoll(mob.Defense, 0, mobSciDef)
if mob.Weakness == mod.Element {
attRoll = attRoll * 13 / 10
@@ -67,14 +68,7 @@ func (g *Game) scienceAttack(sess *net.Session, p *player.Player, mob *world.Mob
g.colorize(sess, "mob", mobName),
g.colorize(sess, "damage_dealt", fmt.Sprint(dmg)))
hpSuffix := fmt.Sprintf("%s [%2d/%d]", g.hpBar(sess, mob.HP, mob.MaxHP), mob.HP, mob.MaxHP)
- line := prefix + " " + hpSuffix
- if p.OptionBool("xp_drops") && len(gains) > 0 {
- var parts []string
- for _, gain := range gains {
- parts = append(parts, fmt.Sprintf("+%dxp %s", gain.XP, player.SkillAbbr[player.SkillName(gain.Skill)]))
- }
- line += g.colorize(sess, "xp", " ("+strings.Join(parts, ", ")+")")
- }
+ line := prefix + " " + hpSuffix + g.formatXpDrop(sess, p, gains)
sess.WriteLine(line)
} else {
sess.WriteLine(g.colorize(sess, "miss", fmt.Sprintf("%s fails to connect.", mod.Name)))