-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add Alteration effects and Impulse based weapons support #43
base: develop
Are you sure you want to change the base?
Conversation
@@ -10,17 +25,22 @@ | |||
* <p> | |||
* {@link HurtEvent} is used to hurt other entity/entities. | |||
*/ | |||
public class HurtingComponent implements Component{ | |||
public class HurtingComponent implements Component { | |||
/** | |||
* The amount of damage the entity will inflict. | |||
*/ | |||
@Replicate | |||
public int amount = 3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
magic number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a magic number, yes, but what would be a better solution here?
If this is a default value it should be mentioned in the doc comment. Maybe there's a more sensible default value such as 0
which is kind of neutral?
@iaronaraujo Do you think the default values are important to know outside this component?
|
||
|
||
@Replicate | ||
public long duration = 2000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
magic number
@@ -9,7 +24,7 @@ | |||
* Damaging critically means multiplying the original damage by <b>critFactor</b>. | |||
* The critical damage has <b>critChance</b>/100 probability of occurring. | |||
*/ | |||
public class CritDamageComponent implements Component{ | |||
public class CritDamageComponent implements Component { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: figure out why CritDamageComponent
has an int
value do denote a percentage 🤔
public HurtEvent(){ | ||
private EntityRef target = EntityRef.NULL; | ||
|
||
private Vector3f impulseDirection = new Vector3f(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the impulseDirection
cannot be changed for this event you can make it final
:
private Vector3f impulseDirection = new Vector3f(); | |
final private Vector3f impulseDirection; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The member then needs to be initialized in the constructor(s).
|
||
private Vector3f impulseDirection = new Vector3f(); | ||
|
||
public HurtEvent() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this constructor needed? What is a HurtEvent
without a target or direction?
@@ -10,17 +25,22 @@ | |||
* <p> | |||
* {@link HurtEvent} is used to hurt other entity/entities. | |||
*/ | |||
public class HurtingComponent implements Component{ | |||
public class HurtingComponent implements Component { | |||
/** | |||
* The amount of damage the entity will inflict. | |||
*/ | |||
@Replicate | |||
public int amount = 3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a magic number, yes, but what would be a better solution here?
If this is a default value it should be mentioned in the doc comment. Maybe there's a more sensible default value such as 0
which is kind of neutral?
@iaronaraujo Do you think the default values are important to know outside this component?
dotAlterationEffect.applyEffect(instigator, otherEntity, hurtingComponent.amount, hurtingComponent.duration); | ||
} | ||
break; | ||
default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This treats everything else than the previously matched cases as "damage"
type - is that intended? Keep in mind that the hurtingType
is an arbitrary string, thus it may contain full garbage such as "watermelon"
- should that be treated as damage or do we want to ignore that case (and just log a warning)?
@Replicate | ||
public Prefab explosionPrefab; | ||
@Replicate | ||
public Vector3f impulseDirection; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the ExplodeComponent
really need an impulseDirection
? Or can it be derived from the location and the fact that it is an explosion?
No description provided.