From 2ae21a0bca14f6a0e2509420b7642fc2971f5b7c Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Mon, 26 Jul 2021 17:45:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E7=82=B9=E6=80=AA=E6=98=BE=E5=BC=80?= =?UTF-8?q?=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/MotaAction.g4 | 8 ++++++-- libs/actions.js | 17 +++++++++++++---- libs/core.js | 1 + libs/enemys.js | 6 +++++- libs/events.js | 2 ++ libs/ui.js | 1 + project/functions.js | 8 ++++---- 7 files changed, 32 insertions(+), 11 deletions(-) diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index c5b78627..8e1c52f2 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -1170,7 +1170,7 @@ return code; setEnemyOnPoint_s - : '设置某点怪物属性' ':' 'x' PosString? ',' 'y' PosString? '楼层' IdString? '的' EnemyId_List AssignOperator_List expression Newline + : '设置某点怪物属性' ':' 'x' PosString? ',' 'y' PosString? '楼层' IdString? '的' EnemyPoint_List AssignOperator_List expression Newline /* setEnemyOnPoint_s @@ -1185,7 +1185,7 @@ if (AssignOperator_List_0 && AssignOperator_List_0 != '=') { } else AssignOperator_List_0 = ''; IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"'); var floorstr = PosString_0 && PosString_1 ? ', "loc": ['+PosString_0+','+PosString_1+']' : ''; -var code = '{"type": "setEnemyOnPoint"'+floorstr+IdString_0+', "name": "'+EnemyId_List_0+'"'+AssignOperator_List_0+', "value": "'+expression_0+'"},\n'; +var code = '{"type": "setEnemyOnPoint"'+floorstr+IdString_0+', "name": "'+EnemyPoint_List_0+'"'+AssignOperator_List_0+', "value": "'+expression_0+'"},\n'; return code; */; @@ -3946,6 +3946,10 @@ EnemyId_List : '生命'|'攻击'|'防御'|'金币'|'经验'|'加点'|'属性'|'名称'|'映射名'|'属性值'|'退化扣攻'|'退化扣防'|'不可炸'|'九宫格领域'|'领域范围'|'连击数'|'吸血到自身'|'固伤值' /*EnemyId_List ['hp','atk','def','money','exp','point','special','name','displayInBook','value','atkValue','defValue','notBomb','zoneSquare','range','n','add','damage']*/; +EnemyPoint_List + : '生命'|'攻击'|'防御'|'金币'|'经验'|'加点'|'名称' + /*EnemyPoint_List ['hp','atk','def','money','exp','point','name']*/; + Equip_List : '生命'|'生命上限'|'攻击'|'防御'|'护盾'|'魔力'|'魔力上限' /*Equip_List ['hp','hpmax','atk','def','mdef','mana','manamax']*/; diff --git a/libs/actions.js b/libs/actions.js index 4ec343d8..95444d31 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -2213,17 +2213,20 @@ actions.prototype._clickSwitchs_display = function (x, y) { return this._clickSwitchs_display_enableHDCanvas(); case 2: core.playSound('确定'); - return this._clickSwitchs_display_enemyDamage(); + return this._clickSwitchs_display_enableEnemyPoint(); case 3: core.playSound('确定'); - return this._clickSwitchs_display_critical(); + return this._clickSwitchs_display_enemyDamage(); case 4: core.playSound('确定'); - return this._clickSwitchs_display_extraDamage(); + return this._clickSwitchs_display_critical(); case 5: core.playSound('确定'); - return this._clickSwitchs_display_extraDamageType(); + return this._clickSwitchs_display_extraDamage(); case 6: + core.playSound('确定'); + return this._clickSwitchs_display_extraDamageType(); + case 7: core.status.event.selection = 1; core.playSound('取消'); core.ui._drawSwitchs(); @@ -2254,6 +2257,12 @@ actions.prototype._clickSwitchs_display_enableHDCanvas = function () { core.ui._drawSwitchs_display(); } +actions.prototype._clickSwitchs_display_enableEnemyPoint = function () { + core.flags.enableEnemyPoint = !core.flags.enableEnemyPoint; + core.setLocalStorage('enableEnemyPoint', core.flags.enableEnemyPoint); + core.ui._drawSwitchs_display(); +} + actions.prototype._clickSwitchs_display_enemyDamage = function () { core.flags.displayEnemyDamage = !core.flags.displayEnemyDamage; core.updateDamage(); diff --git a/libs/core.js b/libs/core.js index 4b31fc3e..f91efbeb 100644 --- a/libs/core.js +++ b/libs/core.js @@ -336,6 +336,7 @@ core.prototype._init_sys_flags = function () { core.values.floorChangeTime = core.getLocalStorage('floorChangeTime', core.values.floorChangeTime); if (core.values.floorChangeTime == null) core.values.floorChangeTime = 500; core.flags.enableHDCanvas = core.getLocalStorage('enableHDCanvas', !core.platform.isIOS); + core.flags.enableEnemyPoint = core.getLocalStorage('enableEnemyPoint', true); } core.prototype._init_platform = function () { diff --git a/libs/enemys.js b/libs/enemys.js index 44d7983a..47427ee6 100644 --- a/libs/enemys.js +++ b/libs/enemys.js @@ -378,7 +378,8 @@ enemys.prototype._getCurrentEnemys_addEnemy = function (enemyId, enemys, used, x var enemyInfo = this.getEnemyInfo(enemy, null, null, null, floorId); var locEnemyInfo = this.getEnemyInfo(enemy, null, x, y, floorId); - if (locEnemyInfo.atk == enemyInfo.atk && locEnemyInfo.def == enemyInfo.def && locEnemyInfo.hp == enemyInfo.hp) { + if (!core.flags.enableEnemyPoint || + (locEnemyInfo.atk == enemyInfo.atk && locEnemyInfo.def == enemyInfo.def && locEnemyInfo.hp == enemyInfo.hp)) { x = null; y = null; } else { @@ -402,6 +403,9 @@ enemys.prototype._getCurrentEnemys_addEnemy = function (enemyId, enemys, used, x e.x = x; e.y = y; } + ["name", "money", "exp", "point"].forEach(function (one) { + e[one] = core.getEnemyValue(enemy, one, x, y, floorId); + }); e.specialText = specialText; e.specialColor = specialColor; e.damage = this.getDamage(enemy, x, y, floorId); diff --git a/libs/events.js b/libs/events.js index 5214f8a2..2cd5cfc3 100644 --- a/libs/events.js +++ b/libs/events.js @@ -2820,6 +2820,7 @@ events.prototype.setEnemy = function (id, name, value, operator, prefix) { } var enemyInfo = core.getFlag('enemyInfo'); if (!enemyInfo[id]) enemyInfo[id] = {}; + if (typeof value === 'string' && name == 'name') value = value.replaceAll('\r', '\\r'); value = this._updateValueByOperator(core.calValue(value, prefix), (core.material.enemys[id]||{})[name], operator); enemyInfo[id][name] = value; (core.material.enemys[id]||{})[name] = core.clone(value); @@ -2834,6 +2835,7 @@ events.prototype.setEnemyOnPoint = function (x, y, floorId, name, value, operato if (block.event.cls.indexOf('enemy') != 0) return; var enemy = core.material.enemys[block.event.id]; if (enemy == null) return; + if (typeof value === 'string' && name == 'name') value = value.replaceAll('\r', '\\r'); value = this._updateValueByOperator(core.calValue(value, prefix), enemy[name], operator); flags.enemyOnPoint = flags.enemyOnPoint || {}; flags.enemyOnPoint[floorId] = flags.enemyOnPoint[floorId] || {}; diff --git a/libs/ui.js b/libs/ui.js index 17ab6718..36cfb9f1 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -1833,6 +1833,7 @@ ui.prototype._drawSwitchs_display = function () { var choices = [ " < 放缩:" + Math.max(core.domStyle.scale, 1) + "x > ", "高清画面: " + (core.flags.enableHDCanvas ? "[ON]" : "[OFF]"), + "定点怪显: " + (core.flags.enableEnemyPoint ? "[ON]" : "[OFF]"), "怪物显伤: " + (core.flags.displayEnemyDamage ? "[ON]" : "[OFF]"), "临界显伤: " + (core.flags.displayCritical ? "[ON]" : "[OFF]"), "领域显伤: " + (core.flags.displayExtraDamage ? "[ON]" : "[OFF]"), diff --git a/project/functions.js b/project/functions.js index d16d2f37..e1ed36fa 100644 --- a/project/functions.js +++ b/project/functions.js @@ -314,7 +314,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = // 获得金币 var money = guards.reduce(function (curr, g) { return curr + core.material.enemys[g[2]].money; - }, enemy.money); + }, core.getEnemyValue(enemy, "money", x, y)); if (core.hasItem('coin')) money *= 2; // 幸运金币:双倍 if (core.hasFlag('curse')) money = 0; // 诅咒效果 core.status.hero.money += money; @@ -323,12 +323,12 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = // 获得经验 var exp = guards.reduce(function (curr, g) { return curr + core.material.enemys[g[2]].exp; - }, enemy.exp); + }, core.getEnemyValue(enemy, "exp", x, y)); if (core.hasFlag('curse')) exp = 0; core.status.hero.exp += exp; core.status.hero.statistics.exp += exp; - var hint = "打败 " + enemy.name; + var hint = "打败 " + core.getEnemyValue(enemy, "name", x, y); if (core.flags.statusBarItems.indexOf('enableMoney') >= 0) hint += ',' + core.getStatusLabel('money') + '+' + money; // hint += ",金币+" + money; if (core.flags.statusBarItems.indexOf('enableExp') >= 0) @@ -385,7 +385,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = // 加点事件 var point = guards.reduce(function (curr, g) { return curr + core.material.enemys[g[2]].point; - }, enemy.point) || 0; + }, core.getEnemyValue(enemy, "point", x, y)) || 0; if (core.flags.enableAddPoint && point > 0) { core.push(todo, [{ "type": "insert", "name": "加点事件", "args": [point] }]); }