diff --git a/Content/Weapons/LightningRing/BP_LightningRingWeapon.uasset b/Content/Weapons/LightningRing/BP_LightningRingWeapon.uasset index eb15618..863083c 100644 --- a/Content/Weapons/LightningRing/BP_LightningRingWeapon.uasset +++ b/Content/Weapons/LightningRing/BP_LightningRingWeapon.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4de9fff11f72fce532f97a233fd214d68dc0a46df6732cba03e1c9cc98b0a002 -size 23128 +oid sha256:9d0e9de42c67cb59e1334045bed97f283b3946583a0e85e1c95b8279ca734d7e +size 24112 diff --git a/Source/vampires/Weapons/LightningRingWeapon.cpp b/Source/vampires/Weapons/LightningRingWeapon.cpp index d2cafc8..0833a38 100644 --- a/Source/vampires/Weapons/LightningRingWeapon.cpp +++ b/Source/vampires/Weapons/LightningRingWeapon.cpp @@ -35,30 +35,69 @@ void ALightningRingWeapon::FireWeaponAction_Implementation() { AEnemyCharacter* target = targetableEnemies[FMath::RandRange(0, targetableEnemies.Num() - 1)]; + TArray> traceObjectTypes; + traceObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECC_Pawn)); + TArray actorsToIgnore = TArray({ GetOwner() }); - TArray hitResults; - UKismetSystemLibrary::SphereTraceMultiByProfile(GetWorld(), - target->GetActorLocation(), - target->GetActorLocation(), - 500.0f, - FName(TEXT("Funny")), - false, - actorsToIgnore, - EDrawDebugTrace::ForDuration, - hitResults, - true); - for (FHitResult EnemyHitResult : hitResults) + TArray hitResults; + + UKismetSystemLibrary::SphereOverlapActors(GetWorld(), + target->GetActorLocation(), + LightingBoltRadius, + traceObjectTypes, + AEnemyCharacter::StaticClass(), + actorsToIgnore, + hitResults); + + for (AActor* EnemyHitResult : hitResults) { - UGameplayStatics::ApplyDamage(EnemyHitResult.GetActor(), Damage, nullptr, this, nullptr); + UGameplayStatics::ApplyDamage(EnemyHitResult, Damage, nullptr, this, nullptr); } targetableEnemies.Remove(target); } } +bool ALightningRingWeapon::UpgradeWeapon_Implementation() +{ + if (!Super::UpgradeWeapon_Implementation()) return false; + + switch (CurrentLevel) + { + case 1: + LightningBolts++; + break; + case 2: + LightingBoltRadius += LightingBoltRadius; + Damage += 10; + break; + case 3: + LightningBolts++; + break; + case 4: + LightingBoltRadius += LightingBoltRadius; + Damage += 20; + break; + case 5: + LightningBolts++; + break; + case 6: + LightingBoltRadius += LightingBoltRadius; + Damage += 20; + break; + case 7: + LightningBolts++; + break; + default: + return false; + } + + return true; +} + void ALightningRingWeapon::OnBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, - UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult) + UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult) { if (AEnemyCharacter* Enemy = Cast(OtherActor)) { diff --git a/Source/vampires/Weapons/LightningRingWeapon.h b/Source/vampires/Weapons/LightningRingWeapon.h index 568bc9c..1b2bd9d 100644 --- a/Source/vampires/Weapons/LightningRingWeapon.h +++ b/Source/vampires/Weapons/LightningRingWeapon.h @@ -25,6 +25,9 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite) int LightningBolts = 1; + UPROPERTY(EditAnywhere, BlueprintReadWrite) + float LightingBoltRadius = 200.0f; + public: ALightningRingWeapon(); @@ -34,6 +37,8 @@ protected: public: virtual void FireWeaponAction_Implementation() override; + virtual bool UpgradeWeapon_Implementation() override; + protected: UFUNCTION() void OnBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,