优化战斗动画
This commit is contained in:
parent
0a9e8383f6
commit
c18057e927
@ -282,7 +282,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
|
||||
return true;
|
||||
},
|
||||
"afterBattle": function (enemyId, x, y) {
|
||||
"afterBattle": async function (enemyId, x, y) {
|
||||
// 战斗结束后触发的事件
|
||||
var enemy = core.getEnemyInfo(enemyId, hero, x, y)
|
||||
var special = enemy.special;
|
||||
@ -295,7 +295,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
animate = core.material.items[equipId].equip.animate;
|
||||
// 你也可以在这里根据自己的需要,比如enemyId或special或flag来修改播放的动画效果
|
||||
// if (enemyId == '...') animate = '...';
|
||||
|
||||
if (core.getFlag('noAnimate')) {
|
||||
// 检查该动画是否存在SE,如果不存在则使用默认音效
|
||||
if (!(core.material.animates[animate] || {}).se)
|
||||
core.playSound('attack.mp3');
|
||||
@ -305,11 +305,11 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
core.drawAnimate(animate, x, y);
|
||||
else
|
||||
core.drawHeroAnimate(animate);
|
||||
|
||||
}
|
||||
// 获得战斗伤害信息
|
||||
var damageInfo = core.getDamageInfo(enemyId, null, x, y) || {};
|
||||
|
||||
if (!core.getFlag("noAnimate")) core.attackAnimate(
|
||||
if (!core.getFlag("noAnimate")) await core.attackAnimate(
|
||||
enemyId,
|
||||
damageInfo.start[0],
|
||||
damageInfo.start[1],
|
||||
|
@ -4666,12 +4666,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
core.events.battle = function () {
|
||||
var hpBeforeBattle = core.status.hero.hp;
|
||||
Dove.MorePerform.ShowDamagePop.OnBattle.apply(core.events, arguments);
|
||||
Dove.MorePerform.ShowDamagePop.PopDamage(
|
||||
'ui', // 默认画布名称
|
||||
if (core.getFlag('noAnimate')) Dove.MorePerform.ShowDamagePop.PopDamage(
|
||||
"ui", // 默认画布名称
|
||||
core.getHeroLoc('x') * 32, // 英雄位置 x
|
||||
core.getHeroLoc('y') * 32, // 英雄位置 y
|
||||
Math.floor(core.status.hero.hp - hpBeforeBattle), // 伤害值
|
||||
16, // 默认字体大小
|
||||
"Arial", //默认字体
|
||||
null, // 默认颜色
|
||||
null, // 默认描边颜色
|
||||
null, // 默认水平速度
|
||||
@ -4679,6 +4680,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
null, // 默认重力
|
||||
90 // 默认显示时长(帧数)
|
||||
);
|
||||
|
||||
};
|
||||
let time = 0
|
||||
// 注册每帧事件
|
||||
@ -4716,9 +4718,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
this._font = font ?? "Arial"
|
||||
this._fontColor = fontColor ?? (damage > 0 ? '#22FF44' : 'lightcoral'); // 默认颜色
|
||||
this._outlineColor = outlineColor ?? '#FFFFFF'; // 默认描边颜色
|
||||
this._speedX = speedX ?? (-2 + Math.random() * 3); // 水平速度,默认随机
|
||||
this._speedX = speedX ?? (-1 + Math.random() * 2); // 水平速度,默认随机
|
||||
this._speedY = speedY ?? (-3 - Math.random() * 4); // 垂直速度,默认随机
|
||||
this._gravity = gravity ?? 0.3; // 重力加速度,默认 0.5
|
||||
this._gravity = gravity ?? 0.3; // 重力加速度,默认 0.3
|
||||
this._duration = duration ?? 180; // 显示时长(帧数),默认 180 帧
|
||||
this.initAllMembers();
|
||||
this.requestCanvas();
|
||||
@ -4745,7 +4747,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
|
||||
// 申请并描绘canvas
|
||||
PopSprite.prototype.requestCanvas = function () {
|
||||
core.createCanvas(this._symbol, this._x, this._y, this._width, this._height, this._z);
|
||||
core.createCanvas(this._symbol, this._x, this._y, this._width + 4, this._height + 4, this._z);
|
||||
|
||||
var canvas = core.getContextByName(this._symbol)
|
||||
canvas.font = this._fontSize + 'px ' + this._font; // 动态设置字体大小
|
||||
@ -4762,7 +4764,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
uiContext.font = this._fontSize + 'px ' + this._font; // 动态设置字体大小
|
||||
var textRect = uiContext.measureText(this._text);
|
||||
this._width = textRect.width + 4;
|
||||
this._height = this._fontSize * 1.4 + 4; // 动态设置高度
|
||||
this._height = this._fontSize + 4; // 动态设置高度
|
||||
this._z = uiContext.canvas.style.zIndex ? Number(uiContext.canvas.style.zIndex) + PopSprite._count : PopSprite._baseZOrder + PopSprite._count;
|
||||
this._symbol = 'popSprite' + PopSprite._count++;
|
||||
this._alive = true;
|
||||
@ -20861,6 +20863,44 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
main.dom.gameDraw.appendChild(animateAttack);
|
||||
const { lcm, gcd } = core.plugin.utils
|
||||
|
||||
function animateOnAttack(name, onenemy) {
|
||||
if (onenemy) {
|
||||
playanimate(name, 290, 180);
|
||||
} else {
|
||||
playanimate(name, 130, 180);
|
||||
}
|
||||
}
|
||||
|
||||
this.attackAnimate = function (
|
||||
enemyId,
|
||||
heroInfo,
|
||||
enemyInfo,
|
||||
equipInfo,
|
||||
oneTurn,
|
||||
onegcd,
|
||||
heroDiffList,
|
||||
enemyDiffList,
|
||||
heroanimateList,
|
||||
enemyanimateList
|
||||
) {
|
||||
//参数分别为怪物id、真实属性,战斗信息,特殊装备(如火焰风衣)属性特殊装备属性为以元组{equipId,oneDamage,speed,now:0}构成的数组(列出每个需要计算的特殊装备,没有则为空数组或不填)
|
||||
core.lockControl();
|
||||
core.clearMap(ctx);
|
||||
core.status.event.id = "attackAnimate";
|
||||
let turn = 0
|
||||
enemyInfo.id = enemyId;
|
||||
enemyInfo.cls = core.getClsFromId(enemyId);
|
||||
enemyInfo.name = core.material.enemys[enemyId].name;
|
||||
|
||||
if (oneTurn < 120) oneTurn *= Math.round(120 / oneTurn)
|
||||
let time = 0,
|
||||
farme = 0;
|
||||
return new Promise(res => {
|
||||
core.plugin.battle_onclick = function (x, y, px, py) {
|
||||
const makeBox = ([x, y], [w, h]) => {
|
||||
return [
|
||||
@ -20875,10 +20915,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
return sx <= x && x <= dx && sy <= y && y <= dy;
|
||||
};
|
||||
const pos = [px, py];
|
||||
const easybox = makeBox([90, 212], [80, 22]),
|
||||
easyclosebox = makeBox([290, 212], [40, 22]),
|
||||
uneasybox = makeBox([265, 310], [65, 20]),
|
||||
uneasyclosebox = makeBox([290, 330], [40, 20]);
|
||||
const easybox = makeBox([90, 232], [80, 22]),
|
||||
easyclosebox = makeBox([290, 232], [40, 22]),
|
||||
uneasybox = makeBox([265, 330], [65, 20]),
|
||||
uneasyclosebox = makeBox([290, 350], [40, 20]);
|
||||
if (inRect(pos, easybox) && easy) {
|
||||
easy = false
|
||||
} else if (inRect(pos, uneasybox) && !easy) {
|
||||
@ -20888,13 +20928,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
core.unregisterAnimationFrame("attackAnimate")
|
||||
core.clearMap(ctx)
|
||||
core.closePanel()
|
||||
|
||||
res()
|
||||
}
|
||||
}
|
||||
let turn = 0
|
||||
main.dom.gameDraw.appendChild(animateAttack);
|
||||
const { lcm, gcd } = core.plugin.utils
|
||||
this.drawAttackAnimate = async function (
|
||||
async function drawAttackAnimate(
|
||||
heroInfo,
|
||||
oneTurn,
|
||||
enemyInfo,
|
||||
@ -20925,25 +20962,25 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
core.clearMap(ctx);
|
||||
let animate = Math.floor(farme / 30);
|
||||
if (easy) {
|
||||
core.fillRect(ctx, 64, 64, 288, 180, "rgba(0,0,0,0.5)");
|
||||
core.strokeRect(ctx, 64, 64, 288, 180, "rgba(255,255,255,0.5)", 4);
|
||||
core.fillRect(ctx, 64, 52, 288, 212, "rgba(0,0,0,0.5)");
|
||||
core.strokeRect(ctx, 64, 52, 288, 212, "rgba(255,255,255,0.5)", 4);
|
||||
core.setTextAlign(ctx, "center");
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
hero.name,
|
||||
127,
|
||||
128,
|
||||
148,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
"bold 14px Verdana"
|
||||
);
|
||||
core.setTextAlign(ctx, "left");
|
||||
core.drawIcon(ctx, "hp", 70, 190, 16, 16);
|
||||
core.drawIcon(ctx, "hp", 70, 210, 16, 16);
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
"生命 " + core.formatBigNumber(heroInfo.hp, true),
|
||||
90,
|
||||
205,
|
||||
225,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
"bold 14px Arial"
|
||||
@ -20953,14 +20990,14 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
ctx,
|
||||
"详细模式",
|
||||
90,
|
||||
230,
|
||||
250,
|
||||
"#FFFF60",
|
||||
"#000000",
|
||||
"bold 18px Verdana"
|
||||
);
|
||||
|
||||
|
||||
core.strokeRect(ctx, 112, 139, 32, 48, "rgba(255,255,255,1)", 1);
|
||||
core.strokeRect(ctx, 112, 159, 32, 48, "rgba(255,255,255,1)", 1);
|
||||
let img = attack && (heroDiffList[turn].hp < 0) ? imagelighter(core.material.images.images["hero.webp"]) : attack && (heroDiffList[turn].hp > 0) ? imagelighter(core.material.images.images["hero.webp"], 'rgba(0, 255, 0, 0.5)') : core.material.images.images["hero.webp"]
|
||||
core.drawImage(
|
||||
ctx,
|
||||
@ -20970,7 +21007,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
32,
|
||||
48,
|
||||
112,
|
||||
139,
|
||||
159,
|
||||
32,
|
||||
48
|
||||
);
|
||||
@ -20980,7 +21017,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
ctx,
|
||||
enemyInfo.name,
|
||||
289,
|
||||
128,
|
||||
148,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
"bold 14px Verdana"
|
||||
@ -20988,7 +21025,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
|
||||
core.setTextAlign(ctx, "right");
|
||||
if (enemyInfo.cls === "enemys") {
|
||||
core.strokeRect(ctx, 272, 155, 32, 32, "rgba(255,255,255,1)", 1);
|
||||
core.strokeRect(ctx, 272, 175, 32, 32, "rgba(255,255,255,1)", 1);
|
||||
let img = attack && (enemyDiffList[turn].hp < 0) ? imagelighter(core.getBlockInfo(enemyInfo.id).image) : attack && (enemyDiffList[turn].hp > 0) ? imagelighter(core.getBlockInfo(enemyInfo.id).image, 'rgba(0, 255, 0, 0.5)') : core.getBlockInfo(enemyInfo.id).image
|
||||
core.drawImage(
|
||||
ctx,
|
||||
@ -20998,12 +21035,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
32,
|
||||
32,
|
||||
272,
|
||||
155,
|
||||
175,
|
||||
32,
|
||||
32
|
||||
);
|
||||
} else {
|
||||
core.strokeRect(ctx, 272, 139, 32, 48, "rgba(255,255,255,1)", 1);
|
||||
core.strokeRect(ctx, 272, 159, 32, 48, "rgba(255,255,255,1)", 1);
|
||||
let img = attack && (enemyDiffList[turn].hp < 0) ? imagelighter(core.getBlockInfo(enemyInfo.id).image) : attack && (enemyDiffList[turn].hp > 0) ? imagelighter(core.getBlockInfo(enemyInfo.id).image, 'rgba(0, 255, 0, 0.5)') : core.getBlockInfo(enemyInfo.id).image
|
||||
core.drawImage(
|
||||
ctx,
|
||||
@ -21013,18 +21050,18 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
32,
|
||||
48,
|
||||
272,
|
||||
139,
|
||||
159,
|
||||
32,
|
||||
48
|
||||
);
|
||||
}
|
||||
core.drawIcon(ctx, "hp", 330, 190, 16, 16);
|
||||
core.drawIcon(ctx, "hp", 330, 210, 16, 16);
|
||||
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
core.formatBigNumber(enemyInfo.hp, true) + " 生命",
|
||||
330,
|
||||
205,
|
||||
225,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
"bold 14px Verdana"
|
||||
@ -21033,7 +21070,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
ctx,
|
||||
"跳过",
|
||||
330,
|
||||
230,
|
||||
250,
|
||||
"#FFFF60",
|
||||
"#000000",
|
||||
"bold 18px Verdana"
|
||||
@ -21043,7 +21080,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
ctx,
|
||||
"V",
|
||||
219,
|
||||
163,
|
||||
183,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
"bold 48px pala"
|
||||
@ -21052,7 +21089,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
ctx,
|
||||
"s",
|
||||
231,
|
||||
163,
|
||||
183,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
"bold 36px pala"
|
||||
@ -21062,9 +21099,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
let enemynow = Math.min(100 + enemyInfo.now / oneTurn * 215, 315);
|
||||
ctx.fillStyle = "#FFFFFF";
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(enemynow, 100);
|
||||
ctx.lineTo(enemynow + 5, 90);
|
||||
ctx.lineTo(enemynow - 5, 90);
|
||||
ctx.moveTo(enemynow, 120);
|
||||
ctx.lineTo(enemynow + 5, 110);
|
||||
ctx.lineTo(enemynow - 5, 110);
|
||||
ctx.closePath();
|
||||
ctx.fill();
|
||||
|
||||
@ -21077,7 +21114,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
32,
|
||||
32,
|
||||
enemynow - 16,
|
||||
64,
|
||||
74,
|
||||
32,
|
||||
32
|
||||
);
|
||||
@ -21088,64 +21125,64 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
32,
|
||||
core.getBlockInfo(enemyInfo.id).posY * 48,
|
||||
32,
|
||||
19,
|
||||
48,
|
||||
enemynow - 16,
|
||||
70,
|
||||
58,
|
||||
32,
|
||||
19
|
||||
48
|
||||
);
|
||||
}
|
||||
core.drawLine(ctx, 100, 105, 315, 105, "#FFFFFF", 5);
|
||||
core.drawLine(ctx, 100, 125, 315, 125, "#FFFFFF", 5);
|
||||
equipInfo.forEach(function (v) {
|
||||
if (!attack && !onattack) v.now += v.speed / onegcd;
|
||||
let vnow = Math.min(100 + v.now / oneTurn * 215, 315);
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(vnow, 100);
|
||||
ctx.lineTo(vnow + 5, 90);
|
||||
ctx.lineTo(vnow - 5, 90);
|
||||
ctx.moveTo(vnow, 120);
|
||||
ctx.lineTo(vnow + 5, 110);
|
||||
ctx.lineTo(vnow - 5, 110);
|
||||
ctx.closePath();
|
||||
|
||||
ctx.fill();
|
||||
|
||||
core.drawIcon(ctx, v.id, vnow - 16, 64, 32, 32);
|
||||
core.drawIcon(ctx, v.id, vnow - 16, 54, 32, 32);
|
||||
});
|
||||
if (!attack && !onattack) heroInfo.now += hero.speed / onegcd;
|
||||
let heronow = Math.min(100 + heroInfo.now / oneTurn * 215, 315);
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(heronow, 100);
|
||||
ctx.lineTo(heronow + 5, 90);
|
||||
ctx.lineTo(heronow - 5, 90);
|
||||
ctx.moveTo(heronow, 120);
|
||||
ctx.lineTo(heronow + 5, 110);
|
||||
ctx.lineTo(heronow - 5, 110);
|
||||
ctx.closePath();
|
||||
|
||||
ctx.fill();
|
||||
core.drawImage(ctx, "hero.webp", 0, 0, 32, 19, heronow - 16, 70, 32, 19);
|
||||
core.drawImage(ctx, "hero.webp", 0, 0, 32, 48, heronow - 16, 58, 32, 48);
|
||||
} else {
|
||||
core.fillRect(ctx, 64, 64, 288, 288, "rgba(0,0,0,0.5)");
|
||||
core.strokeRect(ctx, 64, 64, 288, 288, "rgba(255,255,255,0.5)", 4);
|
||||
core.fillRect(ctx, 64, 52, 288, 320, "rgba(0,0,0,0.5)");
|
||||
core.strokeRect(ctx, 64, 52, 288, 320, "rgba(255,255,255,0.5)", 4);
|
||||
core.setTextAlign(ctx, "center");
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
hero.name,
|
||||
127,
|
||||
128,
|
||||
148,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
"bold 14px Verdana"
|
||||
);
|
||||
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, 210, 16, 16);
|
||||
core.drawIcon(ctx, "atk", 70, 230, 16, 16);
|
||||
core.drawIcon(ctx, "def", 70, 250, 16, 16);
|
||||
core.drawIcon(ctx, "I374", 70, 270, 16, 16);
|
||||
core.drawIcon(ctx, "I375", 70, 290, 16, 16);
|
||||
core.drawIcon(ctx, "mdef", 70, 310, 16, 16);
|
||||
core.drawIcon(ctx, "amulet", 70, 330, 16, 16);
|
||||
core.drawIcon(ctx, "jumpShoes", 70, 350, 16, 16);
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
"生命 " + core.formatBigNumber(heroInfo.hp, true),
|
||||
90,
|
||||
205,
|
||||
225,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
"bold 14px Arial"
|
||||
@ -21155,7 +21192,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
ctx,
|
||||
"攻击 " + core.formatBigNumber(heroInfo.atk),
|
||||
90,
|
||||
225,
|
||||
245,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
"bold 14px Arial"
|
||||
@ -21164,7 +21201,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
ctx,
|
||||
"防御 " + core.formatBigNumber(heroInfo.def),
|
||||
90,
|
||||
245,
|
||||
265,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
"bold 14px Arial"
|
||||
@ -21173,7 +21210,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
ctx,
|
||||
"法强 " + core.formatBigNumber(heroInfo.spell),
|
||||
90,
|
||||
265,
|
||||
285,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
"bold 14px Arial"
|
||||
@ -21183,7 +21220,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
"法攻 " +
|
||||
core.formatBigNumber(heroInfo.matk),
|
||||
90,
|
||||
285,
|
||||
305,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
"bold 14px Arial"
|
||||
@ -21193,7 +21230,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
"护盾 " +
|
||||
core.formatBigNumber(heroInfo.mhp),
|
||||
90,
|
||||
305,
|
||||
325,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
"bold 14px Arial"
|
||||
@ -21202,7 +21239,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
ctx,
|
||||
"法抗 " + heroInfo.mdef + "%",
|
||||
90,
|
||||
325,
|
||||
345,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
"bold 14px Arial"
|
||||
@ -21211,13 +21248,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
ctx,
|
||||
"速度 " + core.formatBigNumber(heroInfo.speed),
|
||||
90,
|
||||
345,
|
||||
365,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
"bold 14px Arial"
|
||||
);
|
||||
|
||||
core.strokeRect(ctx, 112, 139, 32, 48, "rgba(255,255,255,1)", 1);
|
||||
core.strokeRect(ctx, 112, 159, 32, 48, "rgba(255,255,255,1)", 1);
|
||||
let img = attack && (heroDiffList[turn].hp < 0) ? imagelighter(core.material.images.images["hero.webp"]) : attack && (heroDiffList[turn].hp > 0) ? imagelighter(core.material.images.images["hero.webp"], 'rgba(0, 255, 0, 0.5)') : core.material.images.images["hero.webp"]
|
||||
core.drawImage(
|
||||
ctx,
|
||||
@ -21227,7 +21264,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
32,
|
||||
48,
|
||||
112,
|
||||
139,
|
||||
159,
|
||||
32,
|
||||
48
|
||||
);
|
||||
@ -21237,7 +21274,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
ctx,
|
||||
enemyInfo.name,
|
||||
289,
|
||||
128,
|
||||
148,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
"bold 14px Verdana"
|
||||
@ -21245,7 +21282,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
|
||||
core.setTextAlign(ctx, "right");
|
||||
if (enemyInfo.cls === "enemys") {
|
||||
core.strokeRect(ctx, 272, 155, 32, 32, "rgba(255,255,255,1)", 1);
|
||||
core.strokeRect(ctx, 272, 175, 32, 32, "rgba(255,255,255,1)", 1);
|
||||
let img = attack && (enemyDiffList[turn].hp < 0) ? imagelighter(core.getBlockInfo(enemyInfo.id).image) : attack && (enemyDiffList[turn].hp > 0) ? imagelighter(core.getBlockInfo(enemyInfo.id).image, 'rgba(0, 255, 0, 0.5)') : core.getBlockInfo(enemyInfo.id).image
|
||||
core.drawImage(
|
||||
ctx,
|
||||
@ -21255,12 +21292,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
32,
|
||||
32,
|
||||
272,
|
||||
155,
|
||||
175,
|
||||
32,
|
||||
32
|
||||
);
|
||||
} else {
|
||||
core.strokeRect(ctx, 272, 139, 32, 48, "rgba(255,255,255,1)", 1);
|
||||
core.strokeRect(ctx, 272, 159, 32, 48, "rgba(255,255,255,1)", 1);
|
||||
let img = attack && (enemyDiffList[turn].hp < 0) ? imagelighter(core.getBlockInfo(enemyInfo.id).image) : attack && (enemyDiffList[turn].hp > 0) ? imagelighter(core.getBlockInfo(enemyInfo.id).image, 'rgba(0, 255, 0, 0.5)') : core.getBlockInfo(enemyInfo.id).image
|
||||
core.drawImage(
|
||||
ctx,
|
||||
@ -21270,30 +21307,21 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
32,
|
||||
48,
|
||||
272,
|
||||
139,
|
||||
159,
|
||||
32,
|
||||
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, "I374", 330, 250, 16, 16);
|
||||
core.drawIcon(ctx, "amulet", 330, 270, 16, 16);
|
||||
core.drawIcon(ctx, "jumpShoes", 330, 290, 16, 16);
|
||||
core.drawIcon(ctx, "hp", 330, 210, 16, 16);
|
||||
core.drawIcon(ctx, "atk", 330, 230, 16, 16);
|
||||
core.drawIcon(ctx, "def", 330, 250, 16, 16);
|
||||
core.drawIcon(ctx, "I374", 330, 270, 16, 16);
|
||||
core.drawIcon(ctx, "amulet", 330, 290, 16, 16);
|
||||
core.drawIcon(ctx, "jumpShoes", 330, 310, 16, 16);
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
core.formatBigNumber(enemyInfo.hp, true) + " 生命",
|
||||
330,
|
||||
205,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
"bold 14px Arial"
|
||||
);
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
core.formatBigNumber(enemyInfo.atk) + " 攻击",
|
||||
330,
|
||||
225,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
@ -21301,7 +21329,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
);
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
core.formatBigNumber(enemyInfo.def) + " 防御",
|
||||
core.formatBigNumber(enemyInfo.atk) + " 攻击",
|
||||
330,
|
||||
245,
|
||||
"#FFFFFF",
|
||||
@ -21310,7 +21338,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
);
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
(enemyInfo.spell ?? 0) + " 法qi强",
|
||||
core.formatBigNumber(enemyInfo.def) + " 防御",
|
||||
330,
|
||||
265,
|
||||
"#FFFFFF",
|
||||
@ -21319,7 +21347,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
);
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
(enemyInfo.mdef ?? 0) * 100 + "% 法抗",
|
||||
(enemyInfo.spell ?? 0) + " 法qi强",
|
||||
330,
|
||||
285,
|
||||
"#FFFFFF",
|
||||
@ -21328,7 +21356,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
);
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
core.formatBigNumber(enemyInfo.speed) + " 速度",
|
||||
(enemyInfo.mdef ?? 0) * 100 + "% 法抗",
|
||||
330,
|
||||
305,
|
||||
"#FFFFFF",
|
||||
@ -21337,9 +21365,18 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
);
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
"简易模式",
|
||||
core.formatBigNumber(enemyInfo.speed) + " 速度",
|
||||
330,
|
||||
325,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
"bold 14px Arial"
|
||||
);
|
||||
core.fillBoldText(
|
||||
ctx,
|
||||
"简易模式",
|
||||
330,
|
||||
345,
|
||||
"#FFFF60",
|
||||
"#000000",
|
||||
"bold 16px Verdana"
|
||||
@ -21348,7 +21385,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
ctx,
|
||||
"跳过",
|
||||
330,
|
||||
345,
|
||||
365,
|
||||
"#FFFF60",
|
||||
"#000000",
|
||||
"bold 16px Verdana"
|
||||
@ -21358,7 +21395,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
ctx,
|
||||
"V",
|
||||
219,
|
||||
163,
|
||||
183,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
"bold 48px pala"
|
||||
@ -21367,7 +21404,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
ctx,
|
||||
"s",
|
||||
231,
|
||||
163,
|
||||
183,
|
||||
"#FFFFFF",
|
||||
"#000000",
|
||||
"bold 36px pala"
|
||||
@ -21377,9 +21414,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
let enemynow = Math.min(100 + enemyInfo.now / oneTurn * 215, 315);
|
||||
ctx.fillStyle = "#FFFFFF";
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(enemynow, 100);
|
||||
ctx.lineTo(enemynow + 5, 90);
|
||||
ctx.lineTo(enemynow - 5, 90);
|
||||
ctx.moveTo(enemynow, 120);
|
||||
ctx.lineTo(enemynow + 5, 110);
|
||||
ctx.lineTo(enemynow - 5, 110);
|
||||
ctx.closePath();
|
||||
ctx.fill();
|
||||
|
||||
@ -21392,7 +21429,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
32,
|
||||
32,
|
||||
enemynow - 16,
|
||||
64,
|
||||
74,
|
||||
32,
|
||||
32
|
||||
);
|
||||
@ -21405,35 +21442,35 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
32,
|
||||
19,
|
||||
enemynow - 16,
|
||||
70,
|
||||
58,
|
||||
32,
|
||||
19
|
||||
48
|
||||
);
|
||||
}
|
||||
core.drawLine(ctx, 100, 105, 315, 105, "#FFFFFF", 5);
|
||||
core.drawLine(ctx, 100, 125, 315, 125, "#FFFFFF", 5);
|
||||
equipInfo.forEach(function (v) {
|
||||
if (!attack && !onattack) v.now += v.speed / onegcd;
|
||||
let vnow = Math.min(100 + v.now / oneTurn * 215, 315);
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(vnow, 100);
|
||||
ctx.lineTo(vnow + 5, 90);
|
||||
ctx.lineTo(vnow - 5, 90);
|
||||
ctx.moveTo(vnow, 120);
|
||||
ctx.lineTo(vnow + 5, 110);
|
||||
ctx.lineTo(vnow - 5, 110);
|
||||
ctx.closePath();
|
||||
|
||||
ctx.fill();
|
||||
|
||||
core.drawIcon(ctx, v.id, vnow - 16, 64, 32, 32);
|
||||
core.drawIcon(ctx, v.id, vnow - 16, 54, 32, 32);
|
||||
});
|
||||
if (!attack && !onattack) heroInfo.now += hero.speed / onegcd;
|
||||
let heronow = Math.min(100 + heroInfo.now / oneTurn * 215, 315);
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(heronow, 100);
|
||||
ctx.lineTo(heronow + 5, 90);
|
||||
ctx.lineTo(heronow - 5, 90);
|
||||
ctx.moveTo(heronow, 120);
|
||||
ctx.lineTo(heronow + 5, 110);
|
||||
ctx.lineTo(heronow - 5, 110);
|
||||
ctx.closePath();
|
||||
|
||||
ctx.fill();
|
||||
core.drawImage(ctx, "hero.webp", 0, 0, 32, 19, heronow - 16, 70, 32, 19);
|
||||
core.drawImage(ctx, "hero.webp", 0, 0, 32, 48, heronow - 16, 58, 32, 48);
|
||||
}
|
||||
let nowattacking = false
|
||||
if (heroInfo.now >= oneTurn && !heroInfo.isAttack) {
|
||||
@ -21462,10 +21499,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
|
||||
let herodamage = enemyDiffList[turn].hp
|
||||
let text = herodamage === 0 ? "抵抗" : herodamage
|
||||
if (enemyDiffList[turn].attack) Dove.MorePerform.ShowDamagePop.PopDamage(
|
||||
Dove.MorePerform.ShowDamagePop.PopDamage(
|
||||
ctx, // 默认画布名称
|
||||
270, // 英雄位置 x
|
||||
140, // 英雄位置 y
|
||||
160, // 英雄位置 y
|
||||
text, // 伤害值
|
||||
18, // 默认字体大小
|
||||
"Arial", //默认字体
|
||||
@ -21482,10 +21519,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
enemyanimateList[turn].forEach(v => animateOnAttack(v, true))
|
||||
const enemydamage = heroDiffList[turn].hp
|
||||
text = enemydamage === 0 ? "抵抗" : enemydamage
|
||||
if (heroDiffList[turn].attack) Dove.MorePerform.ShowDamagePop.PopDamage(
|
||||
Dove.MorePerform.ShowDamagePop.PopDamage(
|
||||
ctx, // 默认画布名称
|
||||
110, // 英雄位置 x
|
||||
140, // 英雄位置 y
|
||||
160, // 英雄位置 y
|
||||
text, // 伤害值
|
||||
18, // 默认字体大小
|
||||
"Arial", //默认字体
|
||||
@ -21542,50 +21579,15 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
core.unregisterAnimationFrame("attackAnimate")
|
||||
core.clearMap(ctx)
|
||||
core.closePanel()
|
||||
res()
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function animateOnAttack(name, onenemy) {
|
||||
if (onenemy) {
|
||||
playanimate(name, 290, 160);
|
||||
} else {
|
||||
playanimate(name, 130, 160);
|
||||
}
|
||||
}
|
||||
|
||||
this.attackAnimate = function (
|
||||
enemyId,
|
||||
heroInfo,
|
||||
enemyInfo,
|
||||
equipInfo,
|
||||
oneTurn,
|
||||
onegcd,
|
||||
heroDiffList,
|
||||
enemyDiffList,
|
||||
heroanimateList,
|
||||
enemyanimateList
|
||||
) {
|
||||
//参数分别为怪物id、真实属性,战斗信息,特殊装备(如火焰风衣)属性特殊装备属性为以元组{equipId,oneDamage,speed,now:0}构成的数组(列出每个需要计算的特殊装备,没有则为空数组或不填)
|
||||
core.lockControl();
|
||||
core.clearMap(ctx);
|
||||
core.status.event.id = "attackAnimate";
|
||||
turn = 0
|
||||
enemyInfo.id = enemyId;
|
||||
enemyInfo.cls = core.getClsFromId(enemyId);
|
||||
enemyInfo.name = core.material.enemys[enemyId].name;
|
||||
|
||||
if (oneTurn < 120) oneTurn *= Math.round(120 / oneTurn)
|
||||
let time = 0,
|
||||
farme = 0;
|
||||
|
||||
core.registerAnimationFrame("attackAnimate", true, (temptime) => {
|
||||
if (temptime - time > 1000 / 60) {
|
||||
time = temptime;
|
||||
this.drawAttackAnimate(
|
||||
drawAttackAnimate(
|
||||
heroInfo,
|
||||
oneTurn,
|
||||
enemyInfo,
|
||||
@ -21602,7 +21604,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
farme++;
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
}
|
||||
},
|
||||
"剧情内容": function () {
|
||||
|
Loading…
Reference in New Issue
Block a user