From 87dbccc4461850ae85cfd7a8f58c15b312b9e4b4 Mon Sep 17 00:00:00 2001 From: Anthony Shaw Date: Fri, 7 Oct 2022 17:08:04 +1100 Subject: [PATCH] Recompile bundle --- media/main-bundle.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/media/main-bundle.js b/media/main-bundle.js index 4f02e8b3..f4424d6e 100644 --- a/media/main-bundle.js +++ b/media/main-bundle.js @@ -847,7 +847,7 @@ class BasePetType { this.currentStateEnum = this.sequence.startingState; this.currentState = (0, states_1.resolveState)(this.currentStateEnum, this); this._name = name; - this._speed = speed; // TODO #183 : Add a random modifier (+/- 30%) to this value. + this._speed = this.randomizeSpeed(speed); // Increment the static count of the Pet class that the constructor belongs to this.constructor.count += 1; } @@ -899,6 +899,12 @@ class BasePetType { speed() { return this._speed; } + randomizeSpeed(speed) { + const min = speed * 0.7; + const max = speed * 1.3; + const newSpeed = Math.random() * (max - min) + min; + return newSpeed; + } isMoving() { return this._speed !== 0 /* PetSpeed.still */; } @@ -1173,8 +1179,7 @@ class Cat extends BasePetType { return '🐱'; } hello() { - // TODO: #185 Add a custom message for cat - return ` says hello 👋!`; + return `brrr... Meow!`; } } exports.Cat = Cat;