feat:血瓶宝石显示数据适配

This commit is contained in:
lizhuoyuan 2025-02-08 16:52:23 +08:00
parent eaae6884ce
commit 2128a2389d
4 changed files with 125 additions and 30 deletions

View File

@ -140,7 +140,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"items": { "items": {
"constants": { "constants": {
"book": 1, "book": 1,
"setting": 1, "setting": 1
}, },
"tools": {}, "tools": {},
"equips": {} "equips": {}
@ -510,6 +510,11 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
{ {
"type": "comment", "type": "comment",
"text": "初始剧情" "text": "初始剧情"
},
{
"type": "setValue",
"name": "flag:itemDetail",
"value": "true"
} }
], ],
"shops": [ "shops": [

View File

@ -9,17 +9,17 @@ main.floors.MT0=
"cannotViewMap": false, "cannotViewMap": false,
"defaultGround": "ground", "defaultGround": "ground",
"images": [], "images": [],
"ratio": 1, "ratio": 2,
"map": [ "map": [
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 27, 34, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 28, 33, 0,341, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 29, 32, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 30, 31, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],

View File

@ -22,12 +22,12 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"cls": "items", "cls": "items",
"name": "红宝石", "name": "红宝石",
"text": "攻击+${core.values.redGem}", "text": "攻击+${core.values.redGem}",
"itemEffect": "core.status.hero.atk += core.values.redGem * core.status.thisMap.ratio", "itemEffect": null,
"itemEffectTip": ",攻击+${core.values.redGem * core.status.thisMap.ratio}", "itemEffectTip": ",攻击+${core.values.redGem * core.status.thisMap.ratio}",
"useItemEffect": "core.status.hero.atk += core.values.redGem", "useItemEffect": "core.status.hero.atk += core.values.redGem",
"canUseItemEffect": "true", "canUseItemEffect": "true",
"itemEffectEvent": { "itemEffectEvent": {
"sound": "item.mp3", "sound": "gem.mp3",
"value": { "value": {
"atk:o": "core.values.redGem" "atk:o": "core.values.redGem"
} }
@ -37,25 +37,37 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"cls": "items", "cls": "items",
"name": "蓝宝石", "name": "蓝宝石",
"text": ",防御+${core.values.blueGem}", "text": ",防御+${core.values.blueGem}",
"itemEffect": "core.status.hero.def += core.values.blueGem * core.status.thisMap.ratio", "itemEffect": null,
"itemEffectTip": ",防御+${core.values.blueGem * core.status.thisMap.ratio}", "itemEffectTip": ",防御+${core.values.blueGem * core.status.thisMap.ratio}",
"useItemEffect": "core.status.hero.def += core.values.blueGem", "useItemEffect": "core.status.hero.def += core.values.blueGem",
"canUseItemEffect": "true" "canUseItemEffect": "true",
"itemEffectEvent": {
"sound": "gem.mp3",
"value": {
"def:o": "core.values.blueGem"
}
}
}, },
"greenGem": { "greenGem": {
"cls": "items", "cls": "items",
"name": "绿宝石", "name": "绿宝石",
"text": ",护盾+${core.values.greenGem}", "text": ",护盾+${core.values.greenGem}",
"itemEffect": "core.status.hero.mdef += core.values.greenGem * core.status.thisMap.ratio", "itemEffect": null,
"itemEffectTip": ",护盾+${core.values.greenGem * core.status.thisMap.ratio}", "itemEffectTip": ",护盾+${core.values.greenGem * core.status.thisMap.ratio}",
"useItemEffect": "core.status.hero.mdef += core.values.greenGem", "useItemEffect": "core.status.hero.mdef += core.values.greenGem",
"canUseItemEffect": "true" "canUseItemEffect": "true",
"itemEffectEvent": {
"sound": "gem.mp3",
"value": {
"mdef:o": "core.values.greenGem"
}
}
}, },
"yellowGem": { "yellowGem": {
"cls": "items", "cls": "items",
"name": "黄宝石", "name": "黄宝石",
"text": "可以进行加点", "text": "可以进行加点",
"itemEffect": "core.status.hero.hp+=1000;core.status.hero.atk+=6;core.status.hero.def+=6;core.status.hero.mdef+=10;", "itemEffect": null,
"itemEffectTip": ",全属性提升", "itemEffectTip": ",全属性提升",
"useItemEvent": [ "useItemEvent": [
{ {
@ -97,43 +109,75 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
] ]
} }
], ],
"canUseItemEffect": "true" "canUseItemEffect": "true",
"itemEffectEvent": {
"sound": "gem.mp3",
"value": {
"mdef:o": "core.values.greenGem",
"def:o": "core.values.blueGem",
"atk:o": "core.values.redGem"
}
}
}, },
"redPotion": { "redPotion": {
"cls": "items", "cls": "items",
"name": "红血瓶", "name": "红血瓶",
"text": ",生命+${core.values.redPotion}", "text": ",生命+${core.values.redPotion}",
"itemEffect": "core.status.hero.hp += core.values.redPotion * core.status.thisMap.ratio", "itemEffect": null,
"itemEffectTip": ",生命+${core.values.redPotion * core.status.thisMap.ratio}", "itemEffectTip": ",生命+${core.values.redPotion * core.status.thisMap.ratio}",
"useItemEffect": "core.status.hero.hp += core.values.redPotion", "useItemEffect": "core.status.hero.hp += core.values.redPotion",
"canUseItemEffect": "true" "canUseItemEffect": "true",
"itemEffectEvent": {
"sound": "recovery.mp3",
"value": {
"hp:o": "core.values.redPotion"
}
}
}, },
"bluePotion": { "bluePotion": {
"cls": "items", "cls": "items",
"name": "蓝血瓶", "name": "蓝血瓶",
"text": ",生命+${core.values.bluePotion}", "text": ",生命+${core.values.bluePotion}",
"itemEffect": "core.status.hero.hp += core.values.bluePotion * core.status.thisMap.ratio", "itemEffect": null,
"itemEffectTip": ",生命+${core.values.bluePotion * core.status.thisMap.ratio}", "itemEffectTip": ",生命+${core.values.bluePotion * core.status.thisMap.ratio}",
"useItemEffect": "core.status.hero.hp += core.values.bluePotion", "useItemEffect": "core.status.hero.hp += core.values.bluePotion",
"canUseItemEffect": "true" "canUseItemEffect": "true",
"itemEffectEvent": {
"sound": "recovery.mp3",
"value": {
"hp:o": "core.values.bluePotion"
}
}
}, },
"yellowPotion": { "yellowPotion": {
"cls": "items", "cls": "items",
"name": "黄血瓶", "name": "黄血瓶",
"text": ",生命+${core.values.yellowPotion}", "text": ",生命+${core.values.yellowPotion}",
"itemEffect": "core.status.hero.hp += core.values.yellowPotion * core.status.thisMap.ratio", "itemEffect": null,
"itemEffectTip": ",生命+${core.values.yellowPotion * core.status.thisMap.ratio}", "itemEffectTip": ",生命+${core.values.yellowPotion * core.status.thisMap.ratio}",
"useItemEffect": "core.status.hero.hp += core.values.yellowPotion", "useItemEffect": "core.status.hero.hp += core.values.yellowPotion",
"canUseItemEffect": "true" "canUseItemEffect": "true",
"itemEffectEvent": {
"sound": "recovery.mp3",
"value": {
"hp:o": "core.values.yellowPotion"
}
}
}, },
"greenPotion": { "greenPotion": {
"cls": "items", "cls": "items",
"name": "绿血瓶", "name": "绿血瓶",
"text": ",生命+${core.values.greenPotion}", "text": ",生命+${core.values.greenPotion}",
"itemEffect": "core.status.hero.hp += core.values.greenPotion * core.status.thisMap.ratio", "itemEffect": null,
"itemEffectTip": ",生命+${core.values.greenPotion * core.status.thisMap.ratio}", "itemEffectTip": ",生命+${core.values.greenPotion * core.status.thisMap.ratio}",
"useItemEffect": "core.status.hero.hp += core.values.greenPotion", "useItemEffect": "core.status.hero.hp += core.values.greenPotion",
"canUseItemEffect": "true" "canUseItemEffect": "true",
"itemEffectEvent": {
"sound": "recovery.mp3",
"value": {
"hp:o": "core.values.greenPotion"
}
}
}, },
"sword0": { "sword0": {
"cls": "items", "cls": "items",

View File

@ -1733,6 +1733,26 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
if (core.status.thisMap) core.getItemDetail(floorId); // 宝石血瓶详细信息 if (core.status.thisMap) core.getItemDetail(floorId); // 宝石血瓶详细信息
this.drawDamage(ctx); this.drawDamage(ctx);
}; };
function getRatio() {
let ratio = core.status.thisMap.ratio;
if (!core.isset(ratio)) ratio = 1;
const currEvent = core.status.event;
if (!currEvent) return ratio;
switch (currEvent.id) {
case 'viewMaps': //调整浏览地图时的倍率
if (currEvent.data) {
const viewMapFloorId = (currEvent.data.floorId);
ratio = core.status.maps[viewMapFloorId].ratio;
}
break;
case 'fly': //调整在楼传界面浏览地图时的倍率
ratio = core.status.maps[core.floorIds[currEvent.data]].ratio;
break;
}
return ratio;
}
// 获取宝石信息 并绘制 // 获取宝石信息 并绘制
this.getItemDetail = function (floorId) { this.getItemDetail = function (floorId) {
if (!core.getFlag('itemDetail')) return; if (!core.getFlag('itemDetail')) return;
@ -1764,9 +1784,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
if (core.bigmap.v2) { if (core.bigmap.v2) {
if ( if (
x < core.bigmap.posX - core.bigmap.extend || x < core.bigmap.posX - core.bigmap.extend ||
x > core.bigmap.posX + core._SIZE_ + core.bigmap.extend || x > core.bigmap.posX + core.__SIZE__ + core.bigmap.extend ||
y < core.bigmap.posY - core.bigmap.extend || y < core.bigmap.posY - core.bigmap.extend ||
y > core.bigmap.posY + core._SIZE_ + core.bigmap.extend y > core.bigmap.posY + core.__SIZE__ + core.bigmap.extend
) { ) {
return; return;
} }
@ -1774,6 +1794,30 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
diff = {}; diff = {};
const id = block.event.id; const id = block.event.id;
const item = core.material.items[id]; const item = core.material.items[id];
if (item.cls === 'items' && item.hasOwnProperty('itemEffectEvent') && item.itemEffectEvent.hasOwnProperty('value')) {
const values = item.itemEffectEvent.value;
for (let statusName in values) {
const getStatusValue = values[statusName];
let ratio, needRatio, statusValue;
if (statusName.endsWith(':o')) {
needRatio = true;
statusName = statusName.slice(0, -2);
}
ratio = getRatio();
if (core.status.hero.hasOwnProperty(statusName)) {
if (!diff.hasOwnProperty(statusName)) {
diff[statusName] = 0;
}
try {
statusValue = eval(getStatusValue);
} catch (error) {
console.log(error);
}
if (needRatio) statusValue *= ratio;
diff[statusName] += statusValue || 0;
}
}
}
if (item.cls === 'equips') { if (item.cls === 'equips') {
// 装备也显示 // 装备也显示
const diff = item.equip.value ?? {}; const diff = item.equip.value ?? {};
@ -1832,7 +1876,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
color = ' #F9FF00'; color = ' #F9FF00';
break; break;
case 'mana': case 'mana':
color = '#c66'; case 'manamax':
color = ' #CC6666';
break; break;
} }
// 绘制 // 绘制
@ -4294,5 +4339,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
// todolist 修复已知的插件bug // todolist 修复已知的插件bug
// todolist 添加鸽窝样板的快速读取撤回 和 优化美工 // todolist 添加鸽窝样板的快速读取撤回 和 优化美工
// todolist 音效连续播放的优化(与自动清有关) // todolist 音效连续播放的优化(与自动清有关)
// todolist 新的临界计算
} }
} }