{"action":"created","issue":{"url":"https://api.github.com/repos/olistic/warriorjs/issues/61","repository_url":"https://api.github.com/repos/olistic/warriorjs","labels_url":"https://api.github.com/repos/olistic/warriorjs/issues/61/labels{/name}","comments_url":"https://api.github.com/repos/olistic/warriorjs/issues/61/comments","events_url":"https://api.github.com/repos/olistic/warriorjs/issues/61/events","html_url":"https://github.com/olistic/warriorjs/issues/61","id":321288339,"number":61,"title":"Units are hostile or friendly","user":{"login":"olistic","id":5600126,"avatar_url":"https://avatars1.githubusercontent.com/u/5600126?v=4","gravatar_id":"","url":"https://api.github.com/users/olistic","html_url":"https://github.com/olistic","followers_url":"https://api.github.com/users/olistic/followers","following_url":"https://api.github.com/users/olistic/following{/other_user}","gists_url":"https://api.github.com/users/olistic/gists{/gist_id}","starred_url":"https://api.github.com/users/olistic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olistic/subscriptions","organizations_url":"https://api.github.com/users/olistic/orgs","repos_url":"https://api.github.com/users/olistic/repos","events_url":"https://api.github.com/users/olistic/events{/privacy}","received_events_url":"https://api.github.com/users/olistic/received_events","type":"User","site_admin":false},"labels":[{"id":922010764,"url":"https://api.github.com/repos/olistic/warriorjs/labels/area:%20player%20api","name":"area: player api","color":"FFFCE3","default":false},{"id":921999994,"url":"https://api.github.com/repos/olistic/warriorjs/labels/good%20first%20issue","name":"good first issue","color":"DAB2C4","default":true},{"id":922002561,"url":"https://api.github.com/repos/olistic/warriorjs/labels/pkg:%20abilities","name":"pkg: abilities","color":"B2DAB3","default":false},{"id":922001826,"url":"https://api.github.com/repos/olistic/warriorjs/labels/pkg:%20core","name":"pkg: core","color":"B2DAB3","default":false},{"id":922002788,"url":"https://api.github.com/repos/olistic/warriorjs/labels/pkg:%20units","name":"pkg: units","color":"B2DAB3","default":false},{"id":922034956,"url":"https://api.github.com/repos/olistic/warriorjs/labels/type:%20enhancement","name":"type: enhancement","color":"C9F7FF","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-05-08T18:03:49Z","updated_at":"2018-05-14T16:44:10Z","closed_at":null,"author_association":"OWNER","body":"Units are \"hostile\" or \"friendly\", instead of \"enemy\" or \"captive\". This gives greater flexibility.\r\n\r\nWith this change:\r\n\r\n* Units' constructor receives a `hostile` parameter that defaults to `true` instead of the [current `captive` parameter](https://github.com/olistic/warriorjs/blob/6b90d0629e563ea664e822acf3914353c99c5a7c/packages/warriorjs-core/src/Unit.js#L18).\r\n* [Space's `.isEnemy()`](https://github.com/olistic/warriorjs/blob/master/packages/warriorjs-core/src/Space.js#L60-L67) is deprecated in favor of a new and simplified method `.isHostile()`.\r\n  * `.isHostile()` calls `unit.isHostile()` (also new) under the hood.\r\n  * `.isHostile()` still returns `false` if the unit is bound.\r\n* [Space's `.isCaptive()`](https://github.com/olistic/warriorjs/blob/master/packages/warriorjs-core/src/Space.js#L95-L98) is deprecated in favor of a new method `.isFriendly()`.\r\n* The rescue ability should [check if the receiver is friendly, instead of captive](https://github.com/olistic/warriorjs/blob/6b90d0629e563ea664e822acf3914353c99c5a7c/packages/warriorjs-abilities/src/rescue.js#L15).\r\n\r\nDocs and official levels tips like [this one](https://github.com/olistic/warriorjs/blob/master/packages/warriorjs-tower-beginner/src/index.js#L219) will need update as well."},"comment":{"url":"https://api.github.com/repos/olistic/warriorjs/issues/comments/388884025","html_url":"https://github.com/olistic/warriorjs/issues/61#issuecomment-388884025","issue_url":"https://api.github.com/repos/olistic/warriorjs/issues/61","id":388884025,"user":{"login":"froehlichA","id":25703146,"avatar_url":"https://avatars1.githubusercontent.com/u/25703146?v=4","gravatar_id":"","url":"https://api.github.com/users/froehlichA","html_url":"https://github.com/froehlichA","followers_url":"https://api.github.com/users/froehlichA/followers","following_url":"https://api.github.com/users/froehlichA/following{/other_user}","gists_url":"https://api.github.com/users/froehlichA/gists{/gist_id}","starred_url":"https://api.github.com/users/froehlichA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/froehlichA/subscriptions","organizations_url":"https://api.github.com/users/froehlichA/orgs","repos_url":"https://api.github.com/users/froehlichA/repos","events_url":"https://api.github.com/users/froehlichA/events{/privacy}","received_events_url":"https://api.github.com/users/froehlichA/received_events","type":"User","site_admin":false},"created_at":"2018-05-14T16:44:10Z","updated_at":"2018-05-14T16:44:10Z","author_association":"NONE","body":"Currenty, the beginner tower uses the units imported from warriorjs/units. Why are these units defined in this seperate package, and not in the beginner tower source? Are they there for other tower creators to expand upon?\r\n\r\nIf you want to make the core as generic as possible, I would just put basic unit types, that provide a basis to build upon, in the @warriorjs/units package and leave the rest to the tower creators (like ``Archer``, ``Sludge``, or ``Wizard``).\r\n\r\nConcerning the ``.isCaptive()`` method, my personal opinion is that the ``.isCaptive()`` should be removed from the Space API and replaced with the ``.isFriendly()`` method, like you mentioned, but that tower creators should then be able to define the appropiate methods on the units themselves instead.\r\n\r\nAn Example:\r\n```js\r\n//warrior-tower-community/index.js\r\nconst Shopkeeper = {\r\n  name: 'Shopkeeper',\r\n  character: '$',\r\n  maxHealth: 7,\r\n  friendly: true,\r\n  detectionName: 'isShopkeeper'\r\n}\r\n```\r\n_Warriorjs should then automatically expose the method `unit.isShopkeeper()` (or something similar) in their API._\r\n\r\nWith this principle, the tower creators themselves would be able to give players the possibility to check if an unit is a specific unit type or not, because players may want to take different actions if a unit is a friendly shopkeeper, a friendly captive or another friendly unit.\r\n\r\nTLDR: Generally, I agree with you that there should only be detection of alignment (``.isHostile()`` and ``.isFriendly()``) in the core, but also leave detection of unit types (``.isCaptive()``, ``.isArcher()``, ``...``) to the tower creators."}}
{"actor":{"display_login":"froehlichA"}}