部分成就的完成

This commit is contained in:
unanmed 2023-02-23 23:18:38 +08:00
parent 2ea95671a5
commit d47c18105d
3 changed files with 48 additions and 4 deletions

View File

@ -52,7 +52,14 @@ main.floors.MT17=
] ]
} }
}, },
"afterBattle": {}, "afterBattle": {
"12,6": [
{
"type": "function",
"function": "function(){\nif (core.status.hero.hp - flags.hphphp >= 150000) {\n\tcore.completeAchievement('normal', 1);\n\tdelete flags.hphphp;\n}\n}"
}
]
},
"afterGetItem": {}, "afterGetItem": {},
"afterOpenDoor": {}, "afterOpenDoor": {},
"autoEvent": {}, "autoEvent": {},
@ -94,7 +101,15 @@ main.floors.MT17=
"fgmap": [ "fgmap": [
], ],
"beforeBattle": {}, "beforeBattle": {
"12,6": [
{
"type": "setValue",
"name": "flag:hphphp",
"value": "core.status.hero.hp"
}
]
},
"bg2map": [ "bg2map": [
], ],

View File

@ -120,7 +120,14 @@ main.floors.MT6=
] ]
} }
}, },
"afterBattle": {}, "afterBattle": {
"4,12": [
{
"type": "function",
"function": "function(){\nif (core.status.hero.hp === 1) {\n\tcore.completeAchievement('normal', 0);\n}\n}"
}
]
},
"afterGetItem": { "afterGetItem": {
"4,4": [ "4,4": [
{ {

View File

@ -1,4 +1,5 @@
import { Animation, sleep, TimingFn } from 'mutate-animate'; import { Animation, sleep, TimingFn } from 'mutate-animate';
import { completeAchievement } from '../ui/achievement';
import { has } from '../utils'; import { has } from '../utils';
import { ChaseCameraData, ChasePath, getChaseDataByIndex } from './data'; import { ChaseCameraData, ChasePath, getChaseDataByIndex } from './data';
@ -30,6 +31,8 @@ export class Chase {
*/ */
showPath: boolean = false; showPath: boolean = false;
endFn?: () => void;
/** /**
* *
* @param index * @param index
@ -203,6 +206,14 @@ export class Chase {
this.showPath = show; this.showPath = show;
} }
/**
*
* @param fn
*/
onEnd(fn: () => void) {
this.endFn = fn;
}
/** /**
* *
*/ */
@ -215,6 +226,7 @@ export class Chase {
delete flags.chaseIndex; delete flags.chaseIndex;
flags.__lockViewport__ = false; flags.__lockViewport__ = false;
core.deleteCanvas('chasePath'); core.deleteCanvas('chasePath');
if (this.endFn) this.endFn();
} }
} }
@ -223,10 +235,20 @@ export async function startChase(index: number) {
flags.chaseIndex = index; flags.chaseIndex = index;
flags.onChase = true; flags.onChase = true;
await sleep(20); await sleep(20);
flags.chase = new Chase( const chase = new Chase(
data.path, data.path,
data.fns, data.fns,
data.camera, data.camera,
flags.chaseHard === 0 flags.chaseHard === 0
); );
flags.chase = chase;
// 成就
chase.onEnd(() => {
if (flags.chaseHard === 1) {
if (index === 1) {
completeAchievement('challenge', 0);
}
}
});
} }