Skip to content
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

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

darshan3
Copy link
Member

No description provided.

@@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

magic number

Copy link
Contributor

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;
Copy link
Contributor

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 {
Copy link
Contributor

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();
Copy link
Contributor

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:

Suggested change
private Vector3f impulseDirection = new Vector3f();
final private Vector3f impulseDirection;

Copy link
Contributor

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() {
Copy link
Contributor

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;
Copy link
Contributor

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:
Copy link
Contributor

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;
Copy link
Contributor

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?

@skaldarnar skaldarnar closed this May 21, 2020
@jdrueckert jdrueckert reopened this May 21, 2020
@jdrueckert jdrueckert changed the base branch from master to develop May 21, 2020 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants