本文整理汇总了C#中Obj_AI_Base.CalcDamage方法的典型用法代码示例。如果您正苦于以下问题:C# Obj_AI_Base.CalcDamage方法的具体用法?C# Obj_AI_Base.CalcDamage怎么用?C# Obj_AI_Base.CalcDamage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Obj_AI_Base
的用法示例。
在下文中一共展示了Obj_AI_Base.CalcDamage方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Obj_AI_Base_OnProcessSpellCast
//.........这里部分代码省略.........
{
hero.Attacker = null;
hero.IncomeDamage -= dmg;
hero.HitTypes.Remove(HitType.Spell);
if (Activator.Origin.Item(data.SDataName + "danger").GetValue<bool>())
hero.HitTypes.Remove(HitType.Danger);
if (Activator.Origin.Item(data.SDataName + "crowdcontrol").GetValue<bool>())
hero.HitTypes.Remove(HitType.CrowdControl);
if (Activator.Origin.Item(data.SDataName + "ultimate").GetValue<bool>())
hero.HitTypes.Remove(HitType.Ultimate);
if (Activator.Origin.Item(data.SDataName + "forceexhaust").GetValue<bool>())
hero.HitTypes.Remove(HitType.ForceExhaust);
});
});
}
#endregion
}
}
}
#endregion
#region Turret Detection
if (sender.IsEnemy && sender.Type == GameObjectType.obj_AI_Turret)
{
foreach (var hero in Activator.Allies())
{
if (args.Target.NetworkId == hero.Player.NetworkId && !hero.Immunity)
{
var dmg = (int) Math.Abs(sender.CalcDamage(hero.Player, Damage.DamageType.Physical,
sender.BaseAttackDamage + sender.FlatPhysicalDamageMod));
if (sender.Distance(hero.Player.ServerPosition) <= 900)
{
if (Activator.Player.Distance(hero.Player.ServerPosition) <= 1000)
{
Utility.DelayAction.Add(450, () =>
{
hero.HitTypes.Add(HitType.TurretAttack);
hero.IncomeDamage += dmg;
Utility.DelayAction.Add(650, () =>
{
hero.Attacker = null;
hero.IncomeDamage -= dmg;
hero.HitTypes.Remove(HitType.TurretAttack);
});
});
}
}
}
}
}
#endregion
#region Minion Detection
if (sender.IsEnemy && sender.Type == GameObjectType.obj_AI_Minion)
{
foreach (var hero in Activator.Allies())
{
示例2: Obj_AI_Base_OnProcessSpellCast
//.........这里部分代码省略.........
var distance = (int) (1000 * (sender.Distance(hero.Player.ServerPosition) / data.MissileSpeed));
var endtime = data.Delay - 100 + Game.Ping / 2 + distance - (Utils.GameTimeTickCount - Casted);
Utility.DelayAction.Add((int) (endtime - (endtime * 0.3)), () =>
{
hero.Attacker = sender;
hero.HitTypes.Add(HitType.Spell);
hero.IncomeDamage +=
(float) Math.Abs(sender.GetSpellDamage(hero.Player, args.SData.Name));
foreach (var type in data.HitType)
hero.HitTypes.Add(type);
// lazy reset
Utility.DelayAction.Add((int) (endtime + 300), () =>
{
hero.Attacker = null;
hero.IncomeDamage = 0;
hero.HitTypes.Clear();
});
});
}
#endregion
}
}
}
#endregion
#region Turret Detection
if (sender.IsEnemy && sender.Type == GameObjectType.obj_AI_Turret)
{
foreach (var hero in Activator.Allies())
{
if (args.Target.NetworkId != hero.Player.NetworkId)
continue;
if (hero.Immunity)
continue;
if (sender.Distance(hero.Player.ServerPosition) <= 900 &&
Activator.Player.Distance(hero.Player.ServerPosition) <= 1000)
{
Utility.DelayAction.Add(500, () =>
{
hero.HitTypes.Add(HitType.TurretAttack);
hero.IncomeDamage =
(float) Math.Abs(sender.CalcDamage(hero.Player, Damage.DamageType.Physical,
sender.BaseAttackDamage + sender.FlatPhysicalDamageMod));
// lazy reset
Utility.DelayAction.Add(800, () =>
{
hero.Attacker = null;
hero.IncomeDamage = 0;
hero.HitTypes.Remove(HitType.TurretAttack);
});
});
}
}
}
#endregion
#region Minion Detection
if (sender.IsEnemy && sender.Type == GameObjectType.obj_AI_Minion)
{
foreach (var hero in Activator.Allies())
{
if (hero.Player.NetworkId != args.Target.NetworkId)
continue;
if (hero.Immunity)
continue;
if (hero.Player.Distance(sender.ServerPosition) <= 750 &&
Activator.Player.Distance(hero.Player.ServerPosition) <= 1000)
{
hero.HitTypes.Add(HitType.MinionAttack);
hero.MinionDamage =
(float) Math.Abs(sender.CalcDamage(hero.Player, Damage.DamageType.Physical,
sender.BaseAttackDamage + sender.FlatPhysicalDamageMod));
// lazy reset
Utility.DelayAction.Add(500, () =>
{
hero.HitTypes.Remove(HitType.MinionAttack);
hero.MinionDamage = 0;
});
}
}
}
#endregion
}
示例3: GetTarget
public static Obj_AI_Hero GetTarget(Obj_AI_Base champion,
float range,
DamageType type,
bool ignoreShieldSpells = true,
IEnumerable<Obj_AI_Hero> ignoredChamps = null,
Vector3? rangeCheckFrom = null)
{
try
{
if (ignoredChamps == null)
{
ignoredChamps = new List<Obj_AI_Hero>();
}
var damageType = (Damage.DamageType) Enum.Parse(typeof(Damage.DamageType), type.ToString());
if (_configMenu != null && IsValidTarget(
SelectedTarget, _configMenu.Item("ForceFocusSelected").GetValue<bool>() ? float.MaxValue : range,
type, ignoreShieldSpells, rangeCheckFrom))
{
return SelectedTarget;
}
if (_configMenu != null && _configMenu.Item("TargetingMode") != null &&
Mode == TargetingMode.AutoPriority)
{
var menuItem = _configMenu.Item("TargetingMode").GetValue<StringList>();
Enum.TryParse(menuItem.SList[menuItem.SelectedIndex], out Mode);
}
var targets =
HeroManager.Enemies
.FindAll(
hero =>
ignoredChamps.All(ignored => ignored.NetworkId != hero.NetworkId) &&
IsValidTarget(hero, range, type, ignoreShieldSpells, rangeCheckFrom));
switch (Mode)
{
case TargetingMode.LowHP:
return targets.MinOrDefault(hero => hero.Health);
case TargetingMode.MostAD:
return targets.MaxOrDefault(hero => hero.BaseAttackDamage + hero.FlatPhysicalDamageMod);
case TargetingMode.MostAP:
return targets.MaxOrDefault(hero => hero.BaseAbilityDamage + hero.FlatMagicDamageMod);
case TargetingMode.Closest:
return
targets.MinOrDefault(
hero =>
(rangeCheckFrom.HasValue ? rangeCheckFrom.Value : champion.ServerPosition).Distance(
hero.ServerPosition, true));
case TargetingMode.NearMouse:
return targets.Find(hero => hero.Distance(Game.CursorPos, true) < 22500); // 150 * 150
case TargetingMode.AutoPriority:
return
targets.MaxOrDefault(
hero =>
champion.CalcDamage(hero, damageType, 100) / (1 + hero.Health) * GetPriority(hero));
case TargetingMode.LessAttack:
return
targets.MaxOrDefault(
hero =>
champion.CalcDamage(hero, Damage.DamageType.Physical, 100) / (1 + hero.Health) *
GetPriority(hero));
case TargetingMode.LessCast:
return
targets.MaxOrDefault(
hero =>
champion.CalcDamage(hero, Damage.DamageType.Magical, 100) / (1 + hero.Health) *
GetPriority(hero));
}
}
catch (Exception e)
{
Console.WriteLine(e);
}
return null;
}
示例4: GetTarget
public static Obj_AI_Hero GetTarget(Obj_AI_Base champion,
float range,
IEnumerable<Obj_AI_Hero> ignoredChamps = null,
Vector3? rangeCheckFrom = null)
{
try
{
if (ignoredChamps == null)
{
ignoredChamps = new List<Obj_AI_Hero>();
}
if (_configMenu != null && IsValidTarget(
SelectedTarget, _configMenu.Item("ForceFocusSelected").GetValue<bool>() ? float.MaxValue : range,
rangeCheckFrom))
{
return SelectedTarget;
}
if (_configMenu != null && _configMenu.Item("TargetingMode") != null &&
Mode == TargetingMode.AutoPriority)
{
var menuItem = _configMenu.Item("TargetingMode").GetValue<StringList>();
Enum.TryParse(menuItem.SList[menuItem.SelectedIndex], out Mode);
}
var targets =
HeroManager.Enemies
.FindAll(
hero => !IsInvulnerable(hero) &&
ignoredChamps.All(ignored => ignored.NetworkId != hero.NetworkId) &&
IsValidTarget(hero, range, rangeCheckFrom));
switch (Mode)
{
case TargetingMode.LowHP:
return targets.MinOrDefault(hero => hero.Health);
case TargetingMode.Closest:
return
targets.MinOrDefault(
hero =>
(rangeCheckFrom.HasValue ? rangeCheckFrom.Value : champion.ServerPosition).Distance(
hero.ServerPosition, true));
case TargetingMode.AutoPriority:
return
targets.MaxOrDefault(
hero =>
champion.CalcDamage(hero, Damage.DamageType.Physical, 100)/(1 + hero.Health)*
GetPriority(hero));
case TargetingMode.LeastAttacks:
return
targets.MaxOrDefault(
hero =>
champion.CalcDamage(hero, Damage.DamageType.Physical, 100)/(1 + hero.Health)*
GetPriority(hero));
case TargetingMode.HighestPriority:
return
targets.MaxOrDefault(
hero =>
GetPriority(hero));
default:
return
targets.MaxOrDefault(
hero =>
champion.CalcDamage(hero, Damage.DamageType.Physical, 100)/(1 + hero.Health)*
GetPriority(hero));
}
}
catch (Exception e)
{
Console.WriteLine(e);
}
return null;
}
示例5: OnObjAiBaseProcessSpellCast
private static void OnObjAiBaseProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
{
try
{
if (!Enabled)
{
return;
}
var enemy = sender as AIHeroClient;
var turret = sender as Obj_AI_Turret;
foreach (
var hero in GameObjects.Heroes.Where(h => h.IsValid && IncomingDamages.ContainsKey(h.NetworkId)))
{
if (ShouldReset(hero))
{
IncomingDamages[hero.NetworkId] = 0;
continue;
}
if (enemy != null && enemy.IsValid && enemy.IsEnemy && enemy.LSDistance(hero) <= 2000f)
{
if (args.Target != null && args.Target.NetworkId.Equals(hero.NetworkId))
{
if (args.SData.IsAutoAttack())
{
AddDamage(
hero, (int)(GetTime(sender, hero, args.SData) * 0.3f),
(float)sender.LSGetAutoAttackDamage(hero, true));
}
else if (args.SData.TargettingType == SpellDataTargetType.Unit ||
args.SData.TargettingType == SpellDataTargetType.SelfAndUnit)
{
AddDamage(
hero, (int)(GetTime(sender, hero, args.SData) * 0.3f),
(float)sender.LSGetSpellDamage(hero, args.SData.Name));
}
}
if (args.Target == null && Skillshots)
{
var slot = enemy.GetSpellSlot(args.SData.Name);
if (slot != SpellSlot.Unknown &&
(slot == SpellSlot.Q || slot == SpellSlot.E || slot == SpellSlot.W ||
slot == SpellSlot.R))
{
var width = Math.Min(
750f,
(args.SData.TargettingType == SpellDataTargetType.Cone || args.SData.LineWidth > 0) &&
args.SData.TargettingType != SpellDataTargetType.Cone
? args.SData.LineWidth
: (args.SData.CastRadius <= 0
? args.SData.CastRadiusSecondary
: args.SData.CastRadius));
if (args.End.LSDistance(hero.ServerPosition) <= Math.Pow(width, 2))
{
AddDamage(
hero, (int)(GetTime(sender, hero, args.SData) * 0.6f),
(float)sender.LSGetSpellDamage(hero, args.SData.Name));
}
}
}
}
if (turret != null && turret.IsValid && turret.IsEnemy && turret.LSDistance(hero) <= 1500f)
{
if (args.Target != null && args.Target.NetworkId.Equals(hero.NetworkId))
{
AddDamage(
hero, (int)(GetTime(sender, hero, args.SData) * 0.3f),
(float)
sender.CalcDamage(
hero, DamageType.Physical,
sender.BaseAttackDamage + sender.FlatPhysicalDamageMod));
}
}
}
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
示例6: OnProcessSpellCast
private static void OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
{
if (sender.Type == GameObjectType.obj_AI_Hero && sender.IsEnemy)
{
var heroSender = ObjectManager.Get<Obj_AI_Hero>().First(x => x.NetworkId == sender.NetworkId);
if (heroSender.GetSpellSlot(args.SData.Name) == SpellSlot.Unknown && args.Target.Type == Player.Type)
{
AggroTarget = ObjectManager.GetUnitByNetworkId<Obj_AI_Hero>(args.Target.NetworkId);
incomingDamage = (float)heroSender.GetAutoAttackDamage(AggroTarget);
}
if (heroSender.ChampionName == "Jinx" && args.SData.Name.Contains("JinxQAttack")
&& args.Target.Type == Player.Type)
{
AggroTarget = ObjectManager.GetUnitByNetworkId<Obj_AI_Hero>(args.Target.NetworkId);
incomingDamage = (float)heroSender.GetAutoAttackDamage(AggroTarget);
}
}
if (sender.Type == GameObjectType.obj_AI_Turret && sender.IsEnemy)
{
if (args.Target.Type == Player.Type)
{
if (sender.Distance(Allies().ServerPosition, true) <= 900 * 900)
{
AggroTarget = ObjectManager.GetUnitByNetworkId<Obj_AI_Hero>(args.Target.NetworkId);
incomingDamage =
(float)
sender.CalcDamage(
AggroTarget,
Damage.DamageType.Physical,
sender.BaseAttackDamage + sender.FlatPhysicalDamageMod);
}
}
}
}
示例7: GetTarget
public static AIHeroClient GetTarget(Obj_AI_Base champion,
float range,
DamageType type,
bool ignoreShieldSpells = true,
IEnumerable<AIHeroClient> ignoredChamps = null,
Vector3? rangeCheckFrom = null, TargetSelectionConditionDelegate conditions = null)
{
try
{
if (ignoredChamps == null)
{
ignoredChamps = new List<AIHeroClient>();
}
var damageType = (EloBuddy.DamageType)Enum.Parse(typeof(EloBuddy.DamageType), type.ToString());
if (_configMenu != null && IsValidTarget(
SelectedTarget, focusMenu["ForceFocusSelected"].Cast<CheckBox>().CurrentValue ? float.MaxValue : range,
type, ignoreShieldSpells, rangeCheckFrom))
{
return SelectedTarget;
}
if (_configMenu != null && IsValidTarget(
SelectedTarget, focusMenu["ForceFocusSelectedKeys"].Cast<CheckBox>().CurrentValue ? float.MaxValue : range,
type, ignoreShieldSpells, rangeCheckFrom))
{
if (focusMenu["ForceFocusSelectedK"].Cast<KeyBind>().CurrentValue ||
focusMenu["ForceFocusSelectedK2"].Cast<KeyBind>().CurrentValue)
{
return SelectedTarget;
}
}
if (_configMenu != null && _configMenu["TargetingMode"] != null && Mode == TargetingMode.AutoPriority)
{
var menuItem = _configMenu["TargetingMode"].Cast<ComboBox>().CurrentValue;
Enum.TryParse(getMode().ToString(), out Mode);
}
var targets =
EntityManager.Heroes.Enemies
.FindAll(
hero =>
ignoredChamps.All(ignored => ignored.NetworkId != hero.NetworkId) &&
IsValidTarget(hero, range, type, ignoreShieldSpells, rangeCheckFrom) && (conditions == null || conditions(hero)));
switch (Mode)
{
case TargetingMode.LowHP:
return targets.MinOrDefault(hero => hero.Health);
case TargetingMode.MostAD:
return targets.MaxOrDefault(hero => hero.BaseAttackDamage + hero.FlatPhysicalDamageMod);
case TargetingMode.MostAP:
return targets.MaxOrDefault(hero => hero.BaseAbilityDamage + hero.FlatMagicDamageMod);
case TargetingMode.Closest:
return
targets.MinOrDefault(
hero =>
(rangeCheckFrom.HasValue ? rangeCheckFrom.Value : champion.ServerPosition).LSDistance(
hero.ServerPosition, true));
case TargetingMode.NearMouse:
return targets.MinOrDefault(hero => hero.LSDistance(Game.CursorPos, true));
case TargetingMode.AutoPriority:
return
targets.MaxOrDefault(
hero =>
champion.CalcDamage(hero, damageType, 100) / (1 + hero.Health) * GetPriority(hero));
case TargetingMode.LessAttack:
return
targets.MaxOrDefault(
hero =>
champion.CalcDamage(hero, EloBuddy.DamageType.Physical, 100) / (1 + hero.Health) *
GetPriority(hero));
case TargetingMode.LessCast:
return
targets.MaxOrDefault(
hero =>
champion.CalcDamage(hero, EloBuddy.DamageType.Magical, 100) / (1 + hero.Health) *
GetPriority(hero));
case TargetingMode.MostStack:
return
targets.MaxOrDefault(
hero =>
champion.CalcDamage(hero, damageType, 100) / (1 + hero.Health) * GetPriority(hero) +
(1 + hero.Buffs.Where(b => StackNames.Contains(b.Name.ToLower())).Sum(t => t.Count)));
}
}
catch (Exception e)
{
Console.WriteLine(e);
//.........这里部分代码省略.........
示例8: GetTowerDamage
public static double GetTowerDamage(Obj_AI_Base sender)
{
var towerDamage = sender.CalcDamage(
ObjectManager.Player,
Damage.DamageType.Physical,
sender.BaseAttackDamage);
if (TowerIsOuter(sender))
{
towerDamage = towerDamage * (1 + 0.375f * WarmingUpStacks + 0.25f * HeatedUpStacks);
}
else if (TowerIsInhib(sender))
{
towerDamage = towerDamage * (1 + 0.0105f * HeatStacks);
}
return towerDamage;
}
示例9: MinionIsLethal
public static bool MinionIsLethal(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
{
//Console.WriteLine("Damage from Minion: " + sender.GetAutoAttackDamage(ObjectManager.Player));
return ObjectManager.Player.Health
<= sender.CalcDamage(ObjectManager.Player, Damage.DamageType.Physical, sender.BaseAttackDamage);
}
示例10: OnObjAiBaseProcessSpellCast
private static void OnObjAiBaseProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
{
try
{
if (!Enabled)
{
return;
}
var enemy = sender as Obj_AI_Hero;
var turret = sender as Obj_AI_Turret;
foreach (
var hero in GameObjects.Heroes.Where(h => h.IsValid && IncomingDamages.ContainsKey(h.NetworkId)))
{
if (ShouldReset(hero))
{
IncomingDamages[hero.NetworkId] = 0;
continue;
}
if (enemy != null && enemy.IsValid && enemy.IsEnemy && enemy.Distance(hero) <= 2000)
{
if (args.Target != null && args.Target.NetworkId.Equals(hero.NetworkId))
{
if (args.SData.IsAutoAttack())
{
AddDamage(
hero, (int) (GetTime(sender, hero, args.SData) * 0.3f),
(float) sender.GetAutoAttackDamage(hero, true));
}
else if ((args.SData.TargettingType == SpellDataTargetType.Unit ||
args.SData.TargettingType == SpellDataTargetType.SelfAndUnit))
{
AddDamage(
hero, (int) (GetTime(sender, hero, args.SData) * 0.3f),
(float) sender.GetSpellDamage(hero, args.SData.Name));
}
}
if (Skillshots)
{
if (args.SData.TargettingType == SpellDataTargetType.Cone ||
args.SData.TargettingType.ToString().Contains("Location"))
{
var width = (args.SData.TargettingType == SpellDataTargetType.Cone ||
args.SData.LineWidth > 0) &&
args.SData.TargettingType != SpellDataTargetType.Cone
? args.SData.LineWidth
: (args.SData.CastRadius <= 0
? args.SData.CastRadiusSecondary
: args.SData.CastRadius);
if (args.End.Distance(hero.ServerPosition) <= width * 1.2f)
{
AddDamage(
hero, (int) (GetTime(sender, hero, args.SData) * 0.7f),
(float) sender.GetSpellDamage(hero, args.SData.Name));
}
}
}
}
if (turret != null && turret.IsValid && turret.IsEnemy && turret.Distance(hero) <= 1500)
{
if (args.Target != null && args.Target.NetworkId.Equals(hero.NetworkId))
{
AddDamage(
hero, (int) (GetTime(sender, hero, args.SData) * 0.3f),
(float)
sender.CalcDamage(
hero, Damage.DamageType.Physical,
sender.BaseAttackDamage + sender.FlatPhysicalDamageMod));
}
}
}
}
catch (Exception ex)
{
Global.Logger.AddItem(new LogItem(ex));
}
}