继续搞点新机制
This commit is contained in:
@@ -17,7 +17,7 @@ namespace Continentis.Mods.Basic.Buffs
|
||||
this.iconSubmodule = new IconSubmodule(this);
|
||||
|
||||
this.actionCountSubmodule = new CountSubmodule(this, initialCount);
|
||||
actionCountSubmodule.onCountChanged = OnCountChange;
|
||||
actionCountSubmodule.onCountChanged = OnCountChanged;
|
||||
|
||||
this.generalAttributeSubmodule = new GeneralAttributeSubmodule(this);
|
||||
generalAttributeSubmodule.numericChange.Add("Speed", -initialCount);
|
||||
@@ -38,7 +38,7 @@ namespace Continentis.Mods.Basic.Buffs
|
||||
return true;
|
||||
}
|
||||
|
||||
private void OnCountChange(int remainingCount)
|
||||
private void OnCountChanged(int remainingCount)
|
||||
{
|
||||
generalAttributeSubmodule.numericChange["Speed"] = -remainingCount;
|
||||
generalAttributeSubmodule.numericChange["DodgeGainMultiplier"] = -0.01f * unitedStackSubmodule.stackAmount;
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
using Continentis.MainGame;
|
||||
using Continentis.MainGame.Character;
|
||||
using Continentis.MainGame.Combat;
|
||||
using SLSFramework.General;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Continentis.Mods.Basic.Buffs
|
||||
{
|
||||
public class Protected : CharacterCombatBuffBase
|
||||
{
|
||||
public CharacterBase protector;
|
||||
public Protecting protectingBuff;
|
||||
|
||||
public Protected(CharacterBase protector)
|
||||
{
|
||||
Initialize(BuffType.Neutral, BuffDispelLevel.DeathOnly, 100);
|
||||
SetIdentification(protector.elementID.ToString());
|
||||
|
||||
this.protector = protector;
|
||||
this.contentSubmodule = new ContentSubmodule(this)
|
||||
.AddParameterGetter("Protector", () => protector.data.displayName);//TODO: 以后增加角色的ContentSubmodule
|
||||
|
||||
this.iconSubmodule = new IconSubmodule(this).SetTextFunctions();
|
||||
|
||||
this.eventSubmodule = new EventSubmodule(this);
|
||||
this.eventSubmodule.onOpponentDecideAction.Add("Protected",
|
||||
new EventUnit<CharacterBase, IntendedCard, CharacterBase>((opponent, intendedCard, originalTarget) =>
|
||||
{
|
||||
if (opponent is CombatNPC npc)
|
||||
{
|
||||
intendedCard.targets.Remove(originalTarget);
|
||||
intendedCard.targets.Add(protector); //TODO: 后续用设计专门的函数决定目标改变
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)
|
||||
{
|
||||
MainGameManager.Instance.basePrefabs.GenerateInfoText(contentSubmodule.displayName, attachedCharacter.characterView);
|
||||
|
||||
if (FindExistingSameBuff(out existingBuff))
|
||||
{
|
||||
return true; //独立处理,直接返回true
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cfb784cc7cf10244fbc0ed66ebe5788c
|
||||
@@ -0,0 +1,54 @@
|
||||
using Continentis.MainGame;
|
||||
using Continentis.MainGame.Character;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Continentis.Mods.Basic.Buffs
|
||||
{
|
||||
public class Protecting : CharacterCombatBuffBase
|
||||
{
|
||||
public CharacterBase target;
|
||||
public Protected protectedBuff;
|
||||
|
||||
public Protecting(CharacterBase target, int actionCount, Protected protectedBuff = null)
|
||||
{
|
||||
Initialize(BuffType.Neutral, BuffDispelLevel.DeathOnly, 100);
|
||||
this.target = target;
|
||||
this.protectedBuff = protectedBuff;
|
||||
|
||||
if (this.protectedBuff == null)
|
||||
{
|
||||
Debug.LogError("Protecting buff requires a Protected buff on the target.");
|
||||
}
|
||||
|
||||
this.contentSubmodule = new ContentSubmodule(this)
|
||||
.AddParameterGetter("Count", () => combatRoundTimeSubmodule.remainingCount.ToString())
|
||||
.AddParameterGetter("Target", () => target.data.displayName);//TODO: 以后增加角色的ContentSubmodule
|
||||
|
||||
this.iconSubmodule = new IconSubmodule(this).SetTextFunctions("Count");
|
||||
|
||||
this.combatRoundTimeSubmodule = new CountSubmodule(this, actionCount);
|
||||
|
||||
this.eventSubmodule = new EventSubmodule(this);
|
||||
}
|
||||
|
||||
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)
|
||||
{
|
||||
this.protectedBuff ??= target.combatBuffSubmodule.GetBuff<Protected>(attachedCharacter.elementID.ToString());
|
||||
this.protectedBuff.protectingBuff = this;
|
||||
MainGameManager.Instance.basePrefabs.GenerateInfoText(contentSubmodule.displayName, attachedCharacter.characterView);
|
||||
|
||||
if (FindExistingSameBuff(out existingBuff))
|
||||
{
|
||||
return true; //独立处理,直接返回true
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnBuffRemove()
|
||||
{
|
||||
base.OnBuffRemove();
|
||||
protectedBuff?.OnBuffRemove();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2ba94b343efd81e4482ee19db5fb8fb2
|
||||
Reference in New Issue
Block a user