Commit f3411376 authored by Chunchi Che's avatar Chunchi Che

optimize attack

parent 720e5e8c
Pipeline #22185 passed with stages
in 13 minutes and 33 seconds
...@@ -22,6 +22,7 @@ export const attack = async (props: { ...@@ -22,6 +22,7 @@ export const attack = async (props: {
let x = current.x; let x = current.x;
let y = current.y; let y = current.y;
let rz = current.rz;
if (directAttack) { if (directAttack) {
// 直接攻击 // 直接攻击
y = BLOCK_HEIGHT_M.value + BLOCK_HEIGHT_S.value; y = BLOCK_HEIGHT_M.value + BLOCK_HEIGHT_S.value;
...@@ -41,13 +42,12 @@ export const attack = async (props: { ...@@ -41,13 +42,12 @@ export const attack = async (props: {
y = BLOCK_HEIGHT_M.value + ROW_GAP.value; y = BLOCK_HEIGHT_M.value + ROW_GAP.value;
} }
// 往下偏移半个卡位
y -= BLOCK_HEIGHT_M.value / 2;
if (!isMe(controller)) { if (!isMe(controller)) {
x = -x; x = -x;
y = -y; y = -y;
} }
rz += -Math.atan((x - current.x) / (y - current.y)) / (Math.PI / 180);
} else { } else {
console.error(`<Spring/Attack>directAttack is false and target is null.`); console.error(`<Spring/Attack>directAttack is false and target is null.`);
return; return;
...@@ -57,11 +57,12 @@ export const attack = async (props: { ...@@ -57,11 +57,12 @@ export const attack = async (props: {
await asyncStart(api)({ await asyncStart(api)({
z: 200, z: 200,
}); });
// 后撤半个卡位 // 后撤半个卡位,并调整倾斜角
await asyncStart(api)({ await asyncStart(api)({
y: y:
current.y + current.y +
(BLOCK_HEIGHT_M.value / 2) * (isMe(card.location.controller) ? 1 : -1), (BLOCK_HEIGHT_M.value / 2) * (isMe(card.location.controller) ? 1 : -1),
rz,
}); });
// 加速前冲 // 加速前冲
await asyncStart(api)({ await asyncStart(api)({
...@@ -76,6 +77,7 @@ export const attack = async (props: { ...@@ -76,6 +77,7 @@ export const attack = async (props: {
x: current.x, x: current.x,
y: current.y, y: current.y,
z: current.z, z: current.z,
rz: current.rz,
config: { config: {
easing: easings.easeInOutQuad, easing: easings.easeInOutQuad,
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment