using Continentis.MainGame; using Continentis.MainGame.Character; using SLSFramework.General; using UnityEngine; namespace Continentis.Mods.Basic.Buffs { public class WoundDeterioration : CharacterCombatBuffBase { private int damageCount; public WoundDeterioration(int stack, int damageCount) { Initialize(BuffType.Positive, BuffDispelLevel.Basic); this.damageCount = damageCount; this.contentSubmodule = new ContentSubmodule(this) .AddParameterGetter("Stack", () => unitedStackSubmodule.stackAmount.ToString()) .AddParameterGetter("DamageCount", damageCount.ToString); this.iconSubmodule = new IconSubmodule(this); this.unitedStackSubmodule = new UnitedStackSubmodule(this, stack); this.eventSubmodule = new EventSubmodule(this); this.eventSubmodule.onDealAttack.Add("WoundDeterioration", new PrioritizedAction(atkRes => { if (atkRes.hurtDamage >= 20) { CreateCharacterBuff(this.unitedStackSubmodule.stackAmount).Apply(atkRes.target, atkRes.attacker); } })); //TODO: When character damage exceed 20, apply corrision //this.attachedCharacter.eventSubmodule.onFinishAttack.Add; } public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff) { MainGameManager.Instance.basePrefabs.GenerateInfoText(contentSubmodule.displayName, attachedCharacter.characterView); if (FindExistingSameBuff(out existingBuff)) { WoundDeterioration existing = existingBuff as WoundDeterioration; existingBuff.unitedStackSubmodule.PickHigherStack(this.unitedStackSubmodule); existing!.damageCount = Mathf.Min(existing.damageCount, this.damageCount); return false; } return true; } } }