using System; using System.Collections.Generic; using System.Linq; using Cielonos.MainGame.Characters; using SLSUtilities.General; using SLSUtilities.FunctionalAnimation; using UnityEngine; namespace Cielonos.MainGame { public static partial class Attack { public enum AttackType { Energy = 1, Kinetics = 2, Explosion = 3, Magic = 4, Pure = 5, Blank = 6, // 代表不具有特定攻击类型的伤害,例如持续伤害、反伤等 } public static string AttackTypeToString(this AttackType attackType) { return attackType switch { AttackType.Energy => "Energy", AttackType.Kinetics => "Kinetics", AttackType.Explosion => "Explosion", AttackType.Magic => "Magic", AttackType.Pure => "Pure", AttackType.Blank => "Blank", _ => throw new ArgumentOutOfRangeException(nameof(attackType), attackType, null) }; } } public enum BreakthroughType { None = 0, Weak = 10, Medium = 20, Heavy = 30, Disruption = 40, Forced = 50, Unstoppable = 100 // 不可用于攻击,只能用于防御状态,表示无法被打断 } public static class Breakthrough { public static readonly List Types = new List() { BreakthroughType.None, BreakthroughType.Weak, BreakthroughType.Medium, BreakthroughType.Heavy, BreakthroughType.Disruption, BreakthroughType.Forced, BreakthroughType.Unstoppable }; public static List GetLowerTypes(BreakthroughType type) { return Types.Where(t => t < type).ToList(); } public static List GetEqualOrLowerTypes(BreakthroughType type) { return Types.Where(t => t <= type).ToList(); } public static List GetHigherTypes(BreakthroughType type) { return Types.Where(t => t > type).ToList(); } public static List GetEqualOrHigherTypes(BreakthroughType type) { return Types.Where(t => t >= type).ToList(); } } public class AttackValue : ICloneable { public CharacterBase attacker; public bool isCritical; public float damage; public Attack.AttackType attackType; public BreakthroughType breakthroughType; public DisruptionType disruptionType; public List tags; public float damageMultiplier = 1f; public float additionalFlatDamage = 0f; public AttackValue(CharacterBase attacker, bool isCritical, float damage, Attack.AttackType attackType, DisruptionType disruptionType = DisruptionType.None, BreakthroughType breakthroughType = BreakthroughType.None, List tags = null) { this.attacker = attacker; this.isCritical = isCritical; this.damage = damage; this.attackType = attackType; this.disruptionType = disruptionType; this.breakthroughType = breakthroughType; this.tags = tags != null ? new List(tags) : new List(); } public AttackValue Clone() { AttackValue cloned = new AttackValue(attacker, isCritical, damage, attackType, disruptionType, breakthroughType, tags); cloned.damageMultiplier = this.damageMultiplier; cloned.additionalFlatDamage = this.additionalFlatDamage; return cloned; } } }