This commit is contained in:
ckcz123 2021-09-25 20:59:37 +08:00
parent 90a197fe88
commit 019b99396a
4 changed files with 34 additions and 1 deletions

View File

@ -3636,6 +3636,8 @@ expression
| isShopVisited_e
| hasEquip_e
| canBattle_e
| damage_e
| damage_1_e
| rand_e
| evalString_e
@ -3875,6 +3877,33 @@ return [code, Blockly.JavaScript.ORDER_ATOMIC];
*/;
damage_e
: '战斗伤害' '怪物ID' IdString
/* damage_e
default : ['greenSlime']
allEnemys : ['IdString_0']
var code = 'core.getDamage(\'' + IdString_0 + '\')';
return [code, Blockly.JavaScript.ORDER_ATOMIC];
*/;
damage_1_e
: '战斗伤害' '点坐标' 'x' PosString 'y' PosString
/* damage_1_e
default : [0, 0]
if (PosString_0.startsWith('"')) {
PosString_0 = PosString_0.substring(1, PosString_0.length - 1);
}
if (PosString_1.startsWith('"')) {
PosString_1 = PosString_1.substring(1, PosString_1.length - 1);
}
var code = 'core.getDamage(null, ' + PosString_0 + ',' + PosString_1 + ')';
return [code, Blockly.JavaScript.ORDER_ATOMIC];
*/;
rand_e
: '随机数 [0, ' Int ')'

View File

@ -290,6 +290,8 @@ editor_blocklyconfig=(function(){
MotaActionBlocks['hasVisitedFloor_e'].xmlText(),
MotaActionBlocks['isShopVisited_e'].xmlText(),
MotaActionBlocks['canBattle_e'].xmlText(),
MotaActionBlocks['damage_e'].xmlText(),
MotaActionBlocks['damage_1_e'].xmlText(),
MotaActionBlocks['rand_e'].xmlText(),
MotaActionBlocks['evalString_e'].xmlText(),
],

View File

@ -401,8 +401,9 @@ enemys.prototype.getDamage = function (enemy, x, y, floorId) {
}
enemys.prototype._getDamage = function (enemy, hero, x, y, floorId) {
if (enemy == null) return null;
if (enemy == null) enemy = core.getBlockId(x, y, floorId);
if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
if (enemy == null) return null;
var info = this.getDamageInfo(enemy, hero, x, y, floorId);
if (info == null) return null;

View File

@ -245,6 +245,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
});
core.push(actions, [
{ "type": "waitAsync" }, // 等待所有异步事件执行完毕
{ "type": "setBlock", "number": enemyId, "loc": [[x, y]]}, // 重新设置怪物自身
{ "type": "battle", "loc": [x, y] } // 重要!重新触发本次战斗
]);
core.insertAction(actions);