Files
Cielonos/Assets/Scripts/MainGame/AttackArea/AttackInfo/AttackInfo.cs

118 lines
3.8 KiB
C#
Raw Normal View History

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