using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
using Random = System.Random;
public enum DamageType
{
///
/// 物理伤害
///
physicalDamage,
///
/// 魔法伤害
///
magicDamage,
///
/// 无属性伤害
///
noAttributeDamage,
}
public class BUff
{
public float timeLeft = 0;//剩余时间
public float executionInterval = 0;//buff执行间隔
public float executionInterval_max = 100;//buff执行间隔
public Action Funaction;//调用的函数
public object[] value;//调用函数的值
public BuffTypeState buffTypeState = 0;
public bool hasfalg(BuffTypeState fag)
{
return (buffTypeState & fag) == fag;
}
}
public enum BuffTypeState
{
}
public class Fun : Base
{
///
/// 扣血 传入参数 目标,伤害值,攻击类型,使用者,子弹射来的方向(0是右边,1是左边)
///
///
public void bloodLoss(object[] objects,int direction=1)//目标,伤害值,攻击类型,使用者,子弹射来的方向
{
Role targetAudience = (Role)objects[0];
float harm = (float)objects[1];
DamageType damageType = (DamageType)objects[2];
Role UserObj = (Role)objects[3];
float finalDamage = harm;
switch (damageType)
{
case DamageType.physicalDamage://物理伤害
finalDamage -= targetAudience.physicalArmor;
break;
case DamageType.magicDamage://魔法伤害
finalDamage -= targetAudience.magicArmor;
break;
case DamageType.noAttributeDamage://无属性伤害
finalDamage -= 0;
break;
}
if (finalDamage < 0)
{
finalDamage = 0;
}
targetAudience.Hp -= finalDamage;
targetAudience.HurtDirectin = direction;
}
///
/// 创建一个减速(眩晕) Buff
///
/// 眩晕持续时间
/// 触发概率(0到1之间)
public Action CreateDecelerationBuff(float duration, float probability)
{
Debug.Log("!!!!!!!!!!!!!!!!!!!!!!!!!!");
return (Role targetRole) =>
{
Debug.Log("@@@@@@@@@@@@@@@@@@@@@@@@");
float temp = UnityEngine.Random.Range(0f, 1f);
Debug.LogWarning("temp="+temp);
Debug.LogWarning("duration="+duration);
Debug.LogWarning("probability=" + probability);
if (temp <= probability)
{
// 执行眩晕效果
targetRole.Navigation.StopPathDoTween(duration);
Debug.LogWarning(targetRole.name + "执行眩晕效果");
Debug.LogWarning($"Applied Deceleration for {duration} seconds to {targetRole.name}.");
}
else
{
Debug.Log($"Deceleration Buff did not trigger on {targetRole.name}.");
}
};
}
}