fds-vue-core 8.12.1 → 8.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/BankId/FdsBankIdSameDevice/FdsBankIdSameDevice.vue.d.ts +2 -2
- package/dist/components/Blocks/FdsBlockLink/FdsBlockLink.vue.d.ts +1 -1
- package/dist/components/Buttons/FdsButtonIcon/FdsButtonIcon.vue.d.ts +1 -1
- package/dist/components/Buttons/FdsButtonMinor/FdsButtonMinor.vue.d.ts +2 -2
- package/dist/components/Buttons/FdsButtonPrimary/FdsButtonPrimary.vue.d.ts +2 -2
- package/dist/components/Buttons/FdsButtonSecondary/FdsButtonSecondary.vue.d.ts +2 -2
- package/dist/components/Buttons/FdsButtonTertiary/FdsButtonTertiary.vue.d.ts +2 -2
- package/dist/components/FdsIcon/FdsIcon.vue.d.ts +1 -47
- package/dist/components/FdsIcon/types.d.ts +0 -15
- package/dist/components/FdsPopover/FdsPopover.vue.d.ts +2 -2
- package/dist/components/FdsSearchSelect/FdsSearchSelect.vue.d.ts +3 -3
- package/dist/components/FdsSearchSelectPro/FdsSearchSelectPro.vue.d.ts +3 -3
- package/dist/components/FdsSpinner/FdsSpinner.vue.d.ts +1 -1
- package/dist/components/Form/FdsCheckbox/FdsCheckbox.vue.d.ts +3 -3
- package/dist/components/Form/FdsInput/FdsInput.vue.d.ts +3 -3
- package/dist/components/Form/FdsPhonenumber/FdsPhonenumber.vue.d.ts +1 -1
- package/dist/components/Form/FdsRadio/FdsRadio.vue.d.ts +3 -3
- package/dist/components/Form/FdsSelect/FdsSelect.vue.d.ts +3 -3
- package/dist/components/Form/FdsSsn/FdsSsn.vue.d.ts +1 -1
- package/dist/components/Form/FdsSwitch/FdsSwitch.vue.d.ts +1 -1
- package/dist/components/Form/FdsTextarea/FdsTextarea.vue.d.ts +3 -3
- package/dist/components/IconRescue/IconRescueIcon.vue.d.ts +54 -0
- package/dist/components/IconRescue/types.d.ts +18 -0
- package/dist/components/Tabs/FdsTabsItem/FdsTabsItem.vue.d.ts +2 -2
- package/dist/fds-vue-core.cjs.js +18 -1828
- package/dist/fds-vue-core.cjs.js.map +1 -1
- package/dist/fds-vue-core.css +1 -1
- package/dist/fds-vue-core.es.js +19 -1829
- package/dist/fds-vue-core.es.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/FdsIcon/FdsIcon.vue +2 -2405
- package/src/components/FdsIcon/types.ts +0 -12
- package/src/components/{FdsIcon → IconRescue}/IconRescue.stories.ts +7 -7
- package/src/components/IconRescue/IconRescueIcon.vue +2465 -0
- package/src/components/IconRescue/types.ts +16 -0
- package/src/lang/en.json +0 -1
- package/src/lang/sv.json +0 -1
- /package/dist/components/{FdsIcon → IconRescue}/iconGame.d.ts +0 -0
- /package/dist/components/{FdsIcon → IconRescue}/iconTargets.d.ts +0 -0
- /package/src/components/{FdsIcon → IconRescue}/iconGame.ts +0 -0
- /package/src/components/{FdsIcon → IconRescue}/iconTargets.ts +0 -0
package/dist/fds-vue-core.cjs.js
CHANGED
|
@@ -152,7 +152,6 @@ var en_default = {
|
|
|
152
152
|
"FdsDevModeStorage.tabs.localStorage": "localStorage",
|
|
153
153
|
"FdsDevModeStorage.tabs.sessionStorage": "sessionStorage",
|
|
154
154
|
"FdsDevModeStorage.valueLabel": "Value",
|
|
155
|
-
"FdsIcon.headshot": "Headshoooot!",
|
|
156
155
|
"FdsInput.clearInput": "Delete text",
|
|
157
156
|
"FdsInput.hidePassword": "Hide",
|
|
158
157
|
"FdsInput.openDatePicker": "Open date picker",
|
|
@@ -289,7 +288,6 @@ var sv_default = {
|
|
|
289
288
|
"FdsDevModeStorage.tabs.localStorage": "localStorage",
|
|
290
289
|
"FdsDevModeStorage.tabs.sessionStorage": "sessionStorage",
|
|
291
290
|
"FdsDevModeStorage.valueLabel": "Värde",
|
|
292
|
-
"FdsIcon.headshot": "Headshoooot!",
|
|
293
291
|
"FdsInput.clearInput": "Rensa text",
|
|
294
292
|
"FdsInput.hidePassword": "Dölj",
|
|
295
293
|
"FdsInput.openDatePicker": "Öppna datumväljare",
|
|
@@ -897,288 +895,20 @@ var icons = {
|
|
|
897
895
|
</svg>`
|
|
898
896
|
};
|
|
899
897
|
//#endregion
|
|
900
|
-
//#region src/components/FdsIcon/iconGame.ts
|
|
901
|
-
var defaultPlayerStats = {
|
|
902
|
-
damageMultiplier: 1,
|
|
903
|
-
maxHealth: 5,
|
|
904
|
-
speedMultiplier: 1,
|
|
905
|
-
cooldownMultiplier: 1,
|
|
906
|
-
criticalHitChance: .1,
|
|
907
|
-
pickupRadius: 90
|
|
908
|
-
};
|
|
909
|
-
var gameBalance = {
|
|
910
|
-
criticalHitMultiplier: 2,
|
|
911
|
-
laser: {
|
|
912
|
-
damage: 1,
|
|
913
|
-
damagePerLevel: .5,
|
|
914
|
-
chargedMultiplier: 5
|
|
915
|
-
},
|
|
916
|
-
homingLasers: {
|
|
917
|
-
maxCount: 4,
|
|
918
|
-
pixelsPerSecond: 900,
|
|
919
|
-
turnSpeed: 10,
|
|
920
|
-
lifetime: 1500,
|
|
921
|
-
damageShare: .6
|
|
922
|
-
},
|
|
923
|
-
rockets: {
|
|
924
|
-
cooldown: 2800,
|
|
925
|
-
cooldownPerLevel: 200,
|
|
926
|
-
damage: 2,
|
|
927
|
-
damagePerLevel: .75,
|
|
928
|
-
blastRadius: 50,
|
|
929
|
-
blastRadiusPerLevel: 6,
|
|
930
|
-
pixelsPerSecond: 420,
|
|
931
|
-
turnSpeed: 4,
|
|
932
|
-
lifetime: 3e3,
|
|
933
|
-
doubleRocketLevel: 4
|
|
934
|
-
},
|
|
935
|
-
fireballs: {
|
|
936
|
-
damage: 1,
|
|
937
|
-
damagePerLevel: .5,
|
|
938
|
-
orbitRadius: 70,
|
|
939
|
-
orbitRadiusPerLevel: 6,
|
|
940
|
-
orbitDuration: 1600,
|
|
941
|
-
hitCooldown: 450,
|
|
942
|
-
burnDuration: 2e3
|
|
943
|
-
},
|
|
944
|
-
iceAsteroids: {
|
|
945
|
-
cooldown: 3200,
|
|
946
|
-
cooldownPerLevel: 300,
|
|
947
|
-
chunks: 2,
|
|
948
|
-
chunksPerLevel: 1,
|
|
949
|
-
damage: 2.5,
|
|
950
|
-
damagePerLevel: .75,
|
|
951
|
-
pixelsPerSecond: 380,
|
|
952
|
-
freezeDuration: 2e3
|
|
953
|
-
},
|
|
954
|
-
electricShock: {
|
|
955
|
-
cooldown: 2200,
|
|
956
|
-
cooldownPerLevel: 250,
|
|
957
|
-
damage: 1.5,
|
|
958
|
-
damagePerLevel: .5,
|
|
959
|
-
firstRange: 260,
|
|
960
|
-
chainRange: 170,
|
|
961
|
-
stunDuration: 400
|
|
962
|
-
},
|
|
963
|
-
burn: {
|
|
964
|
-
damagePerTick: .5,
|
|
965
|
-
tickTime: 500
|
|
966
|
-
},
|
|
967
|
-
frozenSpeedFactor: .4,
|
|
968
|
-
synergies: {
|
|
969
|
-
napalmBurnDuration: 3e3,
|
|
970
|
-
superconductorMultiplier: 2,
|
|
971
|
-
steamBlastDamage: 4,
|
|
972
|
-
steamBlastRadius: 90,
|
|
973
|
-
plasmaChainDamage: 1
|
|
974
|
-
},
|
|
975
|
-
enemyStrength: {
|
|
976
|
-
scale: .12,
|
|
977
|
-
exponent: 1.5
|
|
978
|
-
},
|
|
979
|
-
bossHealthMultiplier: 2.2,
|
|
980
|
-
finalBossHealthMultiplier: 7,
|
|
981
|
-
enemyFireRateGrowth: .25,
|
|
982
|
-
enemyExperience: {
|
|
983
|
-
normal: 2,
|
|
984
|
-
tough: 6,
|
|
985
|
-
kamikaze: 3,
|
|
986
|
-
splitter: 4,
|
|
987
|
-
sniper: 5,
|
|
988
|
-
swarm: 1,
|
|
989
|
-
boss: 40
|
|
990
|
-
},
|
|
991
|
-
experienceForFirstLevel: 10,
|
|
992
|
-
experiencePerLevel: 8,
|
|
993
|
-
gemMagnetPixelsPerSecond: 520,
|
|
994
|
-
maxGemsOnScreen: 150,
|
|
995
|
-
bossAttacks: {
|
|
996
|
-
cooldown: 3500,
|
|
997
|
-
rageHealthShare: .5,
|
|
998
|
-
rageCooldownFactor: .6,
|
|
999
|
-
ringProjectiles: 12,
|
|
1000
|
-
spiralDuration: 1500,
|
|
1001
|
-
spiralShotInterval: 90,
|
|
1002
|
-
chargeWarningTime: 700,
|
|
1003
|
-
chargeDuration: 600,
|
|
1004
|
-
chargePixelsPerSecond: 700,
|
|
1005
|
-
summonCount: 3
|
|
1006
|
-
},
|
|
1007
|
-
upgrades: {
|
|
1008
|
-
power: {
|
|
1009
|
-
amount: .2,
|
|
1010
|
-
maxPicks: 10
|
|
1011
|
-
},
|
|
1012
|
-
vitality: {
|
|
1013
|
-
amount: 1,
|
|
1014
|
-
maxPicks: 5
|
|
1015
|
-
},
|
|
1016
|
-
agility: {
|
|
1017
|
-
amount: .1,
|
|
1018
|
-
maxPicks: 5
|
|
1019
|
-
},
|
|
1020
|
-
overclock: {
|
|
1021
|
-
amount: .08,
|
|
1022
|
-
maxPicks: 5
|
|
1023
|
-
},
|
|
1024
|
-
precision: {
|
|
1025
|
-
amount: .05,
|
|
1026
|
-
maxPicks: 6
|
|
1027
|
-
},
|
|
1028
|
-
magnet: {
|
|
1029
|
-
amount: 40,
|
|
1030
|
-
maxPicks: 4
|
|
1031
|
-
},
|
|
1032
|
-
repairAmount: 2
|
|
1033
|
-
}
|
|
1034
|
-
};
|
|
1035
|
-
var synergyWeapons = {
|
|
1036
|
-
napalm: ["rockets", "fireballs"],
|
|
1037
|
-
superconductor: ["iceAsteroids", "electricShock"],
|
|
1038
|
-
steamBlast: ["fireballs", "iceAsteroids"],
|
|
1039
|
-
plasmaLaser: ["laser", "electricShock"]
|
|
1040
|
-
};
|
|
1041
|
-
function getActiveSynergies(weapons) {
|
|
1042
|
-
return Object.keys(synergyWeapons).filter((synergy) => synergyWeapons[synergy].every((weapon) => (weapons[weapon] ?? 0) >= 2));
|
|
1043
|
-
}
|
|
1044
|
-
function getElectricShockChainCount(level) {
|
|
1045
|
-
return 1 + Math.ceil(level / 2);
|
|
1046
|
-
}
|
|
1047
|
-
//#endregion
|
|
1048
|
-
//#region src/components/FdsIcon/iconTargets.ts
|
|
1049
|
-
var enemyIconTargets = /* @__PURE__ */ new Set();
|
|
1050
|
-
var playerIconTargets = /* @__PURE__ */ new Set();
|
|
1051
|
-
var experienceGems = (0, vue.shallowRef)([]);
|
|
1052
|
-
var nextGemId = 0;
|
|
1053
|
-
function dropExperienceGem(point, value, maxGems) {
|
|
1054
|
-
experienceGems.value = [...experienceGems.value.slice(-(maxGems - 1)), {
|
|
1055
|
-
id: nextGemId++,
|
|
1056
|
-
...point,
|
|
1057
|
-
value,
|
|
1058
|
-
isMagnetized: false
|
|
1059
|
-
}];
|
|
1060
|
-
}
|
|
1061
|
-
//#endregion
|
|
1062
898
|
//#region src/components/FdsIcon/FdsIcon.vue?vue&type=script&setup=true&lang.ts
|
|
1063
899
|
var _hoisted_1$43 = ["innerHTML"];
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
class: "absolute -bottom-3 left-1/2 -translate-x-1/2 w-full min-w-8 h-1.5 rounded-full bg-gray-300 overflow-hidden",
|
|
1068
|
-
"aria-hidden": "true"
|
|
1069
|
-
};
|
|
1070
|
-
var _hoisted_4$20 = {
|
|
1071
|
-
key: 2,
|
|
1072
|
-
class: "absolute -bottom-3 left-1/2 -translate-x-1/2 flex gap-0.5",
|
|
1073
|
-
"aria-hidden": "true"
|
|
1074
|
-
};
|
|
1075
|
-
var _hoisted_5$18 = {
|
|
1076
|
-
key: 3,
|
|
1077
|
-
class: "absolute bottom-full left-1/2 -translate-x-1/2 mb-1 whitespace-nowrap font-bold text-sm text-red-700"
|
|
1078
|
-
};
|
|
1079
|
-
var _hoisted_6$13 = {
|
|
1080
|
-
key: 4,
|
|
1081
|
-
class: "absolute -bottom-3 left-0 w-full h-1.5 rounded-full bg-gray-300 overflow-hidden",
|
|
1082
|
-
"aria-hidden": "true"
|
|
1083
|
-
};
|
|
1084
|
-
var _hoisted_7$10 = {
|
|
1085
|
-
key: 0,
|
|
1086
|
-
class: "fixed inset-0 w-screen h-screen pointer-events-none z-[99998]",
|
|
1087
|
-
"aria-hidden": "true"
|
|
1088
|
-
};
|
|
1089
|
-
var _hoisted_8$8 = ["points"];
|
|
1090
|
-
var _hoisted_9$7 = ["points"];
|
|
1091
|
-
var _hoisted_10$5 = ["points"];
|
|
1092
|
-
var _hoisted_11$5 = ["points"];
|
|
1093
|
-
var _hoisted_12$3 = ["points"];
|
|
1094
|
-
var _hoisted_13$3 = ["transform"];
|
|
1095
|
-
var _hoisted_14$3 = ["transform"];
|
|
1096
|
-
var _hoisted_15$1 = ["transform"];
|
|
1097
|
-
var _hoisted_16$1 = [
|
|
1098
|
-
"cx",
|
|
1099
|
-
"cy",
|
|
1100
|
-
"r"
|
|
1101
|
-
];
|
|
1102
|
-
var _hoisted_17$1 = {
|
|
1103
|
-
key: 3,
|
|
1104
|
-
class: "fixed inset-0 w-screen h-screen pointer-events-none z-[99998]",
|
|
1105
|
-
"aria-hidden": "true"
|
|
1106
|
-
};
|
|
1107
|
-
var _hoisted_18$1 = [
|
|
1108
|
-
"x1",
|
|
1109
|
-
"y1",
|
|
1110
|
-
"x2",
|
|
1111
|
-
"y2"
|
|
1112
|
-
];
|
|
1113
|
-
var _hoisted_19$1 = [
|
|
1114
|
-
"cx",
|
|
1115
|
-
"cy",
|
|
1116
|
-
"r"
|
|
1117
|
-
];
|
|
1118
|
-
var _hoisted_20$1 = {
|
|
1119
|
-
key: 5,
|
|
1120
|
-
class: "fixed inset-0 w-screen h-screen pointer-events-none z-[100000]",
|
|
1121
|
-
"aria-hidden": "true"
|
|
1122
|
-
};
|
|
1123
|
-
var _hoisted_21$1 = ["transform"];
|
|
1124
|
-
var _hoisted_22$1 = ["r"];
|
|
1125
|
-
var laserFlightDuration = 250;
|
|
1126
|
-
var bossMaxHealth = 20;
|
|
1127
|
-
var playerPixelsPerSecond = 320;
|
|
1128
|
-
var dashPixelsPerSecond = 1100;
|
|
1129
|
-
var dashDuration = 160;
|
|
1130
|
-
var dashCooldown = 1200;
|
|
1131
|
-
var chargedShotTime = 700;
|
|
1132
|
-
var kamikazePixelsPerSecond = 230;
|
|
1133
|
-
var swarmPixelsPerSecond = 300;
|
|
1134
|
-
var heartSize = 36;
|
|
1135
|
-
var crateSize = 40;
|
|
1136
|
-
var maxHealthDots = 5;
|
|
1137
|
-
var FdsIcon_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0, vue.defineComponent)({
|
|
900
|
+
//#endregion
|
|
901
|
+
//#region src/components/FdsIcon/FdsIcon.vue
|
|
902
|
+
var FdsIcon_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
1138
903
|
__name: "FdsIcon",
|
|
1139
904
|
props: {
|
|
1140
905
|
name: {},
|
|
1141
906
|
size: { default: 24 },
|
|
1142
907
|
title: { default: void 0 },
|
|
1143
|
-
laser: {
|
|
1144
|
-
type: Boolean,
|
|
1145
|
-
default: false
|
|
1146
|
-
},
|
|
1147
|
-
flying: {
|
|
1148
|
-
type: Boolean,
|
|
1149
|
-
default: false
|
|
1150
|
-
},
|
|
1151
|
-
boss: {
|
|
1152
|
-
type: Boolean,
|
|
1153
|
-
default: false
|
|
1154
|
-
},
|
|
1155
|
-
enemyKind: { default: void 0 },
|
|
1156
|
-
spawnPoint: { default: void 0 },
|
|
1157
|
-
weapons: { default: () => ({ laser: 1 }) },
|
|
1158
|
-
stats: { default: () => ({ ...defaultPlayerStats }) },
|
|
1159
|
-
bossAttacks: { default: () => [] },
|
|
1160
|
-
strength: { default: 1 },
|
|
1161
|
-
paused: {
|
|
1162
|
-
type: Boolean,
|
|
1163
|
-
default: false
|
|
1164
|
-
},
|
|
1165
|
-
label: { default: void 0 },
|
|
1166
908
|
dataTestid: { default: void 0 }
|
|
1167
909
|
},
|
|
1168
|
-
|
|
1169
|
-
"kill",
|
|
1170
|
-
"gameOver",
|
|
1171
|
-
"destroyed",
|
|
1172
|
-
"split",
|
|
1173
|
-
"experience",
|
|
1174
|
-
"summon",
|
|
1175
|
-
"crate"
|
|
1176
|
-
],
|
|
1177
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
910
|
+
setup(__props) {
|
|
1178
911
|
const props = __props;
|
|
1179
|
-
const emit = __emit;
|
|
1180
|
-
const { t } = useFdsI18n();
|
|
1181
|
-
const headshotText = (0, vue.computed)(() => t("FdsIcon.headshot"));
|
|
1182
912
|
function normalizeSvg(svg) {
|
|
1183
913
|
return svg.replace(/width="(.*?)"/g, "width=\"100%\"").replace(/height="(.*?)"/g, "height=\"100%\"");
|
|
1184
914
|
}
|
|
@@ -1194,1566 +924,18 @@ var FdsIcon_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0, vue.
|
|
|
1194
924
|
if (props.dataTestid) attrs["data-testid"] = props.dataTestid;
|
|
1195
925
|
return attrs;
|
|
1196
926
|
});
|
|
1197
|
-
const animatedRootRef = (0, vue.ref)(null);
|
|
1198
|
-
const shots = (0, vue.ref)([]);
|
|
1199
|
-
const recoilOffset = (0, vue.ref)({
|
|
1200
|
-
x: 0,
|
|
1201
|
-
y: 0
|
|
1202
|
-
});
|
|
1203
|
-
let nextShotId = 0;
|
|
1204
|
-
const hasLaser = (0, vue.computed)(() => shots.value.some((shot) => shot.kind === "laser" || shot.kind === "charged"));
|
|
1205
|
-
function createShotPoints(centerX, centerY, iconRadius, angle, length, jitterSize) {
|
|
1206
|
-
const startX = centerX + Math.cos(angle) * iconRadius;
|
|
1207
|
-
const startY = centerY + Math.sin(angle) * iconRadius;
|
|
1208
|
-
const endX = startX + Math.cos(angle) * length;
|
|
1209
|
-
const endY = startY + Math.sin(angle) * length;
|
|
1210
|
-
const segmentCount = 12;
|
|
1211
|
-
const points = [`${startX},${startY}`];
|
|
1212
|
-
for (let index = 1; index < segmentCount; index++) {
|
|
1213
|
-
const progress = index / segmentCount;
|
|
1214
|
-
const jitter = (Math.random() - .5) * jitterSize;
|
|
1215
|
-
const x = startX + (endX - startX) * progress - Math.sin(angle) * jitter;
|
|
1216
|
-
const y = startY + (endY - startY) * progress + Math.cos(angle) * jitter;
|
|
1217
|
-
points.push(`${x},${y}`);
|
|
1218
|
-
}
|
|
1219
|
-
points.push(`${endX},${endY}`);
|
|
1220
|
-
return points.join(" ");
|
|
1221
|
-
}
|
|
1222
|
-
function addShot(kind, points) {
|
|
1223
|
-
const id = nextShotId++;
|
|
1224
|
-
shots.value.push({
|
|
1225
|
-
id,
|
|
1226
|
-
kind,
|
|
1227
|
-
points
|
|
1228
|
-
});
|
|
1229
|
-
setTimeout(() => {
|
|
1230
|
-
shots.value = shots.value.filter((shot) => shot.id !== id);
|
|
1231
|
-
}, 700);
|
|
1232
|
-
}
|
|
1233
|
-
let pausedTotalTime = 0;
|
|
1234
|
-
let pausedAtTime;
|
|
1235
|
-
function getGameTime() {
|
|
1236
|
-
return (pausedAtTime ?? performance.now()) - pausedTotalTime;
|
|
1237
|
-
}
|
|
1238
|
-
(0, vue.watch)(() => props.paused, (paused) => {
|
|
1239
|
-
if (paused && pausedAtTime === void 0) pausedAtTime = performance.now();
|
|
1240
|
-
if (!paused && pausedAtTime !== void 0) {
|
|
1241
|
-
pausedTotalTime += performance.now() - pausedAtTime;
|
|
1242
|
-
pausedAtTime = void 0;
|
|
1243
|
-
}
|
|
1244
|
-
}, { immediate: true });
|
|
1245
|
-
function getCenter(bounds) {
|
|
1246
|
-
return {
|
|
1247
|
-
x: bounds.left + bounds.width / 2,
|
|
1248
|
-
y: bounds.top + bounds.height / 2
|
|
1249
|
-
};
|
|
1250
|
-
}
|
|
1251
|
-
function getDistance(first, second) {
|
|
1252
|
-
return Math.hypot(first.x - second.x, first.y - second.y);
|
|
1253
|
-
}
|
|
1254
|
-
function clamp(value, min, max) {
|
|
1255
|
-
return Math.min(Math.max(value, min), max);
|
|
1256
|
-
}
|
|
1257
|
-
function isOnShotLine(target, startX, startY, angle, hitTolerance) {
|
|
1258
|
-
const bounds = target.getBounds();
|
|
1259
|
-
if (!bounds || !target.isHittable()) return false;
|
|
1260
|
-
const targetCenter = getCenter(bounds);
|
|
1261
|
-
const distanceAlongShot = (targetCenter.x - startX) * Math.cos(angle) + (targetCenter.y - startY) * Math.sin(angle);
|
|
1262
|
-
const distanceFromShot = Math.abs((targetCenter.x - startX) * Math.sin(angle) - (targetCenter.y - startY) * Math.cos(angle));
|
|
1263
|
-
return distanceAlongShot > 0 && distanceFromShot < bounds.width / 2 + hitTolerance;
|
|
1264
|
-
}
|
|
1265
|
-
function getWeaponLevel(weapon) {
|
|
1266
|
-
return props.weapons[weapon] ?? 0;
|
|
1267
|
-
}
|
|
1268
|
-
const activeSynergies = (0, vue.computed)(() => getActiveSynergies(props.weapons));
|
|
1269
|
-
function hasSynergy(synergy) {
|
|
1270
|
-
return activeSynergies.value.includes(synergy);
|
|
1271
|
-
}
|
|
1272
|
-
function dealDamage(target, baseDamage, damageType) {
|
|
1273
|
-
const isCritical = Math.random() < props.stats.criticalHitChance;
|
|
1274
|
-
const criticalMultiplier = isCritical ? gameBalance.criticalHitMultiplier : 1;
|
|
1275
|
-
const damage = Math.round(baseDamage * props.stats.damageMultiplier * criticalMultiplier * 10) / 10;
|
|
1276
|
-
const points = target.hit(damage, damageType, isCritical);
|
|
1277
|
-
if (points > 0) emit("kill", points);
|
|
1278
|
-
}
|
|
1279
|
-
function getLivingEnemies() {
|
|
1280
|
-
return [...enemyIconTargets].filter((enemy) => enemy !== enemyTarget && enemy.isHittable());
|
|
1281
|
-
}
|
|
1282
|
-
function findNearestEnemy(point, maxDistance, excludedEnemies) {
|
|
1283
|
-
let nearestEnemy;
|
|
1284
|
-
let nearestDistance = maxDistance;
|
|
1285
|
-
for (const enemy of getLivingEnemies()) {
|
|
1286
|
-
const bounds = enemy.getBounds();
|
|
1287
|
-
if (!bounds || excludedEnemies?.has(enemy)) continue;
|
|
1288
|
-
const distance = getDistance(point, getCenter(bounds));
|
|
1289
|
-
if (distance < nearestDistance) {
|
|
1290
|
-
nearestDistance = distance;
|
|
1291
|
-
nearestEnemy = enemy;
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
return nearestEnemy;
|
|
1295
|
-
}
|
|
1296
|
-
function findEnemiesInRadius(point, radius) {
|
|
1297
|
-
return getLivingEnemies().filter((enemy) => {
|
|
1298
|
-
const bounds = enemy.getBounds();
|
|
1299
|
-
return bounds !== void 0 && getDistance(point, getCenter(bounds)) <= radius + bounds.width / 2;
|
|
1300
|
-
});
|
|
1301
|
-
}
|
|
1302
|
-
const weaponBarrels = [
|
|
1303
|
-
[{
|
|
1304
|
-
spreadAngle: 0,
|
|
1305
|
-
sideOffset: 0
|
|
1306
|
-
}],
|
|
1307
|
-
[{
|
|
1308
|
-
spreadAngle: 0,
|
|
1309
|
-
sideOffset: -8
|
|
1310
|
-
}, {
|
|
1311
|
-
spreadAngle: 0,
|
|
1312
|
-
sideOffset: 8
|
|
1313
|
-
}],
|
|
1314
|
-
[
|
|
1315
|
-
{
|
|
1316
|
-
spreadAngle: -.15,
|
|
1317
|
-
sideOffset: 0
|
|
1318
|
-
},
|
|
1319
|
-
{
|
|
1320
|
-
spreadAngle: 0,
|
|
1321
|
-
sideOffset: 0
|
|
1322
|
-
},
|
|
1323
|
-
{
|
|
1324
|
-
spreadAngle: .15,
|
|
1325
|
-
sideOffset: 0
|
|
1326
|
-
}
|
|
1327
|
-
]
|
|
1328
|
-
];
|
|
1329
|
-
const barrelLevel = (0, vue.ref)(0);
|
|
1330
|
-
function getLaserDamage(isCharged) {
|
|
1331
|
-
const laserLevel = Math.max(getWeaponLevel("laser"), 1);
|
|
1332
|
-
return (gameBalance.laser.damage + gameBalance.laser.damagePerLevel * (laserLevel - 1)) * (isCharged ? gameBalance.laser.chargedMultiplier : 1);
|
|
1333
|
-
}
|
|
1334
|
-
function fireBeam(centerX, centerY, iconRadius, angle, isCharged) {
|
|
1335
|
-
const screenLength = Math.max(window.innerWidth, window.innerHeight);
|
|
1336
|
-
addShot(isCharged ? "charged" : "laser", createShotPoints(centerX, centerY, iconRadius, angle, screenLength, 0));
|
|
1337
|
-
const startX = centerX + Math.cos(angle) * iconRadius;
|
|
1338
|
-
const startY = centerY + Math.sin(angle) * iconRadius;
|
|
1339
|
-
const laserDamage = getLaserDamage(isCharged);
|
|
1340
|
-
for (const target of getLivingEnemies()) {
|
|
1341
|
-
const targetBounds = target.getBounds();
|
|
1342
|
-
if (!targetBounds) continue;
|
|
1343
|
-
const targetCenter = getCenter(targetBounds);
|
|
1344
|
-
const arrivalTime = Math.hypot(targetCenter.x - startX, targetCenter.y - startY) / screenLength * laserFlightDuration;
|
|
1345
|
-
setTimeout(() => {
|
|
1346
|
-
if (!isOnShotLine(target, startX, startY, angle, isCharged ? 24 : 6)) return;
|
|
1347
|
-
const hitBounds = target.getBounds();
|
|
1348
|
-
dealDamage(target, laserDamage, "laser");
|
|
1349
|
-
if (hasSynergy("plasmaLaser") && hitBounds) chainShock(getCenter(hitBounds), 1, gameBalance.synergies.plasmaChainDamage, /* @__PURE__ */ new Set([target]));
|
|
1350
|
-
}, arrivalTime);
|
|
1351
|
-
}
|
|
1352
|
-
if (heart.value) shootAtHeart(heart.value, startX, startY, angle, screenLength);
|
|
1353
|
-
}
|
|
1354
|
-
const heart = (0, vue.ref)(null);
|
|
1355
|
-
let heartInterval;
|
|
1356
|
-
let heartTimeout;
|
|
1357
|
-
function showHeart() {
|
|
1358
|
-
if (heart.value || isDestroyed.value || props.paused || Math.random() < .5) return;
|
|
1359
|
-
heart.value = {
|
|
1360
|
-
x: Math.random() * Math.max(window.innerWidth - heartSize, 0),
|
|
1361
|
-
y: Math.random() * Math.max(window.innerHeight - heartSize, 0)
|
|
1362
|
-
};
|
|
1363
|
-
clearTimeout(heartTimeout);
|
|
1364
|
-
heartTimeout = setTimeout(() => {
|
|
1365
|
-
heart.value = null;
|
|
1366
|
-
}, 8e3);
|
|
1367
|
-
}
|
|
1368
|
-
function shootAtHeart(shotHeart, startX, startY, angle, screenLength) {
|
|
1369
|
-
const heartCenterX = shotHeart.x + heartSize / 2;
|
|
1370
|
-
const heartCenterY = shotHeart.y + heartSize / 2;
|
|
1371
|
-
const distanceAlongShot = (heartCenterX - startX) * Math.cos(angle) + (heartCenterY - startY) * Math.sin(angle);
|
|
1372
|
-
const distanceFromShot = Math.abs((heartCenterX - startX) * Math.sin(angle) - (heartCenterY - startY) * Math.cos(angle));
|
|
1373
|
-
if (distanceAlongShot <= 0 || distanceFromShot > 24) return;
|
|
1374
|
-
setTimeout(() => {
|
|
1375
|
-
if (heart.value !== shotHeart) return;
|
|
1376
|
-
heart.value = null;
|
|
1377
|
-
clearTimeout(heartTimeout);
|
|
1378
|
-
heal(1);
|
|
1379
|
-
}, distanceAlongShot / screenLength * laserFlightDuration);
|
|
1380
|
-
}
|
|
1381
|
-
function fireLaser(aimX, aimY, isCharged) {
|
|
1382
|
-
const rectangle = getPlayerBounds();
|
|
1383
|
-
if (!rectangle || isDestroyed.value) return;
|
|
1384
|
-
const center = getCenter(rectangle);
|
|
1385
|
-
const angle = Math.atan2(aimY - center.y, aimX - center.x);
|
|
1386
|
-
const recoilDistance = isCharged ? 8 : 3;
|
|
1387
|
-
const barrels = isCharged ? [{
|
|
1388
|
-
spreadAngle: 0,
|
|
1389
|
-
sideOffset: 0
|
|
1390
|
-
}] : weaponBarrels[barrelLevel.value] ?? [];
|
|
1391
|
-
recoilOffset.value = {
|
|
1392
|
-
x: -Math.cos(angle) * recoilDistance,
|
|
1393
|
-
y: -Math.sin(angle) * recoilDistance
|
|
1394
|
-
};
|
|
1395
|
-
for (const barrel of barrels) fireBeam(center.x - Math.sin(angle) * barrel.sideOffset, center.y + Math.cos(angle) * barrel.sideOffset, rectangle.width / 2, angle + barrel.spreadAngle, isCharged);
|
|
1396
|
-
launchHomingLasers(center, angle);
|
|
1397
|
-
}
|
|
1398
|
-
const homingLaserCount = (0, vue.ref)(0);
|
|
1399
|
-
const homingLasers = (0, vue.shallowRef)([]);
|
|
1400
|
-
function launchHomingLasers(center, aimAngle) {
|
|
1401
|
-
const count = homingLaserCount.value;
|
|
1402
|
-
if (!count) return;
|
|
1403
|
-
const targets = getLivingEnemies().map((enemy) => ({
|
|
1404
|
-
enemy,
|
|
1405
|
-
bounds: enemy.getBounds()
|
|
1406
|
-
})).filter((entry) => entry.bounds !== void 0).sort((first, second) => getDistance(center, getCenter(first.bounds)) - getDistance(center, getCenter(second.bounds))).map((entry) => entry.enemy);
|
|
1407
|
-
const newLasers = Array.from({ length: count }, (_, index) => ({
|
|
1408
|
-
id: nextShotId++,
|
|
1409
|
-
...center,
|
|
1410
|
-
angle: aimAngle + (index - (count - 1) / 2) * .5,
|
|
1411
|
-
target: targets.length ? targets[index % targets.length] : void 0,
|
|
1412
|
-
launchTime: getGameTime()
|
|
1413
|
-
}));
|
|
1414
|
-
homingLasers.value = [...homingLasers.value, ...newLasers];
|
|
1415
|
-
}
|
|
1416
|
-
function updateHomingLasers(now, seconds) {
|
|
1417
|
-
if (!homingLasers.value.length) return;
|
|
1418
|
-
const balance = gameBalance.homingLasers;
|
|
1419
|
-
const remainingLasers = [];
|
|
1420
|
-
for (const homingLaser of homingLasers.value) {
|
|
1421
|
-
if (now - homingLaser.launchTime > balance.lifetime) continue;
|
|
1422
|
-
const target = homingLaser.target?.isHittable() ? homingLaser.target : findNearestEnemy(homingLaser, Infinity);
|
|
1423
|
-
const targetBounds = target?.getBounds();
|
|
1424
|
-
let { angle } = homingLaser;
|
|
1425
|
-
if (target && targetBounds) {
|
|
1426
|
-
const targetCenter = getCenter(targetBounds);
|
|
1427
|
-
if (getDistance(homingLaser, targetCenter) < targetBounds.width / 2 + 6) {
|
|
1428
|
-
dealDamage(target, getLaserDamage(false) * balance.damageShare, "laser");
|
|
1429
|
-
if (hasSynergy("plasmaLaser")) chainShock(targetCenter, 1, gameBalance.synergies.plasmaChainDamage, /* @__PURE__ */ new Set([target]));
|
|
1430
|
-
continue;
|
|
1431
|
-
}
|
|
1432
|
-
const wantedTurn = Math.atan2(targetCenter.y - homingLaser.y, targetCenter.x - homingLaser.x) - angle;
|
|
1433
|
-
angle += clamp(Math.atan2(Math.sin(wantedTurn), Math.cos(wantedTurn)), -balance.turnSpeed * seconds, balance.turnSpeed * seconds);
|
|
1434
|
-
}
|
|
1435
|
-
remainingLasers.push({
|
|
1436
|
-
...homingLaser,
|
|
1437
|
-
target,
|
|
1438
|
-
angle,
|
|
1439
|
-
x: homingLaser.x + Math.cos(angle) * balance.pixelsPerSecond * seconds,
|
|
1440
|
-
y: homingLaser.y + Math.sin(angle) * balance.pixelsPerSecond * seconds
|
|
1441
|
-
});
|
|
1442
|
-
}
|
|
1443
|
-
homingLasers.value = remainingLasers;
|
|
1444
|
-
}
|
|
1445
|
-
function addShockBolt(from, to) {
|
|
1446
|
-
const angle = Math.atan2(to.y - from.y, to.x - from.x);
|
|
1447
|
-
addShot("shock", createShotPoints(from.x, from.y, 0, angle, getDistance(from, to), 30));
|
|
1448
|
-
}
|
|
1449
|
-
function chainShock(startPoint, jumpCount, baseDamage, alreadyHitEnemies, firstRange = gameBalance.electricShock.chainRange) {
|
|
1450
|
-
let currentPoint = startPoint;
|
|
1451
|
-
for (let jump = 0; jump < jumpCount; jump++) {
|
|
1452
|
-
const range = jump === 0 ? firstRange : gameBalance.electricShock.chainRange;
|
|
1453
|
-
const target = findNearestEnemy(currentPoint, range, alreadyHitEnemies);
|
|
1454
|
-
const bounds = target?.getBounds();
|
|
1455
|
-
if (!target || !bounds) return;
|
|
1456
|
-
const targetCenter = getCenter(bounds);
|
|
1457
|
-
const isSuperconducting = hasSynergy("superconductor") && (target.hasStatus?.("frozen") ?? false);
|
|
1458
|
-
addShockBolt(currentPoint, targetCenter);
|
|
1459
|
-
target.applyStatus?.("stunned", gameBalance.electricShock.stunDuration);
|
|
1460
|
-
dealDamage(target, baseDamage * (isSuperconducting ? gameBalance.synergies.superconductorMultiplier : 1), "shock");
|
|
1461
|
-
alreadyHitEnemies.add(target);
|
|
1462
|
-
currentPoint = targetCenter;
|
|
1463
|
-
}
|
|
1464
|
-
}
|
|
1465
|
-
const rockets = (0, vue.shallowRef)([]);
|
|
1466
|
-
const blasts = (0, vue.shallowRef)([]);
|
|
1467
|
-
const iceChunks = (0, vue.shallowRef)([]);
|
|
1468
|
-
function showBlast(point, radius, kind) {
|
|
1469
|
-
const id = nextShotId++;
|
|
1470
|
-
blasts.value = [...blasts.value, {
|
|
1471
|
-
id,
|
|
1472
|
-
...point,
|
|
1473
|
-
radius,
|
|
1474
|
-
kind
|
|
1475
|
-
}];
|
|
1476
|
-
setTimeout(() => {
|
|
1477
|
-
blasts.value = blasts.value.filter((blast) => blast.id !== id);
|
|
1478
|
-
}, 450);
|
|
1479
|
-
}
|
|
1480
|
-
function launchRocket(startPoint, angle) {
|
|
1481
|
-
rockets.value = [...rockets.value, {
|
|
1482
|
-
id: nextShotId++,
|
|
1483
|
-
...startPoint,
|
|
1484
|
-
angle,
|
|
1485
|
-
launchTime: getGameTime()
|
|
1486
|
-
}];
|
|
1487
|
-
}
|
|
1488
|
-
function explodeRocket(point) {
|
|
1489
|
-
const level = getWeaponLevel("rockets");
|
|
1490
|
-
const balance = gameBalance.rockets;
|
|
1491
|
-
const radius = balance.blastRadius + balance.blastRadiusPerLevel * level;
|
|
1492
|
-
showBlast(point, radius, "rocket");
|
|
1493
|
-
for (const enemy of findEnemiesInRadius(point, radius)) {
|
|
1494
|
-
if (hasSynergy("napalm")) enemy.applyStatus?.("burning", gameBalance.synergies.napalmBurnDuration);
|
|
1495
|
-
dealDamage(enemy, balance.damage + balance.damagePerLevel * (level - 1), "rocket");
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
function updateRockets(now, seconds) {
|
|
1499
|
-
if (!rockets.value.length) return;
|
|
1500
|
-
const balance = gameBalance.rockets;
|
|
1501
|
-
const remainingRockets = [];
|
|
1502
|
-
for (const rocket of rockets.value) {
|
|
1503
|
-
const targetBounds = findNearestEnemy(rocket, Infinity)?.getBounds();
|
|
1504
|
-
let { angle } = rocket;
|
|
1505
|
-
if (targetBounds) {
|
|
1506
|
-
const targetCenter = getCenter(targetBounds);
|
|
1507
|
-
if (getDistance(rocket, targetCenter) < targetBounds.width / 2 + 8) {
|
|
1508
|
-
explodeRocket(rocket);
|
|
1509
|
-
continue;
|
|
1510
|
-
}
|
|
1511
|
-
const wantedTurn = Math.atan2(targetCenter.y - rocket.y, targetCenter.x - rocket.x) - angle;
|
|
1512
|
-
angle += clamp(Math.atan2(Math.sin(wantedTurn), Math.cos(wantedTurn)), -balance.turnSpeed * seconds, balance.turnSpeed * seconds);
|
|
1513
|
-
}
|
|
1514
|
-
const x = rocket.x + Math.cos(angle) * balance.pixelsPerSecond * seconds;
|
|
1515
|
-
const y = rocket.y + Math.sin(angle) * balance.pixelsPerSecond * seconds;
|
|
1516
|
-
if (now - rocket.launchTime > balance.lifetime) {
|
|
1517
|
-
explodeRocket({
|
|
1518
|
-
x,
|
|
1519
|
-
y
|
|
1520
|
-
});
|
|
1521
|
-
continue;
|
|
1522
|
-
}
|
|
1523
|
-
remainingRockets.push({
|
|
1524
|
-
...rocket,
|
|
1525
|
-
x,
|
|
1526
|
-
y,
|
|
1527
|
-
angle
|
|
1528
|
-
});
|
|
1529
|
-
}
|
|
1530
|
-
rockets.value = remainingRockets;
|
|
1531
|
-
}
|
|
1532
|
-
function launchIceChunks(center, count) {
|
|
1533
|
-
const startAngle = Math.random() * Math.PI * 2;
|
|
1534
|
-
const { pixelsPerSecond } = gameBalance.iceAsteroids;
|
|
1535
|
-
const newChunks = Array.from({ length: count }, (_, index) => {
|
|
1536
|
-
const angle = startAngle + index * Math.PI * 2 / count;
|
|
1537
|
-
return {
|
|
1538
|
-
id: nextShotId++,
|
|
1539
|
-
startX: center.x,
|
|
1540
|
-
startY: center.y,
|
|
1541
|
-
velocityX: Math.cos(angle) * pixelsPerSecond,
|
|
1542
|
-
velocityY: Math.sin(angle) * pixelsPerSecond,
|
|
1543
|
-
startTime: getGameTime(),
|
|
1544
|
-
flightDuration: Math.hypot(window.innerWidth, window.innerHeight) / pixelsPerSecond * 1e3
|
|
1545
|
-
};
|
|
1546
|
-
});
|
|
1547
|
-
iceChunks.value = [...iceChunks.value, ...newChunks];
|
|
1548
|
-
}
|
|
1549
|
-
function steamBlast(point) {
|
|
1550
|
-
const { steamBlastDamage, steamBlastRadius } = gameBalance.synergies;
|
|
1551
|
-
showBlast(point, steamBlastRadius, "steam");
|
|
1552
|
-
for (const enemy of findEnemiesInRadius(point, steamBlastRadius)) dealDamage(enemy, steamBlastDamage, "fire");
|
|
1553
|
-
}
|
|
1554
|
-
function updateIceChunks(now) {
|
|
1555
|
-
if (!iceChunks.value.length) return;
|
|
1556
|
-
const level = getWeaponLevel("iceAsteroids");
|
|
1557
|
-
const balance = gameBalance.iceAsteroids;
|
|
1558
|
-
const remainingChunks = iceChunks.value.filter((chunk) => {
|
|
1559
|
-
const elapsedTime = now - chunk.startTime;
|
|
1560
|
-
if (elapsedTime > chunk.flightDuration) return false;
|
|
1561
|
-
const position = {
|
|
1562
|
-
x: chunk.startX + chunk.velocityX * elapsedTime / 1e3,
|
|
1563
|
-
y: chunk.startY + chunk.velocityY * elapsedTime / 1e3
|
|
1564
|
-
};
|
|
1565
|
-
const hitEnemy = findEnemiesInRadius(position, 10)[0];
|
|
1566
|
-
if (!hitEnemy) return true;
|
|
1567
|
-
const wasBurning = hitEnemy.hasStatus?.("burning") ?? false;
|
|
1568
|
-
hitEnemy.applyStatus?.("frozen", balance.freezeDuration);
|
|
1569
|
-
dealDamage(hitEnemy, balance.damage + balance.damagePerLevel * (level - 1), "ice");
|
|
1570
|
-
if (wasBurning && hasSynergy("steamBlast")) steamBlast(position);
|
|
1571
|
-
return false;
|
|
1572
|
-
});
|
|
1573
|
-
if (remainingChunks.length !== iceChunks.value.length) iceChunks.value = remainingChunks;
|
|
1574
|
-
}
|
|
1575
|
-
const fireballCount = (0, vue.computed)(() => props.laser ? getWeaponLevel("fireballs") : 0);
|
|
1576
|
-
const fireballOrbitRadius = (0, vue.computed)(() => gameBalance.fireballs.orbitRadius + gameBalance.fireballs.orbitRadiusPerLevel * fireballCount.value);
|
|
1577
|
-
const fireballLastHitTimes = /* @__PURE__ */ new WeakMap();
|
|
1578
|
-
let orbitStartTime = 0;
|
|
1579
|
-
(0, vue.watch)(fireballCount, (count, previousCount) => {
|
|
1580
|
-
if (count > 0 && !previousCount) orbitStartTime = getGameTime();
|
|
1581
|
-
}, { immediate: true });
|
|
1582
|
-
function getFireballStyle(index) {
|
|
1583
|
-
const angle = index * Math.PI * 2 / fireballCount.value;
|
|
1584
|
-
return {
|
|
1585
|
-
left: `${50 + 50 * Math.cos(angle)}%`,
|
|
1586
|
-
top: `${50 + 50 * Math.sin(angle)}%`
|
|
1587
|
-
};
|
|
1588
|
-
}
|
|
1589
|
-
function updateFireballs(now, playerCenter) {
|
|
1590
|
-
const count = fireballCount.value;
|
|
1591
|
-
if (!count) return;
|
|
1592
|
-
const balance = gameBalance.fireballs;
|
|
1593
|
-
const baseAngle = (now - orbitStartTime) / balance.orbitDuration * Math.PI * 2;
|
|
1594
|
-
for (let index = 0; index < count; index++) {
|
|
1595
|
-
const angle = baseAngle + index * Math.PI * 2 / count;
|
|
1596
|
-
const position = {
|
|
1597
|
-
x: playerCenter.x + Math.cos(angle) * fireballOrbitRadius.value,
|
|
1598
|
-
y: playerCenter.y + Math.sin(angle) * fireballOrbitRadius.value
|
|
1599
|
-
};
|
|
1600
|
-
for (const enemy of findEnemiesInRadius(position, 12)) {
|
|
1601
|
-
if (now - (fireballLastHitTimes.get(enemy) ?? -Infinity) < balance.hitCooldown) continue;
|
|
1602
|
-
fireballLastHitTimes.set(enemy, now);
|
|
1603
|
-
enemy.applyStatus?.("burning", balance.burnDuration);
|
|
1604
|
-
dealDamage(enemy, balance.damage + balance.damagePerLevel * (count - 1), "fire");
|
|
1605
|
-
}
|
|
1606
|
-
}
|
|
1607
|
-
}
|
|
1608
|
-
const weaponReadyTimes = {};
|
|
1609
|
-
function fireWeaponWhenReady(weapon, now, balance, fire) {
|
|
1610
|
-
const level = getWeaponLevel(weapon);
|
|
1611
|
-
if (!level) return;
|
|
1612
|
-
const readyTime = weaponReadyTimes[weapon];
|
|
1613
|
-
if (readyTime === void 0) {
|
|
1614
|
-
weaponReadyTimes[weapon] = now + 500;
|
|
1615
|
-
return;
|
|
1616
|
-
}
|
|
1617
|
-
if (now < readyTime) return;
|
|
1618
|
-
fire(level);
|
|
1619
|
-
weaponReadyTimes[weapon] = now + (balance.cooldown - balance.cooldownPerLevel * (level - 1)) * props.stats.cooldownMultiplier;
|
|
1620
|
-
}
|
|
1621
|
-
function updateAutomaticWeapons(now, center) {
|
|
1622
|
-
fireWeaponWhenReady("rockets", now, gameBalance.rockets, (level) => {
|
|
1623
|
-
const rocketCount = level >= gameBalance.rockets.doubleRocketLevel ? 2 : 1;
|
|
1624
|
-
for (let index = 0; index < rocketCount; index++) launchRocket(center, -Math.PI / 2 + (index - (rocketCount - 1) / 2) * .8);
|
|
1625
|
-
});
|
|
1626
|
-
fireWeaponWhenReady("iceAsteroids", now, gameBalance.iceAsteroids, (level) => {
|
|
1627
|
-
const balance = gameBalance.iceAsteroids;
|
|
1628
|
-
launchIceChunks(center, balance.chunks + balance.chunksPerLevel * (level - 1));
|
|
1629
|
-
});
|
|
1630
|
-
fireWeaponWhenReady("electricShock", now, gameBalance.electricShock, (level) => {
|
|
1631
|
-
const balance = gameBalance.electricShock;
|
|
1632
|
-
chainShock(center, getElectricShockChainCount(level), balance.damage + balance.damagePerLevel * (level - 1), /* @__PURE__ */ new Set(), balance.firstRange);
|
|
1633
|
-
});
|
|
1634
|
-
}
|
|
1635
|
-
const chargeState = (0, vue.ref)("idle");
|
|
1636
|
-
let chargeStartTime;
|
|
1637
|
-
let chargeTimeout;
|
|
1638
|
-
function startCharge(event) {
|
|
1639
|
-
if (event.button !== 0 || isDestroyed.value || props.paused) return;
|
|
1640
|
-
chargeStartTime = performance.now();
|
|
1641
|
-
chargeState.value = "charging";
|
|
1642
|
-
clearTimeout(chargeTimeout);
|
|
1643
|
-
chargeTimeout = setTimeout(() => {
|
|
1644
|
-
chargeState.value = "charged";
|
|
1645
|
-
}, chargedShotTime);
|
|
1646
|
-
}
|
|
1647
|
-
function cancelCharge() {
|
|
1648
|
-
chargeStartTime = void 0;
|
|
1649
|
-
clearTimeout(chargeTimeout);
|
|
1650
|
-
chargeState.value = "idle";
|
|
1651
|
-
}
|
|
1652
|
-
function releaseCharge(event) {
|
|
1653
|
-
if (chargeStartTime === void 0) return;
|
|
1654
|
-
const isCharged = performance.now() - chargeStartTime >= chargedShotTime;
|
|
1655
|
-
cancelCharge();
|
|
1656
|
-
if (!props.paused) fireLaser(event.clientX, event.clientY, isCharged);
|
|
1657
|
-
}
|
|
1658
|
-
function stopShooting() {
|
|
1659
|
-
shots.value = [];
|
|
1660
|
-
}
|
|
1661
|
-
const isExploding = (0, vue.ref)(false);
|
|
1662
|
-
const isDestroyed = (0, vue.ref)(false);
|
|
1663
|
-
const isTough = (0, vue.ref)(false);
|
|
1664
|
-
const isDamaged = (0, vue.ref)(false);
|
|
1665
|
-
const healthPoints = (0, vue.ref)(1);
|
|
1666
|
-
const maxHealthPoints = (0, vue.ref)(1);
|
|
1667
|
-
let damageTimeout;
|
|
1668
|
-
let explosionTimeout;
|
|
1669
|
-
function takeDamage(damage) {
|
|
1670
|
-
healthPoints.value = Math.max(Math.round((healthPoints.value - damage) * 10) / 10, 0);
|
|
1671
|
-
if (healthPoints.value > 0) {
|
|
1672
|
-
isDamaged.value = true;
|
|
1673
|
-
clearTimeout(damageTimeout);
|
|
1674
|
-
damageTimeout = setTimeout(() => {
|
|
1675
|
-
isDamaged.value = false;
|
|
1676
|
-
}, 200);
|
|
1677
|
-
return false;
|
|
1678
|
-
}
|
|
1679
|
-
const bounds = getOwnBounds();
|
|
1680
|
-
if (bounds) showExplosion(getCenter(bounds), !props.laser);
|
|
1681
|
-
isExploding.value = true;
|
|
1682
|
-
return true;
|
|
1683
|
-
}
|
|
1684
|
-
function heal(amount) {
|
|
1685
|
-
if (isDestroyed.value || isExploding.value) return;
|
|
1686
|
-
healthPoints.value = Math.min(healthPoints.value + amount, props.stats.maxHealth);
|
|
1687
|
-
}
|
|
1688
|
-
__expose({ heal });
|
|
1689
|
-
function getOwnBounds() {
|
|
1690
|
-
if (props.laser) return getPlayerBounds();
|
|
1691
|
-
if (props.flying) return getEnemyBounds();
|
|
1692
|
-
return animatedRootRef.value?.getBoundingClientRect();
|
|
1693
|
-
}
|
|
1694
|
-
function getEnemyExperience() {
|
|
1695
|
-
const experience = gameBalance.enemyExperience;
|
|
1696
|
-
if (props.boss) return experience.boss;
|
|
1697
|
-
if (props.enemyKind) return experience[props.enemyKind];
|
|
1698
|
-
return isTough.value ? experience.tough : experience.normal;
|
|
1699
|
-
}
|
|
1700
|
-
function getEnemyPoints() {
|
|
1701
|
-
if (props.boss) return 2e3;
|
|
1702
|
-
if (props.enemyKind === "sniper") return 250;
|
|
1703
|
-
if (props.enemyKind === "splitter") return 200;
|
|
1704
|
-
if (props.enemyKind === "kamikaze") return 150;
|
|
1705
|
-
if (props.enemyKind === "swarm") return 50;
|
|
1706
|
-
return isTough.value ? 300 : 100;
|
|
1707
|
-
}
|
|
1708
|
-
const damageNumbers = (0, vue.shallowRef)([]);
|
|
1709
|
-
function showDamageNumber(value, damageType, isCritical) {
|
|
1710
|
-
const bounds = getEnemyBounds();
|
|
1711
|
-
if (!bounds) return;
|
|
1712
|
-
const id = nextShotId++;
|
|
1713
|
-
const x = bounds.x + bounds.width / 2 + (Math.random() - .5) * 24;
|
|
1714
|
-
damageNumbers.value = [...damageNumbers.value, {
|
|
1715
|
-
id,
|
|
1716
|
-
x,
|
|
1717
|
-
y: bounds.y - 4,
|
|
1718
|
-
value,
|
|
1719
|
-
damageType,
|
|
1720
|
-
isCritical
|
|
1721
|
-
}];
|
|
1722
|
-
setTimeout(() => {
|
|
1723
|
-
damageNumbers.value = damageNumbers.value.filter((damageNumber) => damageNumber.id !== id);
|
|
1724
|
-
}, 800);
|
|
1725
|
-
}
|
|
1726
|
-
function formatDamage(value) {
|
|
1727
|
-
return Number.isInteger(value) ? String(value) : value.toFixed(1);
|
|
1728
|
-
}
|
|
1729
|
-
const statusEndTimes = {
|
|
1730
|
-
burning: 0,
|
|
1731
|
-
frozen: 0,
|
|
1732
|
-
stunned: 0
|
|
1733
|
-
};
|
|
1734
|
-
const isBurning = (0, vue.ref)(false);
|
|
1735
|
-
const isFrozen = (0, vue.ref)(false);
|
|
1736
|
-
const isStunned = (0, vue.ref)(false);
|
|
1737
|
-
let nextBurnTickTime = 0;
|
|
1738
|
-
function hasStatus(effect) {
|
|
1739
|
-
return getGameTime() < statusEndTimes[effect];
|
|
1740
|
-
}
|
|
1741
|
-
function updateStatusFlags() {
|
|
1742
|
-
isBurning.value = hasStatus("burning");
|
|
1743
|
-
isFrozen.value = hasStatus("frozen");
|
|
1744
|
-
isStunned.value = hasStatus("stunned");
|
|
1745
|
-
}
|
|
1746
|
-
function applyStatus(effect, duration) {
|
|
1747
|
-
if (!enemyTarget.isHittable()) return;
|
|
1748
|
-
const now = getGameTime();
|
|
1749
|
-
if (effect === "burning" && !hasStatus("burning")) nextBurnTickTime = now + gameBalance.burn.tickTime;
|
|
1750
|
-
statusEndTimes[effect] = Math.max(statusEndTimes[effect], now + duration);
|
|
1751
|
-
updateStatusFlags();
|
|
1752
|
-
}
|
|
1753
|
-
function updateStatuses(now) {
|
|
1754
|
-
updateStatusFlags();
|
|
1755
|
-
if (!isBurning.value || now < nextBurnTickTime) return;
|
|
1756
|
-
nextBurnTickTime = now + gameBalance.burn.tickTime;
|
|
1757
|
-
const points = enemyTarget.hit(gameBalance.burn.damagePerTick, "fire");
|
|
1758
|
-
if (points > 0) emit("kill", points);
|
|
1759
|
-
}
|
|
1760
|
-
const enemyTarget = {
|
|
1761
|
-
getBounds: () => getEnemyBounds(),
|
|
1762
|
-
isHittable: () => !isExploding.value && !isDestroyed.value,
|
|
1763
|
-
hit: (damage, damageType, isCritical = false) => {
|
|
1764
|
-
if (!enemyTarget.isHittable()) return 0;
|
|
1765
|
-
showDamageNumber(damage, damageType, isCritical);
|
|
1766
|
-
if (!takeDamage(damage)) return 0;
|
|
1767
|
-
const bounds = getEnemyBounds();
|
|
1768
|
-
if (bounds) {
|
|
1769
|
-
const center = getCenter(bounds);
|
|
1770
|
-
if (props.enemyKind === "splitter") emit("split", center);
|
|
1771
|
-
dropExperienceGem(center, getEnemyExperience(), gameBalance.maxGemsOnScreen);
|
|
1772
|
-
}
|
|
1773
|
-
isExploding.value = false;
|
|
1774
|
-
isDestroyed.value = true;
|
|
1775
|
-
explosionTimeout = setTimeout(() => emit("destroyed"), 700);
|
|
1776
|
-
return getEnemyPoints();
|
|
1777
|
-
},
|
|
1778
|
-
crash: () => {
|
|
1779
|
-
const diesOnCrash = props.enemyKind === "kamikaze" || props.enemyKind === "swarm";
|
|
1780
|
-
return {
|
|
1781
|
-
damageToPlayer: props.enemyKind === "kamikaze" ? 2 : 1,
|
|
1782
|
-
points: enemyTarget.hit(diesOnCrash ? healthPoints.value : 1, "crash")
|
|
1783
|
-
};
|
|
1784
|
-
},
|
|
1785
|
-
applyStatus,
|
|
1786
|
-
hasStatus
|
|
1787
|
-
};
|
|
1788
|
-
const isInvulnerable = (0, vue.ref)(false);
|
|
1789
|
-
let invulnerableTimeout;
|
|
1790
|
-
function makeInvulnerable(duration) {
|
|
1791
|
-
isInvulnerable.value = true;
|
|
1792
|
-
clearTimeout(invulnerableTimeout);
|
|
1793
|
-
invulnerableTimeout = setTimeout(() => {
|
|
1794
|
-
isInvulnerable.value = false;
|
|
1795
|
-
}, duration);
|
|
1796
|
-
}
|
|
1797
|
-
const playerTarget = {
|
|
1798
|
-
getBounds: () => getPlayerBounds(),
|
|
1799
|
-
isHittable: () => !isExploding.value && !isDestroyed.value && !isInvulnerable.value,
|
|
1800
|
-
hit: (damage) => {
|
|
1801
|
-
if (takeDamage(damage)) {
|
|
1802
|
-
explosionTimeout = setTimeout(() => {
|
|
1803
|
-
isExploding.value = false;
|
|
1804
|
-
isDestroyed.value = true;
|
|
1805
|
-
playerIconTargets.delete(playerTarget);
|
|
1806
|
-
emit("gameOver");
|
|
1807
|
-
}, 400);
|
|
1808
|
-
return 0;
|
|
1809
|
-
}
|
|
1810
|
-
makeInvulnerable(1e3);
|
|
1811
|
-
return 0;
|
|
1812
|
-
}
|
|
1813
|
-
};
|
|
1814
|
-
const explosion = (0, vue.ref)(null);
|
|
1815
|
-
let explosionAnimationTimeout;
|
|
1816
|
-
function showExplosion(center, canBeHeadshot) {
|
|
1817
|
-
const particles = Array.from({ length: 16 }, () => {
|
|
1818
|
-
const angle = Math.random() * Math.PI * 2;
|
|
1819
|
-
const distance = 50 + Math.random() * 90;
|
|
1820
|
-
return {
|
|
1821
|
-
x: Math.cos(angle) * distance,
|
|
1822
|
-
y: Math.sin(angle) * distance
|
|
1823
|
-
};
|
|
1824
|
-
});
|
|
1825
|
-
explosion.value = {
|
|
1826
|
-
...center,
|
|
1827
|
-
particles,
|
|
1828
|
-
isHeadshot: canBeHeadshot && Math.random() < .35
|
|
1829
|
-
};
|
|
1830
|
-
clearTimeout(explosionAnimationTimeout);
|
|
1831
|
-
explosionAnimationTimeout = setTimeout(() => {
|
|
1832
|
-
explosion.value = null;
|
|
1833
|
-
}, 1e3);
|
|
1834
|
-
}
|
|
1835
|
-
let playerOffset = {
|
|
1836
|
-
x: 0,
|
|
1837
|
-
y: 0
|
|
1838
|
-
};
|
|
1839
|
-
let playerBaseBounds;
|
|
1840
|
-
const isDashing = (0, vue.ref)(false);
|
|
1841
|
-
const pressedKeys = /* @__PURE__ */ new Set();
|
|
1842
|
-
const movementKeys = {
|
|
1843
|
-
arrowup: {
|
|
1844
|
-
x: 0,
|
|
1845
|
-
y: -1
|
|
1846
|
-
},
|
|
1847
|
-
w: {
|
|
1848
|
-
x: 0,
|
|
1849
|
-
y: -1
|
|
1850
|
-
},
|
|
1851
|
-
arrowdown: {
|
|
1852
|
-
x: 0,
|
|
1853
|
-
y: 1
|
|
1854
|
-
},
|
|
1855
|
-
s: {
|
|
1856
|
-
x: 0,
|
|
1857
|
-
y: 1
|
|
1858
|
-
},
|
|
1859
|
-
arrowleft: {
|
|
1860
|
-
x: -1,
|
|
1861
|
-
y: 0
|
|
1862
|
-
},
|
|
1863
|
-
a: {
|
|
1864
|
-
x: -1,
|
|
1865
|
-
y: 0
|
|
1866
|
-
},
|
|
1867
|
-
arrowright: {
|
|
1868
|
-
x: 1,
|
|
1869
|
-
y: 0
|
|
1870
|
-
},
|
|
1871
|
-
d: {
|
|
1872
|
-
x: 1,
|
|
1873
|
-
y: 0
|
|
1874
|
-
}
|
|
1875
|
-
};
|
|
1876
|
-
let playerFrame;
|
|
1877
|
-
let lastPlayerFrameTime;
|
|
1878
|
-
let dashDirection = {
|
|
1879
|
-
x: 0,
|
|
1880
|
-
y: 0
|
|
1881
|
-
};
|
|
1882
|
-
let dashEndTime = 0;
|
|
1883
|
-
let dashReadyTime = 0;
|
|
1884
|
-
function getPressedDirection() {
|
|
1885
|
-
let directionX = 0;
|
|
1886
|
-
let directionY = 0;
|
|
1887
|
-
for (const key of pressedKeys) {
|
|
1888
|
-
directionX += movementKeys[key]?.x ?? 0;
|
|
1889
|
-
directionY += movementKeys[key]?.y ?? 0;
|
|
1890
|
-
}
|
|
1891
|
-
const directionLength = Math.hypot(directionX, directionY);
|
|
1892
|
-
return directionLength > 0 ? {
|
|
1893
|
-
x: directionX / directionLength,
|
|
1894
|
-
y: directionY / directionLength
|
|
1895
|
-
} : void 0;
|
|
1896
|
-
}
|
|
1897
|
-
function startDash() {
|
|
1898
|
-
const direction = getPressedDirection();
|
|
1899
|
-
const now = getGameTime();
|
|
1900
|
-
if (!direction || now < dashReadyTime || isDestroyed.value || props.paused) return;
|
|
1901
|
-
dashDirection = direction;
|
|
1902
|
-
dashEndTime = now + dashDuration;
|
|
1903
|
-
dashReadyTime = now + dashCooldown * props.stats.cooldownMultiplier;
|
|
1904
|
-
isDashing.value = true;
|
|
1905
|
-
makeInvulnerable(260);
|
|
1906
|
-
}
|
|
1907
|
-
function isGameKey(key) {
|
|
1908
|
-
return key === " " || movementKeys[key] !== void 0;
|
|
1909
|
-
}
|
|
1910
|
-
function handleKeyDown(event) {
|
|
1911
|
-
const key = event.key.toLowerCase();
|
|
1912
|
-
if (!isGameKey(key)) return;
|
|
1913
|
-
event.preventDefault();
|
|
1914
|
-
event.stopPropagation();
|
|
1915
|
-
if (key === " ") startDash();
|
|
1916
|
-
else pressedKeys.add(key);
|
|
1917
|
-
}
|
|
1918
|
-
function handleKeyUp(event) {
|
|
1919
|
-
const key = event.key.toLowerCase();
|
|
1920
|
-
if (!isGameKey(key)) return;
|
|
1921
|
-
event.stopPropagation();
|
|
1922
|
-
pressedKeys.delete(key);
|
|
1923
|
-
}
|
|
1924
|
-
function preventContextMenu(event) {
|
|
1925
|
-
event.preventDefault();
|
|
1926
|
-
}
|
|
1927
|
-
function releaseAllInput() {
|
|
1928
|
-
pressedKeys.clear();
|
|
1929
|
-
cancelCharge();
|
|
1930
|
-
}
|
|
1931
|
-
function getPlayerBounds() {
|
|
1932
|
-
if (!playerBaseBounds) return void 0;
|
|
1933
|
-
return new DOMRect(playerBaseBounds.x + playerOffset.x, playerBaseBounds.y + playerOffset.y, playerBaseBounds.width, playerBaseBounds.height);
|
|
1934
|
-
}
|
|
1935
|
-
function measurePlayerBase() {
|
|
1936
|
-
const element = animatedRootRef.value;
|
|
1937
|
-
if (!element) return;
|
|
1938
|
-
const rectangle = element.getBoundingClientRect();
|
|
1939
|
-
playerBaseBounds = new DOMRect(rectangle.x - playerOffset.x, rectangle.y - playerOffset.y, rectangle.width, rectangle.height);
|
|
1940
|
-
}
|
|
1941
|
-
function applyPlayerPosition() {
|
|
1942
|
-
const element = animatedRootRef.value;
|
|
1943
|
-
if (element) element.style.transform = `translate3d(${playerOffset.x}px, ${playerOffset.y}px, 0)`;
|
|
1944
|
-
}
|
|
1945
|
-
function updateGems(seconds, playerCenter, playerRadius) {
|
|
1946
|
-
if (!experienceGems.value.length) return;
|
|
1947
|
-
const isWaveCleared = getLivingEnemies().length === 0;
|
|
1948
|
-
let hasChanged = false;
|
|
1949
|
-
let collectedExperience = 0;
|
|
1950
|
-
const remainingGems = [];
|
|
1951
|
-
for (const gem of experienceGems.value) {
|
|
1952
|
-
const distance = getDistance(gem, playerCenter);
|
|
1953
|
-
if (distance < playerRadius + 6) {
|
|
1954
|
-
collectedExperience += gem.value;
|
|
1955
|
-
hasChanged = true;
|
|
1956
|
-
continue;
|
|
1957
|
-
}
|
|
1958
|
-
if (!gem.isMagnetized && !isWaveCleared && distance > props.stats.pickupRadius) {
|
|
1959
|
-
remainingGems.push(gem);
|
|
1960
|
-
continue;
|
|
1961
|
-
}
|
|
1962
|
-
const step = Math.min(gameBalance.gemMagnetPixelsPerSecond * seconds, distance);
|
|
1963
|
-
remainingGems.push({
|
|
1964
|
-
...gem,
|
|
1965
|
-
isMagnetized: true,
|
|
1966
|
-
x: gem.x + (playerCenter.x - gem.x) / distance * step,
|
|
1967
|
-
y: gem.y + (playerCenter.y - gem.y) / distance * step
|
|
1968
|
-
});
|
|
1969
|
-
hasChanged = true;
|
|
1970
|
-
}
|
|
1971
|
-
if (hasChanged) experienceGems.value = remainingGems;
|
|
1972
|
-
if (collectedExperience > 0) emit("experience", collectedExperience);
|
|
1973
|
-
}
|
|
1974
|
-
function getGemPoints(gem) {
|
|
1975
|
-
const size = gem.value >= 10 ? 9 : gem.value >= 4 ? 7 : 5;
|
|
1976
|
-
return `${gem.x},${gem.y - size} ${gem.x + size * .7},${gem.y} ${gem.x},${gem.y + size} ${gem.x - size * .7},${gem.y}`;
|
|
1977
|
-
}
|
|
1978
|
-
function findCrashedEnemy(playerBounds) {
|
|
1979
|
-
const playerCenter = getCenter(playerBounds);
|
|
1980
|
-
for (const enemy of enemyIconTargets) {
|
|
1981
|
-
const enemyBounds = enemy.getBounds();
|
|
1982
|
-
if (!enemyBounds || !enemy.isHittable()) continue;
|
|
1983
|
-
if (getDistance(getCenter(enemyBounds), playerCenter) < (playerBounds.width + enemyBounds.width) * .4) return enemy;
|
|
1984
|
-
}
|
|
1985
|
-
}
|
|
1986
|
-
function movePlayer() {
|
|
1987
|
-
const now = getGameTime();
|
|
1988
|
-
if (lastPlayerFrameTime !== void 0 && !isDestroyed.value && !props.paused) {
|
|
1989
|
-
const seconds = (now - lastPlayerFrameTime) / 1e3;
|
|
1990
|
-
if (isDashing.value && now >= dashEndTime) isDashing.value = false;
|
|
1991
|
-
const direction = isDashing.value ? dashDirection : getPressedDirection();
|
|
1992
|
-
const rectangle = getPlayerBounds();
|
|
1993
|
-
if (direction && rectangle) {
|
|
1994
|
-
const playerSpeed = playerPixelsPerSecond * props.stats.speedMultiplier;
|
|
1995
|
-
const distance = (isDashing.value ? dashPixelsPerSecond : playerSpeed) * seconds;
|
|
1996
|
-
const moveX = clamp(direction.x * distance, -rectangle.left, window.innerWidth - rectangle.right);
|
|
1997
|
-
const moveY = clamp(direction.y * distance, -rectangle.top, window.innerHeight - rectangle.bottom);
|
|
1998
|
-
playerOffset = {
|
|
1999
|
-
x: playerOffset.x + moveX,
|
|
2000
|
-
y: playerOffset.y + moveY
|
|
2001
|
-
};
|
|
2002
|
-
applyPlayerPosition();
|
|
2003
|
-
}
|
|
2004
|
-
const playerBounds = getPlayerBounds();
|
|
2005
|
-
if (playerBounds) {
|
|
2006
|
-
const playerCenter = getCenter(playerBounds);
|
|
2007
|
-
pickUpCrate(playerBounds);
|
|
2008
|
-
updateAutomaticWeapons(now, playerCenter);
|
|
2009
|
-
updateFireballs(now, playerCenter);
|
|
2010
|
-
updateRockets(now, seconds);
|
|
2011
|
-
updateHomingLasers(now, seconds);
|
|
2012
|
-
updateIceChunks(now);
|
|
2013
|
-
updateGems(seconds, playerCenter, playerBounds.width / 2);
|
|
2014
|
-
const crashedEnemy = playerTarget.isHittable() ? findCrashedEnemy(playerBounds) : void 0;
|
|
2015
|
-
if (crashedEnemy?.crash) {
|
|
2016
|
-
const crashResult = crashedEnemy.crash();
|
|
2017
|
-
if (crashResult.points > 0) emit("kill", crashResult.points);
|
|
2018
|
-
playerTarget.hit(crashResult.damageToPlayer, "crash");
|
|
2019
|
-
}
|
|
2020
|
-
}
|
|
2021
|
-
}
|
|
2022
|
-
lastPlayerFrameTime = now;
|
|
2023
|
-
playerFrame = requestAnimationFrame(movePlayer);
|
|
2024
|
-
}
|
|
2025
|
-
const crate = (0, vue.ref)(null);
|
|
2026
|
-
let crateInterval;
|
|
2027
|
-
function dropCrate() {
|
|
2028
|
-
if (crate.value || isDestroyed.value || props.paused) return;
|
|
2029
|
-
crate.value = {
|
|
2030
|
-
x: Math.random() * Math.max(window.innerWidth - crateSize, 0),
|
|
2031
|
-
y: Math.random() * Math.max(window.innerHeight - crateSize, 0)
|
|
2032
|
-
};
|
|
2033
|
-
}
|
|
2034
|
-
function pickUpCrate(playerBounds) {
|
|
2035
|
-
if (!crate.value) return;
|
|
2036
|
-
if (!(playerBounds.right > crate.value.x && playerBounds.left < crate.value.x + crateSize && playerBounds.bottom > crate.value.y && playerBounds.top < crate.value.y + crateSize)) return;
|
|
2037
|
-
crate.value = null;
|
|
2038
|
-
if (barrelLevel.value < weaponBarrels.length - 1) {
|
|
2039
|
-
barrelLevel.value++;
|
|
2040
|
-
emit("crate", "laserBeam");
|
|
2041
|
-
} else if (homingLaserCount.value < gameBalance.homingLasers.maxCount) {
|
|
2042
|
-
homingLaserCount.value++;
|
|
2043
|
-
emit("crate", "homingLaser");
|
|
2044
|
-
} else emit("crate", "weaponUpgrade");
|
|
2045
|
-
}
|
|
2046
|
-
function stopPlaying() {
|
|
2047
|
-
window.removeEventListener("pointerdown", startCharge);
|
|
2048
|
-
window.removeEventListener("pointerup", releaseCharge);
|
|
2049
|
-
window.removeEventListener("keydown", handleKeyDown, true);
|
|
2050
|
-
window.removeEventListener("keyup", handleKeyUp, true);
|
|
2051
|
-
window.removeEventListener("resize", measurePlayerBase);
|
|
2052
|
-
window.removeEventListener("contextmenu", preventContextMenu);
|
|
2053
|
-
window.removeEventListener("blur", releaseAllInput);
|
|
2054
|
-
if (playerFrame !== void 0) cancelAnimationFrame(playerFrame);
|
|
2055
|
-
playerFrame = void 0;
|
|
2056
|
-
lastPlayerFrameTime = void 0;
|
|
2057
|
-
pressedKeys.clear();
|
|
2058
|
-
cancelCharge();
|
|
2059
|
-
isDashing.value = false;
|
|
2060
|
-
playerIconTargets.delete(playerTarget);
|
|
2061
|
-
clearInterval(crateInterval);
|
|
2062
|
-
crateInterval = void 0;
|
|
2063
|
-
crate.value = null;
|
|
2064
|
-
clearInterval(heartInterval);
|
|
2065
|
-
clearTimeout(heartTimeout);
|
|
2066
|
-
heartInterval = void 0;
|
|
2067
|
-
heart.value = null;
|
|
2068
|
-
rockets.value = [];
|
|
2069
|
-
homingLasers.value = [];
|
|
2070
|
-
iceChunks.value = [];
|
|
2071
|
-
blasts.value = [];
|
|
2072
|
-
for (const weapon of Object.keys(weaponReadyTimes)) delete weaponReadyTimes[weapon];
|
|
2073
|
-
}
|
|
2074
|
-
(0, vue.watch)([() => props.laser, animatedRootRef], ([laser, element]) => {
|
|
2075
|
-
stopPlaying();
|
|
2076
|
-
if (!laser || !element) return;
|
|
2077
|
-
healthPoints.value = props.stats.maxHealth;
|
|
2078
|
-
experienceGems.value = [];
|
|
2079
|
-
isDestroyed.value = false;
|
|
2080
|
-
playerOffset = {
|
|
2081
|
-
x: 0,
|
|
2082
|
-
y: 0
|
|
2083
|
-
};
|
|
2084
|
-
applyPlayerPosition();
|
|
2085
|
-
measurePlayerBase();
|
|
2086
|
-
barrelLevel.value = 0;
|
|
2087
|
-
homingLaserCount.value = 0;
|
|
2088
|
-
dashReadyTime = 0;
|
|
2089
|
-
crateInterval = setInterval(dropCrate, 45e3);
|
|
2090
|
-
heartInterval = setInterval(showHeart, 15e3);
|
|
2091
|
-
playerIconTargets.add(playerTarget);
|
|
2092
|
-
window.addEventListener("pointerdown", startCharge);
|
|
2093
|
-
window.addEventListener("pointerup", releaseCharge);
|
|
2094
|
-
window.addEventListener("keydown", handleKeyDown, true);
|
|
2095
|
-
window.addEventListener("keyup", handleKeyUp, true);
|
|
2096
|
-
window.addEventListener("resize", measurePlayerBase);
|
|
2097
|
-
window.addEventListener("contextmenu", preventContextMenu);
|
|
2098
|
-
window.addEventListener("blur", releaseAllInput);
|
|
2099
|
-
playerFrame = requestAnimationFrame(movePlayer);
|
|
2100
|
-
}, { immediate: true });
|
|
2101
|
-
let flyingPosition = {
|
|
2102
|
-
x: 0,
|
|
2103
|
-
y: 0
|
|
2104
|
-
};
|
|
2105
|
-
let enemySize = 0;
|
|
2106
|
-
const enemyProjectiles = (0, vue.shallowRef)([]);
|
|
2107
|
-
const sniperAimLine = (0, vue.ref)(null);
|
|
2108
|
-
let flyingVelocity = {
|
|
2109
|
-
x: 0,
|
|
2110
|
-
y: 0
|
|
2111
|
-
};
|
|
2112
|
-
let flyingFrame;
|
|
2113
|
-
let lastFrameTime;
|
|
2114
|
-
let nextEnemyShotTime;
|
|
2115
|
-
let sniperState = "moving";
|
|
2116
|
-
let sniperStateEndTime = 0;
|
|
2117
|
-
let sniperAimAngle = 0;
|
|
2118
|
-
function getEnemyBounds() {
|
|
2119
|
-
if (!enemySize) return void 0;
|
|
2120
|
-
return new DOMRect(flyingPosition.x, flyingPosition.y, enemySize, enemySize);
|
|
2121
|
-
}
|
|
2122
|
-
function applyFlyingPosition() {
|
|
2123
|
-
const element = animatedRootRef.value;
|
|
2124
|
-
if (element) element.style.transform = `translate3d(${flyingPosition.x}px, ${flyingPosition.y}px, 0)`;
|
|
2125
|
-
}
|
|
2126
|
-
function getBaseHealth() {
|
|
2127
|
-
if (props.boss) return bossMaxHealth;
|
|
2128
|
-
if (isTough.value) return 3;
|
|
2129
|
-
return props.enemyKind === "splitter" ? 2 : 1;
|
|
2130
|
-
}
|
|
2131
|
-
function getSpeedFactor() {
|
|
2132
|
-
if (props.boss) return .4;
|
|
2133
|
-
if (isTough.value) return .6;
|
|
2134
|
-
if (props.enemyKind === "sniper") return .7;
|
|
2135
|
-
return 1;
|
|
2136
|
-
}
|
|
2137
|
-
function startFlight() {
|
|
2138
|
-
const iconSize = animatedRootRef.value?.offsetWidth ?? 0;
|
|
2139
|
-
enemySize = iconSize;
|
|
2140
|
-
const angle = Math.random() * Math.PI * 2;
|
|
2141
|
-
isTough.value = props.boss || !props.enemyKind && Math.random() < .25;
|
|
2142
|
-
maxHealthPoints.value = Math.max(Math.round(getBaseHealth() * props.strength), 1);
|
|
2143
|
-
healthPoints.value = maxHealthPoints.value;
|
|
2144
|
-
const pixelsPerSecond = (120 + Math.random() * 120) * getSpeedFactor();
|
|
2145
|
-
flyingPosition = props.spawnPoint ? {
|
|
2146
|
-
x: props.spawnPoint.x - iconSize / 2,
|
|
2147
|
-
y: props.spawnPoint.y - iconSize / 2
|
|
2148
|
-
} : {
|
|
2149
|
-
x: Math.random() * Math.max(window.innerWidth - iconSize, 0),
|
|
2150
|
-
y: Math.random() * Math.max(window.innerHeight - iconSize, 0)
|
|
2151
|
-
};
|
|
2152
|
-
flyingVelocity = {
|
|
2153
|
-
x: Math.cos(angle) * pixelsPerSecond,
|
|
2154
|
-
y: Math.sin(angle) * pixelsPerSecond
|
|
2155
|
-
};
|
|
2156
|
-
applyFlyingPosition();
|
|
2157
|
-
}
|
|
2158
|
-
function findPlayer() {
|
|
2159
|
-
return [...playerIconTargets][0];
|
|
2160
|
-
}
|
|
2161
|
-
function fireProjectile(angle, pixelsPerSecond, variant) {
|
|
2162
|
-
const bounds = getEnemyBounds();
|
|
2163
|
-
if (!bounds) return;
|
|
2164
|
-
const center = getCenter(bounds);
|
|
2165
|
-
enemyProjectiles.value = [...enemyProjectiles.value, {
|
|
2166
|
-
id: nextShotId++,
|
|
2167
|
-
startX: center.x,
|
|
2168
|
-
startY: center.y,
|
|
2169
|
-
velocityX: Math.cos(angle) * pixelsPerSecond,
|
|
2170
|
-
velocityY: Math.sin(angle) * pixelsPerSecond,
|
|
2171
|
-
startTime: getGameTime(),
|
|
2172
|
-
flightDuration: Math.hypot(window.innerWidth, window.innerHeight) / pixelsPerSecond * 1e3,
|
|
2173
|
-
radius: variant === "boss" ? 9 : variant === "sniper" ? 4 : 5,
|
|
2174
|
-
damage: variant === "boss" ? 2 : 1,
|
|
2175
|
-
variant
|
|
2176
|
-
}];
|
|
2177
|
-
}
|
|
2178
|
-
function getProjectileStyle(projectile) {
|
|
2179
|
-
const seconds = projectile.flightDuration / 1e3;
|
|
2180
|
-
return {
|
|
2181
|
-
"--fds-icon-projectile-x": `${projectile.velocityX * seconds}px`,
|
|
2182
|
-
"--fds-icon-projectile-y": `${projectile.velocityY * seconds}px`,
|
|
2183
|
-
animationDuration: `${projectile.flightDuration}ms`
|
|
2184
|
-
};
|
|
2185
|
-
}
|
|
2186
|
-
function fireAtPlayer() {
|
|
2187
|
-
const bounds = getEnemyBounds();
|
|
2188
|
-
const playerBounds = findPlayer()?.getBounds();
|
|
2189
|
-
if (!bounds || !playerBounds || !enemyTarget.isHittable()) return;
|
|
2190
|
-
const center = getCenter(bounds);
|
|
2191
|
-
const playerCenter = getCenter(playerBounds);
|
|
2192
|
-
const angle = Math.atan2(playerCenter.y - center.y, playerCenter.x - center.x);
|
|
2193
|
-
const spreadAngles = props.boss ? [
|
|
2194
|
-
-.4,
|
|
2195
|
-
-.2,
|
|
2196
|
-
0,
|
|
2197
|
-
.2,
|
|
2198
|
-
.4
|
|
2199
|
-
] : [0];
|
|
2200
|
-
for (const spreadAngle of spreadAngles) fireProjectile(angle + spreadAngle, props.boss ? 320 : 220, props.boss ? "boss" : "enemy");
|
|
2201
|
-
}
|
|
2202
|
-
function updateSniper(now) {
|
|
2203
|
-
const bounds = getEnemyBounds();
|
|
2204
|
-
if (!bounds || !enemyTarget.isHittable() || isStunned.value) {
|
|
2205
|
-
sniperState = "moving";
|
|
2206
|
-
sniperAimLine.value = null;
|
|
2207
|
-
return;
|
|
2208
|
-
}
|
|
2209
|
-
const playerBounds = findPlayer()?.getBounds();
|
|
2210
|
-
if (sniperState === "moving") {
|
|
2211
|
-
if (nextEnemyShotTime === void 0) nextEnemyShotTime = now + 2e3 + Math.random() * 2e3;
|
|
2212
|
-
if (now < nextEnemyShotTime || !playerBounds) return;
|
|
2213
|
-
sniperState = "aiming";
|
|
2214
|
-
sniperStateEndTime = now + 900;
|
|
2215
|
-
}
|
|
2216
|
-
const center = getCenter(bounds);
|
|
2217
|
-
if (sniperState === "aiming") {
|
|
2218
|
-
if (playerBounds) {
|
|
2219
|
-
const playerCenter = getCenter(playerBounds);
|
|
2220
|
-
sniperAimAngle = Math.atan2(playerCenter.y - center.y, playerCenter.x - center.x);
|
|
2221
|
-
}
|
|
2222
|
-
if (now >= sniperStateEndTime) {
|
|
2223
|
-
sniperState = "locked";
|
|
2224
|
-
sniperStateEndTime = now + 350;
|
|
2225
|
-
}
|
|
2226
|
-
} else if (now >= sniperStateEndTime) {
|
|
2227
|
-
fireProjectile(sniperAimAngle, 650, "sniper");
|
|
2228
|
-
sniperState = "moving";
|
|
2229
|
-
sniperAimLine.value = null;
|
|
2230
|
-
nextEnemyShotTime = now + 3e3 + Math.random() * 2e3;
|
|
2231
|
-
return;
|
|
2232
|
-
}
|
|
2233
|
-
const screenLength = Math.max(window.innerWidth, window.innerHeight);
|
|
2234
|
-
sniperAimLine.value = {
|
|
2235
|
-
x1: center.x,
|
|
2236
|
-
y1: center.y,
|
|
2237
|
-
x2: center.x + Math.cos(sniperAimAngle) * screenLength,
|
|
2238
|
-
y2: center.y + Math.sin(sniperAimAngle) * screenLength,
|
|
2239
|
-
isLocked: sniperState === "locked"
|
|
2240
|
-
};
|
|
2241
|
-
}
|
|
2242
|
-
function steerTowardPlayer(seconds, pixelsPerSecond) {
|
|
2243
|
-
const playerBounds = findPlayer()?.getBounds();
|
|
2244
|
-
if (!playerBounds) return;
|
|
2245
|
-
const playerCenter = getCenter(playerBounds);
|
|
2246
|
-
const angle = Math.atan2(playerCenter.y - (flyingPosition.y + enemySize / 2), playerCenter.x - (flyingPosition.x + enemySize / 2));
|
|
2247
|
-
const turnAmount = Math.min(seconds * 2.5, 1);
|
|
2248
|
-
flyingVelocity = {
|
|
2249
|
-
x: flyingVelocity.x + (Math.cos(angle) * pixelsPerSecond - flyingVelocity.x) * turnAmount,
|
|
2250
|
-
y: flyingVelocity.y + (Math.sin(angle) * pixelsPerSecond - flyingVelocity.y) * turnAmount
|
|
2251
|
-
};
|
|
2252
|
-
}
|
|
2253
|
-
function checkEnemyProjectiles(now) {
|
|
2254
|
-
if (!enemyProjectiles.value.length) return;
|
|
2255
|
-
const player = findPlayer();
|
|
2256
|
-
const playerBounds = player?.isHittable() ? player.getBounds() : void 0;
|
|
2257
|
-
const playerCenter = playerBounds ? getCenter(playerBounds) : void 0;
|
|
2258
|
-
const remainingProjectiles = enemyProjectiles.value.filter((projectile) => {
|
|
2259
|
-
const elapsedTime = now - projectile.startTime;
|
|
2260
|
-
if (elapsedTime > projectile.flightDuration) return false;
|
|
2261
|
-
if (!player || !playerBounds || !playerCenter) return true;
|
|
2262
|
-
const x = projectile.startX + projectile.velocityX * elapsedTime / 1e3;
|
|
2263
|
-
const y = projectile.startY + projectile.velocityY * elapsedTime / 1e3;
|
|
2264
|
-
if (Math.hypot(x - playerCenter.x, y - playerCenter.y) >= playerBounds.width / 2 + projectile.radius) return true;
|
|
2265
|
-
player.hit(projectile.damage, "crash");
|
|
2266
|
-
return false;
|
|
2267
|
-
});
|
|
2268
|
-
if (remainingProjectiles.length !== enemyProjectiles.value.length) enemyProjectiles.value = remainingProjectiles;
|
|
2269
|
-
}
|
|
2270
|
-
function scheduleNextEnemyShot(now) {
|
|
2271
|
-
const fireRateFactor = 1 + Math.log(props.strength) * gameBalance.enemyFireRateGrowth;
|
|
2272
|
-
nextEnemyShotTime = now + (props.boss ? 2e3 : 2e3 + Math.random() * 4e3) / fireRateFactor;
|
|
2273
|
-
}
|
|
2274
|
-
let bossAttackReadyTime;
|
|
2275
|
-
let spiralEndTime = 0;
|
|
2276
|
-
let nextSpiralShotTime = 0;
|
|
2277
|
-
let spiralAngle = 0;
|
|
2278
|
-
let bossChargeState = "idle";
|
|
2279
|
-
let bossChargeEndTime = 0;
|
|
2280
|
-
let bossChargeAngle = 0;
|
|
2281
|
-
let velocityBeforeCharge = {
|
|
2282
|
-
x: 0,
|
|
2283
|
-
y: 0
|
|
2284
|
-
};
|
|
2285
|
-
const isEnraged = (0, vue.computed)(() => props.boss && healthPoints.value <= maxHealthPoints.value * gameBalance.bossAttacks.rageHealthShare);
|
|
2286
|
-
function updateBossCharge(now) {
|
|
2287
|
-
const balance = gameBalance.bossAttacks;
|
|
2288
|
-
if (bossChargeState === "warning") {
|
|
2289
|
-
const bounds = getEnemyBounds();
|
|
2290
|
-
const playerBounds = findPlayer()?.getBounds();
|
|
2291
|
-
if (bounds && playerBounds) {
|
|
2292
|
-
const center = getCenter(bounds);
|
|
2293
|
-
const playerCenter = getCenter(playerBounds);
|
|
2294
|
-
bossChargeAngle = Math.atan2(playerCenter.y - center.y, playerCenter.x - center.x);
|
|
2295
|
-
const screenLength = Math.max(window.innerWidth, window.innerHeight);
|
|
2296
|
-
sniperAimLine.value = {
|
|
2297
|
-
x1: center.x,
|
|
2298
|
-
y1: center.y,
|
|
2299
|
-
x2: center.x + Math.cos(bossChargeAngle) * screenLength,
|
|
2300
|
-
y2: center.y + Math.sin(bossChargeAngle) * screenLength,
|
|
2301
|
-
isLocked: true
|
|
2302
|
-
};
|
|
2303
|
-
}
|
|
2304
|
-
if (now < bossChargeEndTime) return;
|
|
2305
|
-
bossChargeState = "charging";
|
|
2306
|
-
bossChargeEndTime = now + balance.chargeDuration;
|
|
2307
|
-
velocityBeforeCharge = flyingVelocity;
|
|
2308
|
-
flyingVelocity = {
|
|
2309
|
-
x: Math.cos(bossChargeAngle) * balance.chargePixelsPerSecond,
|
|
2310
|
-
y: Math.sin(bossChargeAngle) * balance.chargePixelsPerSecond
|
|
2311
|
-
};
|
|
2312
|
-
sniperAimLine.value = null;
|
|
2313
|
-
} else if (bossChargeState === "charging" && now >= bossChargeEndTime) {
|
|
2314
|
-
bossChargeState = "idle";
|
|
2315
|
-
flyingVelocity = velocityBeforeCharge;
|
|
2316
|
-
}
|
|
2317
|
-
}
|
|
2318
|
-
function updateBossAttacks(now) {
|
|
2319
|
-
if (!props.bossAttacks.length || !enemyTarget.isHittable() || isStunned.value) return;
|
|
2320
|
-
const balance = gameBalance.bossAttacks;
|
|
2321
|
-
if (now < spiralEndTime && now >= nextSpiralShotTime) {
|
|
2322
|
-
nextSpiralShotTime = now + balance.spiralShotInterval;
|
|
2323
|
-
spiralAngle += .45;
|
|
2324
|
-
fireProjectile(spiralAngle, 240, "enemy");
|
|
2325
|
-
fireProjectile(spiralAngle + Math.PI, 240, "enemy");
|
|
2326
|
-
}
|
|
2327
|
-
updateBossCharge(now);
|
|
2328
|
-
if (bossAttackReadyTime === void 0) {
|
|
2329
|
-
bossAttackReadyTime = now + balance.cooldown;
|
|
2330
|
-
return;
|
|
2331
|
-
}
|
|
2332
|
-
if (now < bossAttackReadyTime || bossChargeState !== "idle" || now < spiralEndTime) return;
|
|
2333
|
-
const attack = props.bossAttacks[Math.floor(Math.random() * props.bossAttacks.length)];
|
|
2334
|
-
bossAttackReadyTime = now + balance.cooldown * (isEnraged.value ? balance.rageCooldownFactor : 1);
|
|
2335
|
-
const bounds = getEnemyBounds();
|
|
2336
|
-
if (attack === "ring") {
|
|
2337
|
-
const startAngle = Math.random() * Math.PI;
|
|
2338
|
-
for (let index = 0; index < balance.ringProjectiles; index++) fireProjectile(startAngle + index * Math.PI * 2 / balance.ringProjectiles, 200, "enemy");
|
|
2339
|
-
} else if (attack === "spiral") {
|
|
2340
|
-
spiralEndTime = now + balance.spiralDuration;
|
|
2341
|
-
nextSpiralShotTime = now;
|
|
2342
|
-
spiralAngle = Math.random() * Math.PI * 2;
|
|
2343
|
-
} else if (attack === "summon" && bounds) emit("summon", getCenter(bounds));
|
|
2344
|
-
else if (attack === "charge") {
|
|
2345
|
-
bossChargeState = "warning";
|
|
2346
|
-
bossChargeEndTime = now + balance.chargeWarningTime;
|
|
2347
|
-
}
|
|
2348
|
-
}
|
|
2349
|
-
function fly() {
|
|
2350
|
-
const now = getGameTime();
|
|
2351
|
-
if (lastFrameTime !== void 0 && !props.paused) {
|
|
2352
|
-
updateStatuses(now);
|
|
2353
|
-
const statusSpeedFactor = isStunned.value ? 0 : isFrozen.value ? gameBalance.frozenSpeedFactor : 1;
|
|
2354
|
-
const seconds = (now - lastFrameTime) / 1e3 * statusSpeedFactor;
|
|
2355
|
-
const isHoldingPosition = props.enemyKind === "sniper" && sniperState !== "moving" || bossChargeState === "warning";
|
|
2356
|
-
if (props.enemyKind === "kamikaze") steerTowardPlayer(seconds, kamikazePixelsPerSecond);
|
|
2357
|
-
if (props.enemyKind === "swarm") steerTowardPlayer(seconds, swarmPixelsPerSecond);
|
|
2358
|
-
if (!isHoldingPosition) {
|
|
2359
|
-
const maxX = Math.max(window.innerWidth - enemySize, 0);
|
|
2360
|
-
const maxY = Math.max(window.innerHeight - enemySize, 0);
|
|
2361
|
-
let x = flyingPosition.x + flyingVelocity.x * seconds;
|
|
2362
|
-
let y = flyingPosition.y + flyingVelocity.y * seconds;
|
|
2363
|
-
if (x < 0 || x > maxX) {
|
|
2364
|
-
flyingVelocity.x = -flyingVelocity.x;
|
|
2365
|
-
x = clamp(x, 0, maxX);
|
|
2366
|
-
}
|
|
2367
|
-
if (y < 0 || y > maxY) {
|
|
2368
|
-
flyingVelocity.y = -flyingVelocity.y;
|
|
2369
|
-
y = clamp(y, 0, maxY);
|
|
2370
|
-
}
|
|
2371
|
-
flyingPosition = {
|
|
2372
|
-
x,
|
|
2373
|
-
y
|
|
2374
|
-
};
|
|
2375
|
-
applyFlyingPosition();
|
|
2376
|
-
}
|
|
2377
|
-
checkEnemyProjectiles(now);
|
|
2378
|
-
if (props.boss) updateBossAttacks(now);
|
|
2379
|
-
if (props.enemyKind === "sniper") updateSniper(now);
|
|
2380
|
-
else if (props.enemyKind !== "kamikaze" && props.enemyKind !== "swarm" && !isStunned.value) {
|
|
2381
|
-
if (nextEnemyShotTime === void 0) scheduleNextEnemyShot(now);
|
|
2382
|
-
else if (now >= nextEnemyShotTime) {
|
|
2383
|
-
fireAtPlayer();
|
|
2384
|
-
scheduleNextEnemyShot(now);
|
|
2385
|
-
}
|
|
2386
|
-
}
|
|
2387
|
-
}
|
|
2388
|
-
lastFrameTime = now;
|
|
2389
|
-
flyingFrame = requestAnimationFrame(fly);
|
|
2390
|
-
}
|
|
2391
|
-
function stopFlying() {
|
|
2392
|
-
if (flyingFrame !== void 0) cancelAnimationFrame(flyingFrame);
|
|
2393
|
-
flyingFrame = void 0;
|
|
2394
|
-
lastFrameTime = void 0;
|
|
2395
|
-
nextEnemyShotTime = void 0;
|
|
2396
|
-
bossAttackReadyTime = void 0;
|
|
2397
|
-
spiralEndTime = 0;
|
|
2398
|
-
bossChargeState = "idle";
|
|
2399
|
-
sniperState = "moving";
|
|
2400
|
-
sniperAimLine.value = null;
|
|
2401
|
-
enemyProjectiles.value = [];
|
|
2402
|
-
damageNumbers.value = [];
|
|
2403
|
-
enemySize = 0;
|
|
2404
|
-
enemyIconTargets.delete(enemyTarget);
|
|
2405
|
-
}
|
|
2406
|
-
function resetDamageState() {
|
|
2407
|
-
clearTimeout(damageTimeout);
|
|
2408
|
-
clearTimeout(explosionTimeout);
|
|
2409
|
-
clearTimeout(explosionAnimationTimeout);
|
|
2410
|
-
explosion.value = null;
|
|
2411
|
-
isExploding.value = false;
|
|
2412
|
-
isDestroyed.value = false;
|
|
2413
|
-
isDamaged.value = false;
|
|
2414
|
-
clearTimeout(invulnerableTimeout);
|
|
2415
|
-
isInvulnerable.value = false;
|
|
2416
|
-
statusEndTimes.burning = 0;
|
|
2417
|
-
statusEndTimes.frozen = 0;
|
|
2418
|
-
statusEndTimes.stunned = 0;
|
|
2419
|
-
updateStatusFlags();
|
|
2420
|
-
}
|
|
2421
|
-
(0, vue.watch)([() => props.flying, animatedRootRef], ([flying, element]) => {
|
|
2422
|
-
stopFlying();
|
|
2423
|
-
if (!flying || !element) return;
|
|
2424
|
-
resetDamageState();
|
|
2425
|
-
startFlight();
|
|
2426
|
-
enemyIconTargets.add(enemyTarget);
|
|
2427
|
-
if (!window.matchMedia("(prefers-reduced-motion: reduce)").matches) flyingFrame = requestAnimationFrame(fly);
|
|
2428
|
-
}, { immediate: true });
|
|
2429
|
-
const healthDotColor = (0, vue.computed)(() => {
|
|
2430
|
-
if (props.laser) return "bg-green-600";
|
|
2431
|
-
if (props.flying && !props.boss && (isTough.value || props.enemyKind === "splitter")) return "bg-red-600";
|
|
2432
|
-
});
|
|
2433
|
-
const healthMaximum = (0, vue.computed)(() => props.laser ? props.stats.maxHealth : maxHealthPoints.value);
|
|
2434
|
-
const showsHealthBar = (0, vue.computed)(() => healthMaximum.value > maxHealthDots);
|
|
2435
|
-
const animatedRootStyle = (0, vue.computed)(() => ({
|
|
2436
|
-
width: pixelSize.value,
|
|
2437
|
-
height: pixelSize.value,
|
|
2438
|
-
"--fds-icon-recoil-x": `${recoilOffset.value.x}px`,
|
|
2439
|
-
"--fds-icon-recoil-y": `${recoilOffset.value.y}px`
|
|
2440
|
-
}));
|
|
2441
|
-
(0, vue.onBeforeUnmount)(() => {
|
|
2442
|
-
stopShooting();
|
|
2443
|
-
stopPlaying();
|
|
2444
|
-
stopFlying();
|
|
2445
|
-
resetDamageState();
|
|
2446
|
-
});
|
|
2447
927
|
return (_ctx, _cache) => {
|
|
2448
|
-
return
|
|
2449
|
-
key: 0,
|
|
928
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("span", (0, vue.mergeProps)({
|
|
2450
929
|
class: "flex items-center justify-center align-middle",
|
|
2451
930
|
style: {
|
|
2452
931
|
width: pixelSize.value,
|
|
2453
932
|
height: pixelSize.value
|
|
2454
933
|
}
|
|
2455
|
-
}, rootAttrs.value, { innerHTML: svgHtml.value }), null, 16, _hoisted_1$43)
|
|
2456
|
-
key: 1,
|
|
2457
|
-
ref_key: "animatedRootRef",
|
|
2458
|
-
ref: animatedRootRef,
|
|
2459
|
-
class: ["flex items-center justify-center align-middle", {
|
|
2460
|
-
"fds-icon-flying fixed left-0 top-0 z-[99999]": __props.flying,
|
|
2461
|
-
"fds-icon-player": __props.laser,
|
|
2462
|
-
"fds-icon-paused": __props.paused,
|
|
2463
|
-
relative: !__props.flying,
|
|
2464
|
-
invisible: isDestroyed.value
|
|
2465
|
-
}],
|
|
2466
|
-
style: animatedRootStyle.value
|
|
2467
|
-
}, rootAttrs.value), [
|
|
2468
|
-
(0, vue.createElementVNode)("span", {
|
|
2469
|
-
class: (0, vue.normalizeClass)(["flex items-center justify-center w-full h-full", {
|
|
2470
|
-
"fds-icon-recoiling": hasLaser.value,
|
|
2471
|
-
"fds-icon-exploding": isExploding.value,
|
|
2472
|
-
"fds-icon-tough": __props.flying && isTough.value,
|
|
2473
|
-
"fds-icon-enraged": __props.flying && isEnraged.value,
|
|
2474
|
-
"fds-icon-kamikaze": __props.flying && __props.enemyKind === "kamikaze",
|
|
2475
|
-
"fds-icon-splitter": __props.flying && __props.enemyKind === "splitter",
|
|
2476
|
-
"fds-icon-sniper": __props.flying && __props.enemyKind === "sniper",
|
|
2477
|
-
"fds-icon-swarm": __props.flying && __props.enemyKind === "swarm",
|
|
2478
|
-
"fds-icon-burning": isBurning.value,
|
|
2479
|
-
"fds-icon-frozen": isFrozen.value,
|
|
2480
|
-
"fds-icon-stunned": isStunned.value,
|
|
2481
|
-
"fds-icon-charging": chargeState.value === "charging",
|
|
2482
|
-
"fds-icon-charged": chargeState.value === "charged",
|
|
2483
|
-
"fds-icon-invulnerable": isInvulnerable.value && !isDashing.value,
|
|
2484
|
-
"fds-icon-dashing": isDashing.value,
|
|
2485
|
-
"fds-icon-damaged": isDamaged.value
|
|
2486
|
-
}]),
|
|
2487
|
-
innerHTML: svgHtml.value
|
|
2488
|
-
}, null, 10, _hoisted_2$30),
|
|
2489
|
-
fireballCount.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
|
|
2490
|
-
key: 0,
|
|
2491
|
-
class: "fds-icon-orbit absolute left-1/2 top-1/2 pointer-events-none",
|
|
2492
|
-
style: (0, vue.normalizeStyle)({
|
|
2493
|
-
width: `${fireballOrbitRadius.value * 2}px`,
|
|
2494
|
-
height: `${fireballOrbitRadius.value * 2}px`,
|
|
2495
|
-
marginLeft: `${-fireballOrbitRadius.value}px`,
|
|
2496
|
-
marginTop: `${-fireballOrbitRadius.value}px`,
|
|
2497
|
-
animationDuration: `${(0, vue.unref)(gameBalance).fireballs.orbitDuration}ms`
|
|
2498
|
-
}),
|
|
2499
|
-
"aria-hidden": "true"
|
|
2500
|
-
}, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(fireballCount.value, (index) => {
|
|
2501
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
|
|
2502
|
-
key: index,
|
|
2503
|
-
class: "fds-icon-fireball absolute",
|
|
2504
|
-
style: (0, vue.normalizeStyle)(getFireballStyle(index - 1))
|
|
2505
|
-
}, null, 4);
|
|
2506
|
-
}), 128))], 4)) : (0, vue.createCommentVNode)("", true),
|
|
2507
|
-
healthDotColor.value && showsHealthBar.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_3$24, [(0, vue.createElementVNode)("span", {
|
|
2508
|
-
class: (0, vue.normalizeClass)(["block h-full", healthDotColor.value]),
|
|
2509
|
-
style: (0, vue.normalizeStyle)({ width: `${healthPoints.value / healthMaximum.value * 100}%` })
|
|
2510
|
-
}, null, 6)])) : healthDotColor.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_4$20, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(Math.ceil(healthPoints.value), (point) => {
|
|
2511
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
|
|
2512
|
-
key: point,
|
|
2513
|
-
class: (0, vue.normalizeClass)(["w-1.5 h-1.5 rounded-full", healthDotColor.value])
|
|
2514
|
-
}, null, 2);
|
|
2515
|
-
}), 128))])) : (0, vue.createCommentVNode)("", true),
|
|
2516
|
-
__props.label ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_5$18, (0, vue.toDisplayString)(__props.label), 1)) : (0, vue.createCommentVNode)("", true),
|
|
2517
|
-
__props.flying && __props.boss ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_6$13, [(0, vue.createElementVNode)("span", {
|
|
2518
|
-
class: "block h-full bg-red-600",
|
|
2519
|
-
style: (0, vue.normalizeStyle)({ width: `${healthPoints.value / maxHealthPoints.value * 100}%` })
|
|
2520
|
-
}, null, 4)])) : (0, vue.createCommentVNode)("", true),
|
|
2521
|
-
((0, vue.openBlock)(), (0, vue.createBlock)(vue.Teleport, { to: "body" }, [
|
|
2522
|
-
__props.laser && (0, vue.unref)(experienceGems).length ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("svg", _hoisted_7$10, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)((0, vue.unref)(experienceGems), (gem) => {
|
|
2523
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("polygon", {
|
|
2524
|
-
key: gem.id,
|
|
2525
|
-
class: (0, vue.normalizeClass)(["fds-icon-gem", { "fds-icon-gem-large": gem.value >= 10 }]),
|
|
2526
|
-
points: getGemPoints(gem)
|
|
2527
|
-
}, null, 10, _hoisted_8$8);
|
|
2528
|
-
}), 128))])) : (0, vue.createCommentVNode)("", true),
|
|
2529
|
-
shots.value.length ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("svg", {
|
|
2530
|
-
key: 1,
|
|
2531
|
-
class: (0, vue.normalizeClass)(["fixed inset-0 w-screen h-screen pointer-events-none z-[100000]", { "fds-icon-paused": __props.paused }]),
|
|
2532
|
-
"aria-hidden": "true"
|
|
2533
|
-
}, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(shots.value, (shot) => {
|
|
2534
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: shot.id }, [shot.kind === "shock" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("polyline", {
|
|
2535
|
-
key: 0,
|
|
2536
|
-
class: "fds-icon-shock",
|
|
2537
|
-
points: shot.points,
|
|
2538
|
-
fill: "none"
|
|
2539
|
-
}, null, 8, _hoisted_9$7)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 1 }, [
|
|
2540
|
-
(0, vue.createElementVNode)("polyline", {
|
|
2541
|
-
class: (0, vue.normalizeClass)(["fds-icon-laser fds-icon-laser-glow", { "fds-icon-laser-charged": shot.kind === "charged" }]),
|
|
2542
|
-
points: shot.points,
|
|
2543
|
-
pathLength: "1",
|
|
2544
|
-
fill: "none"
|
|
2545
|
-
}, null, 10, _hoisted_10$5),
|
|
2546
|
-
(0, vue.createElementVNode)("polyline", {
|
|
2547
|
-
class: (0, vue.normalizeClass)(["fds-icon-laser", { "fds-icon-laser-charged": shot.kind === "charged" }]),
|
|
2548
|
-
points: shot.points,
|
|
2549
|
-
pathLength: "1",
|
|
2550
|
-
fill: "none"
|
|
2551
|
-
}, null, 10, _hoisted_11$5),
|
|
2552
|
-
(0, vue.createElementVNode)("polyline", {
|
|
2553
|
-
class: (0, vue.normalizeClass)(["fds-icon-laser fds-icon-laser-core", { "fds-icon-laser-charged": shot.kind === "charged" }]),
|
|
2554
|
-
points: shot.points,
|
|
2555
|
-
pathLength: "1",
|
|
2556
|
-
fill: "none"
|
|
2557
|
-
}, null, 10, _hoisted_12$3)
|
|
2558
|
-
], 64))], 64);
|
|
2559
|
-
}), 128))], 2)) : (0, vue.createCommentVNode)("", true),
|
|
2560
|
-
rockets.value.length || homingLasers.value.length || iceChunks.value.length || blasts.value.length ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("svg", {
|
|
2561
|
-
key: 2,
|
|
2562
|
-
class: (0, vue.normalizeClass)(["fixed inset-0 w-screen h-screen pointer-events-none z-[100000]", { "fds-icon-paused": __props.paused }]),
|
|
2563
|
-
"aria-hidden": "true"
|
|
2564
|
-
}, [
|
|
2565
|
-
((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(rockets.value, (rocket) => {
|
|
2566
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("g", {
|
|
2567
|
-
key: rocket.id,
|
|
2568
|
-
transform: `translate(${rocket.x} ${rocket.y}) rotate(${rocket.angle * 180 / Math.PI})`
|
|
2569
|
-
}, [..._cache[0] || (_cache[0] = [(0, vue.createElementVNode)("path", {
|
|
2570
|
-
class: "fds-icon-rocket-flame",
|
|
2571
|
-
d: "M-9 -3 L-18 0 L-9 3 Z"
|
|
2572
|
-
}, null, -1), (0, vue.createElementVNode)("path", {
|
|
2573
|
-
class: "fds-icon-rocket-body",
|
|
2574
|
-
d: "M-10 -4 H5 L11 0 L5 4 H-10 Z"
|
|
2575
|
-
}, null, -1)])], 8, _hoisted_13$3);
|
|
2576
|
-
}), 128)),
|
|
2577
|
-
((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(homingLasers.value, (homingLaser) => {
|
|
2578
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("g", {
|
|
2579
|
-
key: homingLaser.id,
|
|
2580
|
-
transform: `translate(${homingLaser.x} ${homingLaser.y}) rotate(${homingLaser.angle * 180 / Math.PI})`
|
|
2581
|
-
}, [..._cache[1] || (_cache[1] = [
|
|
2582
|
-
(0, vue.createElementVNode)("line", {
|
|
2583
|
-
class: "fds-icon-homing-laser-glow",
|
|
2584
|
-
x1: "-18",
|
|
2585
|
-
y1: "0",
|
|
2586
|
-
x2: "0",
|
|
2587
|
-
y2: "0"
|
|
2588
|
-
}, null, -1),
|
|
2589
|
-
(0, vue.createElementVNode)("line", {
|
|
2590
|
-
class: "fds-icon-homing-laser",
|
|
2591
|
-
x1: "-16",
|
|
2592
|
-
y1: "0",
|
|
2593
|
-
x2: "0",
|
|
2594
|
-
y2: "0"
|
|
2595
|
-
}, null, -1),
|
|
2596
|
-
(0, vue.createElementVNode)("line", {
|
|
2597
|
-
class: "fds-icon-homing-laser-core",
|
|
2598
|
-
x1: "-14",
|
|
2599
|
-
y1: "0",
|
|
2600
|
-
x2: "-2",
|
|
2601
|
-
y2: "0"
|
|
2602
|
-
}, null, -1)
|
|
2603
|
-
])], 8, _hoisted_14$3);
|
|
2604
|
-
}), 128)),
|
|
2605
|
-
((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(iceChunks.value, (chunk) => {
|
|
2606
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("g", {
|
|
2607
|
-
key: chunk.id,
|
|
2608
|
-
class: "fds-icon-projectile",
|
|
2609
|
-
style: (0, vue.normalizeStyle)(getProjectileStyle(chunk))
|
|
2610
|
-
}, [(0, vue.createElementVNode)("g", { transform: `translate(${chunk.startX} ${chunk.startY})` }, [..._cache[2] || (_cache[2] = [(0, vue.createElementVNode)("polygon", {
|
|
2611
|
-
class: "fds-icon-ice-chunk",
|
|
2612
|
-
points: "0,-11 9,-6 11,4 3,11 -8,8 -11,-2 -6,-9"
|
|
2613
|
-
}, null, -1)])], 8, _hoisted_15$1)], 4);
|
|
2614
|
-
}), 128)),
|
|
2615
|
-
((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(blasts.value, (blast) => {
|
|
2616
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("circle", {
|
|
2617
|
-
key: blast.id,
|
|
2618
|
-
class: (0, vue.normalizeClass)(["fds-icon-blast", `fds-icon-blast-${blast.kind}`]),
|
|
2619
|
-
cx: blast.x,
|
|
2620
|
-
cy: blast.y,
|
|
2621
|
-
r: blast.radius
|
|
2622
|
-
}, null, 10, _hoisted_16$1);
|
|
2623
|
-
}), 128))
|
|
2624
|
-
], 2)) : (0, vue.createCommentVNode)("", true),
|
|
2625
|
-
sniperAimLine.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("svg", _hoisted_17$1, [(0, vue.createElementVNode)("line", {
|
|
2626
|
-
class: (0, vue.normalizeClass)(["fds-icon-sniper-aim", { "fds-icon-sniper-aim-locked": sniperAimLine.value.isLocked }]),
|
|
2627
|
-
x1: sniperAimLine.value.x1,
|
|
2628
|
-
y1: sniperAimLine.value.y1,
|
|
2629
|
-
x2: sniperAimLine.value.x2,
|
|
2630
|
-
y2: sniperAimLine.value.y2
|
|
2631
|
-
}, null, 10, _hoisted_18$1)])) : (0, vue.createCommentVNode)("", true),
|
|
2632
|
-
enemyProjectiles.value.length ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("svg", {
|
|
2633
|
-
key: 4,
|
|
2634
|
-
class: (0, vue.normalizeClass)(["fixed inset-0 w-screen h-screen pointer-events-none z-[100000]", { "fds-icon-paused": __props.paused }]),
|
|
2635
|
-
"aria-hidden": "true"
|
|
2636
|
-
}, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(enemyProjectiles.value, (projectile) => {
|
|
2637
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("circle", {
|
|
2638
|
-
key: projectile.id,
|
|
2639
|
-
class: (0, vue.normalizeClass)(["fds-icon-projectile", `fds-icon-${projectile.variant}-projectile`]),
|
|
2640
|
-
cx: projectile.startX,
|
|
2641
|
-
cy: projectile.startY,
|
|
2642
|
-
r: projectile.radius,
|
|
2643
|
-
style: (0, vue.normalizeStyle)(getProjectileStyle(projectile))
|
|
2644
|
-
}, null, 14, _hoisted_19$1);
|
|
2645
|
-
}), 128))], 2)) : (0, vue.createCommentVNode)("", true),
|
|
2646
|
-
((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(damageNumbers.value, (damageNumber) => {
|
|
2647
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
2648
|
-
key: damageNumber.id,
|
|
2649
|
-
class: (0, vue.normalizeClass)(["fds-icon-damage-number fixed m-0 pointer-events-none z-[100001] font-bold whitespace-nowrap", [`fds-icon-damage-${damageNumber.damageType}`, {
|
|
2650
|
-
"fds-icon-damage-critical": damageNumber.isCritical,
|
|
2651
|
-
"fds-icon-paused": __props.paused
|
|
2652
|
-
}]]),
|
|
2653
|
-
style: (0, vue.normalizeStyle)({
|
|
2654
|
-
left: `${damageNumber.x}px`,
|
|
2655
|
-
top: `${damageNumber.y}px`
|
|
2656
|
-
}),
|
|
2657
|
-
"aria-hidden": "true"
|
|
2658
|
-
}, (0, vue.toDisplayString)(formatDamage(damageNumber.value)), 7);
|
|
2659
|
-
}), 128)),
|
|
2660
|
-
explosion.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("svg", _hoisted_20$1, [(0, vue.createElementVNode)("g", { transform: `translate(${explosion.value.x} ${explosion.value.y})` }, [
|
|
2661
|
-
_cache[3] || (_cache[3] = (0, vue.createElementVNode)("circle", {
|
|
2662
|
-
class: "fds-icon-explosion-flash",
|
|
2663
|
-
r: "45"
|
|
2664
|
-
}, null, -1)),
|
|
2665
|
-
_cache[4] || (_cache[4] = (0, vue.createElementVNode)("circle", {
|
|
2666
|
-
class: "fds-icon-explosion-ring",
|
|
2667
|
-
r: "30",
|
|
2668
|
-
fill: "none"
|
|
2669
|
-
}, null, -1)),
|
|
2670
|
-
((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(explosion.value.particles, (particle, index) => {
|
|
2671
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("circle", {
|
|
2672
|
-
key: index,
|
|
2673
|
-
class: "fds-icon-explosion-particle",
|
|
2674
|
-
r: 3 + index % 3,
|
|
2675
|
-
style: (0, vue.normalizeStyle)({
|
|
2676
|
-
"--fds-icon-particle-x": `${particle.x}px`,
|
|
2677
|
-
"--fds-icon-particle-y": `${particle.y}px`
|
|
2678
|
-
})
|
|
2679
|
-
}, null, 12, _hoisted_22$1);
|
|
2680
|
-
}), 128))
|
|
2681
|
-
], 8, _hoisted_21$1)])) : (0, vue.createCommentVNode)("", true),
|
|
2682
|
-
crate.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("svg", {
|
|
2683
|
-
key: 6,
|
|
2684
|
-
class: "fds-icon-crate fixed pointer-events-none z-[99999]",
|
|
2685
|
-
style: (0, vue.normalizeStyle)({
|
|
2686
|
-
left: `${crate.value.x}px`,
|
|
2687
|
-
top: `${crate.value.y}px`,
|
|
2688
|
-
width: `${crateSize}px`,
|
|
2689
|
-
height: `${crateSize}px`
|
|
2690
|
-
}),
|
|
2691
|
-
viewBox: "0 0 32 32",
|
|
2692
|
-
"aria-hidden": "true"
|
|
2693
|
-
}, [..._cache[5] || (_cache[5] = [
|
|
2694
|
-
(0, vue.createElementVNode)("rect", {
|
|
2695
|
-
class: "fds-icon-crate-box",
|
|
2696
|
-
x: "2",
|
|
2697
|
-
y: "2",
|
|
2698
|
-
width: "28",
|
|
2699
|
-
height: "28",
|
|
2700
|
-
rx: "3"
|
|
2701
|
-
}, null, -1),
|
|
2702
|
-
(0, vue.createElementVNode)("path", {
|
|
2703
|
-
class: "fds-icon-crate-planks",
|
|
2704
|
-
d: "M2 11 H30 M2 21 H30 M5 5 L27 27",
|
|
2705
|
-
fill: "none"
|
|
2706
|
-
}, null, -1),
|
|
2707
|
-
(0, vue.createElementVNode)("rect", {
|
|
2708
|
-
class: "fds-icon-crate-planks",
|
|
2709
|
-
x: "2",
|
|
2710
|
-
y: "2",
|
|
2711
|
-
width: "28",
|
|
2712
|
-
height: "28",
|
|
2713
|
-
rx: "3",
|
|
2714
|
-
fill: "none"
|
|
2715
|
-
}, null, -1)
|
|
2716
|
-
])], 4)) : (0, vue.createCommentVNode)("", true),
|
|
2717
|
-
heart.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("svg", {
|
|
2718
|
-
key: 7,
|
|
2719
|
-
class: "fds-icon-heart fixed pointer-events-none z-[99999]",
|
|
2720
|
-
style: (0, vue.normalizeStyle)({
|
|
2721
|
-
left: `${heart.value.x}px`,
|
|
2722
|
-
top: `${heart.value.y}px`,
|
|
2723
|
-
width: `${heartSize}px`,
|
|
2724
|
-
height: `${heartSize}px`
|
|
2725
|
-
}),
|
|
2726
|
-
viewBox: "0 0 32 32",
|
|
2727
|
-
"aria-hidden": "true"
|
|
2728
|
-
}, [..._cache[6] || (_cache[6] = [(0, vue.createElementVNode)("path", {
|
|
2729
|
-
class: "fds-icon-heart-shape",
|
|
2730
|
-
d: "M16 28 C6 20 2 15 2 9.5 C2 5.5 5 3 8.5 3 C11.5 3 14 5 16 8 C18 5 20.5 3 23.5 3 C27 3 30 5.5 30 9.5 C30 15 26 20 16 28 Z"
|
|
2731
|
-
}, null, -1)])], 4)) : (0, vue.createCommentVNode)("", true),
|
|
2732
|
-
explosion.value?.isHeadshot ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
2733
|
-
key: 8,
|
|
2734
|
-
class: "fds-icon-headshot fixed m-0 pointer-events-none z-[100001] font-bold text-3xl whitespace-nowrap",
|
|
2735
|
-
style: (0, vue.normalizeStyle)({
|
|
2736
|
-
left: `${explosion.value.x}px`,
|
|
2737
|
-
top: `${explosion.value.y - 40}px`
|
|
2738
|
-
}),
|
|
2739
|
-
"aria-hidden": "true"
|
|
2740
|
-
}, (0, vue.toDisplayString)(headshotText.value), 5)) : (0, vue.createCommentVNode)("", true)
|
|
2741
|
-
]))
|
|
2742
|
-
], 16));
|
|
934
|
+
}, rootAttrs.value, { innerHTML: svgHtml.value }), null, 16, _hoisted_1$43);
|
|
2743
935
|
};
|
|
2744
936
|
}
|
|
2745
937
|
});
|
|
2746
938
|
//#endregion
|
|
2747
|
-
//#region \0plugin-vue:export-helper
|
|
2748
|
-
var _plugin_vue_export_helper_default = (sfc, props) => {
|
|
2749
|
-
const target = sfc.__vccOpts || sfc;
|
|
2750
|
-
for (const [key, val] of props) target[key] = val;
|
|
2751
|
-
return target;
|
|
2752
|
-
};
|
|
2753
|
-
//#endregion
|
|
2754
|
-
//#region src/components/FdsIcon/FdsIcon.vue
|
|
2755
|
-
var FdsIcon_default = /*#__PURE__*/ _plugin_vue_export_helper_default(FdsIcon_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-c54e429d"]]);
|
|
2756
|
-
//#endregion
|
|
2757
939
|
//#region src/components/Buttons/FdsButtonIcon/FdsButtonIcon.vue
|
|
2758
940
|
var FdsButtonIcon_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
2759
941
|
__name: "FdsButtonIcon",
|
|
@@ -13994,9 +12176,7 @@ var FdsExitModal_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
13994
12176
|
//#endregion
|
|
13995
12177
|
//#region src/components/FdsDrawer/FdsDrawer.vue?vue&type=script&setup=true&lang.ts
|
|
13996
12178
|
var _hoisted_1$21 = { class: "flex items-center gap-2 min-w-0" };
|
|
13997
|
-
|
|
13998
|
-
//#region src/components/FdsDrawer/FdsDrawer.vue
|
|
13999
|
-
var FdsDrawer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ (0, vue.defineComponent)({
|
|
12179
|
+
var FdsDrawer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0, vue.defineComponent)({
|
|
14000
12180
|
__name: "FdsDrawer",
|
|
14001
12181
|
props: {
|
|
14002
12182
|
open: {
|
|
@@ -14155,7 +12335,17 @@ var FdsDrawer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
|
|
|
14155
12335
|
})]);
|
|
14156
12336
|
};
|
|
14157
12337
|
}
|
|
14158
|
-
})
|
|
12338
|
+
});
|
|
12339
|
+
//#endregion
|
|
12340
|
+
//#region \0plugin-vue:export-helper
|
|
12341
|
+
var _plugin_vue_export_helper_default = (sfc, props) => {
|
|
12342
|
+
const target = sfc.__vccOpts || sfc;
|
|
12343
|
+
for (const [key, val] of props) target[key] = val;
|
|
12344
|
+
return target;
|
|
12345
|
+
};
|
|
12346
|
+
//#endregion
|
|
12347
|
+
//#region src/components/FdsDrawer/FdsDrawer.vue
|
|
12348
|
+
var FdsDrawer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(FdsDrawer_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-d72556a2"]]);
|
|
14159
12349
|
//#endregion
|
|
14160
12350
|
//#region src/helpers/debounce.ts
|
|
14161
12351
|
/**
|