Comments (4)
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 .isFriendly()
next to the .isCaptive()
method, so that you have two super types: "hostile" and "friendly", and "captive" as a sub type of "friendly".
from warriorjs.
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 .isCaptive()
?
from warriorjs.
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 Archer
, Sludge
, or Wizard
) to the tower creators.
Concerning 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.
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 unit.isShopkeeper()
(or something similar) in their API.
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 (.isHostile()
and .isFriendly()
) in the core, but also leave definition of detection of unit types (.isCaptive()
, .isArcher()
, ...
) to the tower creators, and only expose those through the API.
from warriorjs.
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?
Currently, the two official warriorjs towers are beginner
and intermediate
. As both shared units, abilities and effects, I decided to create separate packages for them. That allowed me to reuse code in both towers, and also allows other tower makers to use them if they want.
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 Archer, Sludge, or Wizard) to the tower creators.
What I mean by "the core" is the @warriorjs/core
package, not all the packages inside this repo. With that definition, the core is already agnostic to unit types, abilities and effects. Those are left entirely to tower makers.
(...) tower creators should then be able to define the appropiate methods on the units themselves instead.
I like this idea, I think it's worth exploring. Would you mind submitting a new issue to discuss this?
from warriorjs.
Related Issues (20)
- How to contribute towers? HOT 1
- Any plans on i18n? HOT 1
- Documentation links are broken in many places HOT 1
- access to newer abilities in previous levels HOT 3
- Connect WarriorJS CLI with warriorjs.com HOT 2
- Add ability to get warrior's max health HOT 3
- brief description on each release HOT 3
- @warriorjs/tower-tick-tick-boom warrior haven't got the "pivot" ability and bashing 'backward' forcedly
- Should the warrior receive more damage when attacked from behind? HOT 1
- Add retro sounds HOT 2
- translate Korean HOT 2
- Korean Translation HOT 3
- Can't access functions from a Unit object
- Watch for Player.js changes and run
- I cannot sign in or create an account for the online platform HOT 2
- When I 'Run' the game after defeated, the state isn't refreshed unless I reload the page for several times HOT 1
- rescue('backward') is undefined HOT 3
- This code is wierdly running HOT 4
- where did constructor() come from and what is it? How does it work and what does it mean? I'm not able to learn anything here HOT 1
- Error: No files matching the pattern "packages/**/src" were found
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from warriorjs.