46 lines
1.8 KiB
C#
46 lines
1.8 KiB
C#
using Continentis.MainGame;
|
|
using Continentis.MainGame.Character;
|
|
using SLSFramework.General;
|
|
using UnityEngine;
|
|
|
|
namespace Continentis.Mods.Basic.Buffs
|
|
{
|
|
public class CounterAttack : CharacterCombatBuffBase
|
|
{
|
|
public CounterAttack(int stack)
|
|
{
|
|
Initialize(BuffType.Positive, BuffDispelLevel.Strong);
|
|
|
|
this.contentSubmodule = new ContentSubmodule(this)
|
|
.AddParameterGetter("Stack", () => actionCountSubmodule.remainingCount.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 =>
|
|
{
|
|
attachedCharacter.Attack(atkResult.attacker, unitedStackSubmodule.stackAmount, null, false, true);
|
|
}));
|
|
}
|
|
|
|
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)
|
|
{
|
|
MainGameManager.Instance.basePrefabs.GenerateInfoText("Counter Attack", attachedCharacter.characterView);
|
|
if (FindExistingSameBuff(out existingBuff))
|
|
{
|
|
existingBuff.unitedStackSubmodule.ModifyStack(this.unitedStackSubmodule.stackAmount);
|
|
|
|
int newStack = existingBuff.unitedStackSubmodule.stackAmount;
|
|
existingBuff.coreAttributeSubmodule.numericChange["PhysicsDamageDealtOffset"] = newStack;
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
}
|