回合动画优化

This commit is contained in:
草莓 2025-02-25 15:04:06 +08:00
parent 9d2c199a1e
commit ea950830d5
3 changed files with 60 additions and 18 deletions

View File

@ -1120,8 +1120,8 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"hp": 1000, "hp": 1000,
"manamax": -1, "manamax": -1,
"mana": 0, "mana": 0,
"atk": 100, "atk": 60,
"def": 100, "def": 10,
"mdef": 100, "mdef": 100,
"speed": 10, "speed": 10,
"money": 0, "money": 0,

View File

@ -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}, "redSlime": {"name":"红头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[],"value":10},
"blackSlime": {"name":"青头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, "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]}, "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":15}, "bat": {"name":"小蝙蝠","hp":100,"atk":50,"def":30,"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}, "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":[]}, "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}, "vampire": {"name":"冥灵魔王","hp":888,"atk":888,"def":888,"money":888,"exp":888,"point":0,"special":[6],"n":8},

View File

@ -4623,6 +4623,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
100, 200, // 位置 (x, y) 100, 200, // 位置 (x, y)
-50, // 伤害值 -50, // 伤害值
24, // 字体大小 24, // 字体大小
"宋体",//字体
'#FF0000', // 字体颜色 '#FF0000', // 字体颜色
'#000000', // 描边颜色 '#000000', // 描边颜色
0.5, // 水平速度 (speedX) 0.5, // 水平速度 (speedX)
@ -4652,9 +4653,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}; };
// 弹出伤害气泡 // 弹出伤害气泡
Dove.MorePerform.ShowDamagePop.PopDamage = function (canvasName, x, y, damageValue, fontSize, fontColor, outlineColor, speedX, speedY, gravity, duration) { Dove.MorePerform.ShowDamagePop.PopDamage = function (canvasName, x, y, damageValue, fontSize, font, fontColor, outlineColor, speedX, speedY, gravity, duration) {
if (damageValue) { if (damageValue) {
var poper = new PopSprite(canvasName, x, y, damageValue, fontSize, fontColor, outlineColor, speedX, speedY, gravity, duration); var poper = new PopSprite(canvasName, x, y, damageValue, fontSize, font, fontColor, outlineColor, speedX, speedY, gravity, duration);
Dove.MorePerform.ShowDamagePop.AllPopingCanvas.push(poper); Dove.MorePerform.ShowDamagePop.AllPopingCanvas.push(poper);
} }
}; };
@ -4675,7 +4676,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
null, // 默认水平速度 null, // 默认水平速度
null, // 默认垂直速度 null, // 默认垂直速度
null, // 默认重力 null, // 默认重力
180 // 默认显示时长(帧数) 90 // 默认显示时长(帧数)
); );
}; };
let time = 0 let time = 0
@ -4692,7 +4693,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
); );
// 弹出精灵类 // 弹出精灵类
function PopSprite(canvasName, x, y, damage, fontSize, fontColor, outlineColor, speedX, speedY, gravity, duration) { function PopSprite(canvasName, x, y, damage, fontSize, font, fontColor, outlineColor, speedX, speedY, gravity, duration) {
this.initialize.apply(this, arguments); this.initialize.apply(this, arguments);
} }
@ -4705,12 +4706,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
PopSprite._floorDis = 20; PopSprite._floorDis = 20;
// 初始化 // 初始化
PopSprite.prototype.initialize = function (canvasName, x, y, damage, fontSize, fontColor, outlineColor, speedX, speedY, gravity, duration) { PopSprite.prototype.initialize = function (canvasName, x, y, damage, fontSize, font, fontColor, outlineColor, speedX, speedY, gravity, duration) {
this._canvasName = canvasName ?? 'ui'; // 默认画布名称 this._canvasName = canvasName ?? 'ui'; // 默认画布名称
this._x = x; this._x = x;
this._y = y; this._y = y;
this._damage = damage; this._damage = damage;
this._fontSize = fontSize ?? 16; // 默认字体大小 this._fontSize = fontSize ?? 16; // 默认字体大小
this._font = font ?? "宋体"
this._fontColor = fontColor ?? (damage > 0 ? '#22FF44' : '#FF2244'); // 默认颜色 this._fontColor = fontColor ?? (damage > 0 ? '#22FF44' : '#FF2244'); // 默认颜色
this._outlineColor = outlineColor ?? '#000000'; // 默认描边颜色 this._outlineColor = outlineColor ?? '#000000'; // 默认描边颜色
this._speedX = speedX ?? (-2 + Math.random() * 3); // 水平速度,默认随机 this._speedX = speedX ?? (-2 + Math.random() * 3); // 水平速度,默认随机
@ -4743,7 +4745,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
PopSprite.prototype.requestCanvas = function () { 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, this._height, this._z);
var canvas = core.ui.getContextByName(this._symbol); var canvas = core.ui.getContextByName(this._symbol);
canvas.font = this._fontSize + 'px pala'; // 动态设置字体大小 canvas.font = this._fontSize + 'px ' + this._font; // 动态设置字体大小
canvas.fillStyle = this._fontColor; // 动态设置字体颜色 canvas.fillStyle = this._fontColor; // 动态设置字体颜色
canvas.strokeStyle = this._outlineColor; // 动态设置描边颜色 canvas.strokeStyle = this._outlineColor; // 动态设置描边颜色
canvas.strokeText(this._text, 2, this._height); canvas.strokeText(this._text, 2, this._height);
@ -4754,11 +4756,11 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
PopSprite.prototype.initAllMembers = function () { PopSprite.prototype.initAllMembers = function () {
this._text = String(this._damage); this._text = String(this._damage);
var uiContext = core.ui.getContextByName(this._canvasName); // 使用指定画布 var uiContext = core.ui.getContextByName(this._canvasName); // 使用指定画布
uiContext.font = this._fontSize + 'px pala'; // 动态设置字体大小 uiContext.font = this._fontSize + 'px 宋体'; // 动态设置字体大小
var textRect = uiContext.measureText(this._text); var textRect = uiContext.measureText(this._text);
this._width = Math.round(textRect.width + 4); this._width = Math.round(textRect.width + 4);
this._height = this._fontSize + 4; // 动态设置高度 this._height = this._fontSize + 4; // 动态设置高度
this._z = PopSprite._baseZOrder + PopSprite._count; this._z = uiContext.canvas.style.zIndex ? uiContext.canvas.style.zIndex + PopSprite._count : PopSprite._baseZOrder + PopSprite._count;
this._symbol = 'popSprite' + PopSprite._count++; this._symbol = 'popSprite' + PopSprite._count++;
this._alive = true; this._alive = true;
this._vx = this._speedX; // 使用传入的水平速度 this._vx = this._speedX; // 使用传入的水平速度
@ -21083,8 +21085,47 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
} }
}); });
if (!attack && nowattacking) { if (!attack && nowattacking) {
if (heroInfo.isAttack) animateOnAttack('sword', true)
if (enemyInfo.isAttack) animateOnAttack('sword', false) if (heroInfo.isAttack) {
const herodamage = -Math.max(heroInfo.atk - enemyInfo.def, 0)
Dove.MorePerform.ShowDamagePop.PopDamage(
ctx, // 默认画布名称
270, // 英雄位置 x
140, // 英雄位置 y
herodamage, // 伤害值
16, // 默认字体大小
null, //默认字体
null, // 默认颜色
null, // 默认描边颜色
0, // 默认水平速度
-1, // 默认垂直速度
0, // 默认重力
90 // 默认显示时长(帧数)
);
enemyInfo.hp += herodamage
if (enemyInfo.hp < 0) enemyInfo.hp = 0
animateOnAttack('sword', true)
}
if (enemyInfo.isAttack) {
const enemydamage = -Math.max(enemyInfo.atk - heroInfo.def, 0)
Dove.MorePerform.ShowDamagePop.PopDamage(
ctx, // 默认画布名称
115, // 英雄位置 x
140, // 英雄位置 y
enemydamage, // 伤害值
16, // 默认字体大小
null, //默认字体
null, // 默认颜色
null, // 默认描边颜色
0, // 默认水平速度
-1, // 默认垂直速度
0, // 默认重力
90 // 默认显示时长(帧数)
);
heroInfo.hp += enemydamage
if (heroInfo.hp < 0) heroInfo.hp = 0
animateOnAttack('sword', false)
}
if (equipanimate.length > 0) { if (equipanimate.length > 0) {
equipanimate.forEach(v => { equipanimate.forEach(v => {
animateOnAttack('sword', true) animateOnAttack('sword', true)
@ -21127,12 +21168,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
} }
} }
}
};
function animateOnAttack(name, onenemy) { function animateOnAttack(name, onenemy) {
if (onenemy) { if (onenemy) {
playanimate(name, 290, 160); playanimate(name, 290, 160);
@ -21147,7 +21186,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
damageInfo, damageInfo,
equipInfo = [] equipInfo = []
) { ) {
//参数分别为怪物真实属性,战斗信息,特殊装备(如火焰风衣)属性特殊装备属性为以元组{equipId,oneDamage,speed,now:0}构成的数组(列出每个需要计算的特殊装备,没有则为空数组或不填) //参数分别为怪物id、真实属性,战斗信息,特殊装备(如火焰风衣)属性特殊装备属性为以元组{equipId,oneDamage,speed,now:0}构成的数组(列出每个需要计算的特殊装备,没有则为空数组或不填)
core.lockControl(); core.lockControl();
core.clearMap(ctx); core.clearMap(ctx);
core.status.event.id = "attackAnimate"; core.status.event.id = "attackAnimate";
@ -21205,10 +21244,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
damageInfo, damageInfo,
onegcd onegcd
); );
farme++; farme++;
} }
}); });
};
}
}, },
"剧情内容": function () { "剧情内容": function () {
// 在此增加新插件 // 在此增加新插件