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;
}
}
}
}

View File

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

View File

@@ -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<AttackResult>(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;
}
}

View File

@@ -116,7 +116,7 @@ MonoBehaviour:
index: 14
isKeyDuplicated: 0
- Key: MaximumStamina
Value: 2
Value: 99
index: 15
isKeyDuplicated: 0
- Key: MaximumMana