Enforce hardcore retirement with level-one faction-balanced replacements
This commit is contained in:
@@ -3,6 +3,7 @@ const assert=require('node:assert/strict');
|
||||
const {execute}=require('../.test-build/service.js');
|
||||
const {seed}=require('../.test-build/seed.js');
|
||||
const {connectors}=require('../.test-build/connectors/index.js');
|
||||
const {applyAuthoritativeAleEvent}=require('../.test-build/service.js');
|
||||
|
||||
class Store {
|
||||
constructor(){this.state=seed();}
|
||||
@@ -10,6 +11,18 @@ class Store {
|
||||
async save(s,r){assert.equal(this.state.revision,r);s.revision=r+1;this.state=structuredClone(s);}
|
||||
}
|
||||
|
||||
test('game lifecycle death closes identity once and preserves Zaku',async()=>{
|
||||
const store=new Store();
|
||||
const bot=store.state.bots.find(b=>b.id==='bot-6');
|
||||
const payload={name:bot.name,isBot:true,characterGuid:99,accountId:2,deathId:'hardcore-99'};
|
||||
await applyAuthoritativeAleEvent(store,'player.permanent-death',payload);
|
||||
assert.equal(store.state.bots.find(b=>b.id===bot.id).status,'dead');
|
||||
await applyAuthoritativeAleEvent(store,'player.permanent-death',payload);
|
||||
assert.equal(store.state.events.filter(e=>e.kind==='death').length,1);
|
||||
await applyAuthoritativeAleEvent(store,'player.permanent-death',{name:'Zaku',isBot:true,characterGuid:9,accountId:1});
|
||||
assert.notEqual(store.state.bots.find(b=>b.name==='Zaku').status,'dead');
|
||||
});
|
||||
|
||||
test('Zaku is a mortal persistent hero and hardcore starts enabled',()=>{
|
||||
const state=seed();
|
||||
const zaku=state.bots.find(b=>b.id==='hero-zaku');
|
||||
|
||||
Reference in New Issue
Block a user