From: xangelo Date: Thu, 27 Jul 2023 16:53:11 +0000 (-0400) Subject: fix: only run into monsters 20% of the time X-Git-Tag: v0.2.1~1 X-Git-Url: https://git.xangelo.ca/?a=commitdiff_plain;h=84c3282a1f467759abc4e076f775261c12df92cb;p=risinglegends.git fix: only run into monsters 20% of the time --- diff --git a/src/events/travel/server.ts b/src/events/travel/server.ts index b7c3b42..8fc6300 100644 --- a/src/events/travel/server.ts +++ b/src/events/travel/server.ts @@ -4,6 +4,8 @@ import {SocketEvent} from "../../server/socket-event.server"; import { sample, random } from 'lodash'; import { createFight, getRandomMonster, loadMonster } from "../../server/monster"; +const MONSTER_ENCOUNTER_CHANCE = 30; + export const explore: SocketEvent = { eventName: 'city:travel', handler: async (api, data: { args: string }) => { @@ -88,9 +90,8 @@ export const nextStep: SocketEvent = { // @TODO send back monsters const chanceToSeeMonster = random(0, 100); - // 20% chance to see monster const things: any[] = []; - if(chanceToSeeMonster < 20 || true) { + if(chanceToSeeMonster < MONSTER_ENCOUNTER_CHANCE) { const monster = await getRandomMonster([closest]); things.push(monster); }