Skip to content

Commit

Permalink
Added Elden Ring Roll Mechanic
Browse files Browse the repository at this point in the history
  • Loading branch information
ChezyName committed Jul 26, 2023
1 parent 94c8b06 commit 97608be
Show file tree
Hide file tree
Showing 39 changed files with 94 additions and 8 deletions.
1 change: 1 addition & 0 deletions Config/DefaultInput.ini
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ DoubleClickTime=0.200000
+ActionMappings=(ActionName="Skill4",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=RightMouseButton)
+ActionMappings=(ActionName="Ultimate",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=R)
+ActionMappings=(ActionName="Dance",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=G)
+ActionMappings=(ActionName="Dodge",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=SpaceBar)
+AxisMappings=(AxisName="Zoom",Scale=1.000000,Key=MouseWheelAxis)
DefaultPlayerInputClass=/Script/Engine.PlayerInput
DefaultInputComponentClass=/Script/Engine.InputComponent
Expand Down
Binary file added Content/Characters/Moss/Anims/AM_DodgeRoll.uasset
Binary file not shown.
Binary file modified Content/Characters/Moss/Anims/AM_Pistol_Fire.uasset
Binary file not shown.
Binary file added Content/Characters/Moss/Anims/DodgeRoll.uasset
Binary file not shown.
Binary file modified Content/Characters/Moss/Anims/Moss_ABP.uasset
Binary file not shown.
Binary file modified Content/Characters/Moss/Anims/Moss_Emote.uasset
Binary file not shown.
Binary file modified Content/Characters/Moss/Anims/Moss_Idle.uasset
Binary file not shown.
Binary file modified Content/Characters/Moss/Anims/Moss_RPG.uasset
Binary file not shown.
Binary file modified Content/Characters/Moss/Anims/Moss_Run.uasset
Binary file not shown.
Binary file modified Content/Characters/Moss/Anims/Moss_Shotgun.uasset
Binary file not shown.
Binary file modified Content/Characters/Moss/Anims/Pistol_Fire.uasset
Binary file not shown.
Binary file modified Content/Characters/Moss/C_Moss.uasset
Binary file not shown.
Binary file modified Content/Characters/Moss/MichealMoss.uasset
Binary file not shown.
Binary file modified Content/Characters/THEBEAST/Anims/AM_AUTOATTACK.uasset
Binary file not shown.
Binary file modified Content/Characters/THEBEAST/Anims/AM_BEAST_Emote.uasset
Binary file not shown.
Binary file modified Content/Characters/THEBEAST/Anims/AM_CLAW.uasset
Binary file not shown.
Binary file not shown.
Binary file modified Content/Characters/THEBEAST/Anims/AM_Grapple.uasset
Binary file not shown.
Binary file modified Content/Characters/THEBEAST/Anims/AM_Grapple_Pull.uasset
Binary file not shown.
Binary file modified Content/Characters/THEBEAST/Anims/AUTOATTACK.uasset
Binary file not shown.
Binary file modified Content/Characters/THEBEAST/Anims/BEAST_ABP.uasset
Binary file not shown.
Binary file modified Content/Characters/THEBEAST/Anims/Claw.uasset
Binary file not shown.
Binary file not shown.
Binary file modified Content/Characters/THEBEAST/Anims/Emote.uasset
Binary file not shown.
Binary file modified Content/Characters/THEBEAST/Anims/GRAPPLE.uasset
Binary file not shown.
Binary file modified Content/Characters/THEBEAST/Anims/GRAPPLE_PULL.uasset
Binary file not shown.
Binary file modified Content/Characters/THEBEAST/Anims/IDLE.uasset
Binary file not shown.
Binary file modified Content/Characters/THEBEAST/Anims/MOVE.uasset
Binary file not shown.
Binary file modified Content/Characters/THEBEAST/C_BEAST.uasset
Binary file not shown.
Binary file modified Content/ClientController.uasset
Binary file not shown.
Binary file modified Models/MICHEALMOSS/MichealMoss.blend
Binary file not shown.
Binary file modified Models/MICHEALMOSS/MichealMoss.blend1
Binary file not shown.
Binary file modified Models/THE BEAST/THE BEAST.blend
Binary file not shown.
Binary file modified Models/THE BEAST/THE BEAST.blend1
Binary file not shown.
5 changes: 2 additions & 3 deletions Source/DIAVOLO/BaseProjectile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,12 @@ void ABaseProjectile::OnOverlap(UPrimitiveComponent* OverlappedComp, AActor* Oth
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
DrawDebugBox(GetWorld(),SweepResult.ImpactPoint,FVector(5,5,5),FColor::Red,false,5);

USkeletalMeshComponent* MeshHit = Cast<USkeletalMeshComponent>(OtherComp);
if(!MeshHit) return;

if(!HasAuthority()) return;
if(bEnemyProjectile)
{
USkeletalMeshComponent* MeshHit = Cast<USkeletalMeshComponent>(OtherComp);
if(!MeshHit) return;
ADIAVOLOCharacter* HitPlayer = Cast<ADIAVOLOCharacter>(OtherActor);
AEnemy* HitEnemy = Cast<AEnemy>(OtherActor);
if(HitPlayer)
Expand Down
50 changes: 50 additions & 0 deletions Source/DIAVOLO/DIAVOLOCharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,41 @@
#include "Net/UnrealNetwork.h"


void ADIAVOLOCharacter::DodgeRoll_Implementation(FVector MouseLocation)
{
if(bisDodging || bUsingAbility) return;
bisDodging = true;
bUsingAbility = true;
PlayAnimationClient(DodgeAnim);
PlaySoundSingle(DodgeSound);

FVector TargetDirection = MouseLocation - GetActorLocation();
TargetDirection.Normalize();
FRotator TargetRotation = TargetDirection.Rotation();
SetActorRotation(TargetRotation);
DodgeDirection = TargetDirection;

FTimerDelegate TimerDelegate;
TimerDelegate.BindLambda([&]
{
bisDodging = false;
});

FTimerDelegate TimerDelegateB;
TimerDelegateB.BindLambda([&]
{
StopAnimationClient(DodgeAnim);
bisDodging = false;
bUsingAbility = false;
});

FTimerHandle TimerHandle;
GetWorld()->GetTimerManager().SetTimer(TimerHandle, TimerDelegate, DodgeFrames, false);

FTimerHandle TimerHandleB;
GetWorld()->GetTimerManager().SetTimer(TimerHandleB, TimerDelegateB, DodgeFrames+RestFrames, false);
}

ADIAVOLOCharacter::ADIAVOLOCharacter()
{
// Set size for player capsule
Expand Down Expand Up @@ -62,6 +97,11 @@ ADIAVOLOCharacter::ADIAVOLOCharacter()

void ADIAVOLOCharacter::CharacterTakeDamage_Implementation(float DamageAmount)
{
if(bisDodging)
{
//Do Effect
return;
}
Health -= DamageAmount;
if(Health <= 0)
{
Expand Down Expand Up @@ -97,6 +137,16 @@ void ADIAVOLOCharacter::Tick(float DeltaSeconds)
}
GEngine->AddOnScreenDebugMessage(-1,0,FColor::Magenta,"Mana: " +
FString::SanitizeFloat(Mana) + ". CD: " + FString::SanitizeFloat(ManaCD));

if(bisDodging)
{
GetCharacterMovement()->Launch(DodgeDirection * 1500);
}

FRotator CharRot = GetActorRotation();
CharRot.Pitch = 0;
CharRot.Roll = 0;
SetActorRotation(CharRot);
}

//if(HasAuthority()) GEngine->AddOnScreenDebugMessage(-1,0,FColor::Red, "SERVER ON " + GetController()->GetName());
Expand Down
15 changes: 15 additions & 0 deletions Source/DIAVOLO/DIAVOLOCharacter.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,21 @@ class ADIAVOLOCharacter : public ACharacter
UPROPERTY(EditAnywhere,Category="Character Info | Emote ")
UAudioComponent* EmotePlayer;

UPROPERTY(EditAnywhere,Category="Character Info | DodgeRoll ")
UAnimMontage* DodgeAnim;
UPROPERTY(EditAnywhere,Category="Character Info | DodgeRoll ")
USoundWave* DodgeSound;
UPROPERTY(EditAnywhere,Category="Character Info | DodgeRoll ")
float DodgeFrames = 0.2;
UPROPERTY(EditAnywhere,Category="Character Info | DodgeRoll ")
float RestFrames = 0.12;

UFUNCTION(Server,Reliable)
void DodgeRoll(FVector MouseLocation);

bool bisDodging = false;
FVector DodgeDirection;

UFUNCTION(Server,Reliable)
void StartEmote();
UFUNCTION(Server,Reliable)
Expand Down
27 changes: 22 additions & 5 deletions Source/DIAVOLO/DIAVOLOPlayerController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ void ADIAVOLOPlayerController::SetupInputComponent()
InputComponent->BindAction("Ultimate",IE_Released,this,&ADIAVOLOPlayerController::endUltimateC);

InputComponent->BindAction("Dance",IE_Released,this,&ADIAVOLOPlayerController::startEmoteC);
InputComponent->BindAction("Dodge",IE_Pressed,this,&ADIAVOLOPlayerController::onDodgeC);
}

void ADIAVOLOPlayerController::BeginPlay()
Expand Down Expand Up @@ -326,7 +327,8 @@ void ADIAVOLOPlayerController::ChangeCharState_Implementation(EPlayerStates NewS

void ADIAVOLOPlayerController::DoAutoAttack_Implementation()
{
if(EnemyAttacking == nullptr || GetProxy()->Character == nullptr || GetProxy()->Character->bUsingAbility) return;
if(EnemyAttacking == nullptr || GetProxy()->Character == nullptr || GetProxy()->Character->bUsingAbility
|| GetProxy()->Character->isDead || GetProxy()->Character->bUsingAbility) return;
//GEngine->AddOnScreenDebugMessage(-1,25,FColor::Magenta,GetName() + " USING BASIC ATTACK!");

//Face Enemy
Expand Down Expand Up @@ -407,24 +409,39 @@ void ADIAVOLOPlayerController::onUltimateC_Implementation()
endEmoteC();
}

void ADIAVOLOPlayerController::onDodgeC_Implementation()
{
FVector Ground = getMousePositionGround();
if(!GetProxy() || !GetProxy()->Character || GetProxy()->Character->CharState == EPlayerStates::E_ABILITY
|| GetProxy()->Character->bUsingAbility) return;
if(GetProxy() && GetProxy()->Character) SetNewMoveDestination(GetProxy()->Character->GetActorLocation());
onDodgeS(Ground);
endEmoteC();
}

//===========================================================================================
// SERVER

void ADIAVOLOPlayerController::onSkill1S_Implementation(FVector MouseLoc,AEnemy* Enemy)
{
if(GetProxy() && GetProxy()->Character) GetProxy()->Character->onSkill1(MouseLoc,Enemy);
if(GetProxy() && GetProxy()->Character && !GetProxy()->Character->isDead) GetProxy()->Character->onSkill1(MouseLoc,Enemy);
}
void ADIAVOLOPlayerController::onSkill2S_Implementation(FVector MouseLoc,AEnemy* Enemy)
{
if(GetProxy() && GetProxy()->Character) GetProxy()->Character->onSkill2(MouseLoc,Enemy);
if(GetProxy() && GetProxy()->Character && !GetProxy()->Character->isDead) GetProxy()->Character->onSkill2(MouseLoc,Enemy);
}
void ADIAVOLOPlayerController::onSkill3S_Implementation(FVector MouseLoc,AEnemy* Enemy)
{
if(GetProxy() && GetProxy()->Character) GetProxy()->Character->onSkill3(MouseLoc,Enemy);
if(GetProxy() && GetProxy()->Character && !GetProxy()->Character->isDead) GetProxy()->Character->onSkill3(MouseLoc,Enemy);
}
void ADIAVOLOPlayerController::onUltimateS_Implementation(FVector MouseLoc,AEnemy* Enemy)
{
if(GetProxy() && GetProxy()->Character) GetProxy()->Character->onUltimate(MouseLoc,Enemy);
if(GetProxy() && GetProxy()->Character && !GetProxy()->Character->isDead) GetProxy()->Character->onUltimate(MouseLoc,Enemy);
}

void ADIAVOLOPlayerController::onDodgeS_Implementation(FVector MouseLoc)
{
if(GetProxy() && GetProxy()->Character && !GetProxy()->Character->isDead) GetProxy()->Character->DodgeRoll(MouseLoc);
}

//===========================================================================================
Expand Down
4 changes: 4 additions & 0 deletions Source/DIAVOLO/DIAVOLOPlayerController.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class ADIAVOLOPlayerController : public APlayerController
void onSkill3C();
UFUNCTION(Client,Reliable)
void onUltimateC();
UFUNCTION(Client,Reliable)
void onDodgeC();

UFUNCTION(Server,Reliable)
void onSkill1S(FVector MouseLoc,AEnemy* Enemy);
Expand All @@ -75,6 +77,8 @@ class ADIAVOLOPlayerController : public APlayerController
void onSkill3S(FVector MouseLoc,AEnemy* Enemy);
UFUNCTION(Server,Reliable)
void onUltimateS(FVector MouseLoc,AEnemy* Enemy);
UFUNCTION(Server,Reliable)
void onDodgeS(FVector MouseLoc);

UFUNCTION(Client,Reliable)
void endSkill1C();
Expand Down

0 comments on commit 97608be

Please sign in to comment.