New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Units are hostile or friendly #61
Comments
If you plan to support additional characters that are friendly, but not captive (for example, NPC shopkeepers) further down the road, I would suggest adding the |
Hello @froehlichA! Thanks for your interest in the project. Regarding this issue, my plan is to make the core as generic as possible. For that matter, being able to distinguish between hostile and friendly units is enough, leaving the semantics of what a captive is to the towers (some towers may not even define them). For the existing towers, for example, a captive is a unit that is friendly and is bound. With that in mind, do you think there's a benefit for preserving |
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? Personal Opinion: If 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 (like Concerning the An Example: //warrior-tower-community/units/Shopkeeper.js
const Shopkeeper = {
name: 'Shopkeeper',
character: '$',
maxHealth: 7,
friendly: true,
detectionFunction: 'isShopkeeper'
}
export default Shopkeeper; Warriorjs should then automatically expose the method With 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. TLDR: Generally, I agree with you that there should only be detection of alignment ( |
Currently, the two official warriorjs towers are
What I mean by "the core" is the
I like this idea, I think it's worth exploring. Would you mind submitting a new issue to discuss this? |
Units are "hostile" or "friendly", instead of "enemy" or "captive". This gives greater flexibility.
With this change:
hostile
parameter that defaults totrue
instead of the currentcaptive
parameter..isEnemy()
is removed in favor of a new and simplified method.isHostile()
..isHostile()
callsunit.isHostile()
(also new) under the hood..isHostile()
still returnsfalse
if the unit is bound..isCaptive()
is removed in favor of a new method.isFriendly()
.Docs and official levels tips like this one will need update as well.
UPDATE: Let's also pass a
bound
parameter that defaults tofalse
to the Unit's constructor, and set it totrue
in theCaptive
unit definition.The text was updated successfully, but these errors were encountered: