CREATORJD commited on
Commit
a8ea5c4
·
verified ·
1 Parent(s): 5ade793

1.33.14 ground + destructible skyline

Browse files
Files changed (1) hide show
  1. src/game/sim.js +26 -6
src/game/sim.js CHANGED
@@ -2436,11 +2436,14 @@ function setupRelics(){
2436
  srand((def.seed^0x51EF)|1);
2437
  for(const P of cityPlan){
2438
  const s=Math.max(P.w,P.h), k=P.kind;
2439
- const hp=k===2?1500 : k===0?1150 : k===3?520 : 780;
 
 
 
2440
  relics.push({x:P.x,y:P.y,w:P.w,h:P.h,s,a:P.a,kind:k,zone:P.zone,
2441
  hp,hpm:hp,alive:true,
2442
- salv:Math.round(s*(k===2?2.4 : k===0?1.7 : k===3?1.2 : 1.25)),
2443
- salvE:Math.round(s*(k===2?2.0 : k===3?2.6 : 0.5)),
2444
  lean:0, burn:0, seed:(P.x*7+P.y*13)|0});
2445
  }
2446
  // loot scattered through every district
@@ -2532,6 +2535,23 @@ function damageRelic(R,dmg,byTeam){
2532
  R.burn=Math.min(1,(R.burn||0)+0.06);
2533
  R.lean=Math.min(0.13,(R.lean||0)+0.004);
2534
  R.hitT=0.25;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2535
  if(R.hp<=0) collapseBlock(R,byTeam);
2536
  }
2537
  let razeTip=0;
@@ -2543,15 +2563,15 @@ function collapseBlock(R,byTeam){
2543
  addCrater(R.x,R.y,R.s*1.05);
2544
  /* A tower block coming down displaces real ground — that's the biggest
2545
  single deformation event in the game outside a NOVA strike. */
2546
- deformTerrain(R.x,R.y,R.s*1.25, R.kind===0?0.070:0.045);
2547
- shake=Math.max(shake, R.kind===0?7:4);
2548
  for(let k=0;k<14;k++)
2549
  addParticle(1,R.x+rr(-R.w*0.4,R.w*0.4),R.y+rr(-R.h*0.35,R.h*0.35),rr(-22,22),rr(-30,-6),1.9,R.s*0.32, 120,118,112);
2550
  addParticle(2,R.x,R.y,0,0,1.5,R.s*1.4, 150,144,132); // dust bloom
2551
  /* THE PAYOUT. Levelling a derelict is an economic act: it dumps a wide field
2552
  of salvage on the ground for whoever holds the rubble afterwards. Nobody
2553
  "owns" it — it goes to whichever side has units standing there. */
2554
- addWreckField(R.x,R.y, R.salv, R.salvE, 2, R.s*0.85, R.kind===2?5:3);
2555
  if(R.kind===3){ // tank farm: goes up loudly
2556
  const RR2=R.s*3.4, DMG=380;
2557
  forUnitsIn(R.x,R.y,RR2,j=>{
 
2436
  srand((def.seed^0x51EF)|1);
2437
  for(const P of cityPlan){
2438
  const s=Math.max(P.w,P.h), k=P.kind;
2439
+ /* A 330-unit skyscraper cannot share a low block's health bar. It is the
2440
+ toughest thing on the map and it comes down in two stages, so half of
2441
+ this pool buys the shear and half buys the ground. */
2442
+ const hp=k===5?4200 : k===2?1500 : k===0?1150 : k===3?520 : 780;
2443
  relics.push({x:P.x,y:P.y,w:P.w,h:P.h,s,a:P.a,kind:k,zone:P.zone,
2444
  hp,hpm:hp,alive:true,
2445
+ salv:Math.round(s*(k===5?4.2 : k===2?2.4 : k===0?1.7 : k===3?1.2 : 1.25)),
2446
+ salvE:Math.round(s*(k===5?3.0 : k===2?2.0 : k===3?2.6 : 0.5)),
2447
  lean:0, burn:0, seed:(P.x*7+P.y*13)|0});
2448
  }
2449
  // loot scattered through every district
 
2535
  R.burn=Math.min(1,(R.burn||0)+0.06);
2536
  R.lean=Math.min(0.13,(R.lean||0)+0.004);
2537
  R.hitT=0.25;
2538
+ /* STAGED COLLAPSE. A skyscraper that vanished the instant its bar emptied
2539
+ was the least believable destruction in the game. At half health the top
2540
+ two thirds shear off as a real event — dust, debris, ground displacement,
2541
+ a salvage dividend — and the stump keeps fighting for the other half. */
2542
+ if(R.kind===5&&!R.part&&R.hp<=R.hpm*0.5&&R.hp>0){
2543
+ R.part=1; R.lean=0;
2544
+ spawnExplosion(R.x,R.y,R.s*0.62,1);
2545
+ addRubble(R.x,R.y,R.s*0.72);
2546
+ deformTerrain(R.x,R.y,R.s*0.95,0.030);
2547
+ shake=Math.max(shake,6);
2548
+ for(let k=0;k<18;k++)
2549
+ addParticle(1,R.x+rr(-R.w*0.5,R.w*0.5),R.y+rr(-R.h*0.5,R.h*0.5),rr(-34,34),rr(-40,-8),2.3,R.s*0.38, 122,120,114);
2550
+ addParticle(2,R.x,R.y,0,0,2.0,R.s*1.9, 152,146,134);
2551
+ addWreckField(R.x,R.y, Math.round(R.salv*0.42), Math.round(R.salvE*0.42), 2, R.s*0.9, 4);
2552
+ sfx('boom',R.x,R.y,1.7);
2553
+ if(byTeam===0) heroXP(10);
2554
+ }
2555
  if(R.hp<=0) collapseBlock(R,byTeam);
2556
  }
2557
  let razeTip=0;
 
2563
  addCrater(R.x,R.y,R.s*1.05);
2564
  /* A tower block coming down displaces real ground — that's the biggest
2565
  single deformation event in the game outside a NOVA strike. */
2566
+ deformTerrain(R.x,R.y,R.s*(R.kind===5?1.85:1.25), R.kind===5?0.105:R.kind===0?0.070:0.045);
2567
+ shake=Math.max(shake, R.kind===5?11:R.kind===0?7:4);
2568
  for(let k=0;k<14;k++)
2569
  addParticle(1,R.x+rr(-R.w*0.4,R.w*0.4),R.y+rr(-R.h*0.35,R.h*0.35),rr(-22,22),rr(-30,-6),1.9,R.s*0.32, 120,118,112);
2570
  addParticle(2,R.x,R.y,0,0,1.5,R.s*1.4, 150,144,132); // dust bloom
2571
  /* THE PAYOUT. Levelling a derelict is an economic act: it dumps a wide field
2572
  of salvage on the ground for whoever holds the rubble afterwards. Nobody
2573
  "owns" it — it goes to whichever side has units standing there. */
2574
+ addWreckField(R.x,R.y, R.salv, R.salvE, 2, R.s*(R.kind===5?1.35:0.85), R.kind===5?7:R.kind===2?5:3);
2575
  if(R.kind===3){ // tank farm: goes up loudly
2576
  const RR2=R.s*3.4, DMG=380;
2577
  forUnitsIn(R.x,R.y,RR2,j=>{