Skip to content

Commit

Permalink
updated the check
Browse files Browse the repository at this point in the history
  • Loading branch information
Varvara00 committed Dec 29, 2024
1 parent ffae0d4 commit 72b9192
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/herbivoresAndCarnivores.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 72b9192

Please sign in to comment.