复制牌,保护buff显示调整
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using Continentis.MainGame;
|
||||
using Continentis.MainGame.Character;
|
||||
using Continentis.MainGame.Combat;
|
||||
@@ -8,30 +9,28 @@ namespace Continentis.Mods.Basic.Buffs
|
||||
{
|
||||
public class Protected : CharacterCombatBuffBase
|
||||
{
|
||||
public CharacterBase protector;
|
||||
public Protecting protectingBuff;
|
||||
public List<Protecting> protectingSources;
|
||||
|
||||
public Protected(CharacterBase protector)
|
||||
public Protected()
|
||||
{
|
||||
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.contentSubmodule = new ContentSubmodule(this);//TODO: 以后增加角色的ContentSubmodule
|
||||
|
||||
this.iconSubmodule = new IconSubmodule(this).SetTextFunctions();
|
||||
|
||||
this.eventSubmodule = new EventSubmodule(this);
|
||||
this.eventSubmodule.onOpponentDecideAction.Add("Protected",
|
||||
/*
|
||||
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: 后续用设计专门的函数决定目标改变
|
||||
//intendedCard.targets.Add(protector); //TODO: 后续用设计专门的函数决定目标改变
|
||||
}
|
||||
}));
|
||||
*/
|
||||
}
|
||||
|
||||
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)
|
||||
@@ -40,7 +39,7 @@ namespace Continentis.Mods.Basic.Buffs
|
||||
|
||||
if (FindExistingSameBuff(out existingBuff))
|
||||
{
|
||||
return true; //独立处理,直接返回true
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -33,22 +33,37 @@ namespace Continentis.Mods.Basic.Buffs
|
||||
|
||||
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))
|
||||
{
|
||||
Debug.Log("Existing same buff found.");
|
||||
|
||||
Protecting existProtecting = existingBuff as Protecting;
|
||||
Debug.Log(existProtecting == null ? "Existing buff is not of type Protecting!" : "Existing Protecting buff found.");
|
||||
if (existProtecting.target == this.target)
|
||||
{
|
||||
existProtecting.roundCountSubmodule.AddCount(this.roundCountSubmodule.remainingCount);
|
||||
return false;
|
||||
}
|
||||
|
||||
this.protectedBuff ??= target.combatBuffSubmodule.GetBuff<Protected>();
|
||||
this.protectedBuff.protectingSources.Add(this);
|
||||
return true; //独立处理,直接返回true
|
||||
}
|
||||
|
||||
Debug.Log("No existing same buff found.");
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnBuffRemove()
|
||||
{
|
||||
base.OnBuffRemove();
|
||||
protectedBuff?.OnBuffRemove();
|
||||
protectedBuff.protectingSources.Remove(this);
|
||||
if (protectedBuff.protectingSources.Count == 0)
|
||||
{
|
||||
protectedBuff.Remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user