From edbae155bd5c6e32853073b18e6bcc490e874a90 Mon Sep 17 00:00:00 2001 From: FrazeRIP <36977197+FrazeRIP@users.noreply.github.com> Date: Wed, 12 Nov 2025 23:44:20 -0600 Subject: [PATCH] Fix counter attack, divine cards --- .../Cards/Scripts/Cleric/DivineProtection.cs | 59 +++++++++++++++---- .../Cards/Scripts/Cleric/DivinePunishment.cs | 59 +++++++++++++++---- .../CombatBuffs/General/CounterAttack.cs | 10 +--- .../Data/CharacterData_Basic_Cleric.asset | 2 +- 4 files changed, 94 insertions(+), 36 deletions(-) diff --git a/Assets/Mods/Basic/Cards/Scripts/Cleric/DivineProtection.cs b/Assets/Mods/Basic/Cards/Scripts/Cleric/DivineProtection.cs index ff0bcf35..fa2ff0bb 100644 --- a/Assets/Mods/Basic/Cards/Scripts/Cleric/DivineProtection.cs +++ b/Assets/Mods/Basic/Cards/Scripts/Cleric/DivineProtection.cs @@ -1,32 +1,65 @@  +using Continentis.MainGame; using Continentis.MainGame.Card; using Continentis.MainGame.Character; using Continentis.MainGame.Commands; using SLSFramework.General; using System.Collections.Generic; -namespace Continentis.Mods.Basic.Cards.Cleric +namespace Continentis.Mods.Basic { - public class DivineProtection : CardLogicBase + namespace Cards.Cleric { - protected override List PlayEffect(List targetList) + public class DivineProtection : CardLogicBase { - base.PlayEffect(targetList); + protected override List PlayEffect(List targetList) + { + base.PlayEffect(targetList); - CommandGroup mainGroup = TargetListCommandGroup(targetList, - new Cmd_PlayAnimation(user.characterView, "Skill"), - new Cmd_ParamFunction(0.2f, target => + CommandGroup mainGroup = TargetListCommandGroup(targetList, + new Cmd_PlayAnimation(user.characterView, "Skill"), + new Cmd_ParamFunction(0.2f, target => + { + user.AddBlock(GetAttribute("Block")); + })); + + mainGroup.AddCommand(new Cmd_Function(() => { - user.AddBlock(GetAttribute("Block")); + CreateCardBuff(GetAttribute("BlockStack")).Apply(this, user, this); + this.contentSubmodule.dirtyMark = true; })); - mainGroup.AddCommand(new Cmd_Function(() => - { - this.SetAttribute("Block", this.GetAttribute("Block") + this.GetAttribute("BlockStack")); - })); + return new List { mainGroup }; + } + } + } - return new List { mainGroup }; + namespace Buffs + { + public class DivineProtection : CardCombatBuffBase + { + public DivineProtection(int stack) + { + Initialize(BuffType.Positive, BuffDispelLevel.Strong); + this.contentSubmodule = new ContentSubmodule(this); + this.unitedStackSubmodule = new UnitedStackSubmodule(this, true, -1, stack); + this.attributeSubmodule = new AttributeSubmodule(this); + this.attributeSubmodule.numericChange.Add("Block", stack); + } + + public override bool OnBuffApply(out CardCombatBuffBase existingBuff) + { + if (FindExistingSameBuff(out existingBuff)) + { + existingBuff.unitedStackSubmodule.ModifyStack(this.unitedStackSubmodule.stackAmount); + int newStack = existingBuff.unitedStackSubmodule.stackAmount; + existingBuff.attributeSubmodule.numericChange["Block"] = newStack; + return false; + } + return true; + } } } } + diff --git a/Assets/Mods/Basic/Cards/Scripts/Cleric/DivinePunishment.cs b/Assets/Mods/Basic/Cards/Scripts/Cleric/DivinePunishment.cs index 24467dd8..b5829ef4 100644 --- a/Assets/Mods/Basic/Cards/Scripts/Cleric/DivinePunishment.cs +++ b/Assets/Mods/Basic/Cards/Scripts/Cleric/DivinePunishment.cs @@ -1,5 +1,6 @@  +using Continentis.MainGame; using Continentis.MainGame.Card; using Continentis.MainGame.Character; using Continentis.MainGame.Commands; @@ -7,27 +8,59 @@ using SLSFramework.General; using System.Collections.Generic; using Unity.VisualScripting; -namespace Continentis.Mods.Basic.Cards.Cleric +namespace Continentis.Mods.Basic { - public class DivinePunishment : CardLogicBase + namespace Cards.Cleric { - protected override List PlayEffect(List targetList) + public class DivinePunishment : CardLogicBase { - base.PlayEffect(targetList); + protected override List PlayEffect(List targetList) + { + base.PlayEffect(targetList); - CommandGroup mainGroup = TargetListCommandGroup(targetList, - new Cmd_PlayAnimation(user.characterView, "Attack"), - new Cmd_ParamFunction(0.2f, target => + CommandGroup mainGroup = TargetListCommandGroup(targetList, + new Cmd_PlayAnimation(user.characterView, "Attack"), + new Cmd_ParamFunction(0.2f, target => + { + user.Attack(target, GetFinalDamage(target)); + })); + + mainGroup.AddCommand(new Cmd_Function(() => { - user.Attack(target, GetFinalDamage(target)); + CreateCardBuff(GetAttribute("DamageStack")).Apply(this, user, this); + this.contentSubmodule.dirtyMark = true; })); - mainGroup.AddCommand(new Cmd_Function(() => - { - this.SetAttribute("Damage", this.GetAttribute("Damage") + this.GetAttribute("DamageStack")); - })); + return new List { mainGroup }; + } + } + } - return new List { mainGroup }; + namespace Buffs + { + public class DivinePunishment : CardCombatBuffBase + { + public DivinePunishment(int stack) + { + Initialize(BuffType.Positive, BuffDispelLevel.Strong); + this.contentSubmodule = new ContentSubmodule(this); + this.unitedStackSubmodule = new UnitedStackSubmodule(this, true, -1, stack); + this.attributeSubmodule = new AttributeSubmodule(this); + this.attributeSubmodule.numericChange.Add("Damage", stack); + } + + public override bool OnBuffApply(out CardCombatBuffBase existingBuff) + { + if (FindExistingSameBuff(out existingBuff)) + { + existingBuff.unitedStackSubmodule.ModifyStack(this.unitedStackSubmodule.stackAmount); + int newStack = existingBuff.unitedStackSubmodule.stackAmount; + existingBuff.attributeSubmodule.numericChange["Damage"] = newStack; + return false; + } + + return true; + } } } } diff --git a/Assets/Mods/Basic/Characters/CombatBuffs/General/CounterAttack.cs b/Assets/Mods/Basic/Characters/CombatBuffs/General/CounterAttack.cs index fa42b762..4344985d 100644 --- a/Assets/Mods/Basic/Characters/CombatBuffs/General/CounterAttack.cs +++ b/Assets/Mods/Basic/Characters/CombatBuffs/General/CounterAttack.cs @@ -12,14 +12,10 @@ namespace Continentis.Mods.Basic.Buffs Initialize(BuffType.Positive, BuffDispelLevel.Strong); this.contentSubmodule = new ContentSubmodule(this) - .AddParameterGetter("Stack", () => actionCountSubmodule.remainingCount.ToString()); + .AddParameterGetter("Stack", () => unitedStackSubmodule.stackAmount.ToString()); this.iconSubmodule = new IconSubmodule(this); this.unitedStackSubmodule = new UnitedStackSubmodule(this, true, -1, stack, true); - - this.coreAttributeSubmodule = new CoreAttributeSubmodule(this); - this.coreAttributeSubmodule.numericChange.Add("PhysicsDamageDealtOffset", stack); - this.eventSubmodule = new EventSubmodule(this); this.eventSubmodule.onGetAttacked.Add(this.GetType().FullName, new PrioritizedAction(atkResult => { @@ -33,12 +29,8 @@ namespace Continentis.Mods.Basic.Buffs if (FindExistingSameBuff(out existingBuff)) { existingBuff.unitedStackSubmodule.ModifyStack(this.unitedStackSubmodule.stackAmount); - - int newStack = existingBuff.unitedStackSubmodule.stackAmount; - existingBuff.coreAttributeSubmodule.numericChange["PhysicsDamageDealtOffset"] = newStack; return false; } - return true; } } diff --git a/Assets/Mods/Basic/Characters/Data/CharacterData_Basic_Cleric.asset b/Assets/Mods/Basic/Characters/Data/CharacterData_Basic_Cleric.asset index b7d41571..b5708da3 100644 --- a/Assets/Mods/Basic/Characters/Data/CharacterData_Basic_Cleric.asset +++ b/Assets/Mods/Basic/Characters/Data/CharacterData_Basic_Cleric.asset @@ -116,7 +116,7 @@ MonoBehaviour: index: 14 isKeyDuplicated: 0 - Key: MaximumStamina - Value: 2 + Value: 99 index: 15 isKeyDuplicated: 0 - Key: MaximumMana