添加增强目标技能效果的技能
This commit is contained in:
parent
aa7ceba750
commit
25f8adc0a8
Binary file not shown.
@ -17,7 +17,8 @@ enum class ESkillEffectType: uint8
|
||||
Charge UMETA(DisplayName = "充能", ToolTip = "使技能的冷却进度加快"),
|
||||
ModifySpeed UMETA(DisplayName = "速度修改", ToolTip = "使技能冷却进度倍率进展 持续指定时间"),
|
||||
SkillEnduranceRestore UMETA(DisplayName = "技能耐久度恢复", ToolTip = "使技能耐久度恢复"),
|
||||
EnHanceFishRod UMETA(DisplayName = "增强鱼竿", ToolTip = "使鱼竿上海增加"),
|
||||
EnhanceFishRod UMETA(DisplayName = "增强鱼竿", ToolTip = "使鱼竿上海增加"),
|
||||
EnhanceSkill UMETA(DisplayName = "增强技能", ToolTip = "增强指定的技能数值")
|
||||
};
|
||||
|
||||
//技能对象类型
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "SkillEffects/SkillEffect_Charge.h"
|
||||
#include "SkillEffects/SkillEffect_Damage.h"
|
||||
#include "SkillEffects/SkillEffect_EnhanceFishRod.h"
|
||||
#include "SkillEffects/SkillEffect_EnhanceSkill.h"
|
||||
#include "SkillEffects/SkillEffect_Heal.h"
|
||||
#include "SkillEffects/SkillEffect_ModifyCD.h"
|
||||
#include "SkillEffects/SkillEffect_ModifySpeed.h"
|
||||
@ -43,10 +44,13 @@ void USkill::InitSkill(APawnWithSkill* owner, USkillManager* skillManager, FSkil
|
||||
case ESkillEffectType::SkillEnduranceRestore:
|
||||
skillEffect = NewObject<USkillEffect>(this, USkillEffect_SER::StaticClass());
|
||||
break;
|
||||
case ESkillEffectType::EnHanceFishRod:
|
||||
case ESkillEffectType::EnhanceFishRod:
|
||||
skillEffect = NewObject<USkillEffect>(this, USkillEffect_EnhanceFishRod::StaticClass());
|
||||
break;
|
||||
default:
|
||||
case ESkillEffectType::EnhanceSkill:
|
||||
skillEffect = NewObject<USkillEffect>(this, USkillEffect_EnhanceSkill::StaticClass());
|
||||
break;
|
||||
default:
|
||||
const UEnum* EnumPtr = StaticEnum<ESkillEffectType>();
|
||||
UE_LOG(LogTemp, Error, TEXT("没有配置 %s类型的Skill Effect"), *EnumPtr->GetNameStringByValue(static_cast<int64>(effectData.EffectType)))
|
||||
}
|
||||
|
@ -28,6 +28,11 @@ public:
|
||||
class APawnWithSkill* GetOwner();
|
||||
|
||||
FSkillData& GetSkillData();
|
||||
TArray<USkillEffect*> GetAllSkillEffects()
|
||||
{
|
||||
return SkillEffects;
|
||||
}
|
||||
|
||||
FIntPoint GetBagPos();
|
||||
void SetSkillData( FSkillData SkillData);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
|
@ -23,7 +23,10 @@ public:
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
virtual FString GetSkillEffectDes();
|
||||
|
||||
FSkillEffectData& GetEffectData()
|
||||
{
|
||||
return effectData;
|
||||
}
|
||||
private:
|
||||
void GetEffectTargetsByTargetType(const FSkillContext& context, TArray<UObject*>& result);
|
||||
protected:
|
||||
|
@ -9,13 +9,27 @@
|
||||
void USkillEffect_EnhanceFishRod::Execute(const FSkillContext& context)
|
||||
{
|
||||
Super::Execute(context);
|
||||
APawnWithSkill* OwnerPawn = context.OwnerSkill->GetOwner();
|
||||
if (OwnerPawn->GetComponentByClass(UFishingRodComponent::StaticClass()) != NULL)
|
||||
TArray<UObject*> targets = GetApplyTargets(context);
|
||||
for (auto target: targets)
|
||||
{
|
||||
UFishingRodComponent* rod = Cast<UFishingRodComponent>(OwnerPawn->GetComponentByClass(UFishingRodComponent::StaticClass()));
|
||||
rod->AddFishRodDamage( (int32)(effectData.EffectValue));
|
||||
if (!target->GetClass()->IsChildOf(APawnWithSkill::StaticClass()))
|
||||
{
|
||||
UE_LOG(LogTemp, Error, TEXT("skill %s apply target is not a pawn with fish rod"), *(OwnerSkill->GetSkillName()));
|
||||
}
|
||||
else
|
||||
{
|
||||
//修改技能的冷却时间
|
||||
APawnWithSkill* OwnerPawn = Cast<APawnWithSkill>(target);
|
||||
if (OwnerPawn->GetComponentByClass(UFishingRodComponent::StaticClass()) != NULL)
|
||||
{
|
||||
UFishingRodComponent* rod = Cast<UFishingRodComponent>(OwnerPawn->GetComponentByClass(UFishingRodComponent::StaticClass()));
|
||||
rod->AddFishRodDamage( (int32)(effectData.EffectValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
FString USkillEffect_EnhanceFishRod::GetSkillEffectDes()
|
||||
|
@ -0,0 +1,32 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "SkillEffect_EnhanceSkill.h"
|
||||
#include "ProjectFish/Skill/Skill.h"
|
||||
|
||||
void USkillEffect_EnhanceSkill::Execute(const FSkillContext& context)
|
||||
{
|
||||
Super::Execute(context);
|
||||
TArray<UObject*> targets = GetApplyTargets(context);
|
||||
for (auto target: targets)
|
||||
{
|
||||
if (!target->GetClass()->IsChildOf(USkill::StaticClass()))
|
||||
{
|
||||
UE_LOG(LogTemp, Error, TEXT("skill %s apply target is not a skill"), *(OwnerSkill->GetSkillName()));
|
||||
}
|
||||
else
|
||||
{
|
||||
//修改技能的冷却时间
|
||||
USkill* targetSkill = Cast<USkill>(target);
|
||||
for (auto skilleffect: targetSkill->GetAllSkillEffects())
|
||||
{
|
||||
skilleffect->GetEffectData().EffectValue +=(int32)(effectData.EffectValue)*(skilleffect->GetEffectData().EffectValue/FMath::Abs(skilleffect->GetEffectData().EffectValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FString USkillEffect_EnhanceSkill::GetSkillEffectDes()
|
||||
{
|
||||
return FString::Printf(TEXT("增强目标技能 %d点"), (int32)(effectData.EffectValue));
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "ProjectFish/Skill/SkillEffect.h"
|
||||
#include "SkillEffect_EnhanceSkill.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class PROJECTFISH_API USkillEffect_EnhanceSkill : public USkillEffect
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
void Execute(const FSkillContext& context) override;
|
||||
FString GetSkillEffectDes() override;
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user