add:添加buff

master
zxl 2025-02-17 18:00:01 +08:00
parent 2da00cfaa2
commit b301bd5265
24 changed files with 540 additions and 259 deletions

8
Assets/Configs/Buff.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7d340dea7ed4bbe49947498a16e3d524
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,47 @@
using System.IO;
using Game;
using Sirenix.OdinInspector;
using Sirenix.OdinInspector.Editor;
using UnityEditor;
using UnityEngine.Serialization;
namespace ZEditor
{
public class BuffEditor : OdinEditorWindow
{
[MenuItem("Game/Editor Buff Editor")]
static void GetWindow()
{
GetWindow<BuffEditor>("BuffEditor").Show();
}
[LabelText("路径")] [FolderPath] public string savePath = "Assets/Configs/Buff";
[LabelText("Buff配置")] [ReadOnly] public string title = "Buff配置";
[LabelText("基本属性")] public BuffConfig Buff = new BuffConfig();
[Button("保存Config")]
void SaveConfig()
{
if (!Directory.Exists(savePath))
Directory.CreateDirectory(savePath);
if (string.IsNullOrEmpty(Buff.Name))
return;
string path = $"{savePath}/{Buff.Name}.asset";
var config = CreateInstance<BuffConfigObject>();
config.config = Buff;
AssetDatabase.CreateAsset(config, path);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
Refresh();
}
void Refresh()
{
Buff = new BuffConfig();
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0d8f3ba130bc46bda35cada586decfac
timeCreated: 1739784075

View File

@ -19,7 +19,7 @@ namespace ZEditor
[LabelText("路径")] [FolderPath] public string savePath = "Assets/Configs/Character";
[LabelText("英雄配置")] [ReadOnly] public string title = "英雄配置";
[LabelText("基本属性")] public HeroConfig HeroConfig = new HeroConfig();
[LabelText("基本属性")] public CharacterConfig HeroConfig = new CharacterConfig();
[Button("保存Config")]
void SaveConfig()
@ -31,8 +31,8 @@ namespace ZEditor
return;
string path = $"{savePath}/{HeroConfig.BasicStats.Name}.asset";
var config = CreateInstance<HeroConfigObject>();
config.heroConfig = HeroConfig;
var config = CreateInstance<CharacterConfigObject>();
config.config = HeroConfig;
AssetDatabase.CreateAsset(config, path);
AssetDatabase.SaveAssets();
@ -42,7 +42,7 @@ namespace ZEditor
void Refresh()
{
HeroConfig = new HeroConfig();
HeroConfig = new CharacterConfig();
}
}

View File

@ -31,7 +31,7 @@ namespace ZEditor
string path = $"{savePath}/{Equipment.Name}.asset";
var config = CreateInstance<EquipmentConfigObject>();
config.equipmentConfig = Equipment;
config.config = Equipment;
AssetDatabase.CreateAsset(config, path);
AssetDatabase.SaveAssets();

View File

@ -1,43 +1,52 @@
using System.Collections.Generic;
using UnityEngine;
namespace Game
{
public abstract class Buff
public class Buff
{
// 血量、蓝量、攻击力、防御力、攻击速度、回蓝速度、回血速度、
public string BuffName;
public float BuffDuration; // Buff 持续时间(秒)
public float TimeRemaining; // 剩余时间
public Character ApplyCharacter;
public string Name; // Buff的名称例如"战士"、"游侠"等
public string Description; // Buff的描述
public List<BuffEffect> Effects; // Buff带来的效果可以是多个效果
protected Buff(string buffName, float buffDuration)
public Buff(string name, string description, List<BuffEffect> effects)
{
BuffName = buffName;
BuffDuration = buffDuration;
Name = name;
Description = description;
Effects = effects;
}
// Buff 更新,减少剩余时间
public void Update(float deltaTime)
{
TimeRemaining -= deltaTime;
if (TimeRemaining <= 0)
{
OnBuffExpire();
}
} // Buff 过期时调用
protected virtual void OnBuffExpire()
{
Debug.Log($"{BuffName} expired!");
}
// Buff 应用效果
public abstract void ApplyEffect(Character character);
// Buff 移除效果
public abstract void RemoveEffect(Character character);
// // 血量、蓝量、攻击力、防御力、攻击速度、回蓝速度、回血速度、
// public string BuffName;
// public float BuffDuration; // Buff 持续时间(秒)
// public float TimeRemaining; // 剩余时间
// public Character ApplyCharacter;
//
// protected Buff(string buffName, float buffDuration)
// {
// BuffName = buffName;
// BuffDuration = buffDuration;
// }
//
// // Buff 更新,减少剩余时间
// public void Update(float deltaTime)
// {
// TimeRemaining -= deltaTime;
// if (TimeRemaining <= 0)
// {
// OnBuffExpire();
// }
// } // Buff 过期时调用
//
// protected virtual void OnBuffExpire()
// {
// Debug.Log($"{BuffName} expired!");
// }
//
// // Buff 应用效果
// public abstract void ApplyEffect(Character character);
//
// // Buff 移除效果
// public abstract void RemoveEffect(Character character);
}
}

View File

@ -0,0 +1,136 @@
using System.Collections.Generic;
namespace Game
{
public class FactionBuffManager
{
private Dictionary<string, Buff> activeBuffs; // 激活的buff列表
public FactionBuffManager()
{
activeBuffs = new Dictionary<string, Buff>();
}
// 处理职业或种族buff的激活
public void CheckBuffs(List<Character> characters)
{
Dictionary<string, int> countByFaction = new Dictionary<string, int>();
// 统计每个职业/种族的数量
foreach (var character in characters)
{
foreach (var faction in character.Config.Professions) // 职业/种族
{
if (!countByFaction.ContainsKey(faction))
{
countByFaction[faction] = 0;
}
countByFaction[faction]++;
}
}
// 遍历每个职业/种族查看是否满足Buff的条件
foreach (var entry in countByFaction)
{
string factionName = entry.Key;
int count = entry.Value;
// 如果满足Buff条件就激活Buff
Buff factionBuff = GetBuffByFaction(factionName, count);
if (factionBuff != null)
{
if (!activeBuffs.ContainsKey(factionName))
{
activeBuffs.Add(factionName, factionBuff);
ApplyBuffToCharacters(factionBuff, characters);
}
}
else
{
// 如果该buff不再满足条件则去除
if (activeBuffs.ContainsKey(factionName))
{
activeBuffs.Remove(factionName);
RemoveBuffFromCharacters(factionName, characters);
}
}
}
}
// 根据职业/种族数量获取对应的Buff
private Buff GetBuffByFaction(string factionName, int count)
{
// 你可以根据预设的条件例如战士类英雄数量达到3个给全体战士加护甲等来决定返回哪个Buff
if (factionName == "战士" && count >= 3)
{
return new Buff("战士Buff", "战士增加30%护甲", new List<BuffEffect>
{
new BuffEffect(BuffEffectType.Armor, 0.3f, true)
});
}
return null;
}
private void ApplyBuffToCharacters(Buff buff, List<Character> characters)
{
foreach (var character in characters)
{
// 遍历角色的Factions如果该角色属于该buff的职业/种族应用buff
if (character.Config.Professions.Name.Contains(buff.Name))
{
foreach (var effect in buff.Effects)
{
ApplyEffectToCharacter(effect, character);
}
}
}
}
private void RemoveBuffFromCharacters(string factionName, List<Character> characters)
{
// 遍历角色并移除buff的效果
foreach (var character in characters)
{
if (character.Config.Professions.Name.Contains(factionName))
{
foreach (var effect in activeBuffs[factionName].Effects)
{
RemoveEffectFromCharacter(effect, character);
}
}
}
}
private void ApplyEffectToCharacter(BuffEffect effect, Character character)
{
switch (effect.EffectType)
{
case BuffEffectType.AttackDamage:
character.OtherAttackDamage +=
effect.IsPercentage ? character.OtherAttackDamage * effect.Value : effect.Value;
break;
case BuffEffectType.Armor:
character.OtherArmor += effect.IsPercentage ? character.OtherArmor * effect.Value : effect.Value;
break;
// 其他效果的处理逻辑...
}
}
private void RemoveEffectFromCharacter(BuffEffect effect, Character character)
{
switch (effect.EffectType)
{
case BuffEffectType.AttackDamage:
character.OtherAttackDamage -=
effect.IsPercentage ? character.OtherAttackDamage * effect.Value : effect.Value;
break;
case BuffEffectType.Armor:
character.OtherArmor -= effect.IsPercentage ? character.OtherArmor * effect.Value : effect.Value;
break;
// 其他效果的移除逻辑...
}
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a8ae173a145949c9a6d40b3976f9eb36
timeCreated: 1739784251

View File

@ -0,0 +1,178 @@
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace Game
{
public interface ICharacter
{
public int AttackDamage { get; }
public float AttackSpeed { get; }
public int Mana { get; }
public int StartingMana { get; }
public int AttackRange { get; }
public int CriticalHitChance { get; }
public int Armor { get; }
public int MagicResistance { get; }
}
public class Character : ICharacter
{
private int _level;
CharacterConfig _config;
public Character(CharacterConfig config)
{
this._config = config;
}
public int AttackDamage => _config.BasicStats.AttackDamage[_level];
public float AttackSpeed => _config.BasicStats.AttackSpeed[_level];
public int Mana => _config.BasicStats.Mana[_level];
public int StartingMana => _config.BasicStats.StartingMana[_level];
public int AttackRange => _config.BasicStats.AttackRange[_level];
public int CriticalHitChance => _config.BasicStats.CriticalHitChance[_level];
public int Armor => _config.BasicStats.Armor[_level];
public int MagicResistance => _config.BasicStats.MagicResistance[_level];
public CharacterConfig Config => _config;
// tmp Other
public float OtherAttackDamage;
public float OtherArmor;
}
/// <summary>
/// 角色不具备战斗逻辑,所有战斗逻辑由战斗系统完成
/// 自走棋的角色不具备自动回血功能只能通过技能buff进行回血
/// </summary>
// public interface ICharacter
// {
// CharacterConfig Config { get; }
// GameObject Go { get; }
//
// string Name { get; }
// string Description { get; }
// int Level { get; }
// float Hp { get; }
// float Mp { get; }
// float Attack { get; }
// float Defense { get; }
// float MoveSpeed { get; }
// float AttackSpeed { get; }
// bool IsDead { get; }
//
// IReadOnlyList<IEquipment> Equipments { get; }
// IReadOnlyList<Buff> Buffs { get; }
//
// bool AddEquipment(IEquipment equipment);
// bool RemoveAllEquipment(out List<IEquipment> equipments);
//
// void OnAttack(Character character);
// }
//
// public class Character : ICharacter
// {
// private CharacterConfig _characterConfig;
// private GameObject _go;
// private List<IEquipment> _equipments;
// private string _name;
// private string _description;
// private int _level;
// private float _hp;
// private float _mp;
// private float _attack;
// private float _defense;
// private float _moveSpeed;
// private float _attackSpeed;
//
// private float tmphp;
// private float tmpmp;
// private float tmpattack;
// private float tmpdefense;
// private float tmpmoveSpeed;
// private float tmpattackSpeed;
// private IReadOnlyList<Buff> _buffs;
//
// public CharacterConfig Config => _characterConfig;
//
// public GameObject Go => _go;
//
// public string Name => _name;
//
// public string Description => _description;
//
// public int Level => _level;
//
// public float Hp => _hp + tmphp;
//
// public float Mp => _mp + tmpmp;
//
// public float Attack => _attack + tmpattack;
//
// public float Defense => _defense + tmpdefense;
//
// public float MoveSpeed => _moveSpeed + tmpmoveSpeed;
//
// public float AttackSpeed => _attackSpeed + tmpattackSpeed;
//
// public bool IsDead => _hp <= 0;
//
// public IReadOnlyList<IEquipment> Equipments => _equipments;
//
// public IReadOnlyList<Buff> Buffs => _buffs;
//
// public Character(CharacterConfig characterConfig, GameObject go)
// {
// _characterConfig = characterConfig;
// _go = go;
// _name = _characterConfig.BasicStats.Name;
// _description = _characterConfig.BasicStats.Description;
// // _hp = _characterConfig.MaxHp;
// // _mp = _characterConfig.MaxMp;
// _equipments = new List<IEquipment>();
// }
//
// public bool AddEquipment(IEquipment equipment)
// {
// // if (_equipments.Count >= _characterConfig.MaxEquipmentCount)
// // return false;
//
// _equipments.Add(equipment);
// // tmphp += equipment.Config.Hp;
// // tmpmp += equipment.Config.Mp;
// // tmpattack += equipment.Config.Attack;
// // tmpdefense += equipment.Config.Defense;
// // tmpmoveSpeed += equipment.Config.MoveSpeed;
// // tmpattackSpeed += equipment.Config.AttackSpeed;
// return true;
// }
//
// public bool RemoveAllEquipment(out List<IEquipment> equipments)
// {
// equipments = _equipments.ToList();
// // foreach (var equipment in _equipments)
// // {
// // tmphp -= equipment.Config.Hp;
// // tmpmp -= equipment.Config.Mp;
// // tmpattack -= equipment.Config.Attack;
// // tmpdefense -= equipment.Config.Defense;
// // tmpmoveSpeed -= equipment.Config.MoveSpeed;
// // tmpattackSpeed -= equipment.Config.AttackSpeed;
// // }
//
// _equipments.Clear();
// return true;
// }
//
// public void OnAttack(Character target)
// {
// foreach (var equipment in _equipments)
// {
//
// }
// }
// }
}

View File

@ -1,138 +0,0 @@
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace Game
{
/// <summary>
/// 角色不具备战斗逻辑,所有战斗逻辑由战斗系统完成
/// 自走棋的角色不具备自动回血功能只能通过技能buff进行回血
/// </summary>
public interface ICharacter
{
HeroConfig Config { get; }
GameObject Go { get; }
string Name { get; }
string Description { get; }
int Level { get; }
float Hp { get; }
float Mp { get; }
float Attack { get; }
float Defense { get; }
float MoveSpeed { get; }
float AttackSpeed { get; }
bool IsDead { get; }
IReadOnlyList<IEquipment> Equipments { get; }
IReadOnlyList<Buff> Buffs { get; }
bool AddEquipment(IEquipment equipment);
bool RemoveAllEquipment(out List<IEquipment> equipments);
void OnAttack(Character character);
}
public class Character : ICharacter
{
private HeroConfig _characterConfig;
private GameObject _go;
private List<IEquipment> _equipments;
private string _name;
private string _description;
private int _level;
private float _hp;
private float _mp;
private float _attack;
private float _defense;
private float _moveSpeed;
private float _attackSpeed;
private float tmphp;
private float tmpmp;
private float tmpattack;
private float tmpdefense;
private float tmpmoveSpeed;
private float tmpattackSpeed;
private IReadOnlyList<Buff> _buffs;
public HeroConfig Config => _characterConfig;
public GameObject Go => _go;
public string Name => _name;
public string Description => _description;
public int Level => _level;
public float Hp => _hp + tmphp;
public float Mp => _mp + tmpmp;
public float Attack => _attack + tmpattack;
public float Defense => _defense + tmpdefense;
public float MoveSpeed => _moveSpeed + tmpmoveSpeed;
public float AttackSpeed => _attackSpeed + tmpattackSpeed;
public bool IsDead => _hp <= 0;
public IReadOnlyList<IEquipment> Equipments => _equipments;
public IReadOnlyList<Buff> Buffs => _buffs;
public Character(HeroConfig characterConfig, GameObject go)
{
_characterConfig = characterConfig;
_go = go;
_name = _characterConfig.BasicStats.Name;
_description = _characterConfig.BasicStats.Description;
// _hp = _characterConfig.MaxHp;
// _mp = _characterConfig.MaxMp;
_equipments = new List<IEquipment>();
}
public bool AddEquipment(IEquipment equipment)
{
// if (_equipments.Count >= _characterConfig.MaxEquipmentCount)
// return false;
_equipments.Add(equipment);
// tmphp += equipment.Config.Hp;
// tmpmp += equipment.Config.Mp;
// tmpattack += equipment.Config.Attack;
// tmpdefense += equipment.Config.Defense;
// tmpmoveSpeed += equipment.Config.MoveSpeed;
// tmpattackSpeed += equipment.Config.AttackSpeed;
return true;
}
public bool RemoveAllEquipment(out List<IEquipment> equipments)
{
equipments = _equipments.ToList();
// foreach (var equipment in _equipments)
// {
// tmphp -= equipment.Config.Hp;
// tmpmp -= equipment.Config.Mp;
// tmpattack -= equipment.Config.Attack;
// tmpdefense -= equipment.Config.Defense;
// tmpmoveSpeed -= equipment.Config.MoveSpeed;
// tmpattackSpeed -= equipment.Config.AttackSpeed;
// }
_equipments.Clear();
return true;
}
public void OnAttack(Character target)
{
foreach (var equipment in _equipments)
{
}
}
}
}

View File

@ -1,55 +1,93 @@
using System.Collections.Generic;
using Sirenix.OdinInspector;
namespace Game
{
public enum BuffType
{
Buff,
DeBuff,
// None,
// 加血,
// 加蓝,
// 加攻击力,
// 加防御力,
// 加攻击速度,
// 加回蓝速度,
// 加回血速度,
}
// public enum BuffType
// {
// Buff,
// DeBuff,
// // None,
// // 加血,
// // 加蓝,
// // 加攻击力,
// // 加防御力,
// // 加攻击速度,
// // 加回蓝速度,
// // 加回血速度,
// }
//
// [System.Serializable]
// public class BuffConfig
// {
// /// <summary>
// /// Buff ID
// /// </summary>
// public int BuffId;
//
// /// <summary>
// /// Buff名字
// /// </summary>
// public string BuffName;
//
// /// <summary>
// /// Buff类型
// /// </summary>
// public BuffType BuffType;
//
// /// <summary>
// /// 持续时间
// /// </summary>
// public float Duration;
//
// /// <summary>
// /// 每次Tick造成5点伤害
// /// </summary>
// public float DamagePerTick = 5;
//
// /// <summary>
// /// 每1秒Tick一次
// /// </summary>
// public float TickInterval = 1;
//
// /// <summary>
// /// 最大层数
// /// </summary>
// public int MaxLayerNumber = 1;
// }
[System.Serializable]
public class BuffConfig
{
/// <summary>
/// Buff ID
/// </summary>
public int BuffId;
[LabelText("Buff的名称")] public string Name; // Buff的名称例如"战士"、"游侠"等
[LabelText("Buff的描述")] public string Description; // Buff的描述
[LabelText("Buff带来的效果可以是多个效果")] public List<BuffEffect> Effects; // Buff带来的效果可以是多个效果
}
/// <summary>
/// Buff名字
/// </summary>
public string BuffName;
[System.Serializable]
public class BuffEffect
{
[LabelText("效果类型")] public BuffEffectType EffectType; // 增加攻击力、增加生命值等
[LabelText("效果值,可以是百分比或固定数值")] public float Value; // 效果值,可以是百分比或固定数值
[LabelText("是否是百分比增益")] public bool IsPercentage; // 是否是百分比增益
/// <summary>
/// Buff类型
/// </summary>
public BuffType BuffType;
public BuffEffect(BuffEffectType effectType, float value, bool isPercentage)
{
EffectType = effectType;
Value = value;
IsPercentage = isPercentage;
}
}
/// <summary>
/// 持续时间
/// </summary>
public float Duration;
/// <summary>
/// 每次Tick造成5点伤害
/// </summary>
public float DamagePerTick = 5;
/// <summary>
/// 每1秒Tick一次
/// </summary>
public float TickInterval = 1;
/// <summary>
/// 最大层数
/// </summary>
public int MaxLayerNumber = 1;
public enum BuffEffectType
{
[LabelText("增加攻击力")] AttackDamage = 0, // 增加攻击力
[LabelText("增加护甲")] Armor, // 增加护甲
[LabelText("增加魔抗")] MagicResist, // 增加魔抗
[LabelText("增加生命值")] Health, // 增加生命值
[LabelText("增加攻击速度")] AttackSpeed, // 增加攻击速度
[LabelText("增加法术强度")] AbilityPower, // 增加法术强度
[LabelText("增加暴击几率")] CritChance, // 增加暴击几率
[LabelText("吸血效果")] Lifesteal, // 吸血效果
[LabelText("法力恢复")] ManaRegen // 法力恢复
}
}

View File

@ -1,10 +1,10 @@
using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEngine;
namespace Game
{
public class BuffConfigObject : ScriptableObject
{
public List<BuffConfig> configs = new List<BuffConfig>();
[LabelText("基本信息")] public BuffConfig config = new BuffConfig();
}
}

View File

@ -1,8 +1,18 @@
using System.Collections.Generic;
using System.Collections.Generic;
using Game;
using Sirenix.OdinInspector;
using UnityEngine.Serialization;
namespace Game
{
[System.Serializable]
public class CharacterConfig
{
[LabelText("基本属性")] public BasicStats BasicStats = new BasicStats();
[LabelText("技能")] public Ability Ability = new Ability();
[LabelText("职业/羁绊")] public List<Profession> Professions = new List<Profession>();
}
/// <summary>
/// 基本属性Basic Stats
/// </summary>

View File

@ -0,0 +1,10 @@
using Sirenix.OdinInspector;
using UnityEngine;
namespace Game
{
public class CharacterConfigObject : ScriptableObject
{
[LabelText("基本信息")] public CharacterConfig config;
}
}

View File

@ -10,7 +10,7 @@ namespace Game
[LabelText("装备描述")] public string Description; // 装备描述
[LabelText("装备类型")] public EquipmentType Type; // 装备类型(基础装备、合成装备)
[LabelText("装备的属性加成")] public List<StatModifier> Stats; // 装备的属性加成(攻击力、生命值等)
[LabelText("装备附带的技能效果")] public List<Effect> Effects; // 装备附带的技能效果
[LabelText("装备附带的技能效果")] public List<EquipmentEffect> Effects; // 装备附带的技能效果
}
/// <summary>
@ -55,14 +55,14 @@ namespace Game
/// 特效
/// </summary>
[System.Serializable]
public class Effect
public class EquipmentEffect
{
[LabelText("特效名称")] public string Name; // 特效名称
[LabelText("特效描述")] public string Description; // 特效描述
[LabelText("特效类型")] public EffectType EffectType; // 特效类型
[LabelText("特效类型")] public EquipmentEffectType EffectType; // 特效类型
[LabelText("特效的数值")] public float Value; // 特效的数值
public Effect(string name, string description, EffectType effectType, float value)
public EquipmentEffect(string name, string description, EquipmentEffectType effectType, float value)
{
Name = name;
Description = description;
@ -74,7 +74,7 @@ namespace Game
/// <summary>
/// 特效类型
/// </summary>
public enum EffectType
public enum EquipmentEffectType
{
[LabelText("攻击")] OnAttack = 0,
[LabelText("受伤")] OnHit,

View File

@ -1,9 +1,11 @@
using Sirenix.OdinInspector;
using UnityEngine;
using UnityEngine.Serialization;
namespace Game
{
public class EquipmentConfigObject : ScriptableObject
{
public EquipmentConfig equipmentConfig;
[LabelText("基本信息")] public EquipmentConfig config;
}
}

View File

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 467db3e1a96d4773b336e9aee1d8511d
timeCreated: 1739525465

View File

@ -1,13 +0,0 @@
using Game;
using Sirenix.OdinInspector;
namespace Game
{
[System.Serializable]
public class HeroConfig
{
[LabelText("基本属性")] public BasicStats BasicStats = new BasicStats();
[LabelText("技能")] public Ability Ability = new Ability();
[LabelText("职业/羁绊")] public Profession Profession = new Profession();
}
}

View File

@ -1,9 +0,0 @@
using UnityEngine;
namespace Game
{
public class HeroConfigObject : ScriptableObject
{
public HeroConfig heroConfig;
}
}

View File

@ -8,7 +8,7 @@ namespace Game
string Description { get; }
EquipmentType Type { get; }
List<StatModifier> Stats { get; }
List<Effect> Effects { get; }
List<EquipmentEffect> Effects { get; }
}
public class Equipment : IEquipment
@ -17,16 +17,16 @@ namespace Game
private string _description;
private EquipmentType _type;
private List<StatModifier> _stats;
private List<Effect> _effects;
private List<EquipmentEffect> _effects;
public string Name => _name; // 装备名称
public string Description => _description; // 装备描述
public EquipmentType Type => _type; // 装备类型(基础装备、合成装备)
public List<StatModifier> Stats => _stats; // 装备的属性加成(攻击力、生命值等)
public List<Effect> Effects => _effects; // 装备附带的技能效果
public List<EquipmentEffect> Effects => _effects; // 装备附带的技能效果
public Equipment(string name, string description, EquipmentType type, List<StatModifier> stats,
List<Effect> effects)
List<EquipmentEffect> effects)
{
_name = name;
_description = description;

View File

@ -14,7 +14,7 @@ namespace Game
{
return new Equipment("巨人杀手", "增加对高生命值单位的伤害", EquipmentType.Composite,
new List<StatModifier> { new StatModifier(StatType.AttackDamage, 25) },
new List<Effect> { new Effect("巨人杀手效果", "对高生命值单位造成额外伤害", EffectType.OnAttack, 0.5f) });
new List<EquipmentEffect> { new EquipmentEffect("巨人杀手效果", "对高生命值单位造成额外伤害", EquipmentEffectType.OnAttack, 0.5f) });
}
// 可以加入更多合成配方
return null;