63 lines
2.1 KiB
C#
63 lines
2.1 KiB
C#
using System;
|
|
using GeometryTD.Entity;
|
|
using UnityEngine;
|
|
|
|
namespace GeometryTD.Definition
|
|
{
|
|
[Serializable]
|
|
public sealed class HitStatusModifierContext
|
|
{
|
|
public float BonusBurnDurationSeconds { get; set; }
|
|
public float BonusBurnDamagePerSecond { get; set; }
|
|
public float BonusSlowDurationSeconds { get; set; }
|
|
public float BonusSlowRatio { get; set; }
|
|
|
|
public void Reset()
|
|
{
|
|
BonusBurnDurationSeconds = 0f;
|
|
BonusBurnDamagePerSecond = 0f;
|
|
BonusSlowDurationSeconds = 0f;
|
|
BonusSlowRatio = 0f;
|
|
}
|
|
}
|
|
|
|
[Serializable]
|
|
public sealed class HitContext
|
|
{
|
|
public AttackPayload AttackPayload { get; set; }
|
|
public int FinalDamage { get; set; }
|
|
public bool IsCriticalHit { get; set; }
|
|
public bool IsKilled { get; set; }
|
|
public int TargetEntityId { get; set; }
|
|
public Vector3 TargetPosition { get; set; }
|
|
public int TargetCurrentHealthBeforeHit { get; set; }
|
|
public int TargetCurrentHealthAfterHit { get; set; }
|
|
public int TargetMaxHealth { get; set; }
|
|
public float TargetMoveSpeedMultiplierBeforeHit { get; set; } = 1f;
|
|
public TagType[] TargetStatusTagsBeforeHit { get; set; } = Array.Empty<TagType>();
|
|
public EnemyTagStatusRuntime TargetStatusRuntime { get; set; }
|
|
public float? CritRoll { get; set; }
|
|
public HitStatusModifierContext StatusModifierContext { get; set; } = new HitStatusModifierContext();
|
|
|
|
public bool HasTargetStatus(TagType tagType)
|
|
{
|
|
if (tagType == TagType.None || TargetStatusTagsBeforeHit == null || TargetStatusTagsBeforeHit.Length <= 0)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
for (int i = 0; i < TargetStatusTagsBeforeHit.Length; i++)
|
|
{
|
|
if (TargetStatusTagsBeforeHit[i] == tagType)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public bool HasSlowStatusBeforeHit => TargetMoveSpeedMultiplierBeforeHit < 0.999f || HasTargetStatus(TagType.Ice);
|
|
}
|
|
}
|