属性映射

This commit is contained in:
草莓 2024-12-20 21:21:32 +08:00
parent 254f0ca2a5
commit 7fb0248f55
8 changed files with 624 additions and 337 deletions

File diff suppressed because one or more lines are too long

View File

@ -32,6 +32,23 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_docs": "道具类别", "_docs": "道具类别",
"_data": "items(宝石、血瓶) constants(永久物品) tools(消耗道具) equips(装备)" "_data": "items(宝石、血瓶) constants(永久物品) tools(消耗道具) equips(装备)"
}, },
"equipCls": {
"_leaf": true,
"_type": "select",
"_select": {
"values": [
"单手剑",
"法杖",
"双手剑",
"匕首",
"盾牌",
"护具",
"饰品"
]
},
"_docs": "装备类别",
"_data": "单手剑作为副手时主手必须为单手剑,匕首作为副手时主手武器必须为单手剑、法杖、匕首之一,盾牌仅可作为副手使用且主手必须为单手剑、法杖之一"
},
"name": { "name": {
"_leaf": true, "_leaf": true,
"_type": "textarea", "_type": "textarea",
@ -170,7 +187,23 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"def": { "def": {
"_leaf": true, "_leaf": true,
"_type": "textarea", "_type": "textarea",
"_data": "防御力" "_data": "物理防御力"
},
"mdef": {
"_leaf": true,
"_type": "textarea",
"_data": "魔法防御力"
},
"speed": {
"_leaf": true,
"_type": "textarea",
"_data": "速度"
},
"magic": {
"_leaf": true,
"_type": "checkbox",
"_docs": "是否为魔法攻击",
"_data": "勾选以魔法攻击计算,不勾选以物理攻击计算"
}, },
"money": { "money": {
"_leaf": true, "_leaf": true,

View File

@ -257,17 +257,48 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"atk": { "atk": {
"_leaf": true, "_leaf": true,
"_type": "textarea", "_type": "textarea",
"_data": "初始攻击" "_data": "攻击"
}, },
"def": { "def": {
"_leaf": true, "_leaf": true,
"_type": "textarea", "_type": "textarea",
"_data": "初始防御" "_data": "物理防御"
}, },
"mdef": { "mdef": {
"_leaf": true, "_leaf": true,
"_type": "textarea", "_type": "textarea",
"_data": "初始护盾" "_data": "魔法防御"
},
"speed": {
"_leaf": true,
"_type": "textarea",
"_data": "攻击速度"
},
"str": {
"_leaf": true,
"_type": "textarea",
"_data": "力量"
},
"agi": {
"_leaf": true,
"_type": "textarea",
"_data": "敏捷"
},
"int": {
"_leaf": true,
"_type": "textarea",
"_data": "智力"
},
"con": {
"_leaf": true,
"_type": "textarea",
"_data": "体质"
},
"magic": {
"_leaf": true,
"_type": "checkbox",
"_docs": "攻击类型",
"_data": "攻击类型是否是魔法"
}, },
"money": { "money": {
"_leaf": true, "_leaf": true,

View File

@ -218,7 +218,9 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"levelChoose": null, "levelChoose": null,
"equipName": [ "equipName": [
"武器", "武器",
"盾牌" "武器",
"防具",
"饰品"
], ],
"startBgm": "theme.mp3", "startBgm": "theme.mp3",
"styles": { "styles": {
@ -294,7 +296,14 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"useBetweenLight": true "useBetweenLight": true
}, },
"followers": [], "followers": [],
"steps": 0 "steps": 0,
"matk": 0,
"speed": 0,
"str": 10,
"agi": 10,
"int": 10,
"con": 10,
"magic": false
}, },
"startCanvas": [ "startCanvas": [
{ {

View File

@ -10,7 +10,7 @@ var enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 =
"vampire": {"name":"冥灵魔王","hp":888,"atk":888,"def":888,"money":888,"exp":888,"point":0,"special":[6],"n":8}, "vampire": {"name":"冥灵魔王","hp":888,"atk":888,"def":888,"money":888,"exp":888,"point":0,"special":[6],"n":8},
"skeleton": {"name":"骷髅人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, "skeleton": {"name":"骷髅人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"skeletonCaptain": {"name":"骷髅队长","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, "skeletonCaptain": {"name":"骷髅队长","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"zombie": {"name":"兽人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, "zombie": {"name":"兽人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0,"magic":false},
"zombieKnight": {"name":"兽人武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, "zombieKnight": {"name":"兽人武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"rock": {"name":"石头人","hp":50,"atk":50,"def":0,"money":3,"exp":0,"point":0,"special":3}, "rock": {"name":"石头人","hp":50,"atk":50,"def":0,"money":3,"exp":0,"point":0,"special":3},
"bluePriest": {"name":"初级法师","hp":100,"atk":120,"def":0,"money":3,"exp":0,"point":1,"special":[9]}, "bluePriest": {"name":"初级法师","hp":100,"atk":120,"def":0,"money":3,"exp":0,"point":1,"special":[9]},

View File

@ -491,10 +491,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 名字和描述可以直接写字符串也可以写个function将怪物传进去 // 名字和描述可以直接写字符串也可以写个function将怪物传进去
return [ return [
[1, "先攻", "怪物首先攻击", "#ffcc33"], [1, "先攻", "怪物首先攻击", "#ffcc33"],
[2, "魔攻", "怪物无视角色的防御", "#bbb0ff"],
[3, "坚固", "怪物防御不小于角色攻击-1", "#c0b088"], [3, "坚固", "怪物防御不小于角色攻击-1", "#c0b088"],
[4, "2连击", "怪物每回合攻击2次", "#ffee77"],
[5, "3连击", "怪物每回合攻击3次", "#ffee77"],
[6, function (enemy) { return (enemy.n || '') + "连击"; }, function (enemy) { return "怪物每回合攻击" + (enemy.n || 4) + "次"; }, "#ffee77"], [6, function (enemy) { return (enemy.n || '') + "连击"; }, function (enemy) { return "怪物每回合攻击" + (enemy.n || 4) + "次"; }, "#ffee77"],
[7, "破甲", function (enemy) { return "战斗前,怪物附加角色防御的" + Math.floor(100 * (enemy.breakArmor || core.values.breakArmor || 0)) + "%作为伤害"; }, "#88c0ff"], [7, "破甲", function (enemy) { return "战斗前,怪物附加角色防御的" + Math.floor(100 * (enemy.breakArmor || core.values.breakArmor || 0)) + "%作为伤害"; }, "#88c0ff"],
[8, "反击", function (enemy) { return "战斗时,怪物每回合附加角色攻击的" + Math.floor(100 * (enemy.counterAttack || core.values.counterAttack || 0)) + "%作为伤害,无视角色防御"; }, "#ffaa44"], [8, "反击", function (enemy) { return "战斗时,怪物每回合附加角色攻击的" + Math.floor(100 * (enemy.counterAttack || core.values.counterAttack || 0)) + "%作为伤害,无视角色防御"; }, "#ffaa44"],
@ -705,15 +702,12 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 每回合怪物对勇士造成的战斗伤害 // 每回合怪物对勇士造成的战斗伤害
var per_damage = mon_atk - hero_def; var per_damage = mon_atk - hero_def;
// 魔攻:战斗伤害就是怪物攻击力
if (core.hasSpecial(mon_special, 2)) per_damage = mon_atk;
// 战斗伤害不能为负值 // 战斗伤害不能为负值
if (per_damage < 0) per_damage = 0; if (per_damage < 0) per_damage = 0;
// 2连击 & 3连击 & N连击 // 连击
if (core.hasSpecial(mon_special, 4)) per_damage *= 2; if (core.hasSpecial(mon_special, 6)) per_damage *= (enemy.n || 2);
if (core.hasSpecial(mon_special, 5)) per_damage *= 3;
if (core.hasSpecial(mon_special, 6)) per_damage *= (enemy.n || 4);
// 每回合的反击伤害;反击是按照勇士的攻击次数来计算回合 // 每回合的反击伤害;反击是按照勇士的攻击次数来计算回合
var counterDamage = 0; var counterDamage = 0;
@ -1167,6 +1161,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
} }
}, },
"updateStatusBar": function () { "updateStatusBar": function () {
//更新属性映射
core.updateStatus()
// 更新状态栏 // 更新状态栏
core.ui.statusBar.update(); core.ui.statusBar.update();

View File

@ -144,7 +144,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"itemEffectTip": ",攻击+0" "itemEffectTip": ",攻击+0"
}, },
"sword1": { "sword1": {
"cls": "items", "cls": "equips",
"name": "铁剑", "name": "铁剑",
"text": "一把很普通的铁剑", "text": "一把很普通的铁剑",
"equip": { "equip": {
@ -152,27 +152,31 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"animate": "sword", "animate": "sword",
"value": { "value": {
"atk": 10 "atk": 10
} },
"percentage": {}
}, },
"itemEffect": "core.status.hero.atk += 10", "itemEffect": "core.status.hero.atk += 10",
"itemEffectTip": ",攻击+10" "itemEffectTip": ",攻击+10",
"equipCls": "双手剑"
}, },
"sword2": { "sword2": {
"cls": "items", "cls": "equips",
"name": "银剑", "name": "银剑",
"text": "一把很普通的银剑", "text": "一把很普通的银剑",
"equip": { "equip": {
"type": 0, "type": "武器",
"animate": "sword", "animate": "sword",
"value": { "value": {
"atk": 20 "atk": 20
} },
"percentage": {}
}, },
"itemEffect": "core.status.hero.atk += 20", "itemEffect": "core.status.hero.atk += 20",
"itemEffectTip": ",攻击+20" "itemEffectTip": ",攻击+20",
"equipCls": "匕首"
}, },
"sword3": { "sword3": {
"cls": "items", "cls": "equips",
"name": "骑士剑", "name": "骑士剑",
"text": "一把很普通的骑士剑", "text": "一把很普通的骑士剑",
"equip": { "equip": {
@ -180,38 +184,44 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"animate": "sword", "animate": "sword",
"value": { "value": {
"atk": 40 "atk": 40
} },
"percentage": {}
}, },
"itemEffect": "core.status.hero.atk += 40", "itemEffect": "core.status.hero.atk += 40",
"itemEffectTip": ",攻击+40" "itemEffectTip": ",攻击+40",
"equipCls": "法杖"
}, },
"sword4": { "sword4": {
"cls": "items", "cls": "equips",
"name": "圣剑", "name": "圣剑",
"text": "一把很普通的圣剑", "text": "一把很普通的圣剑",
"equip": { "equip": {
"type": 0, "type": "武器",
"animate": "sword", "animate": "sword",
"value": { "value": {
"atk": 80 "atk": 80
} },
"percentage": {}
}, },
"itemEffect": "core.status.hero.atk += 80", "itemEffect": "core.status.hero.atk += 80",
"itemEffectTip": ",攻击+80" "itemEffectTip": ",攻击+80",
"equipCls": "单手剑"
}, },
"sword5": { "sword5": {
"cls": "equips", "cls": "equips",
"name": "神圣剑", "name": "神圣剑",
"text": "一把很普通的神圣剑", "text": "一把很普通的神圣剑",
"equip": { "equip": {
"type": 0, "type": "武器",
"animate": "sword", "animate": "sword",
"value": { "value": {
"atk": 160 "atk": 160
} },
"percentage": {}
}, },
"itemEffect": "core.status.hero.atk += 100", "itemEffect": "core.status.hero.atk += 100",
"itemEffectTip": ",攻击+100" "itemEffectTip": ",攻击+100",
"equipCls": "匕首"
}, },
"shield0": { "shield0": {
"cls": "items", "cls": "items",
@ -234,10 +244,12 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"type": 1, "type": 1,
"value": { "value": {
"def": 10 "def": 10
} },
"percentage": {}
}, },
"itemEffect": "core.status.hero.def += 10", "itemEffect": "core.status.hero.def += 10",
"itemEffectTip": ",防御+10" "itemEffectTip": ",防御+10",
"equipCls": "盾牌"
}, },
"shield2": { "shield2": {
"cls": "items", "cls": "items",

View File

@ -2940,6 +2940,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
this.doEvent(data, x, y, prefix); this.doEvent(data, x, y, prefix);
return; return;
} }
}, },
"额外信息": function () { "额外信息": function () {
/* /*
@ -3864,9 +3865,11 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
cls: "equips", cls: "equips",
name: "未知装备", name: "未知装备",
text: "一无所有,又何尝不是一种装备", text: "一无所有,又何尝不是一种装备",
equipCls: "无",
equip: { equip: {
type: "装备" type: "装备",
} }
} }
///// *** ///// ***
@ -3890,8 +3893,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.setTextBaseline(ctx, "middle"); core.setTextBaseline(ctx, "middle");
core.fillText(ctx, itemName, itemName_x, itemName_middle, itemNameColor, itemNameFont, itemNameMaxWidth); core.fillText(ctx, itemName, itemName_x, itemName_middle, itemNameColor, itemNameFont, itemNameMaxWidth);
core.fillText(ctx, "【" + itemClsName + "】", itemCls_x, itemCls_middle, itemClsColor, itemClsFont); core.fillText(ctx, "【" + itemClsName + "】", itemCls_x, itemCls_middle, itemClsColor, itemClsFont);
var statusText = ""; var statusText = "【装备类型】" + item.equipCls + '\n\n';
if (core.status.event.id == "equipbox") { /*if (core.status.event.id == "equipbox") {
var type = item.equip.type; var type = item.equip.type;
if (typeof type == "string") type = core.getEquipTypeByName(type); if (typeof type == "string") type = core.getEquipTypeByName(type);
var compare = core.compareEquipment(item.id, core.getEquip(type)); var compare = core.compareEquipment(item.id, core.getEquip(type));
@ -3909,7 +3912,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
newValue = core.formatBigNumber(newValue); newValue = core.formatBigNumber(newValue);
statusText += core.getStatusLabel(name) + " " + nowValue + "->\r[" + color + "]" + newValue + "\r\n"; statusText += core.getStatusLabel(name) + " " + nowValue + "->\r[" + color + "]" + newValue + "\r\n";
} }
} }*/
itemText = statusText + itemText; itemText = statusText + itemText;
core.drawTextContent(ctx, itemText, { core.drawTextContent(ctx, itemText, {
left: itemText_x, left: itemText_x,
@ -3999,6 +4002,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
for (var i = 0; i < len; i++) { for (var i = 0; i < len; i++) {
var id = core.getEquip(i), var id = core.getEquip(i),
name = toDrawList[i]; name = toDrawList[i];
if (i === 0) name = "主手";
if (i === 1) name = "副手";
var selectBorder = false; var selectBorder = false;
if (core.status.thisUIEventInfo.select.type == i) selectBorder = true; if (core.status.thisUIEventInfo.select.type == i) selectBorder = true;
var borderStyle = selectBorder ? box_selectBorderStyle : box_borderStyle; var borderStyle = selectBorder ? box_selectBorderStyle : box_borderStyle;
@ -4011,6 +4016,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
box_y += space_y + oneBoxHeight; box_y += space_y + oneBoxHeight;
} }
} }
if (core.material.items[core.getEquip(0)]?.equipCls === "双手剑") {
core.drawLine(ctx, equipList_x + space_x + space_x + oneBoxWidth, equipList_y + space_y, equipList_x + space_x + space_x + oneBoxWidth + box_width + box_borderWidth, equipList_y + space_y + box_height)
core.drawLine(ctx, equipList_x + space_x + space_x + oneBoxWidth, equipList_y + space_y + box_height, equipList_x + space_x + space_x + oneBoxWidth + box_width + box_borderWidth, equipList_y + space_y)
}
} }
this.drawToolbox = function (ctx) { this.drawToolbox = function (ctx) {
@ -4211,6 +4220,80 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
info.index = 1; info.index = 1;
if (action == "load") { if (action == "load") {
var type = core.getEquipTypeById(id); var type = core.getEquipTypeById(id);
let equipClsid = core.material.items[id]?.equipCls;
let equipCls0 = core.material.items[core.getEquip(0)]?.equipCls;
let equipCls1 = core.material.items[core.getEquip(1)]?.equipCls;
if (equipCls0 === "双手剑") {
core.unloadEquip(0, function () {
core.status.route.push("unEquip:" + 0);
});
}
if (equipClsid === "单手剑") {
if (equipCls1 !== "单手剑" && equipCls1 !== "匕首" && equipCls1 !== "盾牌") {
core.unloadEquip(0, function () {
core.status.route.push("unEquip:" + 0);
});
core.unloadEquip(1, function () {
core.status.route.push("unEquip:" + 1);
});
} else if (equipCls0 !== "单手剑") {
core.unloadEquip(0, function () {
core.status.route.push("unEquip:" + 0);
});
}
}
if (equipClsid === "法杖") {
if (equipCls1 !== "匕首" && equipCls1 !== "盾牌") {
core.unloadEquip(0, function () {
core.status.route.push("unEquip:" + 0);
});
core.unloadEquip(1, function () {
core.status.route.push("unEquip:" + 1);
});
} else {
core.unloadEquip(0, function () {
core.status.route.push("unEquip:" + 0);
});
}
}
if (equipClsid === "双手剑") {
core.unloadEquip(0, function () {
core.status.route.push("unEquip:" + 0);
});
core.unloadEquip(1, function () {
core.status.route.push("unEquip:" + 1);
});
}
if (equipClsid === "匕首") {
if (equipCls0 !== "匕首") {
core.unloadEquip(0, function () {
core.status.route.push("unEquip:" + 0);
});
core.unloadEquip(1, function () {
core.status.route.push("unEquip:" + 1);
});
} else {
core.unloadEquip(1, function () {
core.status.route.push("unEquip:" + 1);
});
}
}
if (equipClsid === "盾牌") {
if (equipCls0 !== "单手剑" && equipCls0 !== "法杖") {
core.unloadEquip(0, function () {
core.status.route.push("unEquip:" + 0);
});
core.unloadEquip(1, function () {
core.status.route.push("unEquip:" + 1);
});
} else {
core.unloadEquip(1, function () {
core.status.route.push("unEquip:" + 1);
});
}
}
core.loadEquip(id, function () { core.loadEquip(id, function () {
core.status.route.push("equip:" + id); core.status.route.push("equip:" + id);
info.select.type = type; info.select.type = type;
@ -4228,6 +4311,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}); });
} }
} }
core.updateStatusBar()
} }
this.setIndexAndSelect = function (toChange) { this.setIndexAndSelect = function (toChange) {
var info = core.status.thisUIEventInfo; var info = core.status.thisUIEventInfo;
@ -9959,5 +10043,127 @@ core.plugin.animate = {
} }
core.ui.cgText = new cgText() core.ui.cgText = new cgText()
},
"属性映射": function () {
// 在此增加新插件
this.statusEquip = function () {
const hero = core.status.hero;
//装备具体效果在这里写道具填写道具类型为equip并选择装备类型道具的装备属性中装备类型遵循以下填写方式
//固定装备孔的填写0/1/2/3分别对应主手、副手、防具、饰品
//主副手同时可使用的,填写 武器
//具体的换装时装备切换操作写在新道具栏/物品栏插件
//当前仅完善法杖、单手剑、双手剑、匕首、盾牌的多孔切换操作
//主武器效果
if (core.getEquip[0]) {
switch (core.getEquip[0]) {
case "sword1":
hero.atk = hero.str + hero.agi;
hero.magic = false;
break;
}
}
//副手效果
if (core.getEquip[1]) {
switch (core.getEquip[1]) {
case "sword1":
hero.atk += hero.agi;
break;
}
}
//防具效果
if (core.getEquip[2]) {
switch (core.getEquip[2]) {
case "sword1":
hero.def = hero.con + hero.agi;
hero.hpmax = 2.5 * hero.con;
break;
}
}
//饰品效果
if (core.getEquip[3]) {
switch (core.getEquip[3]) {
case "sword1":
hero.speed += 0.4 * hero.int + 0.6 * hero.agi;
break;
}
}
}
this.updateStatus = function () {
const hero = core.status.hero;
//默认映射关系
hero.hpmax = hero.str * 50 + hero.con * 50;
hero.atk = hero.str * 0.5 + hero.int * 0.5;
hero.manamax = hero.agi * 0.5 + hero.int * 0.5;
hero.def = hero.con * 0.5 + hero.agi * 0.5;
hero.mdef = hero.con * 0.5 + hero.int * 0.5;
hero.speed = hero.str * 0.5 + hero.agi * 0.5;
hero.magic = false;
this.statusEquip(); //处理装备效果
for (let v in hero) { //归整
if (typeof hero[v] === 'number') {
hero[v] = Math.floor(hero[v])
}
}
hero.hp = Math.min(hero.hp, hero.hpmax)
hero.mana = Math.min(hero.mana, hero.manamax)
core.status.hero = hero
}
},
"回合制boss战": function () {
// 在此增加新插件
const boss = document.createElement('canvas'); //boss战画布设置
boss.style.position = 'absolute';
boss.style.zIndex = 300;
boss.style.display = "none"
boss.id = 'boss';
main.dom.gameGroup.insertAdjacentElement('afterend', boss)
boss.style.top = "50%"
boss.style.left = "50%"
boss.style.transform = "translate(-50%,-50%)"
const ctx = boss.getContext("2d");
main.dom.boss = boss;
boss.onclick = function (e) {
try {
e.preventDefault();
if (core.isPlaying()) return false;
const left = core.dom.gameGroup.offsetLeft;
const top = core.dom.gameGroup.offsetTop;
const px = Math.floor((e.clientX - left) / core.domStyle.scale),
py = Math.floor((e.clientY - top) / core.domStyle.scale);
core.ui.boss.onclick(px * 3, py * 3);
} catch (ee) {
main.log(ee);
}
}
class boss1 {
constructor() {
this.bg = ""
}
cavans() {
if (core.domStyle.isVertical) {
ctx.canvas.width = 1248;
ctx.canvas.height = 2028;
core.setTextAlign(ctx, 'center');
} else {
ctx.canvas.width = 2028;
ctx.canvas.height = 1248;
core.setTextAlign(ctx, 'center');
}
}
start() {
}
onclick(px, py) {
}
}
core.ui.boss = new boss1()
} }
} }