boss战回合攻击
This commit is contained in:
parent
d9a5f79f7a
commit
5a3552c2c0
2
main.js
2
main.js
@ -276,7 +276,7 @@ main.prototype.init = function (mode, callback) {
|
|||||||
coreData[t] = main[t];
|
coreData[t] = main[t];
|
||||||
});
|
});
|
||||||
main.core.init(coreData, callback);
|
main.core.init(coreData, callback);
|
||||||
main.core.resize();
|
core.resize();
|
||||||
// 自动放缩最大化
|
// 自动放缩最大化
|
||||||
if (!main.replayChecking) {
|
if (!main.replayChecking) {
|
||||||
if (core.getLocalStorage("autoScale") == null) {
|
if (core.getLocalStorage("autoScale") == null) {
|
||||||
|
@ -2728,6 +2728,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
|
|
||||||
main.dom.boss5.style.width = obj.totalWidth + 3 + "px";
|
main.dom.boss5.style.width = obj.totalWidth + 3 + "px";
|
||||||
main.dom.boss5.style.height = obj.totalHeight + 3 + "px";
|
main.dom.boss5.style.height = obj.totalHeight + 3 + "px";
|
||||||
|
main.dom.boss6.style.width = obj.totalWidth + 3 + "px";
|
||||||
|
main.dom.boss6.style.height = obj.totalHeight + 3 + "px";
|
||||||
|
main.dom.boss7.style.width = obj.totalWidth + 3 + "px";
|
||||||
|
main.dom.boss7.style.height = obj.totalHeight + 3 + "px";
|
||||||
|
main.dom.boss8.style.width = obj.totalWidth + 3 + "px";
|
||||||
|
main.dom.boss8.style.height = obj.totalHeight + 3 + "px";
|
||||||
|
|
||||||
main.dom.boss.style.width = obj.totalWidth + 3 + "px";
|
main.dom.boss.style.width = obj.totalWidth + 3 + "px";
|
||||||
main.dom.boss.style.height = obj.totalHeight + 3 + "px";
|
main.dom.boss.style.height = obj.totalHeight + 3 + "px";
|
||||||
@ -8714,6 +8720,35 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
yellowgreen: "#9acd32",
|
yellowgreen: "#9acd32",
|
||||||
transparent: "#0000",
|
transparent: "#0000",
|
||||||
};
|
};
|
||||||
|
// 计算两个数的最大公约数
|
||||||
|
function gcdOfTwo(a, b) {
|
||||||
|
while (b !== 0) {
|
||||||
|
let temp = b;
|
||||||
|
b = a % b;
|
||||||
|
a = temp;
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算任意项整数的最大公约数
|
||||||
|
function gcd(...numbers) {
|
||||||
|
if (numbers.length < 2) {
|
||||||
|
throw new Error("至少需要两个数");
|
||||||
|
}
|
||||||
|
return numbers.reduce((a, b) => gcdOfTwo(a, b));
|
||||||
|
}
|
||||||
|
// 计算两个数的最小公倍数
|
||||||
|
function lcmOfTwo(a, b) {
|
||||||
|
return (a * b) / gcdOfTwo(a, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算任意项整数的最小公倍数
|
||||||
|
function lcm(...numbers) {
|
||||||
|
if (numbers.length < 2) {
|
||||||
|
throw new Error("至少需要两个数");
|
||||||
|
}
|
||||||
|
return numbers.reduce((a, b) => lcmOfTwo(a, b));
|
||||||
|
}
|
||||||
|
|
||||||
if (has(core.plugin.utils)) {
|
if (has(core.plugin.utils)) {
|
||||||
throw new ReferenceError(
|
throw new ReferenceError(
|
||||||
@ -8721,6 +8756,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
core.plugin.utils = {
|
core.plugin.utils = {
|
||||||
|
gcdOfTwo,
|
||||||
|
lcmOfTwo,
|
||||||
|
gcd,
|
||||||
|
lcm,
|
||||||
has,
|
has,
|
||||||
slide,
|
slide,
|
||||||
backDir,
|
backDir,
|
||||||
@ -16478,6 +16517,41 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
boss5.style.transform = "translate(-50%,-50%)";
|
boss5.style.transform = "translate(-50%,-50%)";
|
||||||
const ctx5 = boss5.getContext("2d");
|
const ctx5 = boss5.getContext("2d");
|
||||||
main.dom.boss5 = boss5;
|
main.dom.boss5 = boss5;
|
||||||
|
|
||||||
|
const boss6 = document.createElement("canvas"); //boss战画布设置
|
||||||
|
boss6.style.position = "absolute";
|
||||||
|
boss6.style.zIndex = 305;
|
||||||
|
boss6.style.display = "none";
|
||||||
|
boss6.id = "boss6";
|
||||||
|
main.dom.gameGroup.insertAdjacentElement("afterend", boss6);
|
||||||
|
boss6.style.top = "50%";
|
||||||
|
boss6.style.left = "50%";
|
||||||
|
boss6.style.transform = "translate(-50%,-50%)";
|
||||||
|
const ctx6 = boss6.getContext("2d");
|
||||||
|
main.dom.boss6 = boss6;
|
||||||
|
const boss7 = document.createElement("canvas"); //boss战画布设置
|
||||||
|
boss7.style.position = "absolute";
|
||||||
|
boss7.style.zIndex = 306;
|
||||||
|
boss7.style.display = "none";
|
||||||
|
boss7.id = "boss7";
|
||||||
|
main.dom.gameGroup.insertAdjacentElement("afterend", boss7);
|
||||||
|
boss7.style.top = "50%";
|
||||||
|
boss7.style.left = "50%";
|
||||||
|
boss7.style.transform = "translate(-50%,-50%)";
|
||||||
|
const ctx7 = boss7.getContext("2d");
|
||||||
|
main.dom.boss7 = boss7;
|
||||||
|
const boss8 = document.createElement("canvas"); //boss战画布设置
|
||||||
|
boss8.style.position = "absolute";
|
||||||
|
boss8.style.zIndex = 307;
|
||||||
|
boss8.style.display = "none";
|
||||||
|
boss8.id = "boss8";
|
||||||
|
main.dom.gameGroup.insertAdjacentElement("afterend", boss8);
|
||||||
|
boss8.style.top = "50%";
|
||||||
|
boss8.style.left = "50%";
|
||||||
|
boss8.style.transform = "translate(-50%,-50%)";
|
||||||
|
const ctx8 = boss8.getContext("2d");
|
||||||
|
main.dom.boss8 = boss8;
|
||||||
|
|
||||||
boss.onclick = function (e) {
|
boss.onclick = function (e) {
|
||||||
try {
|
try {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -16496,7 +16570,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
main.log(ee);
|
main.log(ee);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const { sleep } = core.plugin.utils
|
||||||
|
|
||||||
class Boss {
|
class Boss {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -16504,14 +16578,14 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
this.bg = "bg_3512.webp";
|
this.bg = "bg_3512.webp";
|
||||||
this.heroImage = "tati_310101.webp"
|
this.heroImage = "tati_310101.webp"
|
||||||
this.hero = { hp: 1000, atk: 100, def: 100, spell: 100, speed: 10, mdef: 10 }
|
this.hero = { hp: 1000, atk: 100, def: 100, spell: 100, speed: 10, mdef: 10 }
|
||||||
this.boss = { name: "菲奥奈", id: "angel", image: "tati_050143.webp", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10 }
|
this.boss = { name: "菲奥奈", id: "angel", image: "tati_050143.webp", hp: 1000, atk: 200, def: 100, speed: 10, mdef: 10, skill: ['普通攻击', '重斩'], index: 0 }
|
||||||
this.enemy = [
|
this.enemy = [
|
||||||
{ name: "小蝙蝠", id: "bat", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10 },
|
{ name: "小蝙蝠", id: "bat", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10, skill: ['普通攻击', '重斩'], index: 0 },
|
||||||
{ name: "红蝙蝠", id: "redBat", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10 },
|
{ name: "红蝙蝠", id: "redBat", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10, skill: ['普通攻击', '重斩'], index: 0 },
|
||||||
{ name: "大蝙蝠", id: "bigBat", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10 },
|
{ name: "大蝙蝠", id: "bigBat", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10, skill: ['普通攻击', '重斩'], index: 0 },
|
||||||
{ name: "绿色史莱姆", id: "greenSlime", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10 },
|
{ name: "绿色史莱姆", id: "greenSlime", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10, skill: ['普通攻击', '重斩'], index: 0 },
|
||||||
{ name: "红色史莱姆", id: "redSlime", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10 },
|
{ name: "红色史莱姆", id: "redSlime", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10, skill: ['普通攻击', '重斩'], index: 0 },
|
||||||
{ name: "黑色史莱姆", id: "blackSlime", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10 },
|
{ name: "黑色史莱姆", id: "blackSlime", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10, skill: ['普通攻击', '重斩'], index: 0 },
|
||||||
]
|
]
|
||||||
this.bossImage = "tati_050143.webp"
|
this.bossImage = "tati_050143.webp"
|
||||||
this.selection = "boss"
|
this.selection = "boss"
|
||||||
@ -16525,7 +16599,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
[],
|
[],
|
||||||
[]
|
[]
|
||||||
]
|
]
|
||||||
|
this.skills = { //技能列表,便于调用(可通过this.skills[name]调用)
|
||||||
|
"菲奥奈": ['普通攻击', '重斩']
|
||||||
}
|
}
|
||||||
|
this.turn = 0;
|
||||||
|
this.playingAnimate = new Set();
|
||||||
|
}
|
||||||
|
|
||||||
click(px, py) {
|
click(px, py) {
|
||||||
//点击效果
|
//点击效果
|
||||||
const makeBox = ([x, y], [w, h]) => {
|
const makeBox = ([x, y], [w, h]) => {
|
||||||
@ -16543,18 +16623,169 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
const pos = [px, py];
|
const pos = [px, py];
|
||||||
}
|
}
|
||||||
async bossStart() {
|
async bossStart() {
|
||||||
|
boss.style.display = "block"
|
||||||
|
this.turn = 0
|
||||||
core.lockControl()
|
core.lockControl()
|
||||||
await this.blackBg()
|
await this.blackBg()
|
||||||
this.moveboss()
|
this.moveboss()
|
||||||
await this.movehero()
|
await this.movehero()
|
||||||
await this.moveStatus()
|
await this.moveStatus()
|
||||||
this.drawenemy()
|
this.update()
|
||||||
|
this.fight()
|
||||||
}
|
}
|
||||||
async bossEnd() {
|
async bossEnd() {
|
||||||
|
hero.hp = this.hero.hp
|
||||||
await this.close()
|
await this.close()
|
||||||
core.unlockControl()
|
|
||||||
|
|
||||||
|
core.unlockControl()
|
||||||
|
core.updateStatusBar()
|
||||||
|
if (hero.hp <= 0) {
|
||||||
|
hero.hp = 0
|
||||||
|
core.events.lose("BOSS战失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async fight() {
|
||||||
|
await this.drawturn()
|
||||||
|
const fightList = []
|
||||||
|
fightList.push(['hero', this.hero.speed])
|
||||||
|
if (this.boss.hp > 0) fightList.push(["boss", this.boss.speed])
|
||||||
|
this.enemy.forEach((v, i) => {
|
||||||
|
if (v.id && v.hp > 0) fightList.push([i, v.speed])
|
||||||
|
})
|
||||||
|
fightList.sort((a, b) => b[1] - a[1])
|
||||||
|
let damage;
|
||||||
|
for (const v of fightList) {
|
||||||
|
switch (v[0]) {
|
||||||
|
case 'hero':
|
||||||
|
await this.playanimate("sword", 1800, 800) //播放动画sword
|
||||||
|
await sleep(200) //等待200ms
|
||||||
|
break;
|
||||||
|
case 'boss':
|
||||||
|
if (this.boss.hp > 0) {
|
||||||
|
this.selection = "boss"
|
||||||
|
this.update()
|
||||||
|
|
||||||
|
switch (this.boss.skill[this.boss.index]) { //这里写boss技能的效果
|
||||||
|
case "普通攻击":
|
||||||
|
damage = Math.max(this.boss.atk - this.hero.def, 0) //基础伤害
|
||||||
|
damage = Math.floor(damage * this.boss.speed / this.hero.speed) //速度比值伤害加成
|
||||||
|
this.hero.hp -= damage //承受伤害
|
||||||
|
core.status.hero.statistics.battleDamage += damage; //数据统计记录伤害
|
||||||
|
await this.playanimate("sword", 350, 800) //播放动画sword
|
||||||
|
await sleep(200) //等待200ms
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
this.boss.index++
|
||||||
|
if (this.boss.index >= this.boss.skill.length) this.boss.index = 0
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
const enemy = this.enemy[v[0]];
|
||||||
|
if (enemy.hp > 0) {
|
||||||
|
this.selection = v[0]
|
||||||
|
this.update()
|
||||||
|
|
||||||
|
switch (enemy.skill[enemy.index]) { //这里写boss召唤物(小怪)的技能效果
|
||||||
|
case "普通攻击":
|
||||||
|
damage = Math.max(enemy.atk - this.hero.def, 0) //基础伤害
|
||||||
|
damage = Math.floor(damage * enemy.speed / enemy.speed) //速度比值伤害加成
|
||||||
|
this.hero.hp -= damage //承受伤害
|
||||||
|
core.status.hero.statistics.battleDamage += damage; //数据统计记录伤害
|
||||||
|
|
||||||
|
switch (enemy.id) { //根据怪物id选取不同的特效
|
||||||
|
|
||||||
|
case "bat":
|
||||||
|
await this.playanimate("sword", 350, 800) //播放动画sword
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "redBat":
|
||||||
|
await this.playanimate("Fire01", 350, 800) //播放动画Fire01
|
||||||
|
break;
|
||||||
|
case "bigBat":
|
||||||
|
await this.playanimate("Fire02", 350, 800) //播放动画Fire02
|
||||||
|
break;
|
||||||
|
case "greenSlime":
|
||||||
|
await this.playanimate("005-Attack03", 350, 800) //播放动画005-Attack03
|
||||||
|
break;
|
||||||
|
case "redSlime":
|
||||||
|
await this.playanimate("012-Heal01", 350, 800) //播放动画012-Heal01
|
||||||
|
break;
|
||||||
|
case "blackSlime":
|
||||||
|
await this.playanimate("sword", 350, 800) //播放动画sword
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
await sleep(200) //等待200ms
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (enemy.index >= enemy.length) enemy.index = 0
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
this.update()
|
||||||
|
|
||||||
|
}
|
||||||
|
let end = true;
|
||||||
|
if (this.boss.hp > 0) end = false;
|
||||||
|
this.enemy.forEach(v => { if (v.hp > 0) end = false })
|
||||||
|
|
||||||
|
if (this.hero.hp <= 0) end = true
|
||||||
|
if (end) { this.bossEnd() } else { this.fight() }
|
||||||
|
}
|
||||||
|
drawturn() {
|
||||||
|
boss8.style.display = "block"
|
||||||
|
this.turn += 1
|
||||||
|
let time = 0,
|
||||||
|
frame = 0,
|
||||||
|
frame2 = 0,
|
||||||
|
right = 1,
|
||||||
|
once = 10;
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
core.registerAnimationFrame("drawturn", true, (temptime) => {
|
||||||
|
if (temptime - time > 1000 / 60) {
|
||||||
|
time = temptime
|
||||||
|
frame += 1 * right
|
||||||
|
core.clearMap(ctx)
|
||||||
|
if (core.domStyle.isVertical) {
|
||||||
|
ctx.canvas.width = 1248;
|
||||||
|
ctx.canvas.height = 2028;
|
||||||
|
ctx.save(); //保存设置
|
||||||
|
ctx.translate(1248, 0); //重新定位右上角为基准
|
||||||
|
ctx.rotate(Math.PI / 2); //旋转90度
|
||||||
|
} else {
|
||||||
|
ctx.canvas.width = 2028;
|
||||||
|
ctx.canvas.height = 1248;
|
||||||
|
}
|
||||||
|
|
||||||
|
core.fillRect(ctx, 0, 624 - once * frame, 2028, once * frame * 2, 'rgba(0,0,0,0.7)')
|
||||||
|
core.setTextAlign(ctx, "center")
|
||||||
|
core.fillBoldText1(
|
||||||
|
ctx,
|
||||||
|
'ROUND ' + this.turn,
|
||||||
|
1014,
|
||||||
|
624,
|
||||||
|
"#FFFFFF",
|
||||||
|
"#000000",
|
||||||
|
6,
|
||||||
|
core.ui._buildFont(frame * 5, true)
|
||||||
|
)
|
||||||
|
if (1014 - once * frame * 7 <= 0) {
|
||||||
|
frame -= 1
|
||||||
|
frame2++
|
||||||
|
|
||||||
|
if (frame2 > 30) right = -1
|
||||||
|
|
||||||
|
}
|
||||||
|
if (frame < 0) {
|
||||||
|
core.clearMap(ctx)
|
||||||
|
core.unregisterAnimationFrame("drawturn")
|
||||||
|
resolve()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
drawenemy() {
|
drawenemy() {
|
||||||
let block,
|
let block,
|
||||||
@ -16567,7 +16798,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
farme += 1
|
farme += 1
|
||||||
let animate = Math.floor(farme / 30),
|
let animate = Math.floor(farme / 30),
|
||||||
posx = 700,
|
posx = 700,
|
||||||
posy = 350;
|
posy = 500;
|
||||||
core.clearMap(ctx5)
|
core.clearMap(ctx5)
|
||||||
if (core.domStyle.isVertical) {
|
if (core.domStyle.isVertical) {
|
||||||
ctx5.canvas.width = 1248;
|
ctx5.canvas.width = 1248;
|
||||||
@ -16584,7 +16815,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
if (enemy) {
|
if (enemy) {
|
||||||
|
|
||||||
core.drawWindowSkin("winskin.webp", ctx5, 650, 250, 400, 660, null, null, null, 3)
|
core.drawWindowSkin("winskin.webp", ctx5, 650, 250, 400, 660, null, null, null, 3)
|
||||||
if (this.selection === "boss") core.strokeRect(ctx5, 800, 600, 100, 150, "yellow", 6)
|
if (this.selection === "boss") core.strokeRect(ctx5, 800, 300, 100, 150, "yellow", 6)
|
||||||
const bossBlock = core.getBlockInfo(this.boss.id)
|
const bossBlock = core.getBlockInfo(this.boss.id)
|
||||||
core.drawImage(
|
core.drawImage(
|
||||||
ctx5,
|
ctx5,
|
||||||
@ -16594,7 +16825,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
32,
|
32,
|
||||||
48,
|
48,
|
||||||
800,
|
800,
|
||||||
600,
|
300,
|
||||||
96,
|
96,
|
||||||
144
|
144
|
||||||
);
|
);
|
||||||
@ -16611,7 +16842,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
144
|
144
|
||||||
);
|
);
|
||||||
for (let i = 0; i < this.enemy.length; i++) {
|
for (let i = 0; i < this.enemy.length; i++) {
|
||||||
if (this.enemy[i].id) {
|
if (this.enemy[i].id && this.enemy[i].hp > 0) {
|
||||||
block = core.getBlockInfo(this.enemy[i].id)
|
block = core.getBlockInfo(this.enemy[i].id)
|
||||||
} else {
|
} else {
|
||||||
posx += 100
|
posx += 100
|
||||||
@ -16717,7 +16948,158 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
this.drawboss()
|
this.drawboss()
|
||||||
this.drawhero()
|
this.drawhero()
|
||||||
this.drawStatus()
|
this.drawStatus()
|
||||||
|
let dodraw = false
|
||||||
|
for (let i = 0; i < this.enemy.length; i++) {
|
||||||
|
if (this.enemy[i].id && this.enemy[i].hp > 0) { dodraw = true }
|
||||||
}
|
}
|
||||||
|
if (dodraw === true) this.drawenemy()
|
||||||
|
|
||||||
|
}
|
||||||
|
playanimate(name, x, y, scalex = 10, scaley = 10) {
|
||||||
|
const one = {
|
||||||
|
name: name,
|
||||||
|
x: x,
|
||||||
|
y: y,
|
||||||
|
scalex: scalex,
|
||||||
|
scaley: scaley,
|
||||||
|
farme: 0
|
||||||
|
|
||||||
|
}
|
||||||
|
let time = 0
|
||||||
|
boss6.style.display = "block"
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
core.registerAnimationFrame("animateboss", true, (timestamp) => {
|
||||||
|
if (timestamp - time > 1000 / 60) {
|
||||||
|
time = timestamp;
|
||||||
|
core.clearMap(ctx6);
|
||||||
|
|
||||||
|
|
||||||
|
const data = flags["animate_" + one.name];
|
||||||
|
if (core.domStyle.isVertical) {
|
||||||
|
ctx6.canvas.width = 1248;
|
||||||
|
ctx6.canvas.height = 2028;
|
||||||
|
ctx6.save(); //保存设置
|
||||||
|
ctx6.translate(1248, 0); //重新定位右上角为基准
|
||||||
|
ctx6.rotate(Math.PI / 2); //旋转90度
|
||||||
|
} else {
|
||||||
|
ctx6.canvas.width = 2028;
|
||||||
|
ctx6.canvas.height = 1248;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
|
||||||
|
core.registerAnimationFrame("animateboss")
|
||||||
|
resolve()
|
||||||
|
} else {
|
||||||
|
data.imageList.forEach(function (image) {
|
||||||
|
if (
|
||||||
|
one.farme >= (image.beforefarme ?? 0) &&
|
||||||
|
one.farme <= (image.afterfarme ?? data.allFarme)
|
||||||
|
) {
|
||||||
|
const img = core.material.images.images?.[image.image];
|
||||||
|
if (img) {
|
||||||
|
const gla = image.globalAlpha ?? 100;
|
||||||
|
const agla = image.aglobalAlpha ?? gla,
|
||||||
|
beforefarme = image.beforefarme ?? 0;
|
||||||
|
const afterfarme = image.afterfarme ?? data.allFarme;
|
||||||
|
|
||||||
|
ctx6.globalAlpha =
|
||||||
|
(gla +
|
||||||
|
((agla - gla) * (one.farme - beforefarme)) /
|
||||||
|
(afterfarme - beforefarme || 1)) /
|
||||||
|
100;
|
||||||
|
|
||||||
|
const cx =
|
||||||
|
(image.cx ?? 0) +
|
||||||
|
(((image.acx ?? 0) - (image.cx ?? 0)) *
|
||||||
|
(one.farme - beforefarme)) /
|
||||||
|
(afterfarme - beforefarme || 1),
|
||||||
|
cy =
|
||||||
|
(image.cy ?? 0) +
|
||||||
|
(((image.acy ?? 0) - (image.cy ?? 0)) *
|
||||||
|
(one.farme - beforefarme)) /
|
||||||
|
(afterfarme - beforefarme || 1),
|
||||||
|
cw =
|
||||||
|
(image.cw ?? img.width) +
|
||||||
|
(((image.acw ?? img.width) - (image.cw ?? img.width)) *
|
||||||
|
(one.farme - beforefarme)) /
|
||||||
|
(afterfarme - beforefarme || 1),
|
||||||
|
ch =
|
||||||
|
(image.ch ?? img.height) +
|
||||||
|
(((image.acw ?? img.height) - (image.cw ?? img.height)) *
|
||||||
|
(one.farme - beforefarme)) /
|
||||||
|
(afterfarme - beforefarme || 1),
|
||||||
|
x =
|
||||||
|
(image.x ?? 0) +
|
||||||
|
(((image.ax ?? 0) - (image.x ?? 0)) *
|
||||||
|
(one.farme - beforefarme)) /
|
||||||
|
(afterfarme - beforefarme || 1),
|
||||||
|
y =
|
||||||
|
(image.y ?? 0) +
|
||||||
|
(((image.ay ?? 0) - (image.y ?? 0)) *
|
||||||
|
(one.farme - beforefarme)) /
|
||||||
|
(afterfarme - beforefarme || 1),
|
||||||
|
w =
|
||||||
|
(image.w ?? one.width) +
|
||||||
|
(((image.aw ?? one.width) - (image.w ?? one.width)) *
|
||||||
|
(one.farme - beforefarme)) /
|
||||||
|
(afterfarme - beforefarme || 1),
|
||||||
|
h =
|
||||||
|
(image.h ?? one.height) +
|
||||||
|
(((image.aw ?? one.height) - (image.w ?? one.height)) *
|
||||||
|
(one.farme - beforefarme)) /
|
||||||
|
(afterfarme - beforefarme || 1),
|
||||||
|
angle =
|
||||||
|
(Math.PI *
|
||||||
|
((image.image.angle ?? 0) +
|
||||||
|
(((image.aangle ?? 0) - (image.image.angle ?? 0)) *
|
||||||
|
(one.farme - beforefarme)) /
|
||||||
|
(afterfarme - beforefarme || 1))) /
|
||||||
|
180;
|
||||||
|
|
||||||
|
|
||||||
|
core.drawImage(
|
||||||
|
ctx6,
|
||||||
|
img,
|
||||||
|
cx,
|
||||||
|
cy,
|
||||||
|
cw,
|
||||||
|
ch,
|
||||||
|
one.x + (x - data.px) * one.scalex,
|
||||||
|
one.y + (y - data.py) * one.scaley,
|
||||||
|
w * one.scalex,
|
||||||
|
h * one.scaley,
|
||||||
|
angle
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
data.soundList.forEach(function (sound) {
|
||||||
|
const lisen =
|
||||||
|
sound.sound &&
|
||||||
|
core.sounds[sound.sound] &&
|
||||||
|
core.musicStatus.soundStatus;
|
||||||
|
if (one.farme == sound.startfarme && lisen) {
|
||||||
|
if (sound.stopbefore) core.stopSound();
|
||||||
|
core.playSound(sound.sound);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
one.farme++;
|
||||||
|
ctx6.restore();
|
||||||
|
if (one.farme > data.allFarme) {
|
||||||
|
core.clearMap(ctx6)
|
||||||
|
core.registerAnimationFrame("animateboss")
|
||||||
|
resolve()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
drawboss() {
|
drawboss() {
|
||||||
core.clearMap(ctx3)
|
core.clearMap(ctx3)
|
||||||
if (core.domStyle.isVertical) {
|
if (core.domStyle.isVertical) {
|
||||||
@ -17391,7 +17773,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
close() {
|
close() {
|
||||||
let globalAlpha = 0,
|
let globalAlpha = 0,
|
||||||
time = 0
|
time = 0
|
||||||
boss.style.display = 'block'
|
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
core.registerAnimationFrame("closeblack", true, (temptime) => {
|
core.registerAnimationFrame("closeblack", true, (temptime) => {
|
||||||
if (temptime - time > 1000 / 60) {
|
if (temptime - time > 1000 / 60) {
|
||||||
@ -17424,6 +17805,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
boss3.style.display = 'none'
|
boss3.style.display = 'none'
|
||||||
boss4.style.display = 'none'
|
boss4.style.display = 'none'
|
||||||
boss5.style.display = 'none'
|
boss5.style.display = 'none'
|
||||||
|
boss6.style.display = 'none'
|
||||||
|
boss7.style.display = 'none'
|
||||||
|
boss8.style.display = 'none'
|
||||||
|
|
||||||
core.registerAnimationFrame("closeblack2", true, (temptime) => {
|
core.registerAnimationFrame("closeblack2", true, (temptime) => {
|
||||||
if (temptime - time > 1000 / 60) {
|
if (temptime - time > 1000 / 60) {
|
||||||
time = temptime
|
time = temptime
|
||||||
@ -17439,7 +17824,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
ctx.canvas.height = 1248;
|
ctx.canvas.height = 1248;
|
||||||
}
|
}
|
||||||
ctx.globalAlpha = globalAlpha
|
ctx.globalAlpha = globalAlpha
|
||||||
core.fillRect(ctx1, 0, 0, 2028, 1248, "#000000");
|
core.fillRect(ctx, 0, 0, 2028, 1248, "#000000");
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
globalAlpha -= 1 / 30
|
globalAlpha -= 1 / 30
|
||||||
if (globalAlpha < 0) {
|
if (globalAlpha < 0) {
|
||||||
@ -19605,14 +19990,15 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
const ctx = animateAttack.getContext("2d");
|
const ctx = animateAttack.getContext("2d");
|
||||||
|
|
||||||
main.dom.gameDraw.appendChild(animateAttack);
|
main.dom.gameDraw.appendChild(animateAttack);
|
||||||
|
const { lcm, gcd } = core.plugin.utils
|
||||||
this.drawAttackAnimate = function (
|
this.drawAttackAnimate = function (
|
||||||
heroInfo,
|
heroInfo,
|
||||||
oneTurn,
|
oneTurn,
|
||||||
enemyInfo,
|
enemyInfo,
|
||||||
equipInfo,
|
equipInfo,
|
||||||
farme,
|
farme,
|
||||||
damageInfo
|
damageInfo,
|
||||||
|
onegcd
|
||||||
) {
|
) {
|
||||||
let attack = false;
|
let attack = false;
|
||||||
if (heroInfo.isAttack) attack = true;
|
if (heroInfo.isAttack) attack = true;
|
||||||
@ -19852,8 +20238,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
"bold 36px pala"
|
"bold 36px pala"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!attack) enemyInfo.now += (enemyInfo.speed / oneTurn) * 215;
|
if (!attack) enemyInfo.now += enemyInfo.speed / onegcd;
|
||||||
let enemynow = Math.min(100 + enemyInfo.now, 315);
|
let enemynow = Math.min(100 + enemyInfo.now / oneTurn * 215, 315);
|
||||||
ctx.fillStyle = "#FFFFFF";
|
ctx.fillStyle = "#FFFFFF";
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.moveTo(enemynow, 100);
|
ctx.moveTo(enemynow, 100);
|
||||||
@ -19891,8 +20277,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
}
|
}
|
||||||
core.drawLine(ctx, 100, 105, 315, 105, "#FFFFFF", 5);
|
core.drawLine(ctx, 100, 105, 315, 105, "#FFFFFF", 5);
|
||||||
equipInfo.forEach(function (v) {
|
equipInfo.forEach(function (v) {
|
||||||
if (!attack) v.now += (v.speed / oneTurn) * 215;
|
if (!attack) v.now += v.speed / onegcd;
|
||||||
let vnow = Math.min(100 + v.now, 315);
|
let vnow = Math.min(100 + v.now / oneTurn * 215, 315);
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.moveTo(vnow, 100);
|
ctx.moveTo(vnow, 100);
|
||||||
ctx.lineTo(vnow + 3, 90);
|
ctx.lineTo(vnow + 3, 90);
|
||||||
@ -19903,41 +20289,60 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
|
|
||||||
core.drawIcon(ctx, v.id, vnow - 16, 64, 32, 32);
|
core.drawIcon(ctx, v.id, vnow - 16, 64, 32, 32);
|
||||||
});
|
});
|
||||||
if (!attack) heroInfo.now += (heroInfo.speed / oneTurn) * 215;
|
if (!attack) heroInfo.now += hero.speed / onegcd;
|
||||||
let heronow = Math.min(100 + heroInfo.now, 315);
|
let heronow = Math.min(100 + heroInfo.now / oneTurn * 215, 315);
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.moveTo(heronow, 100);
|
ctx.moveTo(heronow, 100);
|
||||||
ctx.lineTo(heronow + 3, 90);
|
ctx.lineTo(heronow + 5, 90);
|
||||||
ctx.lineTo(heronow - 3, 90);
|
ctx.lineTo(heronow - 5, 90);
|
||||||
ctx.closePath();
|
ctx.closePath();
|
||||||
|
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
core.drawImage(ctx, "hero.webp", 0, 0, 32, 19, heronow - 16, 70, 32, 19);
|
core.drawImage(ctx, "hero.webp", 0, 0, 32, 19, heronow - 16, 70, 32, 19);
|
||||||
|
let nowattacking = false
|
||||||
|
if (heroInfo.now >= oneTurn && !heroInfo.isAttack) {
|
||||||
|
|
||||||
if (heroInfo.now >= 215 && !heroInfo.isAttack) {
|
|
||||||
heroInfo.isAttack = true;
|
heroInfo.isAttack = true;
|
||||||
|
nowattacking = true
|
||||||
|
|
||||||
|
}
|
||||||
|
if (enemyInfo.now >= oneTurn && !enemyInfo.isAttack) {
|
||||||
|
|
||||||
|
enemyInfo.isAttack = true;
|
||||||
|
nowattacking = true
|
||||||
|
|
||||||
|
}
|
||||||
|
const equipanimate = []
|
||||||
|
equipInfo.forEach(v => {
|
||||||
|
if (v.now >= oneTurn && !v.isAttack) {
|
||||||
|
v.isAttack = true;
|
||||||
|
nowattacking = true
|
||||||
|
equipanimate.push(v)
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (!attack && nowattacking) {
|
||||||
|
if (heroInfo.isAttack) {
|
||||||
animateOnAttack("sword", true, () => {
|
animateOnAttack("sword", true, () => {
|
||||||
heroInfo.now -= 215;
|
heroInfo.now = 0;
|
||||||
heroInfo.isAttack = false;
|
heroInfo.isAttack = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (enemyInfo.now >= 215 && !enemyInfo.isAttack) {
|
if (enemyInfo.isAttack) {
|
||||||
enemyInfo.isAttack = true;
|
|
||||||
animateOnAttack("sword", false, () => {
|
animateOnAttack("sword", false, () => {
|
||||||
enemyInfo.now -= 215;
|
enemyInfo.now = 0;
|
||||||
enemyInfo.isAttack = false;
|
enemyInfo.isAttack = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
equipInfo.forEach((v) => {
|
if (equipanimate.length > 0) {
|
||||||
if (v.now >= 215 && !v.isAttack) {
|
equipanimate.forEach(v => {
|
||||||
v.isAttack = true;
|
|
||||||
|
|
||||||
animateOnAttack("sword", true, () => {
|
animateOnAttack("sword", true, () => {
|
||||||
v.now -= 215;
|
v.now = 0;
|
||||||
v.isAttack = false;
|
v.isAttack = false;
|
||||||
});
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function animateOnAttack(name, onenemy, callback) {
|
function animateOnAttack(name, onenemy, callback) {
|
||||||
@ -19985,15 +20390,18 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
enemyInfo.name = core.material.enemys[enemyId].name;
|
enemyInfo.name = core.material.enemys[enemyId].name;
|
||||||
enemyInfo.now = 0;
|
enemyInfo.now = 0;
|
||||||
enemyInfo.isAttack = false;
|
enemyInfo.isAttack = false;
|
||||||
let oneTurn = heroInfo.speed + enemyInfo.speed;
|
let oneTurn = [heroInfo.speed, enemyInfo.speed];
|
||||||
if (equipInfo.length > 0) {
|
if (equipInfo.length > 0) {
|
||||||
for (let i; i < equipInfo.length - 1; i++) {
|
for (let i; i < equipInfo.length - 1; i++) {
|
||||||
equipInfo[i].now = 0;
|
equipInfo[i].now = 0;
|
||||||
equipInfo[i].isAttack = false;
|
equipInfo[i].isAttack = false;
|
||||||
oneTurn += equipInfo[i].speed;
|
oneTurn.push(equipInfo[i].speed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
oneTurn *= 25;
|
|
||||||
|
const onegcd = gcd(...oneTurn)
|
||||||
|
oneTurn = lcm(...oneTurn) / onegcd
|
||||||
|
if (oneTurn < 60) oneTurn *= Math.round(60 / oneTurn)
|
||||||
let time = 0,
|
let time = 0,
|
||||||
farme = 0;
|
farme = 0;
|
||||||
|
|
||||||
@ -20006,7 +20414,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
enemyInfo,
|
enemyInfo,
|
||||||
equipInfo,
|
equipInfo,
|
||||||
farme,
|
farme,
|
||||||
damageInfo
|
damageInfo,
|
||||||
|
onegcd
|
||||||
);
|
);
|
||||||
farme++;
|
farme++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user