1
This commit is contained in:
@@ -13,27 +13,37 @@ namespace Net.Project.B.Buff
|
||||
public struct AddHp : IBuff
|
||||
{
|
||||
public float Value { get; set; }
|
||||
public override bool Equals(object obj) => obj?.GetType() == GetType();
|
||||
public override int GetHashCode() => GetType().GetHashCode();
|
||||
}
|
||||
[Serializable]
|
||||
public struct InfiniteAp : IBuff
|
||||
{
|
||||
public float Value { get; set; }
|
||||
public override bool Equals(object obj) => obj?.GetType() == GetType();
|
||||
public override int GetHashCode() => GetType().GetHashCode();
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct Hunger : IBuff
|
||||
{
|
||||
public float Value { get; set; }
|
||||
public override bool Equals(object obj) => obj?.GetType() == GetType();
|
||||
public override int GetHashCode() => GetType().GetHashCode();
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct Thirsty : IBuff
|
||||
{
|
||||
public float Value { get; set; }
|
||||
public override bool Equals(object obj) => obj?.GetType() == GetType();
|
||||
public override int GetHashCode() => GetType().GetHashCode();
|
||||
}
|
||||
[Serializable]
|
||||
public struct Bleeding:IBuff
|
||||
{
|
||||
public float Value { get; set; }
|
||||
public override bool Equals(object obj) => obj?.GetType() == GetType();
|
||||
public override int GetHashCode() => GetType().GetHashCode();
|
||||
}
|
||||
}
|
||||
|
@@ -35,6 +35,19 @@ namespace Net.Project.B.Buff
|
||||
|
||||
public void AddBuff(IBuff buff, float duration = 0)
|
||||
{
|
||||
for (var i = 0; i <_count ; i++)
|
||||
{
|
||||
ref var x = ref _buff[i];
|
||||
if (x.GetType() == buff.GetType())
|
||||
{
|
||||
x.Value += buff.Value;
|
||||
|
||||
_durations[buff] = _durations.GetValueOrDefault(buff) + duration;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_buff[_count++] = buff;
|
||||
OnBuffAdded?.Invoke(buff);
|
||||
if (duration > 0)
|
||||
|
Reference in New Issue
Block a user