+
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions server/src/data/gasStages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ export interface GasStage {
*/
export const GAME_SPAWN_WINDOW = 84;

type GasOffset = {
minOffset: number
maxOffset: number
};

export const gasOffset: GasOffset = {
minOffset: 0.15,
maxOffset: 0.3
}

const gasStageRadii: number[] = [
0.76, // 0
0.55, // 1
Expand Down
10 changes: 4 additions & 6 deletions server/src/gas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Geometry, Numeric } from "@common/utils/math";
import { randomPointInsideCircle } from "@common/utils/random";
import { Vec, type Vector } from "@common/utils/vector";
import { Config, GasMode } from "./config";
import { GasStage, GasStages } from "./data/gasStages";
import { GasStage, GasStages, gasOffset } from "./data/gasStages";
import { type Game } from "./game";

export class Gas {
Expand All @@ -13,15 +13,13 @@ export class Gas {
currentDuration = 0;
countdownStart = 0;
completionRatio = 0;

oldPosition: Vector;
newPosition: Vector;
currentPosition: Vector;

oldRadius: number;
newRadius: number;
currentRadius: number;

dps = 0;
private _lastDamageTimestamp;

Expand All @@ -43,7 +41,7 @@ export class Gas {
this.newRadius = firstStage.newRadius * this.mapSize;
this.currentRadius = firstStage.oldRadius * this.mapSize;

this.oldPosition = Vec.create(game.map.width / 2, game.map.height / 2);
this.oldPosition = Vec.create((game.map.width / 2), (game.map.height / 2));
this.newPosition = Vec.clone(this.oldPosition);
this.currentPosition = Vec.clone(this.oldPosition);
this._lastDamageTimestamp = this.game.now;
Expand Down Expand Up @@ -90,7 +88,6 @@ export class Gas {
this.currentDuration = duration;
this.completionRatio = 1;
this.countdownStart = this.game.now;

if (currentStage.state === GasState.Waiting) {
this.oldPosition = Vec.clone(this.newPosition);
if (currentStage.newRadius !== 0) {
Expand All @@ -101,7 +98,8 @@ export class Gas {
const { oldRadius, newRadius } = currentStage;
const { x, y } = randomPointInsideCircle(
this.oldPosition,
(oldRadius - newRadius) * this.mapSize
gasOffset.maxOffset * this.mapSize,
gasOffset.minOffset * this.mapSize
);
const radius = newRadius * 0.75; // ensure at least 75% of the safe zone will be inside map bounds
this.newPosition = Vec.create(
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载