private void OnAttackStart(Unit9 unit) { try { if (!unit.IsMyHero || this.attackSleeper) { return; } if (unit.Target?.IsCreep != false) { return; } var attackPoint = unit.GetAttackPoint(); var attackCheckDelay = attackPoint * 3f; var disassembleDelay = attackPoint * 1.5f; var assembleDelay = attackPoint * 2f; this.attackSleeper.Sleep(attackCheckDelay); this.sleeper.Sleep(assembleDelay); UpdateManager.BeginInvoke(this.Disassemble, (int)(disassembleDelay * 1000)); } catch (Exception e) { Logger.Error(e); } }
private void AttackStarted(Unit9 unit) { if (this.attackSleeper.IsSleeping(unit.Handle) || !unit.IsAlive) { return; } if (!unit.IsControllable && unit.IsHero) { unit.Target = EntityManager9.Units .Where(x => x.IsAlive && !x.IsAlly(unit) && x.Distance(unit) <= unit.GetAttackRange(x, 25)) .OrderBy(x => unit.GetAngle(x.Position)) .FirstOrDefault(x => unit.GetAngle(x.Position) < 0.35f); } unit.IsAttacking = true; this.attackSleeper.Sleep(unit.Handle, unit.GetAttackPoint()); this.AttackStart?.Invoke(unit); }
// Token: 0x060003B4 RID: 948 RVA: 0x0001CEDC File Offset: 0x0001B0DC private void AttackStarted(Unit9 unit) { if (this.attackSleeper.IsSleeping(unit.Handle) || !unit.IsAlive) { return; } if (!unit.IsControllable && unit.IsHero) { unit.Target = (from x in EntityManager9.Units where x.IsAlive && !x.IsAlly(unit) && x.Distance(unit) <= unit.GetAttackRange(x, 25f) orderby unit.GetAngle(x.Position, false) select x).FirstOrDefault((Unit9 x) => unit.GetAngle(x.Position, false) < 0.35f); } unit.IsAttacking = true; this.attackSleeper.Sleep(unit.Handle, unit.GetAttackPoint(null)); UnitMonitor.EventHandler attackStart = this.AttackStart; if (attackStart == null) { return; } attackStart(unit); }
// Token: 0x06000414 RID: 1044 RVA: 0x000169BC File Offset: 0x00014BBC public void SoulRingSuicide(Dictionary <Unit9, float> attacks, Dictionary <TrackingProjectile, int> projectiles) { if (base.Owner.HealthPercentage > 30f) { return; } Rot rot = this.rot; if (rot == null || !rot.Ability.CanBeCasted(true)) { return; } Vector3 other = (base.Owner.IsMoving && Math.Abs(base.Owner.BaseUnit.RotationDifference) < 60f) ? base.Owner.InFront(55f, 0f, true) : base.Owner.Position; bool flag = true; foreach (KeyValuePair <TrackingProjectile, int> keyValuePair in projectiles) { if (keyValuePair.Key.IsValid && keyValuePair.Key.Position.Distance2D(other, false) < 200f) { flag = false; break; } } bool flag2 = true; foreach (KeyValuePair <Unit9, float> keyValuePair2 in from x in attacks where x.Key.IsValid && x.Key.IsAlive && x.Key.Distance(base.Owner) <= x.Key.GetAttackRange(base.Owner, 200f) && (double)x.Key.GetAngle(base.Owner.Position, false) < 0.5 && (!x.Key.IsRanged || x.Key.Distance(base.Owner) < 400f) select x) { Unit9 key = keyValuePair2.Key; float value = keyValuePair2.Value; float attackPoint = key.GetAttackPoint(base.Owner); float secondsPerAttack = key.BaseUnit.SecondsPerAttack; float rawGameTime = Game.RawGameTime; float num = value + attackPoint; if (key.IsRanged) { num += Math.Max(key.Distance(base.Owner) - base.Owner.HullRadius, 0f) / (float)key.ProjectileSpeed; } Ability9 ability = key.Abilities.FirstOrDefault((Ability9 x) => x.Id == AbilityId.item_echo_sabre); if ((rawGameTime <= num && ((double)attackPoint < 0.35 || (double)rawGameTime + (double)attackPoint * 0.6 > (double)num)) || ((double)attackPoint < 0.25 && (double)rawGameTime > (double)num + (double)key.GetAttackBackswing(base.Owner) * 0.6 && (double)rawGameTime <= (double)(value + secondsPerAttack) + 0.12) || (ability != null && !key.IsRanged && ability.Cooldown - ability.RemainingCooldown <= attackPoint * 2f)) { flag2 = false; break; } } if (!flag || !flag2) { return; } SoulRing soulRing = base.Owner.Abilities.FirstOrDefault((Ability9 x) => x.Id == AbilityId.item_soul_ring) as SoulRing; if (soulRing != null && soulRing.CanBeCasted(true)) { if (base.Owner.Health > (float)soulRing.HealthCost) { return; } soulRing.UseAbility(false, false); if (!this.rot.IsEnabled) { this.rot.Ability.UseAbility(false, false); return; } } else { if (this.rot.IsEnabled) { return; } float num2 = (float)this.rot.Ability.GetDamage(base.Owner) * 0.5f; if (base.Owner.Health > num2) { return; } this.rot.Ability.UseAbility(false, false); } }