Fix counter attack, divine cards

This commit is contained in:
FrazeRIP
2025-11-12 23:44:20 -06:00
parent 24656aba1a
commit edbae155bd
4 changed files with 94 additions and 36 deletions

View File

@@ -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<CommandBase> PlayEffect(List<CharacterBase> targetList)
public class DivineProtection : CardLogicBase
{
base.PlayEffect(targetList);
protected override List<CommandBase> PlayEffect(List<CharacterBase> targetList)
{
base.PlayEffect(targetList);
CommandGroup mainGroup = TargetListCommandGroup(targetList,
new Cmd_PlayAnimation(user.characterView, "Skill"),
new Cmd_ParamFunction<CharacterBase>(0.2f, target =>
CommandGroup mainGroup = TargetListCommandGroup(targetList,
new Cmd_PlayAnimation(user.characterView, "Skill"),
new Cmd_ParamFunction<CharacterBase>(0.2f, target =>
{
user.AddBlock(GetAttribute("Block"));
}));
mainGroup.AddCommand(new Cmd_Function(() =>
{
user.AddBlock(GetAttribute("Block"));
CreateCardBuff<Buffs.DivineProtection>(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<CommandBase> { mainGroup };
}
}
}
return new List<CommandBase> { 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;
}
}
}
}