Commit 5fa13213 by Jonathan Thomas

Clear ATTACK or FLEE goals when friendship improves

parent 2fe926ad
Pipeline #11952 passed with stage
in 20 seconds
...@@ -239,7 +239,8 @@ public class ChatDataManager { ...@@ -239,7 +239,8 @@ public class ChatDataManager {
} else if (behavior.getName().equals("FRIENDSHIP")) { } else if (behavior.getName().equals("FRIENDSHIP")) {
int new_friendship = Math.max(-3, Math.min(3, behavior.getArgument())); int new_friendship = Math.max(-3, Math.min(3, behavior.getArgument()));
if (new_friendship > this.friendship) { if (new_friendship > this.friendship) {
// Stop any attack if friendship improves // Stop any attack/flee if friendship improves
EntityBehaviorManager.removeGoal(entity, FleePlayerGoal.class);
EntityBehaviorManager.removeGoal(entity, AttackPlayerGoal.class); EntityBehaviorManager.removeGoal(entity, AttackPlayerGoal.class);
} }
this.friendship = new_friendship; this.friendship = new_friendship;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment