战前事件
This commit is contained in:
parent
ded1c33189
commit
f306af2d3d
@ -252,6 +252,18 @@ code=JSON.stringify(code,null,2)+',\n';
|
|||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
|
//beforeBattle 事件编辑器入口之一
|
||||||
|
beforeBattle_m
|
||||||
|
: '战斗开始前' BGNL? Newline action+ BEND
|
||||||
|
|
||||||
|
|
||||||
|
/* beforeBattle_m
|
||||||
|
tooltip : 战斗开始前
|
||||||
|
helpUrl : /_docs/#/instruction
|
||||||
|
var code = '[\n'+action_0+']\n';
|
||||||
|
return code;
|
||||||
|
*/;
|
||||||
|
|
||||||
//afterBattle 事件编辑器入口之一
|
//afterBattle 事件编辑器入口之一
|
||||||
afterBattle_m
|
afterBattle_m
|
||||||
: '战斗结束后' BGNL? Newline action+ BEND
|
: '战斗结束后' BGNL? Newline action+ BEND
|
||||||
@ -3975,8 +3987,8 @@ IgnoreChangeFloor_List
|
|||||||
/*IgnoreChangeFloor_List ['null','true','false']*/;
|
/*IgnoreChangeFloor_List ['null','true','false']*/;
|
||||||
|
|
||||||
Event_List
|
Event_List
|
||||||
: '普通事件'|'战后事件'|'道具后事件'|'开门后事件'
|
: '普通事件'|'战前事件'|'战后事件'|'道具后事件'|'开门后事件'
|
||||||
/*Event_List ['null','afterBattle','afterGetItem','afterOpenDoor']*/;
|
/*Event_List ['null','beforeBattle','afterBattle','afterGetItem','afterOpenDoor']*/;
|
||||||
|
|
||||||
Floor_Meta_List
|
Floor_Meta_List
|
||||||
: '楼层中文名'|'状态栏名称'|'能否楼传飞到'|'能否楼传飞出'|'能否打开快捷商店'|'是否不可浏览地图'|'是否不可瞬间移动'|'默认地面ID'|'宝石血瓶效果'|'上楼点坐标'|'下楼点坐标'|'楼传落点坐标'|'背景音乐'|'画面色调'|'天气和强度'|'是否地下层'
|
: '楼层中文名'|'状态栏名称'|'能否楼传飞到'|'能否楼传飞出'|'能否打开快捷商店'|'是否不可浏览地图'|'是否不可瞬间移动'|'默认地面ID'|'宝石血瓶效果'|'上楼点坐标'|'下楼点坐标'|'楼传落点坐标'|'背景音乐'|'画面色调'|'天气和强度'|'是否地下层'
|
||||||
@ -4052,8 +4064,8 @@ IdString
|
|||||||
;
|
;
|
||||||
|
|
||||||
FixedId_List
|
FixedId_List
|
||||||
: '生命'|'生命上限'|'攻击'|'防御'|'护盾'|'黄钥匙'|'蓝钥匙'|'红钥匙'|'金币'|'经验'|'魔力'|'魔力上限'|'生命增益'|'攻击增益'|'防御增益'|'护盾增益'
|
: '生命'|'生命上限'|'攻击'|'防御'|'护盾'|'黄钥匙'|'蓝钥匙'|'红钥匙'|'金币'|'经验'|'魔力'|'魔力上限'|'横坐标'|'纵坐标'|'攻击增益'|'防御增益'|'护盾增益'
|
||||||
/*FixedId_List ['status:hp','status:hpmax','status:atk','status:def','status:mdef','item:yellowKey','item:blueKey','item:redKey','status:money','status:exp','status:mana','status:manamax','buff:hp','buff:atk','buff:def','buff:mdef']*/;
|
/*FixedId_List ['status:hp','status:hpmax','status:atk','status:def','status:mdef','item:yellowKey','item:blueKey','item:redKey','status:money','status:exp','status:mana','status:manamax','status:x','status:y','buff:atk','buff:def','buff:mdef']*/;
|
||||||
|
|
||||||
Id_List
|
Id_List
|
||||||
: '变量' | '状态' | '物品' | '增益' | '独立开关' | '临时变量' |'全局存储'
|
: '变量' | '状态' | '物品' | '增益' | '独立开关' | '临时变量' |'全局存储'
|
||||||
|
|||||||
@ -326,6 +326,7 @@ editor.prototype.mapInit = function () {
|
|||||||
editor.currentFloorData.events = {};
|
editor.currentFloorData.events = {};
|
||||||
editor.currentFloorData.autoEvent = {};
|
editor.currentFloorData.autoEvent = {};
|
||||||
editor.currentFloorData.changeFloor = {};
|
editor.currentFloorData.changeFloor = {};
|
||||||
|
editor.currentFloorData.beforeBattle = {};
|
||||||
editor.currentFloorData.afterBattle = {};
|
editor.currentFloorData.afterBattle = {};
|
||||||
editor.currentFloorData.afterGetItem = {};
|
editor.currentFloorData.afterGetItem = {};
|
||||||
editor.currentFloorData.afterOpenDoor = {};
|
editor.currentFloorData.afterOpenDoor = {};
|
||||||
@ -442,6 +443,8 @@ editor.prototype._drawEventBlock_getColor = function (loc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (editor.currentFloorData.beforeBattle[loc])
|
||||||
|
color.push('#009090');
|
||||||
if (editor.currentFloorData.afterBattle[loc])
|
if (editor.currentFloorData.afterBattle[loc])
|
||||||
color.push('#FFFF00');
|
color.push('#FFFF00');
|
||||||
if (editor.currentFloorData.changeFloor[loc])
|
if (editor.currentFloorData.changeFloor[loc])
|
||||||
|
|||||||
@ -60,6 +60,7 @@ editor_blocklyconfig=(function(){
|
|||||||
"args": ""
|
"args": ""
|
||||||
}],'shop'),
|
}],'shop'),
|
||||||
MotaActionBlocks['common_m'].xmlText(),
|
MotaActionBlocks['common_m'].xmlText(),
|
||||||
|
MotaActionBlocks['beforeBattle_m'].xmlText(),
|
||||||
MotaActionBlocks['afterBattle_m'].xmlText(),
|
MotaActionBlocks['afterBattle_m'].xmlText(),
|
||||||
MotaActionBlocks['afterGetItem_m'].xmlText(),
|
MotaActionBlocks['afterGetItem_m'].xmlText(),
|
||||||
MotaActionBlocks['afterOpenDoor_m'].xmlText(),
|
MotaActionBlocks['afterOpenDoor_m'].xmlText(),
|
||||||
@ -535,7 +536,7 @@ var workspace = Blockly.inject(blocklyDiv,{
|
|||||||
});
|
});
|
||||||
|
|
||||||
editor_blockly.isCommonEntry = function () {
|
editor_blockly.isCommonEntry = function () {
|
||||||
var commonEntries = ['afterBattle', 'afterOpenDoor', 'firstArrive', 'eachArrive', 'commonEvent', 'item'];
|
var commonEntries = ['beforeBattle', 'afterBattle', 'afterOpenDoor', 'firstArrive', 'eachArrive', 'commonEvent', 'item'];
|
||||||
return commonEntries.indexOf(editor_blockly.entryType) >= 0;
|
return commonEntries.indexOf(editor_blockly.entryType) >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -596,7 +596,7 @@ editor_datapanel_wrapper = function (editor) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Step 3:更新所有坐标
|
// Step 3:更新所有坐标
|
||||||
["events", "afterBattle", "afterGetItem", "afterOpenDoor", "changeFloor", "autoEvent", "cannotMove"].forEach(function (name) {
|
["events", "beforeBattle", "afterBattle", "afterGetItem", "afterOpenDoor", "changeFloor", "autoEvent", "cannotMove"].forEach(function (name) {
|
||||||
newFloorData[name] = {};
|
newFloorData[name] = {};
|
||||||
if (!currentFloorData[name]) return;
|
if (!currentFloorData[name]) return;
|
||||||
for (var loc in currentFloorData[name]) {
|
for (var loc in currentFloorData[name]) {
|
||||||
|
|||||||
@ -696,7 +696,7 @@ editor_ui_wrapper = function (editor) {
|
|||||||
|
|
||||||
uievent._searchUsedFlags = function (flag) {
|
uievent._searchUsedFlags = function (flag) {
|
||||||
var list = [];
|
var list = [];
|
||||||
var events = ["events", "autoEvent", "changeFloor", "afterBattle", "afterGetItem", "afterOpenDoor"]
|
var events = ["events", "autoEvent", "changeFloor", "beforeBattle", "afterBattle", "afterGetItem", "afterOpenDoor"]
|
||||||
for (var floorId in core.floors) {
|
for (var floorId in core.floors) {
|
||||||
var floor = core.floors[floorId];
|
var floor = core.floors[floorId];
|
||||||
if (hasUsedFlags(floor.firstArrive, flag)) list.push([floorId, "firstArrive"]);
|
if (hasUsedFlags(floor.firstArrive, flag)) list.push([floorId, "firstArrive"]);
|
||||||
|
|||||||
@ -244,6 +244,13 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
|||||||
"_docs": "固伤",
|
"_docs": "固伤",
|
||||||
"_data": "战前扣血的点数"
|
"_data": "战前扣血的点数"
|
||||||
},
|
},
|
||||||
|
"beforeBattle": {
|
||||||
|
"_leaf": true,
|
||||||
|
"_type": "event",
|
||||||
|
"_event": "beforeBattle",
|
||||||
|
"_docs": "战前事件",
|
||||||
|
"_data": "和该怪物战斗前触发的事件列表"
|
||||||
|
},
|
||||||
"afterBattle": {
|
"afterBattle": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "event",
|
"_type": "event",
|
||||||
@ -570,6 +577,13 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
|||||||
"_docs": "楼层转换",
|
"_docs": "楼层转换",
|
||||||
"_data": "该点楼层转换事件;该事件不能和上面的events同时出现,否则会被覆盖"
|
"_data": "该点楼层转换事件;该事件不能和上面的events同时出现,否则会被覆盖"
|
||||||
},
|
},
|
||||||
|
"beforeBattle": {
|
||||||
|
"_leaf": true,
|
||||||
|
"_type": "event",
|
||||||
|
"_event": "beforeBattle",
|
||||||
|
"_docs": "战前事件",
|
||||||
|
"_data": "该点战斗前可能触发的事件列表,可以双击进入事件编辑器。"
|
||||||
|
},
|
||||||
"afterBattle": {
|
"afterBattle": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "event",
|
"_type": "event",
|
||||||
@ -630,6 +644,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
|||||||
"parallelDo": "",
|
"parallelDo": "",
|
||||||
"events": {},
|
"events": {},
|
||||||
"changeFloor": {},
|
"changeFloor": {},
|
||||||
|
"beforeBattle": {},
|
||||||
"afterBattle": {},
|
"afterBattle": {},
|
||||||
"afterGetItem": {},
|
"afterGetItem": {},
|
||||||
"afterOpenDoor": {},
|
"afterOpenDoor": {},
|
||||||
|
|||||||
@ -317,7 +317,7 @@ core.prototype._init_flags = function () {
|
|||||||
return e1.index - e2.index;
|
return e1.index - e2.index;
|
||||||
})
|
})
|
||||||
|
|
||||||
core.maps._setFloorSize();
|
core.maps._initFloors();
|
||||||
// 初始化怪物、道具等
|
// 初始化怪物、道具等
|
||||||
core.material.enemys = core.enemys.getEnemys();
|
core.material.enemys = core.enemys.getEnemys();
|
||||||
core.material.items = core.items.getItems();
|
core.material.items = core.items.getItems();
|
||||||
|
|||||||
@ -403,7 +403,26 @@ events.prototype._trigger_ignoreChangeFloor = function (block) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
events.prototype._sys_battle = function (data, callback) {
|
events.prototype._sys_battle = function (data, callback) {
|
||||||
|
// 检查战前事件
|
||||||
|
var beforeBattle = [];
|
||||||
|
core.push(beforeBattle, core.floors[core.status.floorId].beforeBattle[data.x + "," + data.y]);
|
||||||
|
core.push(beforeBattle, (core.material.enemys[data.event.id]||{}).beforeBattle);
|
||||||
|
if (beforeBattle.length > 0) {
|
||||||
|
core.push(beforeBattle, [{"type": "battle", "x": data.x, "y": data.y}]);
|
||||||
|
core.clearContinueAutomaticRoute();
|
||||||
|
|
||||||
|
// 自动存档
|
||||||
|
var inAction = core.status.event.id == 'action';
|
||||||
|
if (inAction) {
|
||||||
|
core.insertAction(beforeBattle, data.x, data.y);
|
||||||
|
core.doAction();
|
||||||
|
} else {
|
||||||
|
core.autosave(true);
|
||||||
|
core.insertAction(beforeBattle, data.x, data.y, callback);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
this.battle(data.event.id, data.x, data.y, false, callback);
|
this.battle(data.event.id, data.x, data.y, false, callback);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 战斗 //////
|
////// 战斗 //////
|
||||||
@ -859,8 +878,7 @@ events.prototype._sys_action = function (data, callback) {
|
|||||||
|
|
||||||
events.prototype._sys_custom = function (data, callback) {
|
events.prototype._sys_custom = function (data, callback) {
|
||||||
core.insertAction(["请使用\r[yellow]core.registerSystemEvent('custom', func)\r来处理自己添加的系统触发器!"],
|
core.insertAction(["请使用\r[yellow]core.registerSystemEvent('custom', func)\r来处理自己添加的系统触发器!"],
|
||||||
data.x, data.y);
|
data.x, data.y, callback);
|
||||||
if (callback) callback();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------ 自定义事件的处理 ------ //
|
// ------ 自定义事件的处理 ------ //
|
||||||
|
|||||||
@ -11,15 +11,18 @@ maps.prototype._init = function () {
|
|||||||
//delete(maps_90f36752_8815_4be8_b32b_d7fad1d0542e);
|
//delete(maps_90f36752_8815_4be8_b32b_d7fad1d0542e);
|
||||||
}
|
}
|
||||||
|
|
||||||
maps.prototype._setFloorSize = function (floorId) {
|
maps.prototype._initFloors = function (floorId) {
|
||||||
if (!floorId) {
|
if (!floorId) {
|
||||||
core.floorIds.forEach(function (floorId) {
|
core.floorIds.forEach(function (floorId) {
|
||||||
core.maps._setFloorSize(floorId);
|
core.maps._initFloors(floorId);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
core.floors[floorId].width = core.floors[floorId].width || core.__SIZE__;
|
core.floors[floorId].width = core.floors[floorId].width || core.__SIZE__;
|
||||||
core.floors[floorId].height = core.floors[floorId].height || core.__SIZE__;
|
core.floors[floorId].height = core.floors[floorId].height || core.__SIZE__;
|
||||||
|
|
||||||
|
// 战前事件兼容性
|
||||||
|
if (!core.floors[floorId].beforeBattle) core.floors[floorId].beforeBattle = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
maps.prototype._resetFloorImages = function () {
|
maps.prototype._resetFloorImages = function () {
|
||||||
@ -71,7 +74,7 @@ maps.prototype.loadFloor = function (floorId, map) {
|
|||||||
maps.prototype._loadFloor_doNotCopy = function () {
|
maps.prototype._loadFloor_doNotCopy = function () {
|
||||||
return [
|
return [
|
||||||
"firstArrive", "eachArrive", "blocks", "parallelDo", "map", "bgmap", "fgmap",
|
"firstArrive", "eachArrive", "blocks", "parallelDo", "map", "bgmap", "fgmap",
|
||||||
"events", "changeFloor", "afterBattle", "afterGetItem", "afterOpenDoor", "cannotMove"
|
"events", "changeFloor", "beforeBattle", "afterBattle", "afterGetItem", "afterOpenDoor", "cannotMove"
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -250,7 +250,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
});
|
});
|
||||||
core.push(actions, [
|
core.push(actions, [
|
||||||
{ "type": "waitAsync" }, // 等待所有异步事件执行完毕
|
{ "type": "waitAsync" }, // 等待所有异步事件执行完毕
|
||||||
{ "type": "trigger", "loc": [x, y] } // 重要!重新触发本点事件(即重新触发战斗)
|
{ "type": "battle", "loc": [x, y] } // 重要!重新触发本次战斗
|
||||||
]);
|
]);
|
||||||
core.insertAction(actions);
|
core.insertAction(actions);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -466,11 +466,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
parent.appendChild(input2);
|
parent.appendChild(input2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _loadFloor_doNotCopy = core.maps._loadFloor_doNotCopy;
|
||||||
core.maps._loadFloor_doNotCopy = function () {
|
core.maps._loadFloor_doNotCopy = function () {
|
||||||
return [
|
return ["bg2map", "fg2map"].concat(_loadFloor_doNotCopy());
|
||||||
"firstArrive", "eachArrive", "blocks", "parallelDo", "map", "bgmap", "fgmap", "bg2map", "fg2map",
|
|
||||||
"events", "changeFloor", "afterBattle", "afterGetItem", "afterOpenDoor", "cannotMove"
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
////// 绘制背景和前景层 //////
|
////// 绘制背景和前景层 //////
|
||||||
core.maps._drawBg_draw = function (floorId, toDrawCtx, cacheCtx, config) {
|
core.maps._drawBg_draw = function (floorId, toDrawCtx, cacheCtx, config) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user