本文整理汇总了C#中Ability.GetCastPoint方法的典型用法代码示例。如果您正苦于以下问题:C# Ability.GetCastPoint方法的具体用法?C# Ability.GetCastPoint怎么用?C# Ability.GetCastPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ability
的用法示例。
在下文中一共展示了Ability.GetCastPoint方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Riki_Kill
private static void Riki_Kill(Hero me, Ability blinkstrike, IReadOnlyList<double> damage)
{
var bs = new[] { 0.5, 0.75, 1, 1.25 };
var backstab = me.Spellbook.Spell3;
if (blinkstrike.Level <= 0 || backstab.Level <= 0) return;
var spellDamage = damage[(int) blinkstrike.Level];
var backstabDamage = (float)bs[backstab.Level] * me.TotalAgility + me.MinimumDamage + me.BonusDamage;
var spellRange = blinkstrike.CastRange + 50;
var spellCastPoint = (float)(blinkstrike.GetCastPoint() + Game.AvgPing / 1000);
var enemies = ObjectMgr.GetEntities<Hero>().Where(enemy => enemy.Team == me.GetEnemyTeam() && !enemy.IsIllusion() && enemy.IsVisible && enemy.IsAlive && enemy.Health > 0).ToList();
foreach (var enemy in enemies)
{
var damageBlinkstrike = enemy.DamageTaken((float) spellDamage, blinkstrike.DamageType, me, true);
var damageBackstab = enemy.DamageTaken(backstabDamage, backstab.DamageType, me, true);
float damageNeeded;
if (!HeroDamageDictionary.TryGetValue(enemy, out damageNeeded))
{
damageNeeded = enemy.Health - damageBlinkstrike - damageBackstab + spellCastPoint * enemy.HealthRegeneration + MorphMustDie(enemy, spellCastPoint);
HeroDamageDictionary.Add(enemy, damageNeeded);
HeroSpellDictionary.Add(enemy, blinkstrike);
}
else
{
HeroDamageDictionary.Remove(enemy);
HeroSpellDictionary.Remove(enemy);
damageNeeded = enemy.Health - damageBlinkstrike - damageBackstab + spellCastPoint * enemy.HealthRegeneration + MorphMustDie(enemy, spellCastPoint);
HeroDamageDictionary.Add(enemy, damageNeeded);
HeroSpellDictionary.Add(enemy, blinkstrike);
}
if (_killstealEnabled && !me.IsChanneling())
{
if (damageNeeded < 0 && me.Distance2D(enemy) < spellRange && MeCanSurvive(enemy, me, blinkstrike, damageBlinkstrike + damageBackstab))
{
CastSpell(blinkstrike, enemy, me, true);
break;
}
}
}
}
示例2: Kill
private static void Kill(Ability ability, IReadOnlyList<double> damage, uint spellTargetType, uint? range = null, string abilityType = "normal", bool lsblock = true, bool throughSpellImmunity = false, IReadOnlyList<double> adamage = null)
{
var spellLevel = (int) ability.Level - 1;
if (ability.Level <= 0) return;
Item refresher = null;
var refresh = false;
if (abilityType.Equals("global")) {
refresher = _me.FindItem("item_refresher");
if (refresher != null)
refresh = CanBeCasted(refresher) && (_me.Mana > ability.ManaCost*2 + refresher.ManaCost);
}
double normalDamage;
if (adamage == null)
normalDamage = damage[spellLevel];
else
normalDamage = _me.AghanimState() ? adamage[spellLevel] : damage[spellLevel];
var spellDamageType = (_me.ClassID == ClassID.CDOTA_Unit_Hero_Alchemist) ? DamageType.Physical : ability.DamageType;
var spellRange = range ?? (ability.CastRange + 50);
var spellCastPoint = (float)(((_killError? 0 : ability.GetCastPoint(ability.Level)) + Game.Ping) / 1000);
var enemies = ObjectMgr.GetEntities<Hero>().Where(enemy => enemy.Team == _me.GetEnemyTeam() && !enemy.IsIllusion() && enemy.IsVisible && enemy.IsAlive && enemy.Health > 0).ToList();
foreach (var enemy in enemies) {
double spellDamage = 0;
if (abilityType.Equals("complex"))
spellDamage = GetComplexDamage(spellLevel, enemy, _me, normalDamage);
else if (abilityType.Equals("smart"))
spellDamage = GetSmartDamage(spellLevel, _me, damage);
else if(abilityType.Equals("normal") || abilityType.Equals("global"))
spellDamage = normalDamage;
var damageDone = enemy.DamageTaken((float)spellDamage, spellDamageType, _me, throughSpellImmunity);
if (refresh)
damageDone = damageDone * 2;
if (_me.ClassID == ClassID.CDOTA_Unit_Hero_Axe)
damageDone = (float)spellDamage;
double damageNeeded;
if (!HeroDamageDictionary.TryGetValue(enemy, out damageNeeded)) {
damageNeeded = enemy.Health - damageDone + spellCastPoint * enemy.HealthRegeneration + MorphMustDie(enemy, spellCastPoint);
HeroDamageDictionary.Add(enemy, damageNeeded);
HeroSpellDictionary.Add(enemy, ability.Name);
} else {
HeroDamageDictionary.Remove(enemy);
HeroSpellDictionary.Remove(enemy);
damageNeeded = enemy.Health - damageDone + spellCastPoint * enemy.HealthRegeneration + MorphMustDie(enemy, spellCastPoint);
HeroDamageDictionary.Add(enemy, damageNeeded);
HeroSpellDictionary.Add(enemy, ability.Name);
}
if (_me.IsChanneling()) return;
if (!(damageNeeded < 0) || !(_me.Distance2D(enemy) < spellRange || abilityType.Equals("global")) || !MeCanSurvive(enemy, _me, ability, damageDone)) continue;
switch (spellTargetType) {
case 1:
CastSpell(ability, enemy, _me, lsblock);
if (abilityType.Equals("global") && refresh) {
refresher.UseAbility();
CastSpell(ability, enemy, _me, lsblock);
}
break;
case 2:
CastSpell(ability, enemy.Position, _me, lsblock);
if (abilityType.Equals("global") && refresh) {
refresher.UseAbility();
CastSpell(ability, enemy.Position, _me, lsblock);
}
break;
case 3:
if (CanBeCasted(ability) && _me.CanCast())
ability.UseAbility();
if (abilityType.Equals("global") && refresh) {
refresher.UseAbility();
ability.UseAbility();
}
break;
}
break;
}
}
示例3: Kill
private static void Kill(Hero me, Ability ability, IReadOnlyList<double> damage, uint spellTargetType, uint? range = null, bool lsblock = true, bool piercesSpellImmunity = false, bool smartKill = false, bool complexKill = false, IReadOnlyList<double> adamage = null)
{
if (ability.Level > 0)
{
double normalDamage;
if (adamage == null)
normalDamage = damage[(int) ability.Level];
else
normalDamage = me.AghanimState() ? damage[(int) ability.Level] : adamage[(int) ability.Level];
var spellDamageType = ability.DamageType;
var spellRange = range ?? (ability.CastRange + 50);
var spellCastPoint = (float)(ability.GetCastPoint() + Game.AvgPing / 1000);
var enemies = ObjectMgr.GetEntities<Hero>().Where(enemy => enemy.Team == me.GetEnemyTeam() && !enemy.IsIllusion() && enemy.IsVisible && enemy.IsAlive && enemy.Health > 0).ToList();
foreach (var enemy in enemies)
{
double spellDamage;
if (complexKill)
spellDamage = GetComplexDamage(ability.Level, enemy, me, normalDamage);
else if (smartKill)
spellDamage = GetSmartDamage(ability.Level, me, damage);
else
spellDamage = normalDamage;
var damageDone = enemy.DamageTaken((float)spellDamage, spellDamageType, me, piercesSpellImmunity);
if (me.ClassID == ClassID.CDOTA_Unit_Hero_Axe)
damageDone = (float) spellDamage;
float damageNeeded;
if (!HeroDamageDictionary.TryGetValue(enemy, out damageNeeded))
{
damageNeeded = enemy.Health - damageDone + spellCastPoint * enemy.HealthRegeneration + MorphMustDie(enemy, spellCastPoint);
HeroDamageDictionary.Add(enemy, damageNeeded);
HeroSpellDictionary.Add(enemy, ability);
}
else
{
HeroDamageDictionary.Remove(enemy);
HeroSpellDictionary.Remove(enemy);
damageNeeded = enemy.Health - damageDone + spellCastPoint * enemy.HealthRegeneration + MorphMustDie(enemy, spellCastPoint);
HeroDamageDictionary.Add(enemy, damageNeeded);
HeroSpellDictionary.Add(enemy, ability);
}
if (_killstealEnabled && !me.IsChanneling())
{
if (damageNeeded < 0 && me.Distance2D(enemy) < spellRange && MeCanSurvive(enemy, me, ability, damageDone))
{
switch (spellTargetType)
{
case 1:
CastSpell(ability, enemy, me, lsblock);
break;
case 2:
CastSpell(ability, enemy.Position, me, lsblock);
break;
case 3:
if (ability.CanBeCasted() && me.CanCast())
ability.UseAbility();
break;
}
break;
}
}
}
}
}
示例4: Game_OnUpdate
//.........这里部分代码省略.........
if (_creepTarget != null && _creepTarget.IsValid && _creepTarget.IsVisible && _creepTarget.IsAlive)
{
var time = _me.IsRanged == false
? _aPoint * 2 / 1000 + _me.GetTurnTime(_creepTarget.Position)
: _aPoint * 2 / 1000 + _me.GetTurnTime(_creepTarget.Position) + _me.Distance2D(_creepTarget) / GetProjectileSpeed(_me);
var time2 = _me.IsRanged == false
? _aPoint / 1000
: _aPoint / 1000 + _me.Distance2D(_creepTarget) / GetProjectileSpeed(_me);
var getDamage = GetDamageOnUnit(_creepTarget, Healthpredict(_creepTarget, time));
var getDamage2 = GetDamageOnUnit(_creepTarget, Healthpredict(_creepTarget, time2));
if (_creepTarget.Distance2D(_me) <= _attackRange && _creepTarget.Health < getDamage * 2)
{
if (_creepTarget.Health < getDamage ||
(_creepTarget.Health < getDamage && _creepTarget.Team == _me.Team &&
Menu.Item("denied").GetValue<bool>()))
{
if (!_me.IsAttacking())
_me.Attack(_creepTarget);
}
else if (_creepTarget.Health < getDamage * 2 && _creepTarget.Health >= getDamage &&
_creepTarget.Team != _me.Team && Utils.SleepCheck("stop"))
{
_me.Hold();
_me.Attack(_creepTarget);
Utils.Sleep(_aPoint + Game.Ping, "stop");
}
}
else //if (_me.Distance2D(_creepTarget) >= _attackRange && Utils.SleepCheck("walk"))
{
_target = _me.BestAATarget();
if (_target != null)
{
if (Menu.Item("harassheroes").GetValue<bool>() && _target.Distance2D(_me) <= _attackRange)
_target = _me.BestAATarget();
else
_target = null;
if (Menu.Item("usespell").GetValue<bool>() && Utils.SleepCheck("cooldown") && _target != null)
{
_q.UseAbility(_target);
Utils.Sleep(_q.GetCastPoint(_q.Level) * 300 + 50 + Game.Ping, "cast");
Utils.Sleep(_q.GetCooldown(_q.Level) * 300 + 50 + Game.Ping, "cooldown");
}
else
{
Orbwalking.Orbwalk(_target);
// return;
}
}
//Orbwalking.Orbwalk(_target);
}
}
else
{
_target = _me.BestAATarget();
if (_target != null)
{
if (Menu.Item("harassheroes").GetValue<bool>() && _target.Distance2D(_me) <= _attackRange)
_target = _me.BestAATarget();
else
_target = null;
}
Orbwalking.Orbwalk(_target);
}
}
else if (Game.IsKeyDown(Menu.Item("farmKey").GetValue<KeyBind>().Key) && Utils.SleepCheck("cast"))
{
Autoattack(0, 0);
_creepTarget = GetLowestHpCreep(_me, null);
_creepTarget = KillableCreep(true, _creepTarget, ref wait);
if (_creepTarget != null && _creepTarget.IsValid && _creepTarget.IsVisible && _creepTarget.IsAlive)
{
if (Menu.Item("usespell").GetValue<bool>() && Utils.SleepCheck("cooldown"))
SpellCast();
}
Orbwalking.Orbwalk(_creepTarget);
}
else if (Game.IsKeyDown(Menu.Item("combatkey").GetValue<KeyBind>().Key))
{
Orbwalking.Orbwalk(_target, attackmodifiers: true);
}
else if (Game.IsKeyDown(Menu.Item("kitekey").GetValue<KeyBind>().Key))
{
Orbwalking.Orbwalk(
_target,
attackmodifiers: true,
bonusWindupMs: Menu.Item("bonusWindup").GetValue<Slider>().Value);
}
else
{
Autoattack(_autoAttack, _autoAttackAfterSpell);
}
}