加了打怪时自动装备最优装备;加了个提示

This commit is contained in:
bdf1 2024-07-28 23:53:18 +08:00
parent edc6c4de07
commit 4f4e295bd2
5 changed files with 141 additions and 3 deletions

View File

@ -99,6 +99,12 @@ var functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "textarea",
"_lint": true,
"_data": "战斗伤害信息"
},
"getDamageInfo1": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "lhjnb"
}
}
},

View File

@ -62,7 +62,8 @@ main.floors.YS10=
],
"floorId": "GM1",
"remove": true
}
},
"提示:先去 GM8 ,然后去 SN10 ,最后去 GM2 。"
],
"eachArrive": [],
"parallelDo": "",

View File

@ -697,7 +697,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
"guards": guards, // 返回支援情况
};
},
"getDamageInfo": function (enemy, hero, x, y, floorId) {
"getDamageInfo": function (enemy, hero, x, y, floorId, allEquip = false) {
// 获得战斗伤害信息(实际伤害计算函数)
//
// 参数说明:
@ -706,6 +706,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// x,y该怪物的坐标查看手册和强制战斗时为undefined
// floorId该怪物所在的楼层
// 后面三个参数主要是可以在光环等效果上可以适用
if (!allEquip && core.getFlag('bestEquip')) return this.getDamageInfo1(enemy, hero, x, y, floorId);
floorId = floorId || core.status.floorId;
var hero_hp = core.getRealStatusOrDefault(hero, 'hp'),
@ -917,6 +918,52 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
"turn": Math.floor(turn),
"damage": Math.floor(damage)
};
},
"getDamageInfo1": function (enemy, hero, x, y, floorId) {
var changeLoc = hero ? Object.keys(hero)[0] : null,
change = hero ? hero[changeLoc] - core.status.hero[changeLoc] : null;
var cur = core.clone(core.status.hero.equipment);
core.setFlag("__quickLoadEquip__", true);
core.setFlag("__equipCalc__", true);
var info = null
for (var I = 0; I <= 10; I++) {
var current = core.getFlag("saveEquips", [])[I];
if (I == 10) current = cur;
if (!current) continue;
// 检查所有的装备
var equipSize = core.status.globalAttribute.equipName.length;
/*for (var i = 0; i < equipSize; i++) {
var v = current[i];
if (v && !this.canEquip(v, true)) { current = null; break; }
}
if (!current) continue;*/
// 快速换装
var toEquip = [];
for (var i = 0; i < equipSize; i++) {
var now = core.status.hero.equipment[i];
// --- 只考虑diff的装备
var to = current[i];
if (now != to) {
toEquip.push(to || null);
if (now) {
core.items.unloadEquip(i);
}
}
}
for (var i in toEquip) {
var to = toEquip[i];
if (to) {
core.items.loadEquip(to);
}
}
if (changeLoc) hero[changeLoc] = core.status.hero[changeLoc] + change;
var damageInfo = this.getDamageInfo(enemy, hero, x, y, floorId, true)
if (damageInfo && (!info || info.damage > damageInfo.damage)) info = damageInfo
}
core.removeFlag("__quickLoadEquip__");
core.removeFlag("__equipCalc__");
return info;
}
},
"actions": {

View File

@ -1306,6 +1306,57 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
]
}
]
},
{
"text": "自动计算最优装备",
"color": [
0,
255,
255,
1
],
"action": [
{
"type": "choices",
"text": "自动计算最优装备(需保存套装)",
"choices": [
{
"text": "打开自动计算最优装备",
"color": [
237,
3,
120,
1
],
"action": [
"自动计算最优装备已打开!",
{
"type": "setValue",
"name": "flag:bestEquip",
"value": "true"
}
]
},
{
"text": "关闭自动计算最优装备",
"color": [
233,
233,
23,
1
],
"action": [
"自动计算最优装备已关闭!",
{
"type": "setValue",
"name": "flag:bestEquip",
"value": "false"
}
]
}
]
}
]
}
]
}

View File

@ -6,7 +6,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}
core.enemys.getDamageString = function (enemy, x, y, floorId) {
if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
var damage = this.getDamage(enemy, x, y, floorId);
//console.log('start')
var damage = core.getFlag('bestEquip') ? this.enemydata.getDamageInfo1(enemy, null, x, y, floorId) : this.enemydata.getDamageInfo(enemy, null, x, y, floorId);
//console.log('end')
if (damage) damage = damage.damage
var color = '#000000';
@ -123,6 +126,36 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.updateStatusBar();
core.AllSprites();
}
core.items._realLoadEquip = function (type, loadId, unloadId, callback) {
var loadEquip = core.material.items[loadId] || {},
unloadEquip = core.material.items[unloadId] || {};
// --- 音效
this._realLoadEquip_playSound();
// --- 实际换装
this._loadEquipEffect(loadId, unloadId);
// --- 加减
if (core.getFlag('__equipCalc__')) {
if (unloadId) core.status.hero.items.equips[unloadId] = (core.status.hero.items.equips[unloadId] || 0) + 1;
if (loadId) core.status.hero.items.equips[loadId] -= 1;
if (loadId && !core.status.hero.items.equips[loadId]) delete core.status.hero.items.equips[loadId];
} else {
if (unloadId) core.status.hero.items.equips[unloadId] = (core.status.hero.items.equips[unloadId] || 0) + 1;
if (loadId) core.status.hero.items.equips[loadId] -= 1;
if (loadId && !core.status.hero.items.equips[loadId]) delete core.status.hero.items.equips[loadId];
}
core.status.hero.equipment[type] = loadId || null;
// --- 提示
if (core.getFlag('__quickLoadEquip__'));
else
if (loadId) core.drawTip("已装备上" + loadEquip.name, loadId);
else if (unloadId) core.drawTip("已卸下" + unloadEquip.name, unloadId);
if (callback) callback();
}
},
"drawLight": function () {