adjust Clown Void event from 10min to 8min duration and make it 10%

slower
This commit is contained in:
HF 2022-04-26 13:10:34 +02:00
parent 88e33a4ff6
commit 7c2e62efc2
2 changed files with 13 additions and 17 deletions

View File

@ -25,12 +25,12 @@ import chatProvider from './ChatProvider';
import canvases from './canvases.json'; import canvases from './canvases.json';
// steps in minutes for event stages // steps in minutes for event stages
const STEPS = [30, 10, 2, 1, 0, -10, -15, -40, -60]; // STEPS[5] is event duration, adjusted from 10 to 8 on 2022.04.26
const STEPS = [30, 10, 2, 1, 0, -8, -15, -40, -60];
// const STEPS = [4, 3, 2, 1, 0, -1, -2, -3, -4]; // const STEPS = [4, 3, 2, 1, 0, -1, -2, -3, -4];
// gap between events in min, starting 1h after last event // gap between events in min, starting 1h after last event
// so 60 is a 2h gap, has to be higher than first and highest STEP numbers // so 60 is a 2h gap, has to be higher than first and highest STEP numbers
const EVENT_GAP_MIN = 60; const EVENT_GAP_MIN = 60;
// const EVENT_GAP_MIN = 5;
/* /*
* draw cross in center of chunk * draw cross in center of chunk
@ -277,7 +277,9 @@ class RpgEvent {
RpgEvent.broadcastChatMessage( RpgEvent.broadcastChatMessage(
'Fight starting!', 'Fight starting!',
); );
this.void = new Void(this.eventCenterC); // run event for 8min
const targetDuration = STEPS[5] * -1;
this.void = new Void(this.eventCenterC, targetDuration);
this.eventState = 11; this.eventState = 11;
} else if (this.void) { } else if (this.void) {
const percent = this.void.checkStatus(); const percent = this.void.checkStatus();
@ -301,11 +303,9 @@ class RpgEvent {
} }
} }
} }
// run event for 10min
setTimeout(this.runEventLoop, 1000); setTimeout(this.runEventLoop, 1000);
} else if (eventMinutes > STEPS[6]) { } else if (eventMinutes > STEPS[6]) {
if (eventState !== 12) { if (eventState !== 12) {
// after 10min of event
// check if won // check if won
if (this.void) { if (this.void) {
if (this.void.checkStatus() !== 100) { if (this.void.checkStatus() !== 100) {
@ -321,12 +321,10 @@ class RpgEvent {
} }
this.eventState = 12; this.eventState = 12;
} }
// for 30min after event
// do nothing
setTimeout(this.runEventLoop, 60000); setTimeout(this.runEventLoop, 60000);
} else if (eventMinutes > STEPS[7]) { } else if (eventMinutes > STEPS[7]) {
if (eventState !== 13) { if (eventState !== 13) {
// 5min after last Event // 7min after last Event
// end debuff if lost // end debuff if lost
if (this.success === 2) { if (this.success === 2) {
RpgEvent.broadcastChatMessage( RpgEvent.broadcastChatMessage(
@ -339,7 +337,7 @@ class RpgEvent {
setTimeout(this.runEventLoop, 60000); setTimeout(this.runEventLoop, 60000);
} else if (eventMinutes > STEPS[8]) { } else if (eventMinutes > STEPS[8]) {
if (eventState !== 14) { if (eventState !== 14) {
// 30min after last Event // 32min after last Event
// clear old event area // clear old event area
// reset success state // reset success state
logger.info('Restoring old event area'); logger.info('Restoring old event area');
@ -352,11 +350,11 @@ class RpgEvent {
} }
this.eventState = 14; this.eventState = 14;
} }
// 30min to 50min after last Event // 32min to 52min after last Event
// do nothing // do nothing
setTimeout(this.runEventLoop, 60000); setTimeout(this.runEventLoop, 60000);
} else { } else {
// 50min after last Event / 1h before next Event // 52min after last Event / 1h before next Event
// define and protect it // define and protect it
this.eventTimestamp = await RpgEvent.setNextEvent(); this.eventTimestamp = await RpgEvent.setNextEvent();
await this.calcEventCenter(); await this.calcEventCenter();

View File

@ -14,8 +14,6 @@ import { CANVAS_ID } from '../data/models/Event';
import canvases from './canvases.json'; import canvases from './canvases.json';
const TARGET_RADIUS = 62; const TARGET_RADIUS = 62;
const EVENT_DURATION_MIN = 10;
// const EVENT_DURATION_MIN = 1;
class Void { class Void {
// chunk coords // chunk coords
@ -37,7 +35,7 @@ class Void {
// boolean if ended // boolean if ended
ended; ended;
constructor(centerCell) { constructor(centerCell, targetDuration) {
// chunk coordinates // chunk coordinates
const [i, j] = centerCell; const [i, j] = centerCell;
this.i = i; this.i = i;
@ -46,9 +44,9 @@ class Void {
this.maxClr = canvases[CANVAS_ID].colors.length; this.maxClr = canvases[CANVAS_ID].colors.length;
const area = TARGET_RADIUS ** 2 * Math.PI; const area = TARGET_RADIUS ** 2 * Math.PI;
const online = socketEvents.onlineCounter.total || 0; const online = socketEvents.onlineCounter.total || 0;
// require an average of 0.25 px / min / user // adjusted from 1.8 to 2.0 on 2022.04.26
const requiredSpeed = Math.floor(online / 1.8); const requiredSpeed = Math.floor(online / 2.0);
const ppm = Math.ceil(area / EVENT_DURATION_MIN + requiredSpeed); const ppm = Math.ceil(area / targetDuration + requiredSpeed);
this.msTimeout = 60 * 1000 / ppm; this.msTimeout = 60 * 1000 / ppm;
this.area = new Uint8Array(TILE_SIZE * 3 * TILE_SIZE * 3); this.area = new Uint8Array(TILE_SIZE * 3 * TILE_SIZE * 3);
this.userArea = new Uint8Array(TILE_SIZE * 3 * TILE_SIZE * 3); this.userArea = new Uint8Array(TILE_SIZE * 3 * TILE_SIZE * 3);