战斗动画,属性更名
This commit is contained in:
parent
25fb914841
commit
396abfe222
@ -269,7 +269,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_type": "textarea",
|
||||
"_data": "法强",
|
||||
},
|
||||
"spelldef": {
|
||||
"mdef": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_data": "法抗百分比",
|
||||
@ -280,7 +280,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_data": "100为法强转化为等值魔攻",
|
||||
"_docs": "魔攻比例"
|
||||
},
|
||||
"mdef": {
|
||||
"mhp": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_data": "100为法强转化为等值护盾",
|
||||
|
@ -437,12 +437,14 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"face_440110.webp",
|
||||
"green.webp",
|
||||
"hero.webp",
|
||||
"jianji.webp",
|
||||
"l.webp",
|
||||
"lane1.webp",
|
||||
"light.webp",
|
||||
"lock.webp",
|
||||
"lr.webp",
|
||||
"maba.webp",
|
||||
"miwu.webp",
|
||||
"null.webp",
|
||||
"other_0001.webp",
|
||||
"other_0002.webp",
|
||||
@ -1116,7 +1118,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"atk": 100,
|
||||
"def": 100,
|
||||
"mdef": 0,
|
||||
"speed": 0,
|
||||
"speed": 10,
|
||||
"money": 0,
|
||||
"exp": 0,
|
||||
"equipment": [],
|
||||
@ -1494,14 +1496,12 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
],
|
||||
"startText": [
|
||||
{
|
||||
"type": "setValue",
|
||||
"name": "item:book",
|
||||
"value": "1"
|
||||
"type": "function",
|
||||
"function": "function(){\ncore.getItem('book',1);core.getItem('fly',1)\n}"
|
||||
},
|
||||
{
|
||||
"type": "setValue",
|
||||
"name": "item:fly",
|
||||
"value": "1"
|
||||
"type": "insert",
|
||||
"name": "战斗动画特效注册"
|
||||
},
|
||||
{
|
||||
"type": "insert",
|
||||
|
@ -4,7 +4,7 @@ var enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 =
|
||||
"redSlime": {"name":"红头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[],"value":10,"magic":false},
|
||||
"blackSlime": {"name":"青头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"slimelord": {"name":"怪王","hp":100,"atk":120,"def":0,"money":10,"exp":0,"point":0,"special":[1,9]},
|
||||
"bat": {"name":"小蝙蝠","hp":100,"atk":120,"def":0,"money":2,"exp":0,"point":0,"special":[1],"mdef":0,"speed":10},
|
||||
"bat": {"name":"小蝙蝠","hp":100,"atk":120,"def":0,"money":2,"exp":0,"point":0,"special":[1],"mdef":0,"speed":15},
|
||||
"bigBat": {"name":"大蝙蝠","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"redBat": {"name":"红蝙蝠","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"vampire": {"name":"冥灵魔王","hp":888,"atk":888,"def":888,"money":888,"exp":888,"point":0,"special":[6],"n":8},
|
||||
|
@ -10883,6 +10883,136 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"战斗动画特效注册": [
|
||||
{
|
||||
"type": "setanimate",
|
||||
"name": "sword",
|
||||
"px": 48,
|
||||
"py": 48,
|
||||
"width": 192,
|
||||
"height": 192,
|
||||
"allFarme": 15,
|
||||
"imageList": [
|
||||
{
|
||||
"image": "jianji.webp",
|
||||
"beforefarme": 0,
|
||||
"globalAlpha": 100,
|
||||
"cx": 192,
|
||||
"cy": 2112,
|
||||
"cw": 192,
|
||||
"ch": 192,
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 96,
|
||||
"h": 96,
|
||||
"afterfarme": 3,
|
||||
"acx": 192,
|
||||
"acy": 2112,
|
||||
"acw": 192,
|
||||
"ach": 192,
|
||||
"ax": 0,
|
||||
"ay": 0,
|
||||
"aw": 96,
|
||||
"ah": 96
|
||||
},
|
||||
{
|
||||
"image": "jianji.webp",
|
||||
"beforefarme": 4,
|
||||
"globalAlpha": 100,
|
||||
"cx": 384,
|
||||
"cy": 2112,
|
||||
"cw": 192,
|
||||
"ch": 192,
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 96,
|
||||
"h": 96,
|
||||
"afterfarme": 6,
|
||||
"acx": 384,
|
||||
"acy": 2112,
|
||||
"acw": 192,
|
||||
"ach": 192,
|
||||
"ax": 0,
|
||||
"ay": 0,
|
||||
"aw": 96,
|
||||
"ah": 96
|
||||
},
|
||||
{
|
||||
"image": "jianji.webp",
|
||||
"beforefarme": 7,
|
||||
"globalAlpha": 100,
|
||||
"cx": 576,
|
||||
"cy": 2112,
|
||||
"cw": 192,
|
||||
"ch": 192,
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 96,
|
||||
"h": 96,
|
||||
"afterfarme": 9,
|
||||
"acx": 576,
|
||||
"acy": 2112,
|
||||
"acw": 192,
|
||||
"ach": 192,
|
||||
"ax": 0,
|
||||
"ay": 0,
|
||||
"aw": 96,
|
||||
"ah": 96
|
||||
},
|
||||
{
|
||||
"image": "jianji.webp",
|
||||
"beforefarme": 10,
|
||||
"globalAlpha": 100,
|
||||
"cx": 768,
|
||||
"cy": 2112,
|
||||
"cw": 192,
|
||||
"ch": 192,
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 96,
|
||||
"h": 96,
|
||||
"afterfarme": 12,
|
||||
"acx": 768,
|
||||
"acy": 2112,
|
||||
"acw": 192,
|
||||
"ach": 192,
|
||||
"ax": 0,
|
||||
"ay": 0,
|
||||
"aw": 96,
|
||||
"ah": 96
|
||||
},
|
||||
{
|
||||
"image": "jianji.webp",
|
||||
"beforefarme": 13,
|
||||
"globalAlpha": 100,
|
||||
"cx": 0,
|
||||
"cy": 2304,
|
||||
"cw": 192,
|
||||
"ch": 192,
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 96,
|
||||
"h": 96,
|
||||
"afterfarme": 15,
|
||||
"acx": 0,
|
||||
"acy": 2304,
|
||||
"acw": 192,
|
||||
"ach": 192,
|
||||
"ax": 0,
|
||||
"ay": 0,
|
||||
"aw": 96,
|
||||
"ah": 96
|
||||
}
|
||||
],
|
||||
"soundList": [
|
||||
{
|
||||
"sound": "",
|
||||
"startfarme": 0,
|
||||
"stopbefore": false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"CommonEventTemplate": {
|
||||
|
@ -982,8 +982,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
mon_length = length,
|
||||
hero_length = length,
|
||||
mon_time = 0,
|
||||
hero_time = 0;
|
||||
now_mon_hp > 0;
|
||||
hero_time = 0; now_mon_hp > 0;
|
||||
|
||||
) {
|
||||
//勇士和怪物的长度
|
||||
|
BIN
project/images/jianji.webp
Normal file
BIN
project/images/jianji.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 370 KiB |
BIN
project/images/miwu.webp
Normal file
BIN
project/images/miwu.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
@ -113,7 +113,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
data.image,
|
||||
data.memory,
|
||||
data.hidetime || 30,
|
||||
data.list || [{
|
||||
data.list || [
|
||||
{
|
||||
text: "",
|
||||
sound: "",
|
||||
time: 50,
|
||||
@ -121,7 +122,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
boldColor: "#000000",
|
||||
font: "bold 48px Verdana",
|
||||
frame: 0,
|
||||
}, ]
|
||||
},
|
||||
]
|
||||
);
|
||||
} else {
|
||||
core.doAction();
|
||||
@ -201,9 +203,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
core.ui.cgText.head = core.clone(data.head);
|
||||
core.ui.cgText.index = data.index;
|
||||
core.ui.cgText.name = core.ui.cgText.textList[data.index][0];
|
||||
core.ui.cgText.text = data.text ?
|
||||
data.text :
|
||||
core.ui.cgText.textList[data.index][1];
|
||||
core.ui.cgText.text = data.text
|
||||
? data.text
|
||||
: core.ui.cgText.textList[data.index][1];
|
||||
core.ui.cgText.time = data.time;
|
||||
core.ui.cgText.wait = data.wait;
|
||||
core.ui.cgText.WindowSkin = data.WindowSkin;
|
||||
@ -2845,10 +2847,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
const totalWidthScaled = totalWidth * core.domStyle.scale,
|
||||
totalHeightScaled = totalHeight * core.domStyle.scale;
|
||||
|
||||
const gameDrawBox = isVertical ? {
|
||||
const gameDrawBox = isVertical ?
|
||||
{
|
||||
left: BORDER_WIDTH / 3,
|
||||
top: BAR_HEIGHT_VERTICAL / 3 + BORDER_HEIGHT / 3,
|
||||
} : { left: BAR_WIDTH / 3 + BORDER_WIDTH / 3, top: BORDER_HEIGHT / 3 };
|
||||
} :
|
||||
{ left: BAR_WIDTH / 3 + BORDER_WIDTH / 3, top: BORDER_HEIGHT / 3 };
|
||||
|
||||
const obj = {
|
||||
clientWidth: clientWidth,
|
||||
@ -3485,10 +3489,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
this._update_infoWindow();
|
||||
}
|
||||
_update_toolBox() {
|
||||
const tools = core.isReplaying() ? [
|
||||
const tools = core.isReplaying() ?
|
||||
[
|
||||
[core.status.replay.pausing ? "play" : "pause", "stop", "rewind"],
|
||||
["speedDown", "speedUp", "save"],
|
||||
] : [
|
||||
] :
|
||||
[
|
||||
["keyboard", "shop", "pack", "T332"],
|
||||
["settings", "save", "load", "T331"],
|
||||
];
|
||||
@ -3842,7 +3848,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
var mid = Math.floor((start + end) / 2);
|
||||
if (mid - start > end - mid) mid--;
|
||||
var nextInfo = core.enemys.getDamageInfo(
|
||||
enemy, { atk: mid },
|
||||
enemy,
|
||||
{ atk: mid },
|
||||
x,
|
||||
y,
|
||||
floorId
|
||||
@ -3852,15 +3859,17 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
else start = mid + 1;
|
||||
}
|
||||
var nextInfo = core.enemys.getDamageInfo(
|
||||
enemy, { atk: start },
|
||||
enemy,
|
||||
{ atk: start },
|
||||
x,
|
||||
y,
|
||||
floorId
|
||||
);
|
||||
return nextInfo == null ||
|
||||
typeof nextInfo == "number" ||
|
||||
nextInfo.damage >= pre ?
|
||||
null : [start, nextInfo.damage];
|
||||
nextInfo.damage >= pre
|
||||
? null
|
||||
: [start, nextInfo.damage];
|
||||
};
|
||||
var currAtk = start_atk;
|
||||
while (true) {
|
||||
@ -4293,8 +4302,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
events.prototype.battle = function (id, x, y, force, callback) {
|
||||
core.saveAndStopAutomaticRoute();
|
||||
id = id || core.getBlockId(x, y);
|
||||
const cls = core.getClsFromId(id)
|
||||
if (!id || !cls || !(cls === 'enemys' || cls === 'enemy48')) return core.clearContinueAutomaticRoute(callback);
|
||||
const cls = core.getClsFromId(id);
|
||||
if (!id || !cls || !(cls === "enemys" || cls === "enemy48"))
|
||||
return core.clearContinueAutomaticRoute(callback);
|
||||
// 非强制战斗
|
||||
if (!core.enemys.canBattle(id, x, y) && !force && !core.status.event.id) {
|
||||
core.stopSound();
|
||||
@ -4311,7 +4321,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
this.afterBattle(id, x, y);
|
||||
if (callback) callback();
|
||||
};
|
||||
|
||||
},
|
||||
"额外信息": function () {
|
||||
/* 宝石血瓶左下角显示数值
|
||||
@ -9180,7 +9189,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
const type = checkAudioType(data);
|
||||
if (type === "") {
|
||||
console.error(
|
||||
"Unknown audio type. Header: '" + [...toCheck]
|
||||
"Unknown audio type. Header: '" +
|
||||
[...toCheck]
|
||||
.map((v) => v.toString().padStart(2, "0"))
|
||||
.join(" ")
|
||||
.toUpperCase() +
|
||||
@ -9303,7 +9313,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
return !isNil(data.isFirstPage);
|
||||
}
|
||||
class AudioStreamSource {
|
||||
|
||||
constructor(context) {
|
||||
this.output = context.createBufferSource();
|
||||
/** 是否已经完全加载完毕 */
|
||||
@ -9366,7 +9375,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
this.audioType = checkAudioType(data);
|
||||
if (!this.audioType) {
|
||||
console.error(
|
||||
"Unknown audio type. Header: '" + [...toCheck]
|
||||
"Unknown audio type. Header: '" +
|
||||
[...toCheck]
|
||||
.map((v) => v.toString(16).padStart(2, "0"))
|
||||
.join(" ")
|
||||
.toUpperCase() +
|
||||
@ -9663,7 +9673,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
}
|
||||
}
|
||||
class AudioElementSource {
|
||||
|
||||
constructor(context) {
|
||||
const audio = new Audio();
|
||||
audio.preload = "none";
|
||||
@ -9721,7 +9730,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
}
|
||||
}
|
||||
class AudioBufferSource {
|
||||
|
||||
constructor(context) {
|
||||
this.output = context.createBufferSource();
|
||||
/** 是否循环 */
|
||||
@ -10810,251 +10818,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
core.playSound("确定");
|
||||
core.ui._drawSwitchs_sounds();
|
||||
};
|
||||
},
|
||||
"怪物碎裂特效": function () {
|
||||
// 在此增加新插件
|
||||
// -------------------- 安装说明 -------------------- //
|
||||
// 先安装两个在插件简介中说明的前置插件
|
||||
// 然后再将本插件复制到插件编写中即可
|
||||
// 插件自带一个打怪后显示碎裂特效的功能
|
||||
// -------------------- 使用说明 -------------------- //
|
||||
/*
|
||||
|
||||
本插件的核心是一个名为 applyFragWith 的函数,打怪后的碎裂特效也是由它执行的。
|
||||
我们来说明一下这个函数的使用方式。
|
||||
1. 引入
|
||||
你可以使用 const { applyFragWith } = core.plugin.frag; 在任何地方来引入这个函数。
|
||||
|
||||
2. 函数的参数
|
||||
该函数有三个参数,分别是canvas, length, time。
|
||||
其中,第一个参数意思是,在执行碎裂时,其内容由该画布决定,这个特效并不会修改传入的画布,因此原画布的内容会依然存在
|
||||
第二个参数指的是每个碎片的边长,虽然原则上每个碎片都是正方形,但边缘一周的碎片可能不是正方形,但中间的碎片一定是
|
||||
第三个参数指的是这个特效要执行多长时间
|
||||
第四个参数是一个对象,包含四种配置量,均为可选,分别是maxMoveLength,moveFlush,maxRotate,fragTiming
|
||||
当这些不存在时会默认取同名的常量作为默认值。这些值有什么用可以看下面的常量注释。
|
||||
|
||||
3. 函数的返回值
|
||||
这个函数会返回一个特效控制器对象,这个控制器共有三个属性。
|
||||
animation: 指的是当前特效的高级动画对象
|
||||
onEnd: 一个Promise,当这个特效执行完毕后会被 fulfilled
|
||||
canvas: 特效所显示的画布。这个画布不会自动部署到样板中,需要你手动使用appendChild来部署,具体可参考打怪后碎裂的样例
|
||||
|
||||
4. 修改一些常量
|
||||
在下面有四个有注释的常量MAX_MOVE_LENGTH ~ FRAG_TIMING,你可以根据你自己的需要来更改。
|
||||
|
||||
*/
|
||||
|
||||
if (main.replayChecking) return (core.plugin.frag = {});
|
||||
|
||||
const { Animation, linear, sleep } = core.plugin.animate;
|
||||
const { has } = core.plugin.utils;
|
||||
|
||||
/** 最大移动距离,最终位置距离中心的距离变成原来的几倍 */
|
||||
const MAX_MOVE_LENGTH = 1.15;
|
||||
/** 移动距离波动,在最大移动距离的基础上加上多少倍距离的波动距离 */
|
||||
const MOVE_FLUSH = 0.7;
|
||||
/** 最大旋转角,单位是弧度,每个碎片都会有自己的旋转程度,是随机的 */
|
||||
const MAX_ROTATE = 0.5;
|
||||
/** 碎裂动画的速率曲线函数 */
|
||||
const FRAG_TIMING = linear();
|
||||
|
||||
/**
|
||||
* @param {HTMLCanvasElement} canvas 要执行特效的画布
|
||||
* @param {number} length 切分成的碎片的边长,碎片为正方形
|
||||
* @param {number} time 特效持续时长
|
||||
* @returns 返回一个碎裂特效控制器,是一个对象,详见开头的使用注释
|
||||
*/
|
||||
function applyFragWith(canvas, length = 4, time = 2000, config = {}) {
|
||||
// 先切分图片
|
||||
const imgs = splitCanvas(canvas, length);
|
||||
const cx = canvas.width / 2;
|
||||
const cy = canvas.height / 2;
|
||||
|
||||
let maxX = 0;
|
||||
let maxY = 0;
|
||||
const toMove = imgs.map((v) => {
|
||||
const centerX = v.x + v.canvas.width / 2;
|
||||
const centerY = v.y + v.canvas.height / 2;
|
||||
const onX = centerX === cx;
|
||||
const onY = centerY === cy;
|
||||
const mml = config.maxMoveLength ?? MAX_MOVE_LENGTH;
|
||||
const mf = config.moveFlush ?? MOVE_FLUSH;
|
||||
const rate = mml - 1 + Math.random() ** 3 * mf;
|
||||
let endX = onY ? 0 : (centerX - cx) * rate;
|
||||
let endY = onX ? 0 : (centerY - cy) * rate;
|
||||
const mx = Math.abs(endX + centerX) + Math.abs(v.canvas.width);
|
||||
const my = Math.abs(endY + centerY) + Math.abs(v.canvas.height);
|
||||
if (mx > maxX) maxX = mx;
|
||||
if (my > maxY) maxY = my;
|
||||
const r = config.maxRotate ?? MAX_ROTATE;
|
||||
const endRad = Math.random() * r * 2 - r;
|
||||
|
||||
return {
|
||||
deltaX: endX,
|
||||
deltaY: endY,
|
||||
endRad,
|
||||
x: centerX,
|
||||
y: centerY,
|
||||
canvas: v.canvas,
|
||||
};
|
||||
});
|
||||
|
||||
// 再执行动画
|
||||
const frag = document.createElement("canvas");
|
||||
const ctx = frag.getContext("2d");
|
||||
const ani = new Animation();
|
||||
ani.register("rate", 0);
|
||||
const ft = config.fragTiming ?? FRAG_TIMING;
|
||||
ani.absolute().time(time).mode(ft).apply("rate", 1);
|
||||
frag.width = maxX * 2;
|
||||
frag.height = maxY * 2;
|
||||
ctx.save();
|
||||
const dw = maxX - canvas.width / 2;
|
||||
const dh = maxY - canvas.height / 2;
|
||||
|
||||
const fragFn = () => {
|
||||
const rate = ani.value.rate;
|
||||
const opacity = 1 - rate;
|
||||
ctx.globalAlpha = opacity;
|
||||
ctx.clearRect(0, 0, frag.width, frag.height);
|
||||
toMove.forEach((v) => {
|
||||
ctx.save();
|
||||
const nx = v.deltaX * rate;
|
||||
const ny = v.deltaY * rate;
|
||||
const rotate = v.endRad * rate;
|
||||
|
||||
ctx.translate(nx + v.x + dw, ny + v.y + dh);
|
||||
ctx.rotate(rotate);
|
||||
ctx.drawImage(
|
||||
v.canvas,
|
||||
nx - v.canvas.width / 2,
|
||||
ny - v.canvas.height / 2
|
||||
);
|
||||
ctx.restore();
|
||||
});
|
||||
};
|
||||
const onEnd = () => {};
|
||||
ani.ticker.add(fragFn);
|
||||
|
||||
return makeFragManager(frag, ani, time, onEnd);
|
||||
}
|
||||
|
||||
function makeFragManager(canvas, ani, time, onEnd) {
|
||||
const promise = sleep(time + 50);
|
||||
|
||||
return {
|
||||
animation: ani,
|
||||
|
||||
onEnd: promise.then(() => {
|
||||
ani.ticker.destroy();
|
||||
onEnd();
|
||||
}),
|
||||
canvas,
|
||||
};
|
||||
}
|
||||
|
||||
function withImage(image, sx, sy, sw, sh) {
|
||||
const canvas = document.createElement("canvas");
|
||||
const ctx = canvas.getContext("2d");
|
||||
canvas.width = sw;
|
||||
canvas.height = sh;
|
||||
ctx.drawImage(image, sx, sy, sw, sh, 0, 0, sw, sh);
|
||||
return { canvas, x: sx, y: sy };
|
||||
}
|
||||
|
||||
/**
|
||||
* 切分画布
|
||||
* @param canvas 要被切分的画布
|
||||
* @param l 切分小块的边长
|
||||
*/
|
||||
function splitCanvas(canvas, l) {
|
||||
if (canvas.width / l < 2 || canvas.height / l < 2) {
|
||||
console.warn("切分画布要求切分边长大于等于画布长宽的一半!");
|
||||
return [];
|
||||
}
|
||||
const w = canvas.width;
|
||||
const h = canvas.height;
|
||||
const numX = Math.floor(w / l);
|
||||
const numY = Math.floor(h / l);
|
||||
const rw = (w - numX * l) / 2;
|
||||
const rh = (h - numY * l) / 2;
|
||||
|
||||
const res = [];
|
||||
|
||||
if (rw > 0) {
|
||||
if (rh > 0) {
|
||||
res.push(
|
||||
withImage(canvas, 0, 0, rw, rh),
|
||||
withImage(canvas, 0, canvas.height - rh, rw, rh),
|
||||
withImage(canvas, canvas.width - rw, 0, rw, rh),
|
||||
withImage(canvas, canvas.width - rw, canvas.height - rh, rw, rh)
|
||||
);
|
||||
}
|
||||
for (const x of [0, canvas.width - rw]) {
|
||||
for (let ny = 0; ny < numY; ny++) {
|
||||
res.push(withImage(canvas, x, rh + l * ny, rw, l));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rh > 0) {
|
||||
for (const y of [0, canvas.height - rh]) {
|
||||
for (let nx = 0; nx < numX; nx++) {
|
||||
res.push(withImage(canvas, rw + l * nx, y, l, rh));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let nx = 0; nx < numX; nx++) {
|
||||
for (let ny = 0; ny < numY; ny++) {
|
||||
res.push(withImage(canvas, rw + l * nx, rh + l * ny, l, l));
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
const origin = core.events.afterBattle;
|
||||
core.events.afterBattle = function (enemyId, x, y) {
|
||||
// 打怪特效
|
||||
if (has(x) && has(y)) {
|
||||
const frame = core.status.globalAnimateStatus % 2;
|
||||
// 生成怪物图像
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.width = 32;
|
||||
canvas.height = 32;
|
||||
core.drawIcon(canvas, enemyId, 0, 0, 32, 32, frame);
|
||||
// 执行动画
|
||||
const manager = applyFragWith(canvas);
|
||||
const frag = manager.canvas;
|
||||
// 设置特效画布的css属性
|
||||
frag.style.imageRendering = "pixelated";
|
||||
frag.style.width = `${frag.width * core.domStyle.scale}px`;
|
||||
frag.style.height = `${frag.height * core.domStyle.scale}px`;
|
||||
const left =
|
||||
(x * 32 + 16 - frag.width / 2 - core.bigmap.offsetX) *
|
||||
core.domStyle.scale;
|
||||
const top =
|
||||
(y * 32 + 16 - frag.height / 2 - core.bigmap.offsetY) *
|
||||
core.domStyle.scale;
|
||||
frag.style.left = `${left}px`;
|
||||
frag.style.top = `${top}px`;
|
||||
frag.style.zIndex = "45";
|
||||
frag.style.position = "absolute";
|
||||
// 将特效画布部署到样板上
|
||||
core.dom.gameDraw.appendChild(frag);
|
||||
// 当特效执行完毕后移除这个特效画布
|
||||
manager.onEnd.then(() => {
|
||||
frag.remove();
|
||||
});
|
||||
}
|
||||
return origin.apply(this, arguments);
|
||||
};
|
||||
|
||||
if ("frag" in core.plugin) {
|
||||
throw new ReferenceError(`core.plugin上已存在名为frag的属性!`);
|
||||
}
|
||||
core.plugin.frag = {
|
||||
applyFragWith,
|
||||
};
|
||||
},
|
||||
"自定义常用事件": function () {
|
||||
// editorBlocklyconfigPlus.js
|
||||
@ -13096,8 +12859,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
core.drawImage(ctx, img, 0, 0, 60, 60, fx, fy, w, h);
|
||||
const layer = info.upOrDown[id];
|
||||
const min = Math.min(w, h);
|
||||
if (core.getFlag("任务地点") && core.getFlag("任务地点") === id)
|
||||
ctx.drawImage(tesk, fx + min / 4, fy + min / 4, min / 2, min / 2);
|
||||
|
||||
|
||||
if (layer?.includes("upFloor"))
|
||||
core.drawIcon(
|
||||
ctx,
|
||||
@ -13116,7 +12879,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
min / 2,
|
||||
min / 2
|
||||
);
|
||||
|
||||
if (core.getFlag("任务地点") && core.getFlag("任务地点") === id)
|
||||
ctx.drawImage(tesk, fx + min / 4, fy + min / 4, min / 2, min / 2);
|
||||
if (id === core.status.floorId) core.drawImage(ctx, "hero.webp",
|
||||
0,
|
||||
0,
|
||||
32,
|
||||
19, fx + min / 4, fy + min * 5 / 16, 32, 19);
|
||||
// 显示漏怪数量
|
||||
if (core.getFlag("showEnemy")) {
|
||||
ctx.textAlign = "center";
|
||||
@ -13139,6 +12908,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
);
|
||||
ctx.shadowBlur = 0;
|
||||
}
|
||||
if (!core.hasVisitedFloor(id)) {
|
||||
core.fillRect(ctx, fx, fy, w, h, "rgba(0,0,0,0.7)")
|
||||
core.fillText(ctx, "?", fx + min / 2, fy + min * 3 / 4, "#FFFFFF", "bold 42px Verdana")
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
@ -13528,20 +13301,30 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
if (
|
||||
!core.status.maps[core.floorIds[page]].canFlyTo ||
|
||||
!core.hasVisitedFloor(core.floorIds[page])
|
||||
)
|
||||
) {
|
||||
/*core.fillRect("ui", 58,
|
||||
58,
|
||||
size - 50,
|
||||
size - 50, "rgba(0,0,0,0.5)")*/
|
||||
core.getContextByName("ui").globalAlpha = 0.7
|
||||
|
||||
core.drawImage(
|
||||
"ui",
|
||||
"lock.webp",
|
||||
"miwu.webp",
|
||||
0,
|
||||
0,
|
||||
size,
|
||||
size,
|
||||
58,
|
||||
58,
|
||||
size - 8,
|
||||
size - 8
|
||||
size - 50,
|
||||
size - 50
|
||||
);
|
||||
|
||||
core.getContextByName("ui").globalAlpha = 1
|
||||
/*core.fillText("ui", '?', 188,
|
||||
278,
|
||||
"rgba(255,255,255,0.2)", this._buildFont(250, true))*/
|
||||
}
|
||||
core.fillRoundRect(
|
||||
"ui",
|
||||
15 + 44 - 2,
|
||||
@ -13767,7 +13550,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
title,
|
||||
15 - 4 + size - 4 + 45,
|
||||
85,
|
||||
"#FFFFFF",
|
||||
core.hasVisitedFloor(floorId) ? "#FFFFFF" : "#444444",
|
||||
"#000000",
|
||||
18
|
||||
);
|
||||
@ -14362,10 +14145,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
[x + w, y + h],
|
||||
];
|
||||
};
|
||||
const inRect = ([x, y], [
|
||||
[sx, sy],
|
||||
[dx, dy]
|
||||
]) => {
|
||||
const inRect = ([x, y], [[sx, sy], [dx, dy]]) => {
|
||||
return sx <= x && x <= dx && sy <= y && y <= dy;
|
||||
};
|
||||
const pos = [px, py];
|
||||
@ -15404,10 +15184,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
[x + w, y + h],
|
||||
];
|
||||
};
|
||||
const inRect = ([x, y], [
|
||||
[sx, sy],
|
||||
[dx, dy]
|
||||
]) => {
|
||||
const inRect = ([x, y], [[sx, sy], [dx, dy]]) => {
|
||||
return sx <= x && x <= dx && sy <= y && y <= dy;
|
||||
};
|
||||
const pos = [px, py];
|
||||
@ -15588,9 +15365,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
config.defaultFont = config.font = config.font || globalAttribute.font;
|
||||
config.time = config.time || 0;
|
||||
config.letterSpacing =
|
||||
config.letterSpacing == null ?
|
||||
textAttribute.letterSpacing || 0 :
|
||||
config.letterSpacing;
|
||||
config.letterSpacing == null
|
||||
? textAttribute.letterSpacing || 0
|
||||
: config.letterSpacing;
|
||||
|
||||
config.index = 0;
|
||||
config.currcolor = config.color;
|
||||
@ -15644,9 +15421,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
var block = config.blocks[config.index++];
|
||||
if (block != null) {
|
||||
// It works, why?
|
||||
const scale = config.isHD ?
|
||||
devicePixelRatio * core.domStyle.scale :
|
||||
1;
|
||||
const scale = config.isHD
|
||||
? devicePixelRatio * core.domStyle.scale
|
||||
: 1;
|
||||
ctx.restore();
|
||||
ctx.save(); //保存设置
|
||||
if (core.domStyle.isVertical) {
|
||||
@ -15749,15 +15526,17 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
const indexList = this.textList;
|
||||
core.setTextAlign(logctx, "left");
|
||||
for (
|
||||
let i = (page - 1) * 6; i <= Math.min(this.index, page * 6 - 1); i++
|
||||
let i = (page - 1) * 6;
|
||||
i <= Math.min(this.index, page * 6 - 1);
|
||||
i++
|
||||
) {
|
||||
const text = this.textList[i][1].replaceAll(
|
||||
/(\\(d|e|f|g|i|n|r|b|c|t|z))(\[.*?\])?/g,
|
||||
""
|
||||
); //取消打字机
|
||||
const name = this.textList[i][0] ?
|
||||
"【" + this.textList[i][0] + "】" :
|
||||
"";
|
||||
const name = this.textList[i][0]
|
||||
? "【" + this.textList[i][0] + "】"
|
||||
: "";
|
||||
if (name) {
|
||||
core.fillBoldText1(
|
||||
logctx,
|
||||
@ -18096,7 +17875,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
music.loop = "loop";
|
||||
core.material.bgms[name] = music;*/
|
||||
};
|
||||
|
||||
},
|
||||
"横屏切换": function () {
|
||||
// 在此增加新插件
|
||||
@ -18210,7 +17988,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
core.setFlag("animate_" + name);
|
||||
};
|
||||
let thistime = 0;
|
||||
this.playanimate = function (name, x, y, hero, scalex, scaley) {
|
||||
this.playanimate = function (name, x, y, hero, scalex, scaley, callback) {
|
||||
const data = {
|
||||
name: name,
|
||||
x: x,
|
||||
@ -18219,6 +17997,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
scalex: scalex,
|
||||
scaley: scaley,
|
||||
farme: 0,
|
||||
callback
|
||||
};
|
||||
|
||||
core.plugin.playing.add(data);
|
||||
@ -18357,7 +18136,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
}
|
||||
});
|
||||
one.farme++;
|
||||
if (one.farme > data.allFarme) core.plugin.playing.delete(one);
|
||||
if (one.farme > data.allFarme) {
|
||||
core.plugin.playing.delete(one)
|
||||
if (one.callback) { one.callback() }
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -18728,8 +18510,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
oneTurn,
|
||||
enemyInfo,
|
||||
equipInfo,
|
||||
farme
|
||||
farme,
|
||||
damageInfo
|
||||
) {
|
||||
let attack = false
|
||||
if (heroInfo.isAttack) attack = true
|
||||
if (enemyInfo.isAttack) attack = true
|
||||
equipInfo.forEach(function (v) { if (v.isAttack) attack = true })
|
||||
core.clearMap(ctx);
|
||||
let animate = Math.floor(farme / 30);
|
||||
core.fillRect(ctx, 64, 64, 288, 288, "rgba(0,0,0,0.5)");
|
||||
@ -18739,46 +18526,49 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
ctx,
|
||||
hero.name,
|
||||
127,
|
||||
123,
|
||||
128,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
'bold 14px pala'
|
||||
"bold 14px pala"
|
||||
);
|
||||
core.setTextAlign(ctx, "left");
|
||||
core.drawIcon(ctx, 'hp', 70, 190, 16, 16)
|
||||
core.drawIcon(ctx, 'atk', 70, 210, 16, 16)
|
||||
core.drawIcon(ctx, 'def', 70, 230, 16, 16)
|
||||
core.drawIcon(ctx, 'I374', 70, 250, 16, 16)
|
||||
core.drawIcon(ctx, 'I375', 70, 270, 16, 16)
|
||||
core.drawIcon(ctx, 'mdef', 70, 290, 16, 16)
|
||||
core.drawIcon(ctx, 'amulet', 70, 310, 16, 16)
|
||||
core.drawIcon(ctx, 'jumpShoes', 70, 330, 16, 16)
|
||||
core.drawIcon(ctx, "hp", 70, 190, 16, 16);
|
||||
core.drawIcon(ctx, "atk", 70, 210, 16, 16);
|
||||
core.drawIcon(ctx, "def", 70, 230, 16, 16);
|
||||
core.drawIcon(ctx, "I374", 70, 250, 16, 16);
|
||||
core.drawIcon(ctx, "I375", 70, 270, 16, 16);
|
||||
core.drawIcon(ctx, "mdef", 70, 290, 16, 16);
|
||||
core.drawIcon(ctx, "amulet", 70, 310, 16, 16);
|
||||
core.drawIcon(ctx, "jumpShoes", 70, 330, 16, 16);
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
'生命 ' + core.formatBigNumber(heroInfo.hp, true) + " / " + core.formatBigNumber(heroInfo.hpmax, true),
|
||||
"生命 " +
|
||||
core.formatBigNumber(heroInfo.hp, true) +
|
||||
" / " +
|
||||
core.formatBigNumber(heroInfo.hpmax, true),
|
||||
90,
|
||||
205,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
'bold 14px pala'
|
||||
"bold 14px pala"
|
||||
);
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
'攻击 ' + core.formatBigNumber(heroInfo.atk),
|
||||
"攻击 " + core.formatBigNumber(heroInfo.atk),
|
||||
90,
|
||||
225,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
'bold 14px pala'
|
||||
"bold 14px pala"
|
||||
);
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
'防御 ' + core.formatBigNumber(heroInfo.def),
|
||||
"防御 " + core.formatBigNumber(heroInfo.def),
|
||||
90,
|
||||
245,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
'bold 14px pala'
|
||||
"bold 14px pala"
|
||||
);
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
@ -18787,43 +18577,51 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
265,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
'bold 14px pala'
|
||||
"bold 14px pala"
|
||||
);
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
"法攻 " + core.formatBigNumber(heroInfo.matk / 100 * heroInfo.spell) + "(" + heroInfo.matk + "%)",
|
||||
"法攻 " +
|
||||
core.formatBigNumber((heroInfo.matk / 100) * heroInfo.spell) +
|
||||
"(" +
|
||||
heroInfo.matk +
|
||||
"%)",
|
||||
90,
|
||||
285,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
'bold 14px pala'
|
||||
"bold 14px pala"
|
||||
);
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
'护盾 ' + core.formatBigNumber(heroInfo.mdef / 100 * heroInfo.spell) + "(" + heroInfo.mdef + "%)",
|
||||
"护盾 " +
|
||||
core.formatBigNumber((heroInfo.mhp / 100) * heroInfo.spell) +
|
||||
"(" +
|
||||
heroInfo.mhp +
|
||||
"%)",
|
||||
90,
|
||||
305,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
'bold 14px pala'
|
||||
"bold 14px pala"
|
||||
);
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
'法抗 ' + heroInfo.spelldef + "%",
|
||||
"法抗 " + heroInfo.mdef + "%",
|
||||
90,
|
||||
325,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
'bold 14px pala'
|
||||
"bold 14px pala"
|
||||
);
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
'速度 ' + core.formatBigNumber(heroInfo.speed),
|
||||
"速度 " + core.formatBigNumber(heroInfo.speed),
|
||||
90,
|
||||
345,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
'bold 14px pala'
|
||||
"bold 14px pala"
|
||||
);
|
||||
|
||||
core.strokeRect(ctx, 112, 139, 32, 48, "rgba(255,255,255,1)", 1);
|
||||
@ -18840,17 +18638,17 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
48
|
||||
);
|
||||
|
||||
|
||||
core.setTextAlign(ctx, "center");
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
enemyInfo.name,
|
||||
289,
|
||||
123,
|
||||
128,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
'bold 14px pala'
|
||||
"bold 14px pala"
|
||||
);
|
||||
|
||||
core.setTextAlign(ctx, "right");
|
||||
if (enemyInfo.cls === "enemys") {
|
||||
core.strokeRect(ctx, 272, 155, 32, 32, "rgba(255,255,255,1)", 1);
|
||||
@ -18883,37 +18681,37 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
48
|
||||
);
|
||||
}
|
||||
core.drawIcon(ctx, 'hp', 330, 190, 16, 16)
|
||||
core.drawIcon(ctx, 'atk', 330, 210, 16, 16)
|
||||
core.drawIcon(ctx, 'def', 330, 230, 16, 16)
|
||||
core.drawIcon(ctx, 'amulet', 330, 250, 16, 16)
|
||||
core.drawIcon(ctx, 'jumpShoes', 330, 270, 16, 16)
|
||||
core.drawIcon(ctx, "hp", 330, 190, 16, 16);
|
||||
core.drawIcon(ctx, "atk", 330, 210, 16, 16);
|
||||
core.drawIcon(ctx, "def", 330, 230, 16, 16);
|
||||
core.drawIcon(ctx, "amulet", 330, 250, 16, 16);
|
||||
core.drawIcon(ctx, "jumpShoes", 330, 270, 16, 16);
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
core.formatBigNumber(enemyInfo.hp, true) + ' 生命',
|
||||
core.formatBigNumber(enemyInfo.hp, true) + " 生命",
|
||||
330,
|
||||
205,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
'bold 14px pala'
|
||||
"bold 14px pala"
|
||||
);
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
core.formatBigNumber(enemyInfo.atk) + ' 攻击',
|
||||
core.formatBigNumber(enemyInfo.atk) + " 攻击",
|
||||
330,
|
||||
225,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
'bold 14px pala'
|
||||
"bold 14px pala"
|
||||
);
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
core.formatBigNumber(enemyInfo.def) + ' 防御',
|
||||
core.formatBigNumber(enemyInfo.def) + " 防御",
|
||||
330,
|
||||
245,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
'bold 14px pala'
|
||||
"bold 14px pala"
|
||||
);
|
||||
|
||||
core.fillBoldText(
|
||||
@ -18923,7 +18721,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
265,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
'bold 14px pala'
|
||||
"bold 14px pala"
|
||||
);
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
@ -18932,24 +18730,147 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
285,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
'bold 14px pala'
|
||||
"bold 14px pala"
|
||||
);
|
||||
core.fillBoldText(ctx,
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
"V",
|
||||
219,
|
||||
163,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
'bold 48px pala')
|
||||
core.fillBoldText(ctx,
|
||||
"bold 48px pala"
|
||||
);
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
"s",
|
||||
231,
|
||||
163,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
'bold 36px pala')
|
||||
"bold 36px pala"
|
||||
);
|
||||
|
||||
if (!attack) enemyInfo.now += enemyInfo.speed / oneTurn * 215
|
||||
let enemynow = Math.min(100 + enemyInfo.now, 315)
|
||||
ctx.fillStyle = "#FFFFFF"
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(enemynow, 100)
|
||||
ctx.lineTo(enemynow + 3, 90)
|
||||
ctx.lineTo(enemynow - 3, 90)
|
||||
ctx.closePath()
|
||||
ctx.fill()
|
||||
|
||||
if (enemyInfo.cls === "enemys") {
|
||||
|
||||
|
||||
core.drawImage(
|
||||
ctx,
|
||||
core.getBlockInfo(enemyInfo.id).image,
|
||||
32,
|
||||
core.getBlockInfo(enemyInfo.id).posY * 32,
|
||||
32,
|
||||
32,
|
||||
enemynow - 16,
|
||||
64,
|
||||
32,
|
||||
32
|
||||
);
|
||||
} else {
|
||||
|
||||
|
||||
core.drawImage(
|
||||
ctx,
|
||||
core.getBlockInfo(enemyInfo.id).image,
|
||||
32,
|
||||
core.getBlockInfo(enemyInfo.id).posY * 48,
|
||||
32,
|
||||
19,
|
||||
enemynow - 16,
|
||||
70,
|
||||
32,
|
||||
19
|
||||
);
|
||||
}
|
||||
core.drawLine(ctx, 100, 105, 315, 105, '#FFFFFF', 5)
|
||||
equipInfo.forEach(function (v) {
|
||||
if (!attack) v.now += v.speed / oneTurn * 215
|
||||
let vnow = Math.min(100 + v.now, 315)
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(vnow, 100)
|
||||
ctx.lineTo(vnow + 3, 90)
|
||||
ctx.lineTo(vnow - 3, 90)
|
||||
ctx.closePath()
|
||||
|
||||
ctx.fill()
|
||||
|
||||
core.drawIcon(ctx,
|
||||
v.id,
|
||||
vnow - 16,
|
||||
64,
|
||||
32,
|
||||
32)
|
||||
|
||||
})
|
||||
if (!attack) heroInfo.now += heroInfo.speed / oneTurn * 215
|
||||
let heronow = Math.min(100 + heroInfo.now, 315)
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(heronow, 100)
|
||||
ctx.lineTo(heronow + 3, 90)
|
||||
ctx.lineTo(heronow - 3, 90)
|
||||
ctx.closePath()
|
||||
|
||||
ctx.fill()
|
||||
console.log(heronow)
|
||||
core.drawImage(ctx,
|
||||
"hero.webp",
|
||||
0,
|
||||
0,
|
||||
32,
|
||||
19,
|
||||
heronow - 16,
|
||||
70,
|
||||
32,
|
||||
19)
|
||||
|
||||
if (heroInfo.now >= 215) {
|
||||
heroInfo.isAttack = true;
|
||||
animateOnAttack("sword", true, () => {
|
||||
heroInfo.now -= 215
|
||||
heroInfo.isAttack = false
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
if (enemyInfo.now >= 215) {
|
||||
enemyInfo.isAttack = true
|
||||
animateOnAttack("sword", false, () => {
|
||||
enemyInfo.now -= 215
|
||||
enemyInfo.isAttack = false
|
||||
|
||||
})
|
||||
}
|
||||
equipInfo.forEach(v => {
|
||||
if (v.now >= 215) {
|
||||
v.isAttack = true
|
||||
|
||||
animateOnAttack("sword", true, () => {
|
||||
v.now -= 215
|
||||
v.isAttack = false
|
||||
|
||||
})
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
function animateOnAttack(name, onenemy, callback) {
|
||||
if (onenemy) {
|
||||
core.playanimate(name, 290, 160, null, 1, 1, callback)
|
||||
} else {
|
||||
core.playanimate(name, 130, 160, null, 1, 1, callback)
|
||||
}
|
||||
}
|
||||
|
||||
this.attackAnimate = function (
|
||||
enemyId,
|
||||
enemyInfo,
|
||||
@ -18964,36 +18885,43 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
hero_atk = core.getRealStatusOrDefault(hero, "atk"),
|
||||
hero_def = core.getRealStatusOrDefault(hero, "def"),
|
||||
hero_spell = core.getRealStatusOrDefault(hero, "spell"),
|
||||
hero_matk = core.getRealStatusOrDefault(hero, "mdef"),
|
||||
hero_matk = core.getRealStatusOrDefault(hero, "matk"),
|
||||
hero_mdef = core.getRealStatusOrDefault(hero, "mdef"),
|
||||
hero_speed = core.getRealStatusOrDefault(hero, "speed"),
|
||||
hero_hpmax = core.getRealStatusOrDefault(hero, "hpmax"),
|
||||
hero_spelldef = core.getRealStatusOrDefault(hero, "spelldef");
|
||||
hero_mhp = core.getRealStatusOrDefault(hero, "mhp");
|
||||
const heroInfo = {
|
||||
hp: hero_hp,
|
||||
hpmax: hero_hpmax,
|
||||
atk: hero_atk,
|
||||
def: hero_def,
|
||||
spell: hero_spell,
|
||||
spelldef: hero_spelldef,
|
||||
mhp: hero_mhp,
|
||||
matk: hero_matk,
|
||||
mdef: hero_mdef,
|
||||
speed: hero_speed,
|
||||
now: 0,
|
||||
isAttack: false
|
||||
};
|
||||
enemyInfo.id = enemyId;
|
||||
enemyInfo.cls = core.getClsFromId(enemyId);
|
||||
enemyInfo.name = core.material.enemys[enemyId].name;
|
||||
|
||||
enemyInfo.now = 0;
|
||||
enemyInfo.isAttack = false
|
||||
let oneTurn = heroInfo.speed + enemyInfo.speed;
|
||||
if (equipInfo.length > 0) {
|
||||
for (let i; i < equipInfo.length - 1; i++) {
|
||||
equipInfo[i].now = 0
|
||||
equipInfo[i].isAttack = false
|
||||
oneTurn += equipInfo[i].speed;
|
||||
}
|
||||
}
|
||||
oneTurn *= 100;
|
||||
oneTurn *= 25;
|
||||
let time = 0,
|
||||
farme = 0;
|
||||
|
||||
|
||||
|
||||
core.registerAnimationFrame("attackAnimate", true, (temptime) => {
|
||||
if (temptime - time > 1000 / 60) {
|
||||
time = temptime;
|
||||
@ -19002,7 +18930,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
oneTurn,
|
||||
enemyInfo,
|
||||
equipInfo,
|
||||
farme
|
||||
farme,
|
||||
damageInfo
|
||||
);
|
||||
farme++;
|
||||
}
|
||||
|
@ -544,9 +544,9 @@ p#name {
|
||||
}
|
||||
|
||||
/* 注释下面这三行以开启抗锯齿 */
|
||||
.anti-aliasing {
|
||||
/* .anti-aliasing {
|
||||
image-rendering: pixelated;
|
||||
}
|
||||
} */
|
||||
|
||||
.warning {
|
||||
transition: left cubic-bezier(0, 0.9, 1, 0.1) 2.5s;
|
||||
|
Loading…
Reference in New Issue
Block a user