本文整理汇总了C#中Character.BeRevHit方法的典型用法代码示例。如果您正苦于以下问题:C# Character.BeRevHit方法的具体用法?C# Character.BeRevHit怎么用?C# Character.BeRevHit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Character
的用法示例。
在下文中一共展示了Character.BeRevHit方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddTdam
public static int AddTdam(Character attacker, Character target, int damage, bool check, float tdamBaseValue, float tdamPerValue, NfSkill.TDamageType tdamType, string HitEffect)
{
float tdam = tdamBaseValue;
float dam = 0f;
float per = tdamPerValue;
switch (tdamType)
{
case TDamageType.LowHPHighDam:
{
dam += damage * (tdam - (float)target.HP / (float)target.MaxHp);
} break;
case TDamageType.Real:
{
dam += damage + tdam;
} break;
case TDamageType.HuanXue:
{
bool can = true;
if (target.isMonster)
{
if (target.monsterType != Monster.MonsterType.Normal)
{
can = false;
}
}
if (can)
{
dam = damage + (int)(tdam * target.HP);
if (!check)
{
float val = tdam * attacker.HP;
attacker.BeRevHit(target, (int)val, HitEffect, null, HpLabelContainer.HitType.HuanXue);
}
}
else
{
dam = damage;
}
} break;
case TDamageType.PercentHPTrigger:
{
dam += damage;
float cper = (float)target.HP / (float)target.MaxHp;
if (cper <= per)
dam += tdam;
} break;
case TDamageType.AddPercentHPDam:
{
bool can = true;
if (target.isMonster)
{
if (target.monsterType != Monster.MonsterType.Normal)
{
can = false;
}
}
if (!can)
{
dam += damage;
}
else
{
dam += damage + tdam * target.MaxHp;
}
} break;
default:
{
dam = damage;
}break;
}
return (int)dam;
}
示例2: HandleBeHit
// 被攻击时执行
public override int HandleBeHit(Character attacker, int damage, int addAnger)
{
owner.PlayEffect(HitEffect, 3f);
owner.PlaySound(Sound);
if (damage == 0)
return damage;
owner.ShowXiShou();
int rdam = (int)(TotalValue + damage * Percent);
attacker.BeRevHit(owner, rdam, HitEffect, "hit", HpLabelContainer.HitType.FanShang);
--count;
if (count <= 0)
OnEnd();
return 0;
}
示例3: AddDamage
public int AddDamage(Character attacker, int damage)
{
float dam = damage;
JsonData valueJson = null;
JsonData growJson = null;
try
{
valueJson = JsonMapper.ToObject(buffdata.Value);
growJson = JsonMapper.ToObject(buffdata.Grow);
}
catch (System.Exception)
{
#if UNITY_EDITOR
MessageBox.Show("buff参数错误", "buff(" + id + ") " + "Value和Grow参数错误");
Debug.Log("buff(" + id + ") " + "Value和Grow参数错误");
#endif
return damage;
}
if (valueJson.IsArray && growJson.IsArray)
{
dam = 0f;
for (int i = 0; i < valueJson.Count; ++i)
{
int t = (int)valueJson[i][0];
float v = (float)valueJson[i][1];
v = v + (float)growJson[i] * lv;
switch ((DamageType)t)
{
case DamageType.PercentHPDam:
{
dam += damage * (v - (float)owner.HP / (float)owner.MaxHp);
} break;
case DamageType.Real:
{
dam += damage + v;
} break;
case DamageType.HuanXue:
{
if (owner.isMonster)
{
if (owner.monsterType == Monster.MonsterType.Boss)
{
dam += damage;
}
else
{
dam += damage + v * owner.HP;
float val = v * attacker.HP;
attacker.BeRevHit(owner, (int)val, HitEffect);
}
}
else
{
dam += damage + v * owner.HP;
float val = v * attacker.HP;
attacker.BeRevHit(owner, (int)val, HitEffect);
}
} break;
case DamageType.PercentHPTrigger:
{
dam += damage;
float per = (float)owner.HP / (float)owner.MaxHp;
if (per <= Percent/100f)
dam += v;
} break;
}
}
}
return (int)dam;
}