MOD!
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class AdventureBuffBase : MonoBehaviour
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d7ab017f8e0c27c4f8725e1703be8499
|
||||
@@ -0,0 +1,108 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Continentis.MainGame.Character
|
||||
{
|
||||
public partial class CharacterBuffBase
|
||||
{
|
||||
public abstract class CharacterBuffSubmodule : BuffSubmodule
|
||||
{
|
||||
public CharacterBase character => (buff as CharacterBuffBase)?.attachedCharacter;
|
||||
|
||||
protected CharacterBuffSubmodule(CharacterBuffBase buff) : base(buff)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Buff的角色核心属性调整模块
|
||||
/// </summary>
|
||||
public class CoreAttributeSubmodule : CharacterBuffSubmodule
|
||||
{
|
||||
public Dictionary<string, float> numericChange;
|
||||
public Dictionary<string, float> percentageChangeOfAccumulation;
|
||||
public Dictionary<string, float> percentageChangeOfMultiplication;
|
||||
|
||||
public CoreAttributeSubmodule(CharacterBuffBase buff) : base(buff)
|
||||
{
|
||||
this.numericChange = new Dictionary<string, float>();
|
||||
this.percentageChangeOfAccumulation = new Dictionary<string, float>();
|
||||
this.percentageChangeOfMultiplication = new Dictionary<string, float>();
|
||||
}
|
||||
|
||||
public List<string> RefreshAllModifiedAttributes()
|
||||
{
|
||||
List<string> modifiedAttributes = new List<string>();
|
||||
modifiedAttributes.AddRange(numericChange.Select(kvp => kvp.Key));
|
||||
modifiedAttributes.AddRange(percentageChangeOfAccumulation.Select(kvp => kvp.Key));
|
||||
modifiedAttributes.AddRange(percentageChangeOfMultiplication.Select(kvp => kvp.Key));
|
||||
|
||||
modifiedAttributes.ForEach(attr => character.attributeSubmodule.RefreshCoreAttribute(attr));
|
||||
character.attributeSubmodule.RefreshAllGeneralAttributes(); //刷新核心属性后,需要刷新通用属性
|
||||
|
||||
return modifiedAttributes;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Buff的角色通常属性调整模块
|
||||
/// </summary>
|
||||
public class GeneralAttributeSubmodule : CharacterBuffSubmodule
|
||||
{
|
||||
public Dictionary<string, float> numericChange;
|
||||
public Dictionary<string, float> percentageChangeOfAccumulation;
|
||||
public Dictionary<string, float> percentageChangeOfMultiplication;
|
||||
|
||||
public GeneralAttributeSubmodule(CharacterBuffBase buff) : base(buff)
|
||||
{
|
||||
this.numericChange = new Dictionary<string, float>();
|
||||
this.percentageChangeOfAccumulation = new Dictionary<string, float>();
|
||||
this.percentageChangeOfMultiplication = new Dictionary<string, float>();
|
||||
}
|
||||
|
||||
public List<string> RefreshAllModifiedAttributes()
|
||||
{
|
||||
List<string> modifiedAttributes = new List<string>();
|
||||
modifiedAttributes.AddRange(numericChange.Select(kvp => kvp.Key));
|
||||
modifiedAttributes.AddRange(percentageChangeOfAccumulation.Select(kvp => kvp.Key));
|
||||
modifiedAttributes.AddRange(percentageChangeOfMultiplication.Select(kvp => kvp.Key));
|
||||
|
||||
modifiedAttributes.ForEach(attr => character.attributeSubmodule.RefreshGeneralAttribute(attr));
|
||||
|
||||
return modifiedAttributes;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Buff的角色状态调整模块
|
||||
/// </summary>
|
||||
public class StatusSubmodule : CharacterBuffSubmodule
|
||||
{
|
||||
public List<StatusType> statusList;
|
||||
|
||||
public StatusSubmodule(CharacterBuffBase buff, params StatusType[] statusTypes) : base(buff)
|
||||
{
|
||||
statusList = statusTypes.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将Buff内含的状态添加到角色身上(1层)
|
||||
/// </summary>
|
||||
public void AddStatus()
|
||||
{
|
||||
statusList.ForEach(status => character.statusSubmodule.AddStatus(status));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将Buff内含的状态从角色身上移除(1层),注意,如果某个状态有其它的来源,这个状态的效果仍然存在。
|
||||
/// </summary>
|
||||
public void RemoveStatus()
|
||||
{
|
||||
statusList.ForEach(status => character.statusSubmodule.RemoveStatus(status));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7bd8c45b41910fd44bb7a5313d28ebf9
|
||||
@@ -0,0 +1,23 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Continentis.MainGame.Character
|
||||
{
|
||||
public abstract partial class CharacterBuffBase : BuffBase<CharacterBase>
|
||||
{
|
||||
public CharacterBase attachedCharacter;
|
||||
public CharacterBase sourceCharacter;
|
||||
|
||||
public IconSubmodule iconSubmodule;
|
||||
public EventSubmodule eventSubmodule;
|
||||
}
|
||||
|
||||
public partial class CharacterBuffBase
|
||||
{
|
||||
public override void Apply(CharacterBase attached)
|
||||
{
|
||||
this.Apply(attached, null);
|
||||
}
|
||||
|
||||
public abstract void Apply(CharacterBase attachedCharacter, CharacterBase sourceCharacter = null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 99fbe7ae5b18a984887cae2039b86805
|
||||
@@ -0,0 +1,111 @@
|
||||
using System.Linq;
|
||||
using Continentis.MainGame.Card;
|
||||
using Continentis.MainGame.UI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Continentis.MainGame.Character
|
||||
{
|
||||
public abstract partial class CombatBuffBase : CharacterBuffBase
|
||||
{
|
||||
public CardLogicBase sourceCard;
|
||||
|
||||
public CountSubmodule actionCountSubmodule;
|
||||
public CountSubmodule combatRoundTimeSubmodule;
|
||||
|
||||
public UnitedStackSubmodule unitedStackSubmodule;
|
||||
public IndependentStackSubmodule independentStackSubmodule;
|
||||
public CoreAttributeSubmodule coreAttributeSubmodule;
|
||||
public GeneralAttributeSubmodule generalAttributeSubmodule;
|
||||
public StatusSubmodule statusSubmodule;
|
||||
}
|
||||
|
||||
public partial class CombatBuffBase
|
||||
{
|
||||
public sealed override bool OnBuffApply(out BuffBase<CharacterBase> existingBuff)
|
||||
{
|
||||
throw new System.NotImplementedException("请使用类型约束更强的OnBuffApply方法");
|
||||
}
|
||||
|
||||
public virtual bool OnBuffApply(out CombatBuffBase existingBuff)
|
||||
{
|
||||
throw new System.NotImplementedException(); //需要在子类中实现
|
||||
}
|
||||
|
||||
public override void OnAfterFirstApply()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void OnBuffRemove()
|
||||
{
|
||||
RefreshAttributes();
|
||||
iconSubmodule?.Remove();
|
||||
}
|
||||
}
|
||||
|
||||
public partial class CombatBuffBase
|
||||
{
|
||||
protected bool FindExistingSameBuff<T>(out T existingBuff) where T : CharacterBuffBase
|
||||
{
|
||||
return FindExistingSameBuff(out existingBuff, attachedCharacter.combatBuffSubmodule.buffList);
|
||||
}
|
||||
|
||||
public override void Apply(CharacterBase attachedCharacter, CharacterBase sourceCharacter = null)
|
||||
{
|
||||
this.Apply(attachedCharacter, sourceCharacter, null);
|
||||
}
|
||||
|
||||
public void Apply(CharacterBase attachedCharacter, CharacterBase sourceCharacter = null, CardLogicBase sourceCard = null)
|
||||
{
|
||||
this.attachedCharacter = attachedCharacter;
|
||||
this.sourceCharacter = sourceCharacter;
|
||||
this.sourceCard = sourceCard;
|
||||
|
||||
if (OnBuffApply(out CombatBuffBase existingBuff))
|
||||
{
|
||||
this.attachedCharacter.combatBuffSubmodule.buffList.Add(this);
|
||||
|
||||
OnAfterFirstApply();
|
||||
|
||||
if (iconSubmodule != null)
|
||||
{
|
||||
(attachedCharacter.characterView.hudContainer.enablingHUDs["CharacterBuffCollection"] as HUD_CharacterBuffCollection)
|
||||
?.AddBuffIcon(this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
existingBuff.iconSubmodule?.buffIcon.UpdateIcon();
|
||||
}
|
||||
|
||||
RefreshAttributes();
|
||||
iconSubmodule?.Update();
|
||||
}
|
||||
|
||||
public override void Remove()
|
||||
{
|
||||
OnBuffRemove();
|
||||
this.attachedCharacter.combatBuffSubmodule.buffList.Remove(this);
|
||||
}
|
||||
|
||||
public override void UntriggerRemove()
|
||||
{
|
||||
this.attachedCharacter.combatBuffSubmodule.buffList.Remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
public partial class CombatBuffBase
|
||||
{
|
||||
private void RefreshAttributes()
|
||||
{
|
||||
if (coreAttributeSubmodule != null)
|
||||
{
|
||||
coreAttributeSubmodule.RefreshAllModifiedAttributes();
|
||||
}
|
||||
else
|
||||
{
|
||||
generalAttributeSubmodule?.RefreshAllModifiedAttributes();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3a342cc1db63a104da3bc2e09ba35be3
|
||||
Reference in New Issue
Block a user