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
+ rearchitecture
Quad tree implementation to support grass placement and eventually chunk LOD management
+ fix the vibes
Stability

View File

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

View File

@ -84,6 +84,11 @@ public class ServerAttackTree implements BehaviorTree {
String projectileToFire = 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
*/
@ -528,7 +533,7 @@ public class ServerAttackTree implements BehaviorTree {
}
if(ServerFallTree.getFallTree(parent) != null){
ServerFallTree serverFallTree = ServerFallTree.getFallTree(parent);
if(serverFallTree.isFalling()){
if(serverFallTree.isFalling() && serverFallTree.getFrameCurrent() > MIN_FALL_FRAMES_TO_BLOCK_ATTACK){
return false;
}
}

View File

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

View File

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

View File

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