olistic / warriorjs

🏰 An exciting game of programming and Artificial Intelligence
https://warriorjs.com
MIT License
9.43k stars 490 forks source link

Units are hostile or friendly #101

Closed xFloki closed 6 years ago

xFloki commented 6 years ago

Fixes #61

Changes

Unit's constructor recieves a hostile parameter by default true, instead of the previous captive. Added two Space new methods .isHostile() and .isFriendly() Also two Unit new methods unit.isHostile and unit.isFriendly() New tests for these methods have been added Docs and official level tips have been updated.

Is this what you were thinking of ? Hope is not that far , btw this is my first contribution to an Open Project thanks for all the work! 👍

codecov-io commented 6 years ago

Codecov Report

Merging #101 into master will increase coverage by 0.01%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #101      +/-   ##
==========================================
+ Coverage   90.83%   90.85%   +0.01%     
==========================================
  Files          80       80              
  Lines        1015     1017       +2     
  Branches      159      158       -1     
==========================================
+ Hits          922      924       +2     
  Misses         77       77              
  Partials       16       16
Impacted Files Coverage Δ
packages/warriorjs-units/src/Captive.js 100% <ø> (ø) :arrow_up:
packages/warriorjs-abilities/src/rescue.js 100% <100%> (ø) :arrow_up:
packages/warriorjs-core/src/Unit.js 100% <100%> (ø) :arrow_up:
packages/warriorjs-core/src/LevelLoader.js 91.3% <100%> (ø) :arrow_up:
packages/warriorjs-core/src/Space.js 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update fbc5c10...e474e2e. Read the comment docs.

xFloki commented 6 years ago

Hello @olistic thanks for taking the time to review the code. I've made all the changes you requested except one, in which i've answered with a question about it.

olistic commented 6 years ago

Hey @xFloki, thanks for making the changes. I answered your question: in summary, we want all occurrences of isCaptive and isEnemy to be gone in favor of isFriendly and isHostile with a few modifications where it’s needed (everything that’s in the comments).

olistic commented 6 years ago

And also, the branch needs to be rebased (or updated) against master as changes have been made to it since this PR was opened. Thanks!