diff options
Diffstat (limited to 'internal/game/combat_mob.go')
| -rw-r--r-- | internal/game/combat_mob.go | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/internal/game/combat_mob.go b/internal/game/combat_mob.go index 8b7d869..dabb7d7 100644 --- a/internal/game/combat_mob.go +++ b/internal/game/combat_mob.go @@ -169,9 +169,17 @@ func (g *Game) applyMobHit(sess *net.Session, p *player.Player, mob *world.MobIn } if p.EscapeDir != "" { - p.ClearEscape() - p.WalkSequence = nil - sess.WriteLine("Can't escape!") + p.EscapeFailCount++ + if p.EscapeFailCount >= 3 && p.HP > 0 { + sess.WriteLine(g.colorize(sess, "miss", + fmt.Sprintf("You power through %s's relentless attacks and just flee!", + mobDisplayName(mob, false)))) + g.beginEscapeMove(sess, p) + } else { + p.ClearEscape() + p.WalkSequence = nil + sess.WriteLine("Can't escape!") + } } if p.Action != nil && p.Action.Type == behavior.TypeTriggerModule { @@ -347,8 +355,8 @@ func (g *Game) killPlayer(sess *net.Session, p *player.Player, mob *world.MobIns if mob.HP < 0 { mob.HP = 0 } - sess.WriteLine(fmt.Sprintf("Dead Man's Switch activates! %s takes %s damage!", - mobDisplayName(mob, true), g.dmgDisplay(sess, retDmg))) + sess.WriteLine(fmt.Sprintf("Dead Man's Switch activates! %s takes %s damage!", + mobDisplayName(mob, true), g.dmgDisplay(sess, retDmg))) } } } @@ -414,21 +422,25 @@ func (g *Game) stopCombat(playerName string) { g.Combat.Leave(playerName) } -// beginEscapeMove starts the actual movement after the escape gate (a mob miss -// or mob death) has fired. It copies the stashed Escape* fields into the Move* -// fields, recomputes moveTicks, and either sets MoveTicks for the normal -// 1-2 tick run-delay or calls completeMove instantly for 0-tick gear. +// beginEscapeMove starts the actual movement after the escape gate (a mob +// miss, a mob death, or the 3-strike "power through" relief) has fired. It +// copies the stashed Escape* fields into the Move* fields, recomputes +// moveTicks, sets MoveTicks for the normal 1-2 tick run delay, and records +// whether completion should drain run energy. +// +// beginEscapeMove is only reachable when doMove's in-combat branch stashed the +// escape, and that branch is itself gated on moveTicks returning > 0; the +// Cape-of-Agility / GodMode 0-tick bypass never enters the stash path, so there +// is no 0-tick branch to handle here. func (g *Game) beginEscapeMove(sess *net.Session, p *player.Player) { p.MoveDirection = p.EscapeDir p.MoveTarget = p.EscapeTarget p.MovePendingTrigger = p.EscapeTrigger isWalk := p.EscapeIsWalk p.ClearEscape() + p.EscapeFailCount = 0 - ticks := g.moveTicks(p, isWalk) - if ticks <= 0 { - g.completeMove(sess, p) - return - } + ticks, usesEnergy := g.moveTicks(p, isWalk) + p.MoveUsesEnergy = usesEnergy p.MoveTicks = ticks } |
