aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_attack.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-06-17 02:27:20 -0400
committerhistoria <[not public]>2026-06-17 02:27:20 -0400
commit731adf2e0fbcac9a32179da077299ed6465af41e (patch)
tree29d368917f258350d426f2680bec59feeb464eaf /internal/game/cmd_attack.go
parent389e307f205f9b7edf604fb9f86e1038ead736ef (diff)
downloadthehouseoficarus-731adf2e0fbcac9a32179da077299ed6465af41e.tar.gz
feat: movement overhauled. agility-enhancing items added.
Diffstat (limited to 'internal/game/cmd_attack.go')
-rw-r--r--internal/game/cmd_attack.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/game/cmd_attack.go b/internal/game/cmd_attack.go
index 359e0ac..d7fb365 100644
--- a/internal/game/cmd_attack.go
+++ b/internal/game/cmd_attack.go
@@ -272,6 +272,12 @@ func (g *Game) mobAttack(sess *net.Session, p *player.Player, mob *world.MobInst
prefix := fmt.Sprintf(" %s hits you for %s damage.", g.colorize(sess, "mob_name", attacker), g.colorize(sess, "damage", fmt.Sprint(dmg)))
hpPart := fmt.Sprintf("[%s/%dhp]", g.colorize(sess, "character_hp", fmt.Sprint(p.HP)), p.MaxHP())
sess.WriteLine(fmt.Sprintf("%-*s %s", g.combatPadWidth, prefix, hpPart))
+
+ if p.MoveTicks > 0 {
+ p.ClearMoveState()
+ p.ActionState = &ActionState{Type: ActionCombating, TargetName: mob.Name}
+ sess.WriteLine("Can't escape!")
+ }
} else {
attacker := mob.Name
if !mob.Unique {
@@ -288,6 +294,7 @@ func (g *Game) endCombat(sess *net.Session, p *player.Player, mob *world.MobInst
if p.HP <= 0 {
sess.WriteLine(g.colorize(sess, "death", "\nOh dear, you are dead!"))
+ p.ClearMoveState()
g.dropItemsOnDeath(p)
p.HP = p.MaxHP()
p.RoomID = 1
@@ -476,7 +483,7 @@ func (g *Game) respawnMob(instanceID string) {
if p, ok := sess.Player.(*player.Player); ok && p.OptionBool("mob_spawn") {
mobLvl := mobCombatLevel(inst)
levelStr := g.levelColorize(sess, p.CombatLevel(), mobLvl, fmt.Sprintf("(level %d)", mobLvl))
- sess.WriteLine(g.colorize(sess, "broadcast", fmt.Sprintf("\n%s %s spawns in the area.", mobDisplayName(inst, false), levelStr)))
+ sess.WriteLine(fmt.Sprintf("\n%s %s spawns in the area.", g.colorize(sess, "mob_name", mobDisplayName(inst, false)), levelStr))
}
}
}