nskins / goby

Command-line role-playing game framework
MIT License
122 stars 56 forks source link

Abstract Battle method to Entity class #91

Closed sunny-b closed 6 years ago

sunny-b commented 7 years ago

Abstracted the battle method to the Entity class. I also changed all the "monster" variables into "opponent" since you mentioned you wanted Players to be able to battle Players. I also added "opponent.hp > 0" to the first while loop to remove some repeated code later in the loop.

I'm not sure why those spaces were added and removed in the battle_command.rb and monster.rb files, I think it has something to do with my text editor. Doesn't affect the files though. And all tests pass.

Let me know if I should change anything more.

Addresses #42

nskins commented 7 years ago

Hey @sunny-b, thank you for contributing! I will be looking over this once I have some time.

nskins commented 7 years ago

Hi @sunny-b. I am sorry to say that the battle system is not currently covered by any tests. For this reason, it is difficult to say with certainty if the implementation produces correct behavior for Player vs. Monster (we would also need Player vs. Player and Monster vs. Monster tests, which I may ask you to write later). I am currently working on refactoring the codebase, and I will attempt to address this outstanding issue, which may provide some straightforward boilerplate code for the new PvP and MvM tests. Thanks!

sunny-b commented 7 years ago

No worries. I'll look into writing some tests if I have the time. Just hoping to help out, I like this library a lot.