private int DoEffect(SkillInfo info, ActorController caster, ActorController target) { long num = 0L; for (int i = 0; i < info.EffectType.Count; i++) { if (info.EffectType[i] != 0) { if (info.Rate[i] >= 10000 || UtilFunc.RangeRandom(0, 10000) <= info.Rate[i]) { switch (info.EffectType[i]) { case 2: target.AddBuff(info.Value3[i], caster); goto IL_143; case 4: num += (long)caster.CalculateDamage(info.Value1[i], info.Value2[i], target); goto IL_143; case 5: num += (long)caster.CalculateDamage(info.Value1[i], info.Value2[i], target); goto IL_143; } global::Debug.LogError(new object[] { string.Concat(new object[] { "SkillID = [", info.ID, "] invalid EffectType = [", info.EffectType[i], "]" }) }); } } IL_143:; } Singleton<ActionMgr>.Instance.PlayHitAction(caster, info, target); int num2 = 0; float num3 = info.ThreatBase; if (num > 0L) { bool flag = caster.CanCrit(target); if (flag) { num = num * 150L / 100L; } num = num * (long)(10000 + caster.DamageMod) / 10000L; num2 = target.DoDamage(num, caster, ActorController.CanHitBack(info)); if (target.UIText != null && num2 > 0) { if (target.FactionType == ActorController.EFactionType.ERed) { if (flag) { GameUIManager.mInstance.HUDTextMgr.RequestShow(target, EShowType.EST_CriticalDamage, num2, null, 0); } else { GameUIManager.mInstance.HUDTextMgr.RequestShow(target, EShowType.EST_Damage, num2, null, 0); } } else { GameUIManager.mInstance.HUDTextMgr.RequestShow(target, EShowType.EST_Damage, -num2, null, 2); } } num3 += (float)num2 * info.ThreatCoef; } if (num3 > 0f && caster.IsHostileTo(target)) { target.AiCtrler.ThreatMgr.AddThreat(caster, num3); } return num2; }
public static ActorController FindMinDistEnemy(ActorController actor, float findDist) { if (actor == null) { return null; } float num = 3.40282347E+38f; ActorController result = null; List<ActorController> actors = Globals.Instance.ActorMgr.Actors; for (int i = 0; i < actors.Count; i++) { ActorController actorController = actors[i]; if (actorController && !actorController.IsDead && (!actorController.IsImmunity || actorController.ActorType != ActorController.EActorType.EMonster) && actor.IsHostileTo(actorController)) { float num2 = actor.GetDistance2D(actorController); if (num2 <= findDist) { if (actorController.ActorType == ActorController.EActorType.EPlayer) { num2 *= 1.5f; if (num2 < 1.5f) { num2 = 1.5f; } } if (num2 < num) { num = num2; result = actorController; } } } } return result; }