kill bug & new function
This commit is contained in:
1 parent
4a801cbc85
commit
144ef9755e
6 files changed
+2657
-2574
No files matched your search
@@ -189,7 +189,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- injection -->
|
||||
<script src='libs/thirdparty/browser-polyfill.min.js'></script>
|
||||
<script src='libs/thirdparty/lz-string.min.js'></script>
|
||||
<script src='libs/thirdparty/priority-queue.min.js'></script>
|
||||
<script src='libs/thirdparty/localforage.min.js'></script>
|
||||
|
||||
+354
-339
File diff suppressed because it is too large.
Load diff
-2
@@ -1,2 +0,0 @@
|
||||
!function t(e,n,r){function o(s,c){if(!n[s]){if(!e[s]){var u="function"==typeof require&&require;if(!c&&u)return u(s,!0);if(i)return i(s,!0);var a=new Error("Cannot find module '"+s+"'");throw a.code="MODULE_NOT_FOUND",a}var f=n[s]={exports:{}};e[s][0].call(f.exports,function(t){var n=e[s][1][t];return o(n?n:t)},f,f.exports,t,e,n,r)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<r.length;s++)o(r[s]);return o}({1:[function(t){(function(e){"use strict";if(e._babelPolyfill)throw new Error("only one instance of babel/polyfill is allowed");e._babelPolyfill=!0,t("./es6-shim"),t("regenerator-babel/runtime")}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./es6-shim":2,"regenerator-babel/runtime":60}],2:[function(t,e){t("core-js/es6"),e.exports=t("core-js/modules/$").core},{"core-js/es6":3,"core-js/modules/$":16}],3:[function(t,e){t("../modules/es6.symbol"),t("../modules/es6.object.assign"),t("../modules/es6.object.is"),t("../modules/es6.object.set-prototype-of"),t("../modules/es6.object.to-string"),t("../modules/es6.object.statics-accept-primitives"),t("../modules/es6.function.name"),t("../modules/es6.number.constructor"),t("../modules/es6.number.statics"),t("../modules/es6.math"),t("../modules/es6.string.from-code-point"),t("../modules/es6.string.raw"),t("../modules/es6.string.iterator"),t("../modules/es6.string.code-point-at"),t("../modules/es6.string.ends-with"),t("../modules/es6.string.includes"),t("../modules/es6.string.repeat"),t("../modules/es6.string.starts-with"),t("../modules/es6.array.from"),t("../modules/es6.array.of"),t("../modules/es6.array.species"),t("../modules/es6.array.iterator"),t("../modules/es6.array.copy-within"),t("../modules/es6.array.fill"),t("../modules/es6.array.find"),t("../modules/es6.array.find-index"),t("../modules/es6.regexp"),t("../modules/es6.promise"),t("../modules/es6.map"),t("../modules/es6.set"),t("../modules/es6.weak-map"),t("../modules/es6.weak-set"),t("../modules/es6.reflect"),e.exports=t("../modules/$").core},{"../modules/$":16,"../modules/es6.array.copy-within":27,"../modules/es6.array.fill":28,"../modules/es6.array.find":30,"../modules/es6.array.find-index":29,"../modules/es6.array.from":31,"../modules/es6.array.iterator":32,"../modules/es6.array.of":33,"../modules/es6.array.species":34,"../modules/es6.function.name":35,"../modules/es6.map":36,"../modules/es6.math":37,"../modules/es6.number.constructor":38,"../modules/es6.number.statics":39,"../modules/es6.object.assign":40,"../modules/es6.object.is":41,"../modules/es6.object.set-prototype-of":42,"../modules/es6.object.statics-accept-primitives":43,"../modules/es6.object.to-string":44,"../modules/es6.promise":45,"../modules/es6.reflect":46,"../modules/es6.regexp":47,"../modules/es6.set":48,"../modules/es6.string.code-point-at":49,"../modules/es6.string.ends-with":50,"../modules/es6.string.from-code-point":51,"../modules/es6.string.includes":52,"../modules/es6.string.iterator":53,"../modules/es6.string.raw":54,"../modules/es6.string.repeat":55,"../modules/es6.string.starts-with":56,"../modules/es6.symbol":57,"../modules/es6.weak-map":58,"../modules/es6.weak-set":59}],4:[function(t,e){"use strict";var n=t("./$"),r=t("./$.ctx");e.exports=function(t){var e=1==t,o=2==t,i=3==t,s=4==t,c=6==t,u=5==t||c;return function(a){for(var f,l,h=Object(n.assertDefined(this)),d=n.ES5Object(h),p=r(a,arguments[1],3),g=n.toLength(d.length),$=0,v=e?Array(g):o?[]:void 0;g>$;$++)if((u||$ in d)&&(f=d[$],l=p(f,$,h),t))if(e)v[$]=l;else if(l)switch(t){case 3:return!0;case 5:return f;case 6:return $;case 2:v.push(f)}else if(s)return!1;return c?-1:i||s?s:v}}},{"./$":16,"./$.ctx":11}],5:[function(t,e){function n(t,e,n){if(!t)throw TypeError(n?e+n:e)}var r=t("./$");n.def=r.assertDefined,n.fn=function(t){if(!r.isFunction(t))throw TypeError(t+" is not a function!");return t},n.obj=function(t){if(!r.isObject(t))throw TypeError(t+" is not an object!");return t},n.inst=function(t,e,n){if(!(t instanceof e))throw TypeError(n+": use the 'new' operator!");return t},e.exports=n},{"./$":16}],6:[function(t,e){var n=t("./$");e.exports=Object.assign||function(t){for(var e=Object(n.assertDefined(t)),r=arguments.length,o=1;r>o;)for(var i,s=n.ES5Object(arguments[o++]),c=n.getKeys(s),u=c.length,a=0;u>a;)e[i=c[a++]]=s[i];return e}},{"./$":16}],7:[function(t,e){function n(t){return i.call(t).slice(8,-1)}var r=t("./$"),o=t("./$.wks")("toStringTag"),i={}.toString;n.classof=function(t){var e,r;return void 0==t?void 0===t?"Undefined":"Null":"string"==typeof(r=(e=Object(t))[o])?r:n(e)},n.set=function(t,e,n){t&&!r.has(t=n?t:t.prototype,o)&&r.hide(t,o,e)},e.exports=n},{"./$":16,"./$.wks":26}],8:[function(t,e){"use strict";function n(t,e){if(!l(t))return("string"==typeof t?"S":"P")+t;if(p(t))return"F";if(!a(t,g)){if(!e)return"E";h(t,g,++w)}return"O"+t[g]}function r(t,e){var r,o=n(e);if("F"!=o)return t[$][o];for(r=t[y];r;r=r.n)if(r.k==e)return r}var o=t("./$"),i=t("./$.ctx"),s=t("./$.uid"Line truncated
|
||||
f.prototype[t]=function(n,o){if(c(n)&&u(n)){var i=r(this)[t](n,o);return"set"==t?this:i}return e.call(this,n,o)}})},{"./$":16,"./$.collection":10,"./$.collection-weak":9}],59:[function(t){"use strict";var e=t("./$.collection-weak");t("./$.collection")("WeakSet",{add:function(t){return e.def(this,t,!0)}},e,!1,!0)},{"./$.collection":10,"./$.collection-weak":9}],60:[function(t,e){(function(t){!function(t){"use strict";function n(t,e,n,r){return new s(t,e,n||null,r||[])}function r(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(r){return{type:"throw",arg:r}}}function o(){}function i(){}function s(t,e,n,o){function i(e,o){if(u===m)throw new Error("Generator is already running");if(u===b)return l();for(;;){var i=c.delegate;if(i){var s=r(i.iterator[e],i.iterator,o);if("throw"===s.type){c.delegate=null,e="throw",o=s.arg;continue}e="next",o=h;var a=s.arg;if(!a.done)return u=y,a;c[i.resultName]=a.value,c.next=i.nextLoc,c.delegate=null}if("next"===e){if(u===v&&"undefined"!=typeof o)throw new TypeError("attempt to send "+JSON.stringify(o)+" to newborn generator");u===y?c.sent=o:delete c.sent}else if("throw"===e){if(u===v)throw u=b,o;c.dispatchException(o)&&(e="next",o=h)}else"return"===e&&c.abrupt("return",o);u=m;var s=r(t,n,c);if("normal"===s.type){u=c.done?b:y;var a={value:s.arg,done:c.done};if(s.arg!==w)return a;c.delegate&&"next"===e&&(o=h)}else"throw"===s.type&&(u=b,"next"===e?c.dispatchException(s.arg):o=s.arg)}}var s=e?Object.create(e.prototype):this,c=new a(o),u=v;return s.next=i.bind(s,"next"),s["throw"]=i.bind(s,"throw"),s["return"]=i.bind(s,"return"),s}function c(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function u(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function a(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(c,this),this.reset()}function f(t){if(t){var e=t[p];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function o(){for(;++n<t.length;)if(d.call(t,n))return o.value=t[n],o.done=!1,o;return o.value=h,o.done=!0,o};return r.next=r}}return{next:l}}function l(){return{value:h,done:!0}}var h,d=Object.prototype.hasOwnProperty,p="function"==typeof Symbol&&Symbol.iterator||"@@iterator",g="object"==typeof e,$=t.regeneratorRuntime;if($)return void(g&&(e.exports=$));$=t.regeneratorRuntime=g?e.exports:{},$.wrap=n;var v="suspendedStart",y="suspendedYield",m="executing",b="completed",w={},x=i.prototype=s.prototype;o.prototype=x.constructor=i,i.constructor=o,o.displayName="GeneratorFunction",$.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return e?e===o||"GeneratorFunction"===(e.displayName||e.name):!1},$.mark=function(t){return t.__proto__=i,t.prototype=Object.create(x),t},$.async=function(t,e,o,i){return new Promise(function(s,c){function u(t){var e=r(this,null,t);if("throw"===e.type)return void c(e.arg);var n=e.arg;n.done?s(n.value):Promise.resolve(n.value).then(f,l)}var a=n(t,e,o,i),f=u.bind(a.next),l=u.bind(a["throw"]);f()})},x[p]=function(){return this},x.toString=function(){return"[object Generator]"},$.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},$.values=f,a.prototype={constructor:a,reset:function(){this.prev=0,this.next=0,this.sent=h,this.done=!1,this.delegate=null,this.tryEntries.forEach(u);for(var t,e=0;d.call(this,t="t"+e)||20>e;++e)this[t]=null},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){function e(e,r){return i.type="throw",i.arg=t,n.next=e,!!r}if(this.done)throw t;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var s=d.call(o,"catchLoc"),c=d.call(o,"finallyLoc");if(s&&c){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&d.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?this.next=o.finallyLoc:this.complete(i),w},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=t.arg,this.next="end"):"normal"===t.type&&e&&(this.next=e),w},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc)}},"catch":function(t){for(var e=this.tryEntries.length-1;Line truncated
|
||||
+374
-363
File diff suppressed because it is too large.
Load diff
+1715
-1715
File diff suppressed because it is too large.
Load diff
Vendored
+214
-154
@@ -8,14 +8,16 @@ type move = 'forward' | direction
|
||||
type loc = { direction: direction, x: number, y: number }
|
||||
type rgbarray = [number, number, number, number]
|
||||
|
||||
type Block = {
|
||||
x: number,
|
||||
y: number,
|
||||
id: number,
|
||||
event: {
|
||||
cls: string,
|
||||
id: string,
|
||||
[key: string]: any
|
||||
type Events = MotaAction[] | string
|
||||
|
||||
type Block = {
|
||||
x: number,
|
||||
y: number,
|
||||
id: number,
|
||||
event: {
|
||||
cls: string,
|
||||
id: string,
|
||||
[key: string]: any
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +47,53 @@ type Floor = {
|
||||
}
|
||||
|
||||
type ResolvedMap = {
|
||||
|
||||
floorId: string
|
||||
afterBattle: { [x: string]: Events }
|
||||
afterOpenDoor: { [x: string]: Events }
|
||||
afterGetItem: { [x: string]: Events }
|
||||
autoEvent: Event
|
||||
beforeBattle: { [x: string]: Events }
|
||||
canFlyFrom: boolean
|
||||
canFltTo: boolean
|
||||
canUseQuickShop: boolean
|
||||
cannotMove: Object
|
||||
cannotMoveIn: Object
|
||||
cannotViewMap: boolean
|
||||
changeFloor: {
|
||||
[x: string]: {
|
||||
floorId: ':before' | ':after' | ':now' | string
|
||||
loc?: [number, number]
|
||||
stair?: 'upFloor' | 'downFloor' | ':symmetry' | ':symmetry_x' | ':symmetry_y' | 'flyPoint'
|
||||
direction?: 'left' | 'right' | 'up' | 'down' | ':left' | ':right' | ':back' | ':hero' | ':backhero'
|
||||
time?: number
|
||||
ignoreChangeFloor?: boolean
|
||||
}
|
||||
}
|
||||
defaultGround: string
|
||||
bgm: string | Array<string>
|
||||
bgmap: number[][]
|
||||
/** 事件层 */
|
||||
map: number[][]
|
||||
fgmap: number[][]
|
||||
width: number
|
||||
height: number
|
||||
images: Array<{
|
||||
canvas: 'bg' | 'auto' | 'fg'
|
||||
name: string
|
||||
x: number
|
||||
y: number
|
||||
reverse?: ':x' | ':y' | ':o'
|
||||
disable?: boolean
|
||||
sx?: number
|
||||
sy?: number
|
||||
w?: number
|
||||
h?: number
|
||||
frame?: numer
|
||||
}>
|
||||
name: string
|
||||
ratio: number
|
||||
title: string
|
||||
weather: [string, number]
|
||||
}
|
||||
|
||||
type Enemy = {
|
||||
@@ -68,12 +116,12 @@ type Item = {
|
||||
}
|
||||
|
||||
type Save = {
|
||||
|
||||
|
||||
}
|
||||
|
||||
type MotaAction = {
|
||||
type: string,
|
||||
[key: string]: any
|
||||
type MotaAction = {
|
||||
type: string,
|
||||
[key: string]: any
|
||||
} | string
|
||||
|
||||
type SystemFlags = {
|
||||
@@ -87,7 +135,7 @@ type SystemFlags = {
|
||||
}
|
||||
|
||||
type event = { type: string, [key: string]: any }
|
||||
|
||||
|
||||
type step = 'up' | 'down' | 'left' | 'right' | 'forward' | 'backward'
|
||||
|
||||
type HeroStatus = {
|
||||
@@ -150,12 +198,46 @@ type gameStatus = {
|
||||
fgmaps: { [key: string]: number[][] }
|
||||
mapBlockObjs: { [key: string]: any }
|
||||
/** 显伤伤害 */
|
||||
checkBlock: {}
|
||||
damage: {}
|
||||
checkBlock: {
|
||||
ambush: { [x: string]: [number, number, string, direction] }
|
||||
repulse: { [x: string]: [number, number, string, direction] }
|
||||
damage: { [x: string]: number }
|
||||
needCache: boolean
|
||||
type: { [x: string]: { [x: string]: boolean } }
|
||||
cache: {
|
||||
[s: string]: {
|
||||
hp_buff: number
|
||||
atk_buff: number
|
||||
def_buff: number
|
||||
guards: [number, number, string]
|
||||
}
|
||||
}
|
||||
}
|
||||
damage: {
|
||||
posX: number
|
||||
posY: number
|
||||
data: Array<{
|
||||
[x: string]: {
|
||||
text: string
|
||||
px: number
|
||||
py: number
|
||||
color: string | Array<number>
|
||||
}
|
||||
}>
|
||||
extraData: Array<{
|
||||
[x: string]: {
|
||||
text: string
|
||||
px: number
|
||||
py: number
|
||||
color: string | Array<number>
|
||||
alpha: number
|
||||
}
|
||||
}>
|
||||
}
|
||||
|
||||
lockControl: boolean
|
||||
|
||||
/** 勇士移动状态 */
|
||||
/** 勇士移动状态 */
|
||||
heroMoving: number
|
||||
heroStop: boolean
|
||||
|
||||
@@ -182,13 +264,13 @@ type gameStatus = {
|
||||
ctrlDown: boolean
|
||||
|
||||
// 路线&回放
|
||||
route: [],
|
||||
route: string[],
|
||||
replay: {
|
||||
replaying: boolean
|
||||
pausing: boolean
|
||||
/** 正在某段动画中 */animate: boolean
|
||||
toReplay: []
|
||||
totalList: []
|
||||
toReplay: string[]
|
||||
totalList: string[]
|
||||
speed: number
|
||||
steps: number
|
||||
save: []
|
||||
@@ -197,13 +279,13 @@ type gameStatus = {
|
||||
// event事件
|
||||
shops: {}
|
||||
event: {
|
||||
id: null
|
||||
data: null
|
||||
selection: null
|
||||
ui: null
|
||||
interval: null
|
||||
id: string
|
||||
data: any
|
||||
selection: any
|
||||
ui: any
|
||||
interval: number
|
||||
}
|
||||
autoEvents: []
|
||||
autoEvents: Events
|
||||
textAttribute: {
|
||||
position: string
|
||||
offset: number
|
||||
@@ -253,28 +335,6 @@ declare class control {
|
||||
*/
|
||||
updateStatusBar(doNotCheckAutoEvents?: boolean): void
|
||||
|
||||
/**
|
||||
* 设置某个自定义变量或flag
|
||||
* @example core.setFlag('xyz', 2) // 设置变量xyz为2
|
||||
* @param name 变量名
|
||||
* @param value 要设置的值
|
||||
*/
|
||||
setFlag(name: string, value: any): void
|
||||
|
||||
/**
|
||||
* 获取某个自定义变量或flag
|
||||
* @example core.getFlag('point', 2) // 获得变量point的值;如果该变量从未定义过则返回2
|
||||
* @param name 变量名
|
||||
* @param defaultValue 该变量不存在时返回的值。
|
||||
* @returns 变量的值
|
||||
*/
|
||||
getFlag(name: string, defaultValue: any): any
|
||||
|
||||
/**
|
||||
* 返回是否存在某个变量且不为0。等价于 core.getFlag('xyz', 0)!=0
|
||||
*/
|
||||
hasFlag(name: string): boolean
|
||||
|
||||
/** 删除某个flag/变量 */
|
||||
removeFlag(name: string): void
|
||||
|
||||
@@ -304,7 +364,7 @@ declare class control {
|
||||
|
||||
/** 回放下一个操作 */
|
||||
replay(): void
|
||||
|
||||
|
||||
/**
|
||||
* 进入标题画面
|
||||
* @example core.showStartAnimate(); // 重启游戏但不重置bgm
|
||||
@@ -312,14 +372,14 @@ declare class control {
|
||||
* @param callback 可选,完全亮屏后的回调函数
|
||||
*/
|
||||
showStartAnimate(noAnimate?: boolean, callback?: () => void): void
|
||||
|
||||
|
||||
/**
|
||||
* 淡出标题画面
|
||||
* @example core.hideStartAnimate(core.startGame); // 淡出标题画面并开始新游戏,跳过难度选择
|
||||
* @param callback 标题画面完全淡出后的回调函数
|
||||
*/
|
||||
hideStartAnimate(callback?: () => void): void
|
||||
|
||||
|
||||
/**
|
||||
* 半自动寻路,用于鼠标或手指拖动
|
||||
* @example core.setAutomaticRoute(0, 0, [{direction: "right", x: 4, y: 9}, {direction: "right", x: 5, y: 9}, {direction: "right", x: 6, y: 9}, {direction: "up", x: 6, y: 8}]);
|
||||
@@ -328,21 +388,21 @@ declare class control {
|
||||
* @param stepPostfix 拖动轨迹的数组表示,每项为一步的方向和目标点。
|
||||
*/
|
||||
setAutomaticRoute(destX: number, destY: number, stepPostfix: Array<{ direction: direction, x: number, y: number }>): void
|
||||
|
||||
|
||||
/**
|
||||
* 连续行走
|
||||
* @example core.setAutoHeroMove([{direction: "up", step: 1}, {direction: "left", step: 3}, {direction: "right", step: 3}, {direction: "up", step: 9}]); // 上左左左右右右上9
|
||||
* @param steps 压缩的步伐数组,每项表示朝某方向走多少步
|
||||
*/
|
||||
setAutoHeroMove(steps: Array<{ direction: direction, step: number }>): void
|
||||
|
||||
|
||||
/**
|
||||
* 尝试前进一步,如果面前不可被踏入就会直接触发该点事件
|
||||
* @example core.moveAction(core.doAction); // 尝试前进一步,然后继续事件处理。常用于在事件流中让主角像自由行动时一样前进一步,可以照常触发moveOneStep(跑毒和计步)和面前的事件(包括但不限于阻激夹域捕)
|
||||
* @param callback 走一步后的回调函数,可选
|
||||
*/
|
||||
moveAction(callback?: () => void): void
|
||||
|
||||
|
||||
/**
|
||||
* 连续前进,不撞南墙不回头
|
||||
* @example core.moveHero(); // 连续前进
|
||||
@@ -350,21 +410,21 @@ declare class control {
|
||||
* @param callback 可选,如果设置了就只走一步
|
||||
*/
|
||||
moveHero(direction?: direction, callback?: () => void): void
|
||||
|
||||
|
||||
/**
|
||||
* 等待主角停下
|
||||
* @example core.waitHeroToStop(core.vibrate); // 等待主角停下,然后视野左右抖动1秒
|
||||
* @param callback 主角停止后的回调函数
|
||||
*/
|
||||
waitHeroToStop(callback?: () => void): void
|
||||
|
||||
|
||||
/**
|
||||
* 主角转向并计入录像,不会导致跟随者聚集,会导致视野重置到以主角为中心
|
||||
* @example core.turnHero(); // 主角顺时针旋转90°,即单击主角或按下Z键的效果
|
||||
* @param direction 主角的新朝向,可为 up, down, left, right, :left, :right, :back 七种之一
|
||||
*/
|
||||
turnHero(direction?: direction): void
|
||||
|
||||
|
||||
/**
|
||||
* 尝试瞬移,如果该点有图块/事件/阻激夹域捕则会瞬移到它旁边再走一步(不可踏入的话当然还是触发该点事件),这一步的方向优先和瞬移前主角的朝向一致
|
||||
* @example core.tryMoveDirectly(6, 0); // 尝试瞬移到地图顶部的正中央,以样板0层为例,实际效果是瞬移到了上楼梯下面一格然后向上走一步并触发上楼事件
|
||||
@@ -372,7 +432,7 @@ declare class control {
|
||||
* @param destY 目标点的纵坐标
|
||||
*/
|
||||
tryMoveDirectly(destX: number, destY: number): void
|
||||
|
||||
|
||||
/**
|
||||
* 绘制主角和跟随者并重置视野到以主角为中心
|
||||
* @example core.drawHero(); // 原地绘制主角的静止帧
|
||||
@@ -381,21 +441,21 @@ declare class control {
|
||||
* @param frame 绘制第几帧
|
||||
*/
|
||||
drawHero(status?: 'stop' | 'leftFoot' | 'rightFoot', offset?: number, frame?: number): void
|
||||
|
||||
|
||||
/**
|
||||
* 获取主角面前第n格的横坐标
|
||||
* @example core.closeDoor(core.nextX(), core.nextY(), 'yellowDoor', core.turnHero); // 在主角面前关上一扇黄门,然后主角顺时针旋转90°
|
||||
* @param n 目标格与主角的距离,面前为正数,背后为负数,脚下为0,不填视为1
|
||||
*/
|
||||
nextX(n?: number): number
|
||||
|
||||
|
||||
/**
|
||||
* 获取主角面前第n格的纵坐标
|
||||
* @example core.jumpHero(core.nextX(2), core.nextY(2)); // 主角向前跃过一格,即跳跃靴道具的使用效果
|
||||
* @param n 目标格与主角的距离,面前为正数,背后为负数,脚下为0,不填视为1
|
||||
*/
|
||||
nextY(n?: number): number
|
||||
|
||||
|
||||
/**
|
||||
* 判定主角是否身处某个点的锯齿领域(取曼哈顿距离)
|
||||
* @example core.nearHero(6, 6, 6); // 判定主角是否身处点(6,6)的半径为6的锯齿领域
|
||||
@@ -404,15 +464,15 @@ declare class control {
|
||||
* @param n 领域的半径,不填视为1
|
||||
*/
|
||||
nearHero(x: number, y: number, n?: number): boolean
|
||||
|
||||
|
||||
/**
|
||||
* 重算并绘制地图显伤
|
||||
* 请不要直接使用该函数,请使用core.updateStatusBar()代替!重算并绘制地图显伤
|
||||
* @example core.updateDamage(); // 更新当前地图的显伤,绘制在显伤层(废话)
|
||||
* @param floorId 地图id,不填视为当前地图。预览地图时填写
|
||||
* @param ctx 绘制到的画布,如果填写了就会画在该画布而不是显伤层
|
||||
*/
|
||||
updateDamage(floorId?: string, ctx?: CanvasRenderingContext2D): void
|
||||
|
||||
|
||||
/** 仅重绘地图显伤 */
|
||||
drawDamage(ctx?: CanvasRenderingContext2D): void
|
||||
|
||||
@@ -423,7 +483,7 @@ declare class control {
|
||||
* @param value 属性的新值
|
||||
*/
|
||||
setStatus<K extends keyof HeroStatus>(name: K, value: HeroStatus[K]): void
|
||||
|
||||
|
||||
/**
|
||||
* 增减主角的某个属性,等价于core.setStatus(name, core.getStatus(name) + value)
|
||||
* @example core.addStatus('name', '酱'); // 在主角的名字后加一个“酱”字
|
||||
@@ -431,7 +491,7 @@ declare class control {
|
||||
* @param value 属性的增量,请注意旧量和增量中只要有一个是字符串就会把两者连起来成为一个更长的字符串
|
||||
*/
|
||||
addStatus<K extends keyof HeroStatus>(name: K, value: HeroStatus[K]): void
|
||||
|
||||
|
||||
/**
|
||||
* 读取主角的某个属性,不包括百分比修正
|
||||
* @example core.getStatus('loc'); // 读取主角的坐标和朝向
|
||||
@@ -439,17 +499,17 @@ declare class control {
|
||||
* @returns 属性值
|
||||
*/
|
||||
getStatus<K extends keyof HeroStatus>(name: K): HeroStatus[K]
|
||||
|
||||
|
||||
/**
|
||||
* 计算主角的某个属性,包括百分比修正
|
||||
* @example core.getRealStatus('atk'); // 计算主角的攻击力,包括百分比修正。战斗使用的就是这个值
|
||||
* @param name 属性的英文名,请注意只能用于数值类属性哦,否则乘法会得到NaN
|
||||
*/
|
||||
getRealStatus(name: string): any
|
||||
getRealStatus<K extends keyof HeroStatus>(name: K): HeroStatus[K]
|
||||
|
||||
/** 获得某个状态的名字 */
|
||||
getStatusLabel(name: string): string
|
||||
|
||||
getStatusLabel<K extends keyof HeroStatus>(name: K): string
|
||||
|
||||
/**
|
||||
* 设置主角某个属性的百分比修正倍率,初始值为1,
|
||||
* 倍率存放在flag: '__'+name+'_buff__' 中
|
||||
@@ -457,30 +517,30 @@ declare class control {
|
||||
* @param name 属性的英文名,请注意只能用于数值类属性哦,否则随后的乘法会得到NaN
|
||||
* @param value 新的百分比修正倍率,不填(效果上)视为1
|
||||
*/
|
||||
setBuff(name: string, value?: number): void
|
||||
|
||||
setBuff<K extends keyof HeroStatus>(name: K, value?: HeroStatus[K]): void
|
||||
|
||||
/**
|
||||
* 增减主角某个属性的百分比修正倍率,加减法叠加和抵消。等价于 core.setBuff(name, core.getBuff(name) + value)
|
||||
* @example core.addBuff('atk', -0.1); // 主角获得一层“攻击力减一成”的负面效果
|
||||
* @param name 属性的英文名,请注意只能用于数值类属性哦,否则随后的乘法会得到NaN
|
||||
* @param value 倍率的增量
|
||||
*/
|
||||
addBuff(name: string, value: number): void
|
||||
|
||||
addBuff<K extends keyof HeroStatus>(name: K, value: HeroStatus[K]): void
|
||||
|
||||
/**
|
||||
* 读取主角某个属性的百分比修正倍率,初始值为1
|
||||
* @example core.getBuff('atk'); // 主角当前能发挥出多大比例的攻击力
|
||||
* @param name 属性的英文名
|
||||
*/
|
||||
getBuff(name: string): number
|
||||
getBuff<K extends keyof HeroStatus>(name: HeroStatus[K]): number
|
||||
|
||||
/**
|
||||
* 获得或移除毒衰咒效果
|
||||
* @param action 获得还是移除,'get'为获得,'remove'为移除
|
||||
* @param type 要获得或移除的毒衰咒效果
|
||||
*/
|
||||
triggerDebuff(action: string, type: string|string[]): void
|
||||
|
||||
triggerDebuff(action: string, type: string | string[]): void
|
||||
|
||||
/**
|
||||
* 设置勇士位置
|
||||
* 值得注意的是,这句话虽然会使勇士改变位置,但并不会使界面重新绘制;
|
||||
@@ -492,7 +552,7 @@ declare class control {
|
||||
*/
|
||||
setHeroLoc(name: 'x' | 'y', value: number, noGather?: boolean): void
|
||||
setHeroLoc(name: 'direction', value: direction, noGather?: boolean): void
|
||||
|
||||
|
||||
/**
|
||||
* 读取主角的位置和/或朝向
|
||||
* @example core.getHeroLoc(); // 读取主角的位置和朝向
|
||||
@@ -502,7 +562,7 @@ declare class control {
|
||||
getHeroLoc(): { x: number, y: number, direction: direction }
|
||||
getHeroLoc(name: 'x' | 'y'): number
|
||||
getHeroLoc(name: 'direction'): direction
|
||||
|
||||
|
||||
/**
|
||||
* 根据级别的数字获取对应的名称,后者定义在全塔属性
|
||||
* @example core.getLvName(); // 获取主角当前级别的名称,如“下级佣兵”
|
||||
@@ -510,13 +570,13 @@ declare class control {
|
||||
* @returns 级别的名称,如果不存在就还是返回数字
|
||||
*/
|
||||
getLvName(lv?: number): string | number
|
||||
|
||||
|
||||
/**
|
||||
* 获得下次升级需要的经验值。
|
||||
* 升级扣除模式下会返回经验差值;非扣除模式下会返回总共需要的经验值。
|
||||
* 如果无法进行下次升级,返回null。
|
||||
*/
|
||||
getNextLvUpNeed() : number
|
||||
getNextLvUpNeed(): number
|
||||
|
||||
/**
|
||||
* 设置一个flag变量
|
||||
@@ -525,7 +585,7 @@ declare class control {
|
||||
* @param value 变量的新值,不填或填null视为删除
|
||||
*/
|
||||
setFlag(name: string, value?: any): void
|
||||
|
||||
|
||||
/**
|
||||
* 增减一个flag变量,等价于 core.setFlag(name, core.getFlag(name, 0) + value)
|
||||
* @example core.addFlag('hatred', 1); // 增加1点仇恨值
|
||||
@@ -533,7 +593,7 @@ declare class control {
|
||||
* @param value 变量的增量
|
||||
*/
|
||||
addFlag(name: string, value: number | string): void
|
||||
|
||||
|
||||
/**
|
||||
* 读取一个flag变量
|
||||
* @param name 变量名,支持中文
|
||||
@@ -541,7 +601,7 @@ declare class control {
|
||||
* @returns flags[name] ?? defaultValue
|
||||
*/
|
||||
getFlag(name: string, defaultValue?: any): any
|
||||
|
||||
|
||||
/**
|
||||
* 判定一个flag变量是否存在且不为false、0、''、null、undefined和NaN
|
||||
* @example core.hasFlag('poison'); // 判断主角当前是否中毒
|
||||
@@ -549,20 +609,20 @@ declare class control {
|
||||
* @returns !!core.getFlag(name)
|
||||
*/
|
||||
hasFlag(name: string): boolean
|
||||
|
||||
|
||||
/**
|
||||
* 设置天气,不计入存档。如需长期生效请使用core.events._action_setWeather()函数
|
||||
* @example core.setWeather('fog', 10); // 设置十级大雾天
|
||||
* @param type 新天气的类型,不填视为无天气
|
||||
* @param level 新天气(晴天除外)的级别,必须为不大于10的正整数,不填视为5
|
||||
*/
|
||||
setWeather(type?: 'rain' | 'snow' | 'sun' | 'fog' | 'cloud', level?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10): void
|
||||
|
||||
setWeather(type?: 'rain' | 'snow' | 'sun' | 'fog' | 'cloud' | string, level?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10): void
|
||||
|
||||
/** 注册一个天气 */
|
||||
registerWeather(name: string, initFunc: (level: number) => void, frameFunc?: (timestamp: number, level: number) => void): void
|
||||
|
||||
/** 注销一个天气 */
|
||||
unregisterWeather(name: string) : void;
|
||||
unregisterWeather(name: string): void;
|
||||
|
||||
/**
|
||||
* 更改画面色调,不计入存档。如需长期生效请使用core.events._action_setCurtain()函数
|
||||
@@ -572,7 +632,7 @@ declare class control {
|
||||
* @param callback 更改完毕后的回调函数,可选。事件流中常取core.doAction
|
||||
*/
|
||||
setCurtain(color?: [number, number, number, number?], time?: number, moveMode?: string, callback?: () => void): void
|
||||
|
||||
|
||||
/**
|
||||
* 画面闪烁
|
||||
* @example core.screenFlash([255, 0, 0, 1], 3); // 红屏一闪而过
|
||||
@@ -581,8 +641,8 @@ declare class control {
|
||||
* @param times 闪烁的总次数,不填或填0都视为1
|
||||
* @param callback 闪烁全部完毕后的回调函数,可选
|
||||
*/
|
||||
screenFlash(color: [number, number, number, number], time: number, times?: number, moveMode?: string, callback?: () => void): void
|
||||
|
||||
screenFlash(color: [number, number, number, number?], time: number, times?: number, moveMode?: string, callback?: () => void): void
|
||||
|
||||
/**
|
||||
* 播放背景音乐,中途开播但不计入存档且只会持续到下次场景切换。如需长期生效请将背景音乐的文件名赋值给flags.__bgm__
|
||||
* @example core.playBgm('bgm.mp3', 30); // 播放bgm.mp3,并跳过前半分钟
|
||||
@@ -596,7 +656,7 @@ declare class control {
|
||||
* @param name 名称,可用来作为注销使用
|
||||
* @param needPlaying 是否只在游戏运行时才执行(在标题界面不执行)
|
||||
* @param func 要执行的函数,或插件中的函数名;可接受timestamp(从页面加载完毕到当前所经过的时间)作为参数
|
||||
*/
|
||||
*/
|
||||
registerAnimationFrame(name: string, needPlaying: boolean, func?: (timestamp: number) => void): void
|
||||
|
||||
/** 注销一个animationFrame */
|
||||
@@ -841,7 +901,7 @@ declare class events {
|
||||
* @param callback 回调函数,可选
|
||||
*/
|
||||
startGame(hard: string, seed: number, route: string, callback?: () => void): void
|
||||
|
||||
|
||||
/**
|
||||
* 游戏结束
|
||||
* @example core.gameOver(); // 游戏失败
|
||||
@@ -850,7 +910,7 @@ declare class events {
|
||||
* @param norank true表示不计入榜单,可选
|
||||
*/
|
||||
gameOver(ending?: string, fromReplay?: boolean, norank?: boolean): void
|
||||
|
||||
|
||||
/**
|
||||
* 战斗,如果填写了坐标就会删除该点的敌人并触发战后事件
|
||||
* @example core.battle('greenSlime'); // 和从天而降的绿头怪战斗(如果打得过)
|
||||
@@ -861,7 +921,7 @@ declare class events {
|
||||
* @param callback 回调函数,可选
|
||||
*/
|
||||
battle(id: string, x?: number, y?: number, force?: boolean, callback?: () => void): void
|
||||
|
||||
|
||||
/**
|
||||
* 开门(包括三种基础墙)
|
||||
* @example core.openDoor(0, 0, true, core.jumpHero); // 打开左上角的门,需要钥匙,然后主角原地跳跃半秒
|
||||
@@ -871,7 +931,7 @@ declare class events {
|
||||
* @param callback 门完全打开后或打不开时的回调函数,可选
|
||||
*/
|
||||
openDoor(x: number, y: number, needKey?: boolean, callback?: () => void): void
|
||||
|
||||
|
||||
/**
|
||||
* 获得道具并提示,如果填写了坐标就会删除该点的该道具
|
||||
* @example core.getItem('book'); // 获得敌人手册并提示
|
||||
@@ -882,7 +942,7 @@ declare class events {
|
||||
* @param callback 回调函数,可选
|
||||
*/
|
||||
getItem(id: string, num?: number, x?: number, y?: number, callback?: () => void): void
|
||||
|
||||
|
||||
/**
|
||||
* 场景切换
|
||||
* @example core.changeFloor('MT0'); // 传送到主塔0层,主角坐标和朝向不变,黑屏时间取用户设置值
|
||||
@@ -893,14 +953,14 @@ declare class events {
|
||||
* @param callback 黑屏结束后的回调函数,可选
|
||||
*/
|
||||
changeFloor(floorId: string, stair?: string, heroLoc?: { x?: number, y?: number, direction?: direction }, time?: number, callback?: () => void): void
|
||||
|
||||
|
||||
/**
|
||||
* 执行下一个事件指令,常作为回调
|
||||
* @example core.setCurtain([0,0,0,1], undefined, null, core.doAction); // 事件中的原生脚本,配合勾选“不自动执行下一个事件”来达到此改变色调只持续到下次场景切换的效果
|
||||
* @param keepUI true表示不清除UI画布和选择光标
|
||||
*/
|
||||
doAction(keepUI?: true): void
|
||||
|
||||
|
||||
/**
|
||||
* 插入一段事件;此项不可插入公共事件,请用 core.insertCommonEvent
|
||||
* @example core.insertAction('一段文字'); // 插入一个显示文章
|
||||
@@ -910,8 +970,8 @@ declare class events {
|
||||
* @param callback 新的回调函数,可选
|
||||
* @param addToLast 插入的位置,true表示插入到末尾,否则插入到开头
|
||||
*/
|
||||
insertAction(action: string | MotaAction | MotaAction[], x?: number, y?: number, callback?: () => void, addToLast?: boolean): void
|
||||
|
||||
insertAction(action: Events, x?: number, y?: number, callback?: () => void, addToLast?: boolean): void
|
||||
|
||||
/**
|
||||
* 设置一项敌人属性并计入存档
|
||||
* @example core.setEnemy('greenSlime', 'def', 0); // 把绿头怪的防御设为0
|
||||
@@ -922,7 +982,7 @@ declare class events {
|
||||
* @param prefix 独立开关前缀,一般不需要,下同
|
||||
*/
|
||||
setEnemy<K extends keyof Enemy>(id: string, name: K, value?: Enemy[K], operator?: string, prefix?: string): void
|
||||
|
||||
|
||||
/** 设置某个点的敌人属性 */
|
||||
setEnemyOnPoint<K extends keyof Enemy>(x: number, y: number, floorId: string, name: K, value?: Enemy[K], operator?: string, prefix?: string): void
|
||||
|
||||
@@ -941,7 +1001,7 @@ declare class events {
|
||||
* @param prefix 独立开关前缀,一般不需要,下同
|
||||
*/
|
||||
setFloorInfo<K extends keyof Floor>(name: K, values?: Floor[K] | boolean | number | string | [number, number] | [string, number?] | Array<string | [number, number, string, number?, number?]>, floorId?: string, prefix?: string): void
|
||||
|
||||
|
||||
/**
|
||||
* 设置一个系统开关
|
||||
* @example core.setGlobalFlag('steelDoorWithoutKey', true); // 使全塔的所有铁门都不再需要钥匙就能打开
|
||||
@@ -949,7 +1009,7 @@ declare class events {
|
||||
* @param value 开关的新值,您可以用!core.flags[name]简单地表示将此开关反转
|
||||
*/
|
||||
setGlobalFlag(name: keyof SystemFlags, value: boolean): void
|
||||
|
||||
|
||||
/**
|
||||
* 关门,目标点必须为空地
|
||||
* @example core.closeDoor(0, 0, 'yellowWall', core.jumpHero); // 在左上角关掉一堵黄墙,然后主角原地跳跃半秒
|
||||
@@ -959,7 +1019,7 @@ declare class events {
|
||||
* @param callback 门完全关上后的回调函数,可选
|
||||
*/
|
||||
closeDoor(x: number, y: number, id: string, callback?: () => void): void
|
||||
|
||||
|
||||
/**
|
||||
* 显示一张图片
|
||||
* @example core.showImage(1, core.material.images.images['winskin.png'], [0,0,128,128], [0,0,416,416], 0.5, 1000); // 裁剪winskin.png的最左边128×128px,放大到铺满整个视野,1秒内淡入到50%透明,编号为1
|
||||
@@ -972,7 +1032,7 @@ declare class events {
|
||||
* @param callback 图片完全显示出来后的回调函数,可选
|
||||
*/
|
||||
showImage(code: number, image: string | HTMLImageElement, sloc?: Array<number>, loc?: Array<number>, opacityVal?: number, time?: number, callback?: () => void): void
|
||||
|
||||
|
||||
/**
|
||||
* 隐藏一张图片
|
||||
* @example core.hideImage(1, 1000, core.jumpHero); // 1秒内淡出1号图片,然后主角原地跳跃半秒
|
||||
@@ -981,7 +1041,7 @@ declare class events {
|
||||
* @param callback 图片完全消失后的回调函数,可选
|
||||
*/
|
||||
hideImage(code: number, time?: number, callback?: () => void): void
|
||||
|
||||
|
||||
/**
|
||||
* 移动一张图片并/或改变其透明度
|
||||
* @example core.moveImage(1, null, 0.5); // 1秒内把1号图片变为50%透明
|
||||
@@ -1016,7 +1076,7 @@ declare class events {
|
||||
* @param y 动图在视野中的左上角纵坐标
|
||||
*/
|
||||
showGif(name?: string, x?: number, y?: number): void
|
||||
|
||||
|
||||
/**
|
||||
* 调节bgm的音量
|
||||
* @example core.setVolume(0, 100, core.jumpHero); // 0.1秒内淡出bgm,然后主角原地跳跃半秒
|
||||
@@ -1025,7 +1085,7 @@ declare class events {
|
||||
* @param callback 渐变完成后的回调函数,可选
|
||||
*/
|
||||
setVolume(value: number, time?: number, callback?: () => void): void
|
||||
|
||||
|
||||
/**
|
||||
* 视野抖动
|
||||
* @example core.vibrate(); // 视野左右抖动1秒
|
||||
@@ -1045,7 +1105,7 @@ declare class events {
|
||||
* @param callback 移动完毕后的回调函数,可选
|
||||
*/
|
||||
eventMoveHero(steps: step[], time?: number, callback?: () => void): void
|
||||
|
||||
|
||||
/**
|
||||
* 主角跳跃,跳跃勇士。ex和ey为目标点的坐标,可以为null表示原地跳跃。time为总跳跃时间。
|
||||
* @example core.jumpHero(); // 主角原地跳跃半秒
|
||||
@@ -1055,7 +1115,7 @@ declare class events {
|
||||
* @param callback 跳跃完毕后的回调函数,可选
|
||||
*/
|
||||
jumpHero(ex?: number, ey?: number, time?: number, callback?: () => void): void
|
||||
|
||||
|
||||
/**
|
||||
* 更改主角行走图
|
||||
* @example core.setHeroIcon('npc48.png', true); // 把主角从阳光变成样板0层左下角的小姐姐,但不立即刷新
|
||||
@@ -1063,7 +1123,7 @@ declare class events {
|
||||
* @param noDraw true表示不立即刷新(刷新会导致大地图下视野重置到以主角为中心)
|
||||
*/
|
||||
setHeroIcon(name: string, noDraw?: boolean): void
|
||||
|
||||
|
||||
/**
|
||||
* 尝试使用一个道具
|
||||
* @example core.tryUseItem('pickaxe'); // 尝试使用破墙镐
|
||||
@@ -1072,7 +1132,7 @@ declare class events {
|
||||
tryUseItem(itemId: string): void
|
||||
|
||||
/** 初始化游戏 */
|
||||
resetGame(hero?: any, hard?: any, floorId?: string, maps?: any, values?: any): void
|
||||
resetGame(hero?: HeroStatus, hard?: any, floorId?: string, maps?: any, values?: any): void
|
||||
|
||||
/** 游戏获胜事件 */
|
||||
win(reason?: string, norank?: boolean, noexit?: boolean): void
|
||||
@@ -1468,7 +1528,7 @@ declare class maps {
|
||||
* @returns 图块的数字,定义在project\maps.js(请注意和project\icons.js中的“图块索引”相区分!)
|
||||
*/
|
||||
getNumberById(id: string): number
|
||||
|
||||
|
||||
/**
|
||||
* 生成事件层矩阵
|
||||
* @example core.getMapArray('MT0'); // 生成主塔0层的事件层矩阵,隐藏的图块视为0
|
||||
@@ -1480,7 +1540,7 @@ declare class maps {
|
||||
|
||||
/** 判定图块的事件层数字;不存在为0 */
|
||||
getMapNumber(floorId?: string, noCache?: boolean): number
|
||||
|
||||
|
||||
/**
|
||||
* 生成背景层矩阵
|
||||
* @example core.getBgMapArray('MT0'); // 生成主塔0层的背景层矩阵,使用缓存
|
||||
@@ -1489,7 +1549,7 @@ declare class maps {
|
||||
* @returns 背景层矩阵,注意对其阵元的访问是[y][x]
|
||||
*/
|
||||
getBgMapArray(floorId?: string, noCache?: boolean): number[][]
|
||||
|
||||
|
||||
/**
|
||||
* 生成前景层矩阵
|
||||
* @example core.getFgMapArray('MT0'); // 生成主塔0层的前景层矩阵,使用缓存
|
||||
@@ -1498,7 +1558,7 @@ declare class maps {
|
||||
* @returns 前景层矩阵,注意对其阵元的访问是[y][x]
|
||||
*/
|
||||
getFgMapArray(floorId?: string, noCache?: boolean): number[][]
|
||||
|
||||
|
||||
/**
|
||||
* 判定背景层的一个位置是什么
|
||||
* @example core.getBgNumber(); // 判断主角脚下的背景层图块的数字
|
||||
@@ -1508,7 +1568,7 @@ declare class maps {
|
||||
* @param 可选,true表示不使用缓存而强制重算
|
||||
*/
|
||||
getBgNumber(x?: number, y?: number, floorId?: string, noCache?: boolean): number
|
||||
|
||||
|
||||
/**
|
||||
* 判定前景层的一个位置是什么
|
||||
* @example core.getFgNumber(); // 判断主角脚下的前景层图块的数字
|
||||
@@ -1518,7 +1578,7 @@ declare class maps {
|
||||
* @param 可选,true表示不使用缓存而强制重算
|
||||
*/
|
||||
getFgNumber(x?: number, y?: number, floorId?: string, noCache?: boolean): number
|
||||
|
||||
|
||||
/**
|
||||
* 可通行性判定
|
||||
* @example core.generateMovableArray(); // 判断当前地图主角从各点能向何方向移动
|
||||
@@ -1526,7 +1586,7 @@ declare class maps {
|
||||
* @returns 从各点可移动方向的三维数组
|
||||
*/
|
||||
generateMovableArray(floorId?: string): Array<Array<Array<direction>>>
|
||||
|
||||
|
||||
/**
|
||||
* 单点单朝向的可通行性判定
|
||||
* @exmaple core.canMoveHero(); // 判断主角是否可以前进一步
|
||||
@@ -1537,7 +1597,7 @@ declare class maps {
|
||||
* @returns true表示可移动,false表示不可移动
|
||||
*/
|
||||
canMoveHero(x?: number, y?: number, direction?: direction, floorId?: string): boolean
|
||||
|
||||
|
||||
/**
|
||||
* 能否瞬移到某点,并求出节约的步数。
|
||||
* @example core.canMoveDirectly(0, 0); // 能否瞬移到地图左上角
|
||||
@@ -1546,7 +1606,7 @@ declare class maps {
|
||||
* @returns 正数表示节约的步数,-1表示不可瞬移
|
||||
*/
|
||||
canMoveDirectly(destX: number, destY: number): number
|
||||
|
||||
|
||||
/**
|
||||
* 自动寻路
|
||||
* @example core.automaticRoute(0, 0); // 自动寻路到地图左上角
|
||||
@@ -1555,7 +1615,7 @@ declare class maps {
|
||||
* @returns 每步走完后主角的loc属性组成的一维数组
|
||||
*/
|
||||
automaticRoute(destX: number, destY: number): Array<{ direction: direction, x: number, y: number }>
|
||||
|
||||
|
||||
/**
|
||||
* 地图重绘
|
||||
* @example core.drawMap(); // 重绘当前地图,常用于更改贴图后或自动元件的刷新
|
||||
@@ -1563,7 +1623,7 @@ declare class maps {
|
||||
* @param callback 重绘完毕后的回调函数,可选
|
||||
*/
|
||||
drawMap(floorId?: string, callback?: () => void): void
|
||||
|
||||
|
||||
/**
|
||||
* 绘制背景层(含贴图,其与背景层矩阵的绘制顺序可通过复写此函数来改变)
|
||||
* @example core.drawBg(); // 绘制当前地图的背景层
|
||||
@@ -1571,7 +1631,7 @@ declare class maps {
|
||||
* @param ctx 某画布的ctx,用于绘制缩略图,一般不需要
|
||||
*/
|
||||
drawBg(floorId?: string, ctx?: CanvasRenderingContext2D): void
|
||||
|
||||
|
||||
/**
|
||||
* 绘制事件层
|
||||
* @example core.drawEvents(); // 绘制当前地图的事件层
|
||||
@@ -1580,7 +1640,7 @@ declare class maps {
|
||||
* @param ctx 某画布的ctx,用于绘制缩略图,一般不需要
|
||||
*/
|
||||
drawEvents(floorId?: string, blocks?: Block[], ctx?: CanvasRenderingContext2D): void
|
||||
|
||||
|
||||
/**
|
||||
* 绘制前景层(含贴图,其与前景层矩阵的绘制顺序可通过复写此函数来改变)
|
||||
* @example core.drawFg(); // 绘制当前地图的前景层
|
||||
@@ -1588,7 +1648,7 @@ declare class maps {
|
||||
* @param ctx 某画布的ctx,用于绘制缩略图,一般不需要
|
||||
*/
|
||||
drawFg(floorId?: string, ctx?: CanvasRenderingContext2D): void
|
||||
|
||||
|
||||
/**
|
||||
* 绘制缩略图
|
||||
* @example core.drawThumbnail(); // 绘制当前地图的缩略图
|
||||
@@ -1597,7 +1657,7 @@ declare class maps {
|
||||
* @param options 额外的绘制项,可选。可以增绘主角位置和朝向、采用不同于游戏中的主角行走图、增绘显伤、提供flags用于存读档
|
||||
*/
|
||||
drawThumbnail(floorId?: string, blocks?: Block[], options?: object): void
|
||||
|
||||
|
||||
/**
|
||||
* 判定某个点是否不可被踏入(不基于主角生命值和图块cannotIn属性)
|
||||
* @example core.noPass(0, 0); // 判断地图左上角能否被踏入
|
||||
@@ -1607,7 +1667,7 @@ declare class maps {
|
||||
* @returns true表示可踏入
|
||||
*/
|
||||
noPass(x: number, y: number, floorId?: string): boolean
|
||||
|
||||
|
||||
/**
|
||||
* 判定某个点的图块id
|
||||
* @example if(core.getBlockId(x1, y1) != 'greenSlime' && core.getBlockId(x2, y2) != 'redSlime') core.openDoor(x3, y3); // 一个简单的机关门事件,打败或炸掉这一对绿头怪和红头怪就开门
|
||||
@@ -1618,7 +1678,7 @@ declare class maps {
|
||||
* @returns 图块id,该点无图块则返回null
|
||||
*/
|
||||
getBlockId(x: number, y: number, floorId?: string, showDisable?: boolean): string | null
|
||||
|
||||
|
||||
/** 判定某个点的图块数字;空图块为0 */
|
||||
getBlockNumber(x: number, y: number, floorId?: string, showDisable?: boolean): number
|
||||
|
||||
@@ -1632,7 +1692,7 @@ declare class maps {
|
||||
* @returns 图块类型,即“地形、四帧动画、矮敌人、高敌人、道具、矮npc、高npc、自动元件、额外地形”之一
|
||||
*/
|
||||
getBlockCls(x: number, y: number, floorId?: string, showDisable?: boolean): 'terrains' | 'animates' | 'enemys' | 'enemy48' | 'items' | 'npcs' | 'npc48' | 'autotile' | 'tileset' | null
|
||||
|
||||
|
||||
/**
|
||||
* 搜索图块, 支持通配符
|
||||
* @example core.searchBlock('*Door'); // 搜索当前地图的所有门
|
||||
@@ -1641,8 +1701,8 @@ declare class maps {
|
||||
* @param showDisable 隐藏点是否计入,true表示计入
|
||||
* @returns 一个详尽的数组,一般只用到其长度
|
||||
*/
|
||||
searchBlock(id: string, floorId?: string|Array<string>, showDisable?: boolean): Array<{ floorId: string, index: number, x: number, y: number, block: Block }>
|
||||
|
||||
searchBlock(id: string, floorId?: string | Array<string>, showDisable?: boolean): Array<{ floorId: string, index: number, x: number, y: number, block: Block }>
|
||||
|
||||
/**
|
||||
* 根据给定的筛选函数搜索全部满足条件的图块
|
||||
* @example core.searchBlockWithFilter(function (block) { return block.event.id.endsWith('Door'); }); // 搜索当前地图的所有门
|
||||
@@ -1651,7 +1711,7 @@ declare class maps {
|
||||
* @param showDisable 隐藏点是否计入,true表示计入
|
||||
* @returns 一个详尽的数组
|
||||
*/
|
||||
searchBlockWithFilter(blockFilter: (Block) => boolean, floorId?: string|Array<string>, showDisable?: boolean): Array<{ floorId: string, index: number, x: number, y: number, block: Block }>
|
||||
searchBlockWithFilter(blockFilter: (Block) => boolean, floorId?: string | Array<string>, showDisable?: boolean): Array<{ floorId: string, index: number, x: number, y: number, block: Block }>
|
||||
|
||||
/**
|
||||
* 显示(隐藏或显示的)图块,此函数将被“显示事件”指令和勾选了“不消失”的“移动/跳跃事件”指令(如阻击怪)的终点调用
|
||||
@@ -1661,7 +1721,7 @@ declare class maps {
|
||||
* @param floorId 地图id,不填视为当前地图
|
||||
*/
|
||||
showBlock(x: number, y: number, floorId?: string): void
|
||||
|
||||
|
||||
/**
|
||||
* 隐藏一个图块,对应于「隐藏事件」且不删除
|
||||
* @example core.hideBlock(0, 0); // 隐藏地图左上角的图块
|
||||
@@ -1670,7 +1730,7 @@ declare class maps {
|
||||
* @param floorId 地图id,不填视为当前地图
|
||||
*/
|
||||
hideBlock(x: number, y: number, floorId?: string): void
|
||||
|
||||
|
||||
/**
|
||||
* 删除一个图块,对应于「隐藏事件」并同时删除
|
||||
* @example core.removeBlock(0, 0); // 尝试删除地图左上角的图块
|
||||
@@ -1679,7 +1739,7 @@ declare class maps {
|
||||
* @param floorId 地图id,不填视为当前地图
|
||||
*/
|
||||
removeBlock(x: number, y: number, floorId?: string): void
|
||||
|
||||
|
||||
/**
|
||||
* 显隐背景/前景层图块
|
||||
* @example core.maps._triggerBgFgMap('show', 'fg', [0, 0]); // 显示地图左上角的前景层图块
|
||||
@@ -1690,7 +1750,7 @@ declare class maps {
|
||||
* @param callback 显隐完毕后的回调函数,可选
|
||||
*/
|
||||
//_triggerBgFgMap(type: 'show' | 'hide', name: 'bg' | 'fg', loc: [number, number] | Array<[number, number]>, floorId?: string, callback?: () => void): void
|
||||
|
||||
|
||||
/**
|
||||
* 显隐楼层贴图
|
||||
* @example core.maps._triggerFloorImage('show', [0, 0]); // 显示当前地图以左上角为左上角的贴图
|
||||
@@ -1700,7 +1760,7 @@ declare class maps {
|
||||
* @param callback 显隐完毕后的回调函数,可选
|
||||
*/
|
||||
//_triggerFloorImage(type: 'show' | 'hide', loc: [number, number] | Array<[number, number]>, floorId?: string, callback?: () => void): void
|
||||
|
||||
|
||||
/**
|
||||
* 转变图块
|
||||
* @example core.setBlock(1, 0, 0); // 把地图左上角变成黄墙
|
||||
@@ -1710,7 +1770,7 @@ declare class maps {
|
||||
* @param floorId 地图id,不填视为当前地图
|
||||
*/
|
||||
setBlock(number: number | string, x: number, y: number, floorId?: string): void
|
||||
|
||||
|
||||
/**
|
||||
* 批量替换图块
|
||||
* @example core.replaceBlock(21, 22, core.floorIds); // 把游戏中地上当前所有的黄钥匙都变成蓝钥匙
|
||||
@@ -1719,7 +1779,7 @@ declare class maps {
|
||||
* @param floorId 地图id或其数组,不填视为当前地图
|
||||
*/
|
||||
replaceBlock(fromNumber: number, toNumber: number, floorId?: string | Array<string>): void
|
||||
|
||||
|
||||
/**
|
||||
* 转变图层块
|
||||
* @example core.setBgFgBlock('bg', 167, 6, 6); // 把当前地图背景层的中心块改为滑冰
|
||||
@@ -1730,7 +1790,7 @@ declare class maps {
|
||||
* @param floorId 地图id,不填视为当前地图
|
||||
*/
|
||||
setBgFgBlock(name: 'bg' | 'fg', number: number | string, x: number, y: number, floorId?: string): void
|
||||
|
||||
|
||||
/**
|
||||
* 移动图块
|
||||
* @example core.moveBlock(0, 0, ['down']); // 令地图左上角的图块下移一格,用时半秒,再花半秒淡出
|
||||
@@ -1742,7 +1802,7 @@ declare class maps {
|
||||
* @param callback 移动或淡出后的回调函数,可选
|
||||
*/
|
||||
moveBlock(x: number, y: number, steps: step[], time?: number, keep?: boolean, callback?: () => void): void
|
||||
|
||||
|
||||
/**
|
||||
* 跳跃图块;从V2.7开始不再有音效
|
||||
* @example core.jumpBlock(0, 0, 0, 0); // 令地图左上角的图块原地跳跃半秒,再花半秒淡出
|
||||
@@ -1755,7 +1815,7 @@ declare class maps {
|
||||
* @param callback 落地或淡出后的回调函数,可选
|
||||
*/
|
||||
jumpBlock(sx: number, sy: number, ex: number, ey: number, time?: number, keep?: boolean, callback?: () => void): void
|
||||
|
||||
|
||||
/**
|
||||
* 播放动画,注意即使指定了主角的坐标也不会跟随主角移动,如有需要请使用core.drawHeroAnimate(name, callback)函数
|
||||
* @example core.drawAnimate('attack', core.nextX(), core.nextY(), false, core.vibrate); // 在主角面前一格播放普攻动画,动画停止后视野左右抖动1秒
|
||||
@@ -1781,10 +1841,10 @@ declare class maps {
|
||||
* @param id 播放动画的编号,即drawAnimate或drawHeroAnimate返回值
|
||||
* @param doCallback 是否执行该动画的回调函数
|
||||
*/
|
||||
stopAnimate(id?: number, doCallback?: boolean): void
|
||||
stopAnimate(id?: number, doCallback?: boolean): void
|
||||
|
||||
/** 获得当前正在播放的所有(指定)动画的id列表 */
|
||||
getPlayingAnimates(name?: string) : Array<number>
|
||||
getPlayingAnimates(name?: string): Array<number>
|
||||
|
||||
/** 加载某个楼层(从剧本或存档中) */
|
||||
loadFloor(floorId?: string, map?: any): any
|
||||
@@ -1910,7 +1970,7 @@ declare class maps {
|
||||
/** @file loader.js 主要负责资源的加载 */
|
||||
declare class loader {
|
||||
/** 加载一系列图片 */
|
||||
loadImages(dir: any, names: any, toSave: any, callback?: () => any) : any
|
||||
loadImages(dir: any, names: any, toSave: any, callback?: () => any): any
|
||||
|
||||
/** 加载某一张图片 */
|
||||
loadImage(dir: any, imgName?: any, callback?: () => any): any
|
||||
@@ -2055,7 +2115,7 @@ declare class items {
|
||||
* @param beComparedEquipId 装备乙的id
|
||||
* @returns 两装备的各属性差,甲减乙,0省略
|
||||
*/
|
||||
compareEquipment(compareEquipId: string, beComparedEquipId: string): { [key: string]: number}
|
||||
compareEquipment(compareEquipId: string, beComparedEquipId: string): { [key: string]: number }
|
||||
|
||||
/**
|
||||
* 保存当前套装
|
||||
@@ -2090,7 +2150,7 @@ declare class items {
|
||||
* @param operator 操作符,可选,如+=表示在原始值上增加
|
||||
* @param prefix 独立开关前缀,一般不需要
|
||||
*/
|
||||
setEquip(equipId: string, valueType: string, name: string, value: any, operator?: string, prefix?: string): void
|
||||
setEquip(equipId: string, valueType: string, name: string, value: any, operator?: string, prefix?: string): void
|
||||
}
|
||||
|
||||
/** @file ui.js 主要用来进行UI窗口的绘制,如对话框、怪物手册、楼传器、存读档界面等等。*/
|
||||
@@ -2246,7 +2306,7 @@ declare class ui {
|
||||
drawUIEventSelector(code: number, background: string, x: number, y: number, w: number, h: number, z?: number): void
|
||||
|
||||
/** 清除一个或多个选择光标 */
|
||||
clearUIEventSelector(code: number|number[]): void
|
||||
clearUIEventSelector(code: number | number[]): void
|
||||
|
||||
/** 绘制一个确认框 */
|
||||
drawConfirmBox(text: string, yesCallback?: () => void, noCallback?: () => void): void
|
||||
@@ -2265,7 +2325,7 @@ declare class ui {
|
||||
* left, top:起始点位置;maxWidth:单行最大宽度;color:默认颜色;align:左中右
|
||||
* fontSize:字体大小;lineHeight:行高;time:打字机间隔;font:默认字体名
|
||||
* @returns 绘制信息
|
||||
*/
|
||||
*/
|
||||
drawTextContent(ctx: string | CanvasRenderingContext2D, content: string, config: any): any
|
||||
|
||||
/** 获得某段文字的预计绘制高度;参见 drawTextContent */
|
||||
@@ -2412,7 +2472,7 @@ declare class utils {
|
||||
clone<T>(data?: T, filter?: (name: string, value: any) => boolean, recursion?: boolean): T
|
||||
|
||||
/** 深拷贝一个1D或2D的数组 */
|
||||
cloneArray(data?: Array<number>|Array<Array<number>>): Array<number>|Array<Array<number>>
|
||||
cloneArray(data?: Array<number> | Array<Array<number>>): Array<number> | Array<Array<number>>
|
||||
|
||||
/**
|
||||
* 等比例切分一张图片
|
||||
@@ -2557,7 +2617,7 @@ declare class utils {
|
||||
* @exmaple 1 + core.rand2(6); // 随机生成一个小于7的正整数,模拟骰子的效果
|
||||
* @param num 正整数,0或不填会被视为2147483648
|
||||
* @returns 属于 [0, num) 的随机数
|
||||
*/
|
||||
*/
|
||||
rand2(num?: number): number
|
||||
|
||||
/**
|
||||
@@ -2601,7 +2661,7 @@ declare class utils {
|
||||
* 尝试复制一段文本到剪切板。
|
||||
*/
|
||||
copy(data: string): void
|
||||
|
||||
|
||||
/**
|
||||
* 发送一个HTTP请求 [异步]
|
||||
* @param type 请求类型
|
||||
|
||||
Reference in new issue
Block a user