public float GetTargetHealth(EnemyInfo playerInfo, int additionalTime) { if (playerInfo.Player.IsVisible) { return(playerInfo.Player.Health); } var predictedhealth = playerInfo.Player.Health + playerInfo.Player.HPRegenRate * ((Environment.TickCount - playerInfo.LastSeen + additionalTime) / 1000f); return(predictedhealth > playerInfo.Player.MaxHealth ? playerInfo.Player.MaxHealth : predictedhealth); }
private static void HandleRecallShot(EnemyInfo playerInfo) { var shoot = false; foreach (Obj_AI_Hero champ in Program.Helper.OwnTeam.Where(x => x.IsValid && ((x.IsMe && !x.IsStunned) || Helper.GetSafeMenuItem <bool>(_menu.Item(x.ChampionName))) && !x.IsDead && (x.Spellbook.CanUseSpell(SpellSlot.R) == SpellState.Ready || (x.Spellbook.GetSpell(SpellSlot.R).Level > 0 && x.Spellbook.CanUseSpell(SpellSlot.R) == SpellState.Surpressed && x.Mana >= x.Spellbook.GetSpell(SpellSlot.R).ManaCost)))) //use when fixed: champ.Spellbook.GetSpell(SpellSlot.R) = Ready or champ.Spellbook.GetSpell(SpellSlot.R).ManaCost) { if (UltInfo[champ.ChampionName].Collision && IsCollidingWithChamps(champ, _enemySpawnPos, UltInfo[champ.ChampionName].Width)) { continue; } //increase timeneeded if it should arrive earlier, decrease if later var timeneeded = GetSpellTravelTime(champ, UltInfo[champ.ChampionName].Speed, UltInfo[champ.ChampionName].Delay, _enemySpawnPos) - (_menu.Item("extraDelay").GetValue <Slider>().Value + 65); if (timeneeded - playerInfo.RecallInfo.GetRecallCountdown() > 60) { continue; } playerInfo.RecallInfo.IncomingDamage[champ.NetworkId] = (float)Damage.GetSpellDamage(champ, playerInfo.Player, SpellSlot.R, UltInfo[champ.ChampionName].SpellStage) * UltInfo[champ.ChampionName].DamageMultiplicator; if (!(playerInfo.RecallInfo.GetRecallCountdown() <= timeneeded)) { continue; } if (champ.IsMe) { shoot = true; } } var totalUltDamage = playerInfo.RecallInfo.IncomingDamage.Values.Sum(); var targetHealth = Program.Helper.GetTargetHealth(playerInfo, playerInfo.RecallInfo.GetRecallCountdown()); if (!shoot || _menu.Item("panicKey").GetValue <KeyBind>().Active) { return; } playerInfo.RecallInfo.IncomingDamage.Clear(); //wrong placement? var time = Environment.TickCount; if (time - playerInfo.LastSeen > 20000 && !_menu.Item("regardlessKey").GetValue <KeyBind>().Active) { if (totalUltDamage < playerInfo.Player.MaxHealth) { return; } } else if (totalUltDamage < targetHealth) { return; } _ult.Cast(_enemySpawnPos, true); _ultCasted = time; }
public RecallInfo(EnemyInfo enemyInfo) { EnemyInfo = enemyInfo; Recall = new Packet.S2C.Recall.Struct(EnemyInfo.Player.NetworkId, Packet.S2C.Recall.RecallStatus.Unknown, Packet.S2C.Recall.ObjectType.Player, 0); IncomingDamage = new Dictionary <int, float>(); }