From 72b9192aa92291a8182816a5af41b8c5f97b35b6 Mon Sep 17 00:00:00 2001 From: Varvara00 Date: Sun, 29 Dec 2024 14:35:31 +0100 Subject: [PATCH] updated the check --- src/herbivoresAndCarnivores.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/herbivoresAndCarnivores.js b/src/herbivoresAndCarnivores.js index a30fc0bb..b1420086 100644 --- a/src/herbivoresAndCarnivores.js +++ b/src/herbivoresAndCarnivores.js @@ -39,7 +39,7 @@ class Herbivore extends Animal { class Carnivore extends Animal { bite(prey) { - if (prey.hidden === false) { + if (prey instanceof Herbivore && !prey.hidden) { prey.takeDamage(50); } }