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
Oreon training #9
Conversation
Add buildings gym and classroom for this training.
Add tooltip functionality for Oreons.
Remove unused imports and variables.
@@ -0,0 +1,50 @@ | |||
/* | |||
* Copyright 2017 MovingBlocks |
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.
2018
@@ -0,0 +1,102 @@ | |||
/* | |||
* Copyright 2017 MovingBlocks |
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.
2018
@@ -96,6 +96,20 @@ private void changeOreonAttributes(Actor oreon, TaskComponent taskComponent) { | |||
oreonAttributeComponent.hunger = 0; | |||
break; | |||
|
|||
case AssignedTaskType.Train_Strength: | |||
oreonAttributeComponent.strength += 10; | |||
oreonAttributeComponent.strength = oreonAttributeComponent.strength > oreonAttributeComponent.maxStrength |
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.
Assigning the same value doesn't make sense. Just use an if ( str > max) { str = max; } statement.
|
||
case AssignedTaskType.Train_Intelligence: | ||
oreonAttributeComponent.intelligence += 10; | ||
oreonAttributeComponent.intelligence = oreonAttributeComponent.intelligence > oreonAttributeComponent.maxIntelligence |
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.
Same as above. use an if statement instead.
@@ -0,0 +1,58 @@ | |||
/* | |||
* Copyright 2017 MovingBlocks |
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.
2018
@ReceiveEvent(components = OreonAttributeComponent.class) | ||
public void addAttributesToTooltip(GetItemTooltip event, EntityRef entity, OreonAttributeComponent oreonAttributeComponent) { | ||
event.getTooltipLines().add(new TooltipLine("Level : " + oreonAttributeComponent.currentLevel)); | ||
event.getTooltipLines().add(new TooltipLine("Health : " + oreonAttributeComponent.health + " / " + oreonAttributeComponent.maxStrength )); |
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.
Shouldn't this be maxHealth, not maxStr?
@@ -0,0 +1,24 @@ | |||
/* | |||
* Copyright 2017 MovingBlocks |
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.
2018
private long maxDelay = 10; | ||
|
||
public float sendNotification(String message, EntityRef notificationMessageEntity, float lastNotification) { | ||
if (time.getGameTime() - lastNotification > maxDelay || lastNotification == 0) { |
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.
You should check for lastNotification == 0 first, then the subtraction > max check.
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.
Can't find anything to add on top of existing comments, happy to merge when those are addressed :-)
Tests out well, nice work!
Tweaks applied - merged! :-) |
Intelligence
andStrength
attributes.Gym
andClassroom
for this training. Each time the Oreon visits one of these buildings its corresponding attribute is increased by 10.DelayedNotificationSystem
so that the player is not notified of a missing building every time the Oreon's BT is run.Outstanding before merge: