Files
claudeandClaude Opus 5.5 70b7ea51e8
Ashlar checks / tooling (push) Successful in 5s
Add parry, ignoreStagger and low-stamina phases to the combat scenario
The headless duel now drops the player's shield and holds Block to parry
with the blade, has the duelist set ignoreStagger on hits it takes for a
window, then holds the player's fatigue below the attack fatigue
threshold and below the attack fatigue cap.

The engine logs refused attacks (once per press, any actor) and capped
attack strength at verbose level as "Ashlar stamina:" lines, and
docker/ashlar-run.sh counts parries, refused and capped attacks, and the
duelist's flinches inside the ignoreStagger window. The scenario's
default run time is now 150 s.

Closes #25

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 15:43:52 -05:00

50 lines
1.9 KiB
Lua

-- Ashlar headless combat scenario (CC0): the duelist equips its kit and fights the player with normal combat AI.
local self = require('openmw.self')
local types = require('openmw.types')
local I = require('openmw.interfaces')
local Actor = types.Actor
-- Stats can only be changed by the actor's own local script.
local function toughen(actor)
local stats = types.Actor.stats
for _, name in ipairs({ 'health', 'fatigue' }) do
local stat = stats.dynamic[name](actor)
stat.base = 5000
stat.current = 5000
end
stats.attributes.agility(actor).base = 100
stats.attributes.strength(actor).base = 60
types.NPC.stats.skills.block(actor).base = 100
types.NPC.stats.skills.shortblade(actor).base = 100
end
local ignoreStagger = false
-- Added after the built-in combat handler, so it runs first and can set ignoreStagger before stagger is applied.
I.Combat.addOnHitHandler(function(attack)
local health = attack.damage and attack.damage.health or 0
if ignoreStagger and attack.successful then
attack.ignoreStagger = true
end
print(string.format('ASHLAR_COMBAT npc hit successful=%s health=%.2f strength=%.2f ignoreStagger=%s',
tostring(attack.successful), health, attack.strength or -1, tostring(attack.ignoreStagger == true)))
end)
return {
eventHandlers = {
AshlarIgnoreStagger = function(on)
ignoreStagger = on
print('ASHLAR_COMBAT npc ignoreStagger ' .. (on and 'on' or 'off'))
end,
AshlarCombatStart = function(data)
toughen(self)
local eq = Actor.getEquipment(self)
eq[Actor.EQUIPMENT_SLOT.CarriedLeft] = data.shield
eq[Actor.EQUIPMENT_SLOT.CarriedRight] = data.blade
Actor.setEquipment(self, eq)
I.AI.startPackage({ type = 'Combat', target = data.enemy })
print('ASHLAR_COMBAT npc ready')
end,
},
}