2
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
3.9 KiB
C#

using UnityEngine;
using Articy.Touhou;
namespace Game
{
public static partial class UtilBuff
{
private static void BuffEffect(BuffData data, BuffEffectData buffData)
{
var obj = buffData.BuffObj;
switch (obj)
{
case IObjectWithFeatureBuffEffectAttack _:
BuffEffectAttack(data, buffData);
break;
case IObjectWithFeatureBuffEffectProperty _:
BuffEffectProperty(data, buffData);
break;
case IObjectWithFeatureBuffEffectAddBuff _:
BuffEffectAddBuff(data, buffData);
break;
case IObjectWithFeatureBuffEffectClearLevel _:
BuffEffectClearLevel(data, buffData);
break;
case IObjectWithFeatureBuffEffectSetSpeed _:
BuffEffectSetSpeed(data, buffData);
break;
}
}
private static void BuffEffectAttack(BuffData data, BuffEffectData buffData)
{
var obj = buffData.BuffObj;
var buffAttack = ((IObjectWithFeatureBuffEffectAttack)obj).GetFeatureBuffEffectAttack();
var owner = buffData.Entity;
var target = buffData.Target;
target.skill.HitInfo.Add(new SkillHitInfo()
{
SkillParam = new AttackBehaviour()
{
isFlow = buffAttack.IsFlow,
damageRate = buffAttack.NumberValue * (1 + buffAttack.NumberValueLevel * data.Level.Value),
hitId = 0,
},
OwnerEntity = owner.ID(),
HitEntity = target.ID(),
HitDir = Vector3.up,
IsDealed = false,
SkillId = "",
Performance = (uint)0,
IsBreak = buffAttack.IsStun,
});
}
private static void BuffEffectProperty(BuffData data, BuffEffectData buffData)
{
var obj = buffData.BuffObj;
var buffProperty = ((IObjectWithFeatureBuffEffectProperty)obj).GetFeatureBuffEffectProperty();
var target = buffData.Target;
var property = target.property.Property[(EProperty)buffProperty.Property];
if ((EPropertyChangeType)buffProperty.PropertyChangeType == EPropertyChangeType.Value)
{
property.Value += (int)buffProperty.NumberValue;
}
else
{
property.Percent += (int)buffProperty.NumberValue;
}
}
private static void BuffEffectAddBuff(BuffData data, BuffEffectData buffData)
{
var obj = buffData.BuffObj;
var buffAddBuff = ((IObjectWithFeatureBuffEffectAddBuff)obj).GetFeatureBuffEffectAddBuff();
var owner = buffData.Entity;
var target = buffData.Target;
Util.AddBuff(owner.ID(), target.ID(), buffAddBuff.Buff.TechnicalName, 0, buffAddBuff.BuffLevel * (1 + data.Level.Value));
}
private static void BuffEffectClearLevel(BuffData data, BuffEffectData buffData)
{
var obj = buffData.BuffObj;
var buffClearLevel = ((IObjectWithFeatureBuffEffectClearLevel)obj).GetFeatureBuffEffectClearLevel();
var owner = buffData.Entity;
var target = buffData.Target;
Util.RemoveBuff(target.ID(), data.BuffId);
}
private static void BuffEffectSetSpeed(BuffData data, BuffEffectData buffData)
{
var obj = buffData.BuffObj;
var buffSetSpeed = ((IObjectWithFeatureBuffEffectSetSpeed)obj).GetFeatureBuffEffectSetSpeed();
var owner = buffData.Entity;
var target = buffData.Target;
target.move.Velocity = target.hp.LastDamageDir;
}
}
}