定点怪显开关

This commit is contained in:
ckcz123 2021-07-26 17:45:19 +08:00
parent e0c5374d7a
commit 2ae21a0bca
7 changed files with 32 additions and 11 deletions

View File

@ -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']*/;

View File

@ -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();

View File

@ -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 () {

View File

@ -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);

View File

@ -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] || {};

View File

@ -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]"),

View File

@ -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] }]);
}