mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-22 13:06:15 -04:00
Build 29087244
This commit is contained in:
parent
5ba93500b4
commit
49f3769b54
21 changed files with 2505 additions and 2517 deletions
|
@ -1,6 +1,4 @@
|
|||
import { getSettingValue } from "./settings";
|
||||
import {GameState} from "./types";
|
||||
import {ballTransparency} from "./game_utils";
|
||||
import { Ball, GameState } from "./types";
|
||||
|
||||
export function clamp(value: number, min: number, max: number) {
|
||||
return Math.max(min, Math.min(value, max));
|
||||
|
@ -10,33 +8,39 @@ export function comboKeepingRate(level: number) {
|
|||
return clamp(1 - (1 / (1 + level)) * 1.5, 0, 1);
|
||||
}
|
||||
|
||||
export function hoursSpentPlaying() {
|
||||
try {
|
||||
const timePlayed = getSettingValue("breakout_71_total_play_time", 0);
|
||||
return Math.floor(timePlayed / 1000 / 60 / 60);
|
||||
} catch (e) {
|
||||
return 0;
|
||||
}
|
||||
export function shouldCoinsStick(gameState: GameState) {
|
||||
return (
|
||||
gameState.perks.sticky_coins &&
|
||||
(!gameState.lastExplosion ||
|
||||
gameState.lastExplosion <
|
||||
gameState.levelTime - 300 * gameState.perks.sticky_coins)
|
||||
);
|
||||
}
|
||||
|
||||
export function shouldCoinsStick(gameState:GameState){
|
||||
return gameState.perks.sticky_coins && (!gameState.lastExplosion || gameState.lastExplosion < gameState.levelTime - 300 * gameState.perks.sticky_coins)
|
||||
export function ballTransparency(ball: Ball, gameState: GameState) {
|
||||
if (!gameState.perks.transparency) return 0;
|
||||
return clamp(
|
||||
gameState.perks.transparency *
|
||||
(1 - (ball.y / gameState.gameZoneHeight) * 1.2),
|
||||
0,
|
||||
1,
|
||||
);
|
||||
}
|
||||
|
||||
export function coinsBoostedCombo(gameState:GameState){
|
||||
let boost = 1+gameState.perks.sturdy_bricks / 2 + gameState.perks.smaller_puck/2
|
||||
if(gameState.perks.transparency){
|
||||
let min=1;
|
||||
gameState.balls.forEach(ball=>{
|
||||
const bt=ballTransparency(ball, gameState)
|
||||
if(bt<min){
|
||||
min=bt
|
||||
export function coinsBoostedCombo(gameState: GameState) {
|
||||
let boost =
|
||||
1 + gameState.perks.sturdy_bricks / 2 + gameState.perks.smaller_puck / 2;
|
||||
if (gameState.perks.transparency) {
|
||||
let min = 1;
|
||||
gameState.balls.forEach((ball) => {
|
||||
const bt = ballTransparency(ball, gameState);
|
||||
if (bt < min) {
|
||||
min = bt;
|
||||
}
|
||||
})
|
||||
boost+=min*gameState.perks.transparency / 2
|
||||
});
|
||||
boost += (min * gameState.perks.transparency) / 2;
|
||||
}
|
||||
return Math.ceil(Math.max(gameState.combo,gameState.lastCombo) * boost)
|
||||
|
||||
return Math.ceil(Math.max(gameState.combo, gameState.lastCombo) * boost);
|
||||
}
|
||||
|
||||
export function miniMarkDown(md: string) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue