- 8个Boss全部重做:主攻击模式+1~2种随机小攻击+二/三阶段变形动画 - 新增5个雷霆战机参考Boss:太空原种/暗黑突击/激光钢琴/夺权者X/暗黑魔碟 - 多管血条(蓝/红/橙)+锁血转场+入场不掉血(b.y<b.ty-1免疫) - 签名技能:花弹成长/高机动瞄准弹/21键4模式激光/银钉无人机+巨宽激光压制/锥形弹环+眼激光 - 所有激光发射点跟随Boss移动(bossBeam src机制) - Boss挑战模式:随机装备3主武Lv3+3副武Lv3+2僚机Lv2,可选老虎机抽奖动画 - rush模式Boss血量x10,击破计时存档 - 武器修正:黎明重炮近炸引信26px/死光伤害x2/椭圆判定bossHit等
52 lines
2.5 KiB
JavaScript
52 lines
2.5 KiB
JavaScript
"use strict";
|
||
/* ================================================================
|
||
星尘突击队 STAR RAID —— 像素肉鸽竖版射击
|
||
单文件实现:像素引擎 / 程序化音频 / 双模式 / 局内外成长
|
||
================================================================ */
|
||
|
||
/* ---------------- 工具 ---------------- */
|
||
const $=id=>document.getElementById(id);
|
||
const clamp=(v,a,b)=>v<a?a:v>b?b:v;
|
||
const lerp=(a,b,t)=>a+(b-a)*t;
|
||
const rnd=(a=1,b)=>b===undefined?Math.random()*a:a+Math.random()*(b-a);
|
||
const rndi=(a,b)=>Math.floor(rnd(a,b+1));
|
||
const pick=arr=>arr[Math.floor(Math.random()*arr.length)];
|
||
const TAU=Math.PI*2;
|
||
function shuffle(a){for(let i=a.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));[a[i],a[j]]=[a[j],a[i]];}return a;}
|
||
const dist2=(ax,ay,bx,by)=>{const dx=ax-bx,dy=ay-by;return dx*dx+dy*dy;};
|
||
|
||
/* ---------------- 存档 ---------------- */
|
||
const SAVE_KEY="starraid_v1";
|
||
let SAVE;
|
||
function loadSave(){
|
||
try{SAVE=JSON.parse(localStorage.getItem(SAVE_KEY))||null;}catch(e){SAVE=null;}
|
||
if(!SAVE) SAVE={coins:0, m:{}, ships:["falcon"], best:{s0:0,s1:0,e0:0,e1:0,stage:0}, mute:false, music:true};
|
||
SAVE.m=SAVE.m||{}; SAVE.ships=SAVE.ships||["falcon"]; SAVE.best=SAVE.best||{s0:0,s1:0,e0:0,e1:0,stage:0};
|
||
SAVE.codex=SAVE.codex||{};
|
||
}
|
||
function persist(){try{localStorage.setItem(SAVE_KEY,JSON.stringify(SAVE));}catch(e){}}
|
||
loadSave();
|
||
|
||
/* ---------------- 平衡数值总表 ----------------
|
||
所有概率与成长曲线集中于此,方便调平衡 */
|
||
const BAL={
|
||
player:{ speed:2.35, lives:3, hp:100, bombs:2, hitR:3, grazeR:14, focusMul:0.5,
|
||
fireInt:8, dmg:6, bulletSpd:5.4, critC:0.05, critM:2.5, magnetR:36 },
|
||
// 稀有度权重 [普通,稀有,史诗],每点幸运: 稀有+2 史诗+1.5
|
||
rarity:[62,28,10],
|
||
xpNeed:l=>Math.round(4+l*2.5+Math.pow(l,1.5)), // 升级所需经验(下调,保证每波≈1级)
|
||
// 波次缩放(n 从 0 起):平缓曲线,匹配玩家成长
|
||
hpMul: n=>1+0.10*n+0.012*Math.pow(n,1.5),
|
||
spdMul:n=>Math.max(0.6,1-0.015*n), // 血量越高波次,移动越慢
|
||
fireMul:n=>Math.min(1.3,1+0.012*n),
|
||
eliteC:n=>Math.min(0.16,0.03+n*0.006), // 精英出现率
|
||
coinDrop:0.5, // 普通敌掉币率
|
||
scoreCombo:k=>Math.min(3,1+k*0.02), // 连击倍率上限 x3
|
||
odGain:{kill:2.6,graze:2.2},
|
||
coinGlobal:4, // 全局金币倍率
|
||
bombDmg:80,
|
||
reviveInv:160,
|
||
hard:{hp:1.35,fire:1.3,coin:1.5}, // 困难修正
|
||
};
|
||
|