min fall frames to block attack

This commit is contained in:
austin 2024-09-09 18:25:38 -04:00
parent 9301996bac
commit 99a7434557
6 changed files with 24 additions and 4 deletions

View File

@ -10,7 +10,6 @@
Particles and particle manager Particles and particle manager
+ rearchitecture + rearchitecture
Quad tree implementation to support grass placement and eventually chunk LOD management
+ fix the vibes + fix the vibes
Stability Stability

View File

@ -707,6 +707,7 @@ Framebuffer + RenderingEngine tests
Fix obnoxious opengl state caching bug w/ framebuffers in junit context Fix obnoxious opengl state caching bug w/ framebuffers in junit context
Recoil on attack block Recoil on attack block
Movement speed penalty on swinging sword Movement speed penalty on swinging sword
Fix fall tree blocking attack starting on server
# TODO # TODO

View File

@ -84,6 +84,11 @@ public class ServerAttackTree implements BehaviorTree {
String projectileToFire = null; String projectileToFire = null;
String attackingPoint = null; String attackingPoint = null;
/**
* The minimum number of fall frames required before it blocks attacking
*/
int MIN_FALL_FRAMES_TO_BLOCK_ATTACK = 3;
/** /**
* The list of entities that have collided with the current attack * The list of entities that have collided with the current attack
*/ */
@ -528,7 +533,7 @@ public class ServerAttackTree implements BehaviorTree {
} }
if(ServerFallTree.getFallTree(parent) != null){ if(ServerFallTree.getFallTree(parent) != null){
ServerFallTree serverFallTree = ServerFallTree.getFallTree(parent); ServerFallTree serverFallTree = ServerFallTree.getFallTree(parent);
if(serverFallTree.isFalling()){ if(serverFallTree.isFalling() && serverFallTree.getFrameCurrent() > MIN_FALL_FRAMES_TO_BLOCK_ATTACK){
return false; return false;
} }
} }

View File

@ -95,13 +95,13 @@ public class ClientGravityTree implements BehaviorTree {
frameCurrent = 0; frameCurrent = 0;
} else { } else {
//animation nonsense //animation nonsense
frameCurrent++;
if(frameCurrent == fallFrame){ if(frameCurrent == fallFrame){
ClientFallTree fallTree; ClientFallTree fallTree;
if((fallTree = ClientFallTree.getFallTree(parent))!=null){ if((fallTree = ClientFallTree.getFallTree(parent))!=null){
fallTree.start(); fallTree.start();
} }
} }
frameCurrent++;
} }
break; break;

View File

@ -98,13 +98,13 @@ public class ServerGravityTree implements BehaviorTree {
frameCurrent = 0; frameCurrent = 0;
} else { } else {
//animation nonsense //animation nonsense
frameCurrent++;
if(frameCurrent == fallFrame){ if(frameCurrent == fallFrame){
ServerFallTree fallTree; ServerFallTree fallTree;
if((fallTree = ServerFallTree.getFallTree(parent))!=null){ if((fallTree = ServerFallTree.getFallTree(parent))!=null){
fallTree.start(); fallTree.start();
} }
} }
frameCurrent++;
} }
break; break;
case NOT_ACTIVE: case NOT_ACTIVE:

View File

@ -25,6 +25,11 @@ public class ServerFallTree implements BehaviorTree {
ServerJumpTree jumpTree; ServerJumpTree jumpTree;
/**
* The number of frames this has been active
*/
int frameCurrent = 0;
public ServerFallTree(Entity parent, FallMovementSystem fallMovementSystem){ public ServerFallTree(Entity parent, FallMovementSystem fallMovementSystem){
this.parent = parent; this.parent = parent;
} }
@ -34,6 +39,7 @@ public class ServerFallTree implements BehaviorTree {
PoseActor poseActor = EntityUtils.getPoseActor(parent); PoseActor poseActor = EntityUtils.getPoseActor(parent);
switch(state){ switch(state){
case ACTIVE: case ACTIVE:
frameCurrent++;
if(poseActor != null){ if(poseActor != null){
String animationToPlay = determineCorrectAnimation(); String animationToPlay = determineCorrectAnimation();
if( if(
@ -61,6 +67,7 @@ public class ServerFallTree implements BehaviorTree {
public void land(){ public void land(){
if(state != FallState.INACTIVE){ if(state != FallState.INACTIVE){
state = FallState.INACTIVE; state = FallState.INACTIVE;
frameCurrent = 0;
PoseActor poseActor = EntityUtils.getPoseActor(parent); PoseActor poseActor = EntityUtils.getPoseActor(parent);
if(poseActor != null){ if(poseActor != null){
String animationToPlay = determineCorrectAnimation(); String animationToPlay = determineCorrectAnimation();
@ -100,5 +107,13 @@ public class ServerFallTree implements BehaviorTree {
public void setAnimationLand(String animationName){ public void setAnimationLand(String animationName){
animationLand = animationName; animationLand = animationName;
} }
/**
* Gets the current frame of the attack tree
* @return The frame
*/
public int getFrameCurrent(){
return frameCurrent;
}
} }