setEnemy
This commit is contained in:
parent
31048d7d05
commit
755c998ab8
@ -322,6 +322,7 @@ action
|
||||
| tip_s
|
||||
| setValue_s
|
||||
| addValue_s
|
||||
| setEnemy_s
|
||||
| setFloor_s
|
||||
| setGlobalAttribute_s
|
||||
| setGlobalValue_s
|
||||
@ -610,6 +611,21 @@ var code = '{"type": "addValue", "name": "'+idString_e_0+'", "value": "'+express
|
||||
return code;
|
||||
*/;
|
||||
|
||||
|
||||
setEnemy_s
|
||||
: '设置怪物属性' ':' '怪物ID' IdString '的' EnemyId_List '值' expression Newline
|
||||
|
||||
|
||||
/* setEnemy_s
|
||||
tooltip : setEnemy:设置某个怪物的属性
|
||||
default : ["greenSlime", "atk", "0"]
|
||||
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=addValue%ef%bc%9a%e5%a2%9e%e5%87%8f%e5%8b%87%e5%a3%ab%e7%9a%84%e6%9f%90%e4%b8%aa%e5%b1%9e%e6%80%a7%e3%80%81%e9%81%93%e5%85%b7%e4%b8%aa%e6%95%b0%ef%bc%8c%e6%88%96%e6%9f%90%e4%b8%aa%e5%8f%98%e9%87%8f%2fFlag%e7%9a%84%e5%80%bc
|
||||
colour : this.dataColor
|
||||
var code = '{"type": "setEnemy", "id": "'+IdString_0+'", "name": "'+EnemyId_List_0+'", "value": "'+expression_0+'"},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
|
||||
setFloor_s
|
||||
: '设置楼层属性' ':' Floor_Meta_List '楼层名' IdString? '值' EvalString Newline
|
||||
|
||||
@ -3352,6 +3368,10 @@ ActionParser.prototype.parseAction = function() {
|
||||
MotaActionBlocks['evalString_e'].xmlText([data.value]),
|
||||
this.next]);
|
||||
break;
|
||||
case "setEnemy":
|
||||
this.next = MotaActionBlocks['setEnemy_s'].xmlText([
|
||||
data.id, data.name, MotaActionBlocks['evalString_e'].xmlText([data.value]), this.next]);
|
||||
break;
|
||||
case "setFloor":
|
||||
this.next = MotaActionBlocks['setFloor_s'].xmlText([
|
||||
data.name, data.floorId||null, data.value, this.next]);
|
||||
|
||||
@ -105,6 +105,7 @@ editor_blockly = function () {
|
||||
MotaActionBlocks['setValue_s'].xmlText([
|
||||
MotaActionBlocks['idString_1_e'].xmlText(['status','生命'])
|
||||
]),
|
||||
MotaActionBlocks['setEnemy_s'].xmlText(),
|
||||
MotaActionBlocks['setFloor_s'].xmlText(),
|
||||
MotaActionBlocks['setGlobalAttribute_s'].xmlText(),
|
||||
MotaActionBlocks['setGlobalValue_s'].xmlText(),
|
||||
|
||||
@ -19,7 +19,16 @@ enemys.prototype._init = function () {
|
||||
}
|
||||
|
||||
enemys.prototype.getEnemys = function () {
|
||||
return core.clone(this.enemys);
|
||||
var enemys = core.clone(this.enemys);
|
||||
var enemyInfo = core.getFlag('enemyInfo');
|
||||
if (enemyInfo) {
|
||||
for (var id in enemyInfo) {
|
||||
for (var name in enemyInfo[id]) {
|
||||
enemys[id][name] = core.clone(enemyInfo[id][name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return enemys;
|
||||
}
|
||||
|
||||
////// 判断是否含有某特殊属性 //////
|
||||
|
||||
@ -1465,6 +1465,11 @@ events.prototype._action_addValue = function (data, x, y, prefix) {
|
||||
core.doAction();
|
||||
}
|
||||
|
||||
events.prototype._action_setEnemy = function (data, x, y, prefix) {
|
||||
this.setEnemy(data.id, data.name, data.value, prefix);
|
||||
core.doAction();
|
||||
}
|
||||
|
||||
events.prototype._action_setFloor = function (data, x, y, prefix) {
|
||||
this.setFloorInfo(data.name, data.value, data.floorId, prefix);
|
||||
core.doAction();
|
||||
@ -2150,6 +2155,19 @@ events.prototype.doEffect = function (effect, need, times) {
|
||||
});
|
||||
}
|
||||
|
||||
////// 设置一个怪物属性 //////
|
||||
events.prototype.setEnemy = function (id, name, value, prefix) {
|
||||
if (!core.hasFlag('enemyInfo')) {
|
||||
core.setFlag('enemyInfo', {});
|
||||
}
|
||||
var enemyInfo = core.getFlag('enemyInfo');
|
||||
if (!enemyInfo[id]) enemyInfo[id] = {};
|
||||
value = core.calValue(value, prefix);
|
||||
enemyInfo[id][name] = value;
|
||||
(core.material.enemys[id]||{})[name] = core.clone(value);
|
||||
core.updateStatusBar();
|
||||
}
|
||||
|
||||
////// 设置楼层属性 //////
|
||||
events.prototype.setFloorInfo = function (name, value, floorId, prefix) {
|
||||
floorId = floorId || core.status.floorId;
|
||||
|
||||
@ -642,9 +642,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
hero_atk = core.getRealStatusOrDefault(hero, 'atk'),
|
||||
hero_def = core.getRealStatusOrDefault(hero, 'def'),
|
||||
hero_mdef = core.getRealStatusOrDefault(hero, 'mdef'),
|
||||
origin_hero_hp = hero_hp,
|
||||
origin_hero_atk = hero_atk,
|
||||
origin_hero_def = hero_def;
|
||||
origin_hero_hp = core.getStatusOrDefault(hero, 'hp'),
|
||||
origin_hero_atk = core.getStatusOrDefault(hero, 'atk'),
|
||||
origin_hero_def = core.getStatusOrDefault(hero, 'def');
|
||||
|
||||
// 勇士的负属性都按0计算
|
||||
hero_hp = Math.max(0, hero_hp);
|
||||
@ -1350,20 +1350,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
main.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
// 下面是一个并行事件开门的样例
|
||||
/*
|
||||
// 如果某个flag为真
|
||||
if (core.hasFlag("xxx")) {
|
||||
// 千万别忘了将该flag清空!否则下次仍然会执行这段代码。
|
||||
core.removeFlag("xxx");
|
||||
// 使用insertAction来插入若干自定义事件执行
|
||||
core.insertAction([
|
||||
{"type":"openDoor", "loc":[0,0], "floorId": "MT0"}
|
||||
])
|
||||
// 也可以写任意其他的脚本代码
|
||||
}
|
||||
*/
|
||||
}
|
||||
},
|
||||
"ui": {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user