diff --git a/Config/DefaultGameplayTags.ini b/Config/DefaultGameplayTags.ini index 017d2ed..30b2d63 100644 --- a/Config/DefaultGameplayTags.ini +++ b/Config/DefaultGameplayTags.ini @@ -9,6 +9,7 @@ InvalidTagCharacters="\"\'," NumBitsForContainerSize=6 NetIndexFirstBitSegment=16 +GameplayTagList=(Tag="Ability.Block.UltimatePlaying",DevComment="大招正在释放中") ++GameplayTagList=(Tag="Ability.Flags.Cooldown",DevComment="技能冷却") +GameplayTagList=(Tag="Ability.Flags.Recast",DevComment="可以再次释放技能的标记") +GameplayTagList=(Tag="Ability.Role.AttributeConsume",DevComment="角色属性损耗debuff") +GameplayTagList=(Tag="Ability.Role.EatFood",DevComment="干饭") diff --git a/Content/Blueprint/Level/Actor/Role/BP_Fox.uasset b/Content/Blueprint/Level/Actor/Role/BP_Fox.uasset index 325b22f..ffd54c3 100644 Binary files a/Content/Blueprint/Level/Actor/Role/BP_Fox.uasset and b/Content/Blueprint/Level/Actor/Role/BP_Fox.uasset differ diff --git a/Content/Gas/Ability/Role/Fox/GA_FoxUltimate.uasset b/Content/Gas/Ability/Role/Fox/GA_FoxUltimate.uasset index 7459cdf..a257f5d 100644 Binary files a/Content/Gas/Ability/Role/Fox/GA_FoxUltimate.uasset and b/Content/Gas/Ability/Role/Fox/GA_FoxUltimate.uasset differ diff --git a/Content/Gas/Effects/Role/Fox/GE_FoxUltimateCost.uasset b/Content/Gas/Effects/Role/Fox/GE_FoxUltimateCost.uasset new file mode 100644 index 0000000..bb91c84 Binary files /dev/null and b/Content/Gas/Effects/Role/Fox/GE_FoxUltimateCost.uasset differ diff --git a/Content/Gas/Effects/Role/Fox/GE_UltimateCooldown.uasset b/Content/Gas/Effects/Role/Fox/GE_UltimateCooldown.uasset new file mode 100644 index 0000000..60eb192 Binary files /dev/null and b/Content/Gas/Effects/Role/Fox/GE_UltimateCooldown.uasset differ diff --git a/Content/Level/FalconPlain.umap b/Content/Level/FalconPlain.umap index 48e551f..70f3286 100644 Binary files a/Content/Level/FalconPlain.umap and b/Content/Level/FalconPlain.umap differ diff --git a/Content/Lua/Gas/Ability/Role/Fox/FoxUltimate.lua b/Content/Lua/Gas/Ability/Role/Fox/FoxUltimate.lua index 0d4d74b..6cadc13 100644 --- a/Content/Lua/Gas/Ability/Role/Fox/FoxUltimate.lua +++ b/Content/Lua/Gas/Ability/Role/Fox/FoxUltimate.lua @@ -11,12 +11,18 @@ function FoxUltimate:ctor() self.ultimate_phase = 1 -- 大招阶段 self.active_recast_handle = nil self.active_accelerate_handle = nil + + self.tag_add_or_remove_delegate = nil end function FoxUltimate:K2_ActivateAbilityFromEvent(EventData) print("FoxUltimate:K2_ActivateAbilityFromEvent", self.ultimate_phase) + if not self:K2_CommitAbilityCost(false) then + return self:K2_EndAbility() + end + local owner = self:GetOwningActorFromActorInfo() self.movement = owner.MovementComponent self.animation = owner.SpineAnimationComponent @@ -25,8 +31,17 @@ function FoxUltimate:K2_ActivateAbilityFromEvent(EventData) local asc = self.asc + if self.tag_add_or_remove_delegate == nil then + self.tag_add_or_remove_delegate = slua.createDelegate(function(tag, is_add) + if is_add == 0 and not self.bIsActive then + self.ultimate_phase = 1 + self:K2_CommitAbilityCooldown(false, false) + end + end) + owner:BindGameplayTagAddOrRemove(self.recast_tag, self.tag_add_or_remove_delegate) + end + if self.ultimate_phase == 1 or asc:HasMatchingGameplayTag(self.recast_tag) then - print("triggered") self:TriggerUltimate(asc) else self:K2_EndAbility() @@ -134,7 +149,19 @@ end function FoxUltimate:OnAnimationComplete(entry) - self.ultimate_phase = self.ultimate_phase + 1 + local new_phase = self.ultimate_phase + 1 + if new_phase > 3 then + self.ultimate_phase = 1 + else + self.ultimate_phase = new_phase + end + print("FoxUltimate:OnAnimationComplete", self.ultimate_phase) + + if not self.asc:HasMatchingGameplayTag(self.recast_tag) then + self.ultimate_phase = 1 + self:K2_CommitAbilityCooldown(false, false) + end + entry.AnimationComplete:Clear() entry.AnimationEvent:Clear() self:K2_EndAbility() diff --git a/Source/BusyRabbit/Private/CppBindings/AbilitySystemComponentBinding.cpp b/Source/BusyRabbit/Private/CppBindings/AbilitySystemComponentBinding.cpp index 2601650..0267533 100644 --- a/Source/BusyRabbit/Private/CppBindings/AbilitySystemComponentBinding.cpp +++ b/Source/BusyRabbit/Private/CppBindings/AbilitySystemComponentBinding.cpp @@ -1,27 +1,9 @@ #include "LuaCppBinding.h" -#include "AbilitySystemComponent.h" -#include "GameplayTagContainer.h" + using slua::lua_State, slua::LuaObject, slua::LuaStruct; -using namespace slua; - - -#pragma optimize( "", off ) - - -bool HasMatchingGameplayTag(const UAbilitySystemComponent& Asc, const FName& TagName) -{ - // return Asc.HasMatchingGameplayTag(FGameplayTag::RequestGameplayTag(TagName)); - return true; -} extern void RegisterAbilitySystemComponentExtension() { - REG_EXTENSION_METHOD_LAMBDA(UAbilitySystemComponent, "AHasMatchingGameplayTag", false, - [](UAbilitySystemComponent* ASC, const FName& Tag) -> bool { - return true; - } - ); + } -#pragma optimize( "", on) - diff --git a/Source/BusyRabbit/Private/Level/Actor/BusyPawnBase.cpp b/Source/BusyRabbit/Private/Level/Actor/BusyPawnBase.cpp index a871dad..65198c9 100644 --- a/Source/BusyRabbit/Private/Level/Actor/BusyPawnBase.cpp +++ b/Source/BusyRabbit/Private/Level/Actor/BusyPawnBase.cpp @@ -77,3 +77,18 @@ void ABusyPawnBase::InitPawnAbilities(const FBusyPawnBaseConfig& Config)const } } +void ABusyPawnBase::BindGameplayTagAddOrRemove(const FGameplayTag& Tag, FGameplayTagAddOrRemoveDelegate Delegate)const +{ + AbilitySystemComponent->RegisterGameplayTagEvent(Tag, EGameplayTagEventType::NewOrRemoved).AddLambda( + [Delegate](const FGameplayTag GameplayTag, const int32 Value) + { + Delegate.ExecuteIfBound(GameplayTag, Value); + } + ); +} + +void ABusyPawnBase::InitCollision() +{ +} + + diff --git a/Source/BusyRabbit/Private/Level/Actor/BusyPlayerRole.cpp b/Source/BusyRabbit/Private/Level/Actor/BusyPlayerRole.cpp index dfad955..fca496e 100644 --- a/Source/BusyRabbit/Private/Level/Actor/BusyPlayerRole.cpp +++ b/Source/BusyRabbit/Private/Level/Actor/BusyPlayerRole.cpp @@ -32,18 +32,18 @@ void ABusyPlayerRole::InitPawnAttributes(const struct FBusyPawnBaseConfig& Confi Super::InitPawnAttributes(Config); UBusyPlayerRoleAttributeSet* RoleAttributes = Cast(Attributes); - if (RoleAttributes && Config.StaticStruct() == FBusyRoleBaseConfig::StaticStruct()) + // if (RoleAttributes && Config.StaticStruct() == FBusyRoleBaseConfig::StaticStruct()) { const FBusyRoleBaseConfig* RoleConfig = static_cast(&Config); RoleAttributes->InitHunger(RoleConfig->Hunger); RoleAttributes->InitMaxHunger(RoleConfig->Hunger); RoleAttributes->InitHungerConsume(RoleConfig->HungerConsume); } - else - { - UE_LOG(LogBusyPawn, Warning, TEXT("ABusyPlayerRole::InitPawnAttributes Failed, RoleAttribute: %p, ConfigName: %s"), - RoleAttributes, *Config.StaticStruct()->GetFName().ToString() - ); - } + // else + // { + // UE_LOG(LogBusyPawn, Warning, TEXT("ABusyPlayerRole::InitPawnAttributes Failed, RoleAttribute: %p, ConfigName: %s"), + // RoleAttributes, *Config.StaticStruct()->GetFName().ToString() + // ); + // } } diff --git a/Source/BusyRabbit/Public/Level/Actor/BusyPawnBase.h b/Source/BusyRabbit/Public/Level/Actor/BusyPawnBase.h index 32041dc..1b439a2 100644 --- a/Source/BusyRabbit/Public/Level/Actor/BusyPawnBase.h +++ b/Source/BusyRabbit/Public/Level/Actor/BusyPawnBase.h @@ -4,15 +4,17 @@ #include "Level/Actor/Components/BusyAbilitySystemComponent.h" #include "BusyPawnBase.generated.h" - -class USphereComponent; struct FBusyPawnBaseConfig; +class USphereComponent; class USpineBoneFollowerComponent; class USpineSkeletonRendererComponent; class USpineSkeletonAnimationComponent; class UBusyPawnMovementComponent; +DECLARE_DYNAMIC_DELEGATE_TwoParams(FGameplayTagAddOrRemoveDelegate, const FGameplayTag&, Tag, const int32, Value); + + #define MY_ATTRIBUTE_ACCESSORS(ClassName, PropertyName) \ GAMEPLAYATTRIBUTE_PROPERTY_GETTER(ClassName, PropertyName) \ GAMEPLAYATTRIBUTE_VALUE_GETTER(PropertyName) \ @@ -67,6 +69,13 @@ public: virtual void InitPawnAttributes(const FBusyPawnBaseConfig& Config); virtual void InitPawnAbilities(const FBusyPawnBaseConfig& Config) const; +public: + UFUNCTION(BlueprintCallable) + void BindGameplayTagAddOrRemove(const FGameplayTag& Tag, FGameplayTagAddOrRemoveDelegate Delegate)const; + + +protected: + void InitCollision(); protected: UPROPERTY(EditDefaultsOnly)