forked from Hellsing/LeagueSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExtensions.cs
66 lines (54 loc) · 2.04 KB
/
Extensions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LeagueSharp;
using LeagueSharp.Common;
namespace RektSai
{
public static class Extensions
{
private const string TARGET_BURROW_NAME = "RekSaiKnockupImmune";
private const string Q_ACTIVE_NAME = "RekSaiQ";
public static bool HasMaxFury(this Obj_AI_Hero target)
{
return target.Mana == target.MaxMana;
}
public static bool IsBurrowed(this Obj_AI_Hero target)
{
return target.Buffs.Any(b => b.Caster.NetworkId == target.NetworkId && b.IsValidBuff() && b.DisplayName == "RekSaiW");
}
public static float AttackSpeed(this Obj_AI_Base target)
{
return 1 / target.AttackDelay;
}
public static bool IsLowHealth(this Obj_AI_Base target)
{
return target.HealthPercentage() < 10;
}
public static bool HasQActive(this Obj_AI_Hero target)
{
return target.Buffs.Any(b => b.Caster.NetworkId == target.NetworkId && b.IsValidBuff() && b.DisplayName == Q_ACTIVE_NAME);
}
public static bool HasBurrowBuff(this Obj_AI_Base target)
{
return target.Buffs.Any(b => b.Caster.IsMe && b.IsValidBuff() && b.DisplayName == TARGET_BURROW_NAME);
}
public static BuffInstance GetBurrowBuff(this Obj_AI_Base target)
{
return target.Buffs.Find(b => b.Caster.IsMe && b.IsValidBuff() && b.DisplayName == TARGET_BURROW_NAME);
}
public static float GetBurrowBuffDuration(this Obj_AI_Base target)
{
var buff = target.GetBurrowBuff();
if (buff != null)
return Math.Max(0, buff.EndTime - Game.Time);
return 0;
}
public static bool CanBeKnockedUp(this Obj_AI_Base target)
{
return ObjectManager.Player.IsBurrowed() ? target.GetBurrowBuffDuration() == 0 : target.GetBurrowBuffDuration() < 1;
}
}
}