装备穿上 & 脱下事件
This commit is contained in:
parent
0aff9f9062
commit
dc5326c982
@ -456,7 +456,7 @@ return code;
|
||||
|
||||
// equip 事件编辑器入口之一
|
||||
equip_m
|
||||
: '装备' '类型' EvalString '装备动画(第一个装备格有效)' IdString? BGNL? '数值提升项' equipList+ '百分比提升项' equipList+ '此道具cls须为equips并设置canUseItemEffect' BEND
|
||||
: '装备' '类型' EvalString '装备动画(第一个装备格有效)' IdString? BGNL? '数值提升项' equipList+ '百分比提升项' equipList+ '穿上时事件' action+ '脱下时事件' action+ '此道具cls须为equips并设置canUseItemEffect' BEND
|
||||
|
||||
|
||||
/* equip_m
|
||||
@ -468,7 +468,9 @@ if (!/^\d+$/.test(EvalString_0)) {
|
||||
EvalString_0 = '"' + EvalString_0 + '"';
|
||||
}
|
||||
IdString_0 = IdString_0 && (', "animate": "'+IdString_0+'"');
|
||||
var code = '{"type": '+EvalString_0+IdString_0+', "value": {\n'+equipList_0+'\n}, "percentage": {\n'+equipList_1+'\n}}';
|
||||
if (action_0.trim()) action_0 = ', "equipEvent": [\n' + action_0 + ']';
|
||||
if (action_1.trim()) action_1 = ', "unequipEvent": [\n' + action_1 + ']';
|
||||
var code = '{"type": '+EvalString_0+IdString_0+', "value": {\n'+equipList_0+'\n}, "percentage": {\n'+equipList_1+'\n}'+action_0+action_1+'}';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
@ -2034,7 +2036,7 @@ return code;
|
||||
*/;
|
||||
|
||||
unloadEquip_s
|
||||
: '卸下装备孔' Int '的装备' Newline
|
||||
: '卸下第' Int '格装备孔的装备' Newline
|
||||
|
||||
|
||||
/* unloadEquip_s
|
||||
@ -3868,7 +3870,7 @@ return [code, Blockly.JavaScript.ORDER_ATOMIC];
|
||||
|
||||
|
||||
equip_e
|
||||
: '装备孔:' Int
|
||||
: '第' Int '格装备孔'
|
||||
|
||||
|
||||
/* equip_e
|
||||
|
||||
@ -82,7 +82,8 @@ ActionParser.prototype.parse = function (obj,type) {
|
||||
})
|
||||
return text_choices;
|
||||
}
|
||||
return MotaActionBlocks['equip_m'].xmlText([obj.type, obj.animate, buildEquip(obj.value), buildEquip(obj.percentage)]);
|
||||
return MotaActionBlocks['equip_m'].xmlText([obj.type, obj.animate, buildEquip(obj.value), buildEquip(obj.percentage),
|
||||
this.parseList(obj.equipEvent), this.parseList(obj.unequipEvent)]);
|
||||
|
||||
case 'doorInfo':
|
||||
if(!obj) obj={};
|
||||
|
||||
@ -1503,6 +1503,7 @@ actions.prototype._clickToolbox = function (x, y) {
|
||||
if (x >= this.LAST - 2 && y == this.LAST) {
|
||||
core.playSound('取消');
|
||||
core.ui.closePanel();
|
||||
core.checkAutoEvents();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1678,6 +1679,7 @@ actions.prototype._keyUpToolbox = function (keycode) {
|
||||
if (keycode == 84 || keycode == 27 || keycode == 88) {
|
||||
core.playSound('取消');
|
||||
core.ui.closePanel();
|
||||
core.checkAutoEvents();
|
||||
return;
|
||||
}
|
||||
if (core.status.event.data == null) return;
|
||||
@ -1704,6 +1706,7 @@ actions.prototype._clickEquipbox = function (x, y) {
|
||||
if (x >= this.LAST - 2 && y == this.LAST) {
|
||||
core.playSound('取消');
|
||||
core.ui.closePanel();
|
||||
core.checkAutoEvents();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1861,6 +1864,7 @@ actions.prototype._keyUpEquipbox = function (keycode, altKey) {
|
||||
if (keycode == 81 || keycode == 27 || keycode == 88) {
|
||||
core.playSound('取消');
|
||||
core.ui.closePanel();
|
||||
core.checkAutoEvents();
|
||||
return;
|
||||
}
|
||||
if (!core.status.event.data.selectId) return;
|
||||
|
||||
38
libs/core.js
38
libs/core.js
@ -292,6 +292,13 @@ core.prototype._init_flags = function () {
|
||||
document.title = core.firstData.title + " - HTML5魔塔";
|
||||
document.getElementById("startLogo").innerText = core.firstData.title;
|
||||
(core.firstData.shops||[]).forEach(function (t) { core.initStatus.shops[t.id] = t; });
|
||||
|
||||
core.maps._initFloors();
|
||||
// 初始化怪物、道具等
|
||||
core.material.enemys = core.enemys.getEnemys();
|
||||
core.material.items = core.items.getItems();
|
||||
core.material.icons = core.icons.getIcons();
|
||||
|
||||
// 初始化自动事件
|
||||
for (var floorId in core.floors) {
|
||||
var autoEvents = core.floors[floorId].autoEvent || {};
|
||||
@ -312,7 +319,33 @@ core.prototype._init_flags = function () {
|
||||
}
|
||||
}
|
||||
}
|
||||
// 道具的穿上/脱下,视为自动事件
|
||||
for (var equipId in core.material.items) {
|
||||
var equip = core.material.items[equipId];
|
||||
if (equip.cls != 'equips' || !equip.equip) continue;
|
||||
if (!equip.equip.equipEvent && !equip.equip.unequipEvent) continue;
|
||||
var equipFlag = '_equipEvent_' + equipId;
|
||||
var autoEvent1 = {
|
||||
symbol: "_equipEvent_" + equipId,
|
||||
currentFloor: false,
|
||||
multiExecute: true,
|
||||
condition: "core.hasEquip('" + equipId + "') && !core.hasFlag('"+equipFlag+"')",
|
||||
data: core.precompile([{"type": "setValue", "name": "flag:" + equipFlag, "value": "true"}].concat(equip.equip.equipEvent||[])),
|
||||
};
|
||||
var autoEvent2 = {
|
||||
symbol: "_unequipEvent_" + equipId,
|
||||
currentFloor: false,
|
||||
multiExecute: true,
|
||||
condition: "!core.hasEquip('" + equipId + "') && core.hasFlag('"+equipFlag+"')",
|
||||
data: core.precompile([{"type": "setValue", "name": "flag:" + equipFlag, "value": "null"}].concat(equip.equip.unequipEvent||[])),
|
||||
};
|
||||
core.initStatus.autoEvents.push(autoEvent1);
|
||||
core.initStatus.autoEvents.push(autoEvent2);
|
||||
}
|
||||
|
||||
core.initStatus.autoEvents.sort(function (e1, e2) {
|
||||
if (e1.floorId == null) return 1;
|
||||
if (e2.floorId == null) return -1;
|
||||
if (e1.priority != e2.priority) return e2.priority - e1.priority;
|
||||
if (e1.floorId != e2.floorId) return core.floorIds.indexOf(e1.floorId) - core.floorIds.indexOf(e2.floorId);
|
||||
if (e1.x != e2.x) return e1.x - e2.x;
|
||||
@ -320,11 +353,6 @@ core.prototype._init_flags = function () {
|
||||
return e1.index - e2.index;
|
||||
})
|
||||
|
||||
core.maps._initFloors();
|
||||
// 初始化怪物、道具等
|
||||
core.material.enemys = core.enemys.getEnemys();
|
||||
core.material.items = core.items.getItems();
|
||||
core.material.icons = core.icons.getIcons();
|
||||
}
|
||||
|
||||
core.prototype._init_sys_flags = function () {
|
||||
|
||||
@ -1105,14 +1105,24 @@ events.prototype.checkAutoEvents = function () {
|
||||
core.autoEventExecuting(symbol, true);
|
||||
core.autoEventExecuted(symbol, true);
|
||||
|
||||
var event = [
|
||||
{"type": "function", "function":
|
||||
"function() { core.pushEventLoc(" + x + ", " + y + ", '" + floorId + "' ); }"},
|
||||
// 用do-while(0)包一层防止break影响事件流
|
||||
{"type": "dowhile", "condition": "false", "data": autoEvent.data},
|
||||
{"type": "function", "function":
|
||||
"function() { core.popEventLoc(); core.autoEventExecuting('" + symbol + "', false); }"}
|
||||
];
|
||||
var event;
|
||||
if (x == null && y == null) {
|
||||
event = [
|
||||
// 用do-while(0)包一层防止break影响事件流
|
||||
{"type": "dowhile", "condition": "false", "data": autoEvent.data},
|
||||
{"type": "function", "function":
|
||||
"function() { core.autoEventExecuting('" + symbol + "', false); }"}
|
||||
];
|
||||
} else {
|
||||
event = [
|
||||
{"type": "function", "function":
|
||||
"function() { core.pushEventLoc(" + x + ", " + y + ", '" + floorId + "' ); }"},
|
||||
// 用do-while(0)包一层防止break影响事件流
|
||||
{"type": "dowhile", "condition": "false", "data": autoEvent.data},
|
||||
{"type": "function", "function":
|
||||
"function() { core.popEventLoc(); core.autoEventExecuting('" + symbol + "', false); }"}
|
||||
];
|
||||
}
|
||||
|
||||
if (autoEvent.delayExecute)
|
||||
delay.push(event);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user