C# Class Ensage.Common.Extensions.UnitExtensions

The unit extensions.
Exibir arquivo Open project: EnsageSharp/Ensage.Common Class Usage Examples

Public Methods

Method Description
AghanimState ( this unit ) : bool

Checks if given hero has AghanimScepter

AttackBackswing ( this unit ) : double

The attack backswing.

AttackPoint ( this unit ) : double

The attack point.

AttackRate ( this unit ) : double

The attack rate.

BasePredict ( this unit, Unit source, float delay, float speed ) : System.Vector3

The base predict.

BasePredict ( this unit, float delay ) : System.Vector3

The base predict.

BestAATarget ( this unit, float bonusRange ) : Hero

The best aa target.

CanAttack ( this unit ) : bool

Checks if given unit is able to attack

CanCast ( this unit ) : bool

Checks if given unit is able to cast spells

CanDie ( this unit, string sourceAbilityName = null, bool ignoreReincarnation = false ) : bool

The can die.

CanMove ( this unit ) : bool

Checks if given unit is able to move

CanReincarnate ( this unit ) : bool

The can reincarnate.

CanUseItems ( this unit ) : bool

Checks if given unit is not muted

ClosestToMouseTarget ( this source, float range = 1000 ) : Hero

The closest to mouse target.

DamageTaken ( this target, float dmg, DamageType dmgType, Unit source, bool throughBKB = false, double minusArmor = 0d, double minusDamageResistancePerc = 0d, double minusMagicResistancePerc = 0d ) : float

Returns actual damage the unit takes

DisableTarget ( this unit, Unit target ) : bool

Uses available disable ability which takes least time to hit the target, chains with other disables

FindItem ( this unit, string name, System.Item &item, bool cache = false ) : System.Item

The find item.

FindItem ( this unit, string name, bool cache = false ) : System.Item

Searches for a item in the units inventory with given name

FindModifier ( this unit, string modifierName ) : Modifier

The has modifier.

FindRelativeAngle ( this unit, System.Vector3 pos ) : float

The find relative angle.

FindRelativeAngle ( this unit, System.Vector3 pos, float delta ) : float

The find relative angle.

FindSpell ( this unit, string name, Ability &spell ) : Ability

The find spell.

FindSpell ( this unit, string name, bool cache = false ) : Ability

Returns spell of the unit with given name if it exists

GetAttackRange ( this unit ) : float

Returns actual attack range of a unit

GetChanneledAbility ( this unit ) : Ability

Finds spell/item which is currently being channeled by given unit

GetDagon ( this unit ) : System.Item

Finds a dagon in the units inventory

GetEnemyTeam ( this unit ) : Team

Returns Enemy Team of the unit

GetLeveledItem ( this unit, string name ) : System.Item

Finds item with given name which has more than 1 level

GetTurnRate ( this unit, bool currentTurnRate = true ) : double

The get turn rate.

GetTurnTime ( this unit, System.Entity entity ) : double

Calculates how much time it will take for given unit to turn to another entity

GetTurnTime ( this unit, System.Vector3 position ) : double

Calculates how much time it will take for given unit to turn to given vector

HasItem ( this unit, ClassID classId ) : bool

Returns if the target has the given Item

HasModifier ( this unit, string modifierName ) : bool

The has modifier.

HasModifiers ( this unit, string modifierNames, bool hasAll = true ) : bool

The has modifiers.

InFront ( this unit, float distance ) : System.Vector3

The in front.

IsAttackImmune ( this unit ) : bool

Checks if unit is immune to auto attack

IsAttacking ( this unit ) : bool

The is attacking.

IsChanneling ( this unit ) : bool

Checks if unit is currently channeling

IsDisarmed ( this unit ) : bool

The is disarmed.

IsHexed ( this unit ) : bool

The is hexed.

IsHexed ( this unit, float &hexDuration ) : bool

The is hexed.

IsInvisible ( this unit ) : bool

The is invisible.

IsInvul ( this unit ) : bool

The is invulnerable.

IsInvul ( this unit, float &invulnerabilityDuration ) : bool

The is invulnerable.

IsLinkensProtected ( this unit ) : bool

The is linken protected.

IsMagicImmune ( this unit ) : bool

The is magic immune.

IsPurgable ( this unit ) : bool

Checks if enemy have a modifier which can be purged

IsRooted ( this unit ) : bool

The is rooted.

IsRooted ( this unit, float &rootDuration ) : bool

The is rooted.

IsSilenced ( this unit ) : bool

The is silenced.

IsStunned ( this unit ) : bool

The is stunned.

IsStunned ( this unit, float &stunDuration ) : bool

The is stunned.

IsUnitState ( this unit, UnitState state ) : bool

The is unit state.

IsValidTarget ( this unit, float range = float.MaxValue, bool checkTeam = true, System.Vector3 from = newVector3() ) : bool

The is valid target.

ManaBurnDamageTaken ( this unit, float burnAmount, double multiplier, DamageType dmgType, Unit source, bool throughBkb = false, double minusArmor = 0d, double minusDamageResistancePerc = 0d, double minusMagicResistancePerc = 0d ) : float

Returns how much mana burn damage given unit receives

ManaBurnSpellDamageTaken ( this unit, float burnAmount, double multiplier, DamageType dmgType, Unit source, string spellName, bool throughBkb = false, double minusArmor = 0d, double minusDamageResistancePerc = 0d, double minusMagicResistancePerc = 0d ) : float

The mana burn spell damage taken.

Predict ( this unit, float delay ) : System.Vector3

Returns predicted location of a unit after given milliseconds

ProjectileSpeed ( this unit ) : double

The projectile speed.

SilenceTarget ( this unit, Unit target ) : bool

Uses available silence ability which takes least time to hit the target, chains with disables

SlowTarget ( this unit, Unit target ) : bool

Uses available slow ability which takes least time to hit the target, chains with other disables

SpellDamageTaken ( this target, float dmg, DamageType dmgType, Unit source, string spellName, bool throughBKB = false, double minusArmor = 0d, double minusDamageResistancePerc = 0d, double minusMagicResistancePerc = 0d ) : float

The spell damage taken.

Vector2FromPolarAngle ( this unit, float delta = 0f, float radial = 1f ) : System.Vector2

The vector 2 from polar angle.

Vector3FromPolarAngle ( this unit, float delta = 0f, float radial = 1f ) : System.Vector3

The vector 3 from polar angle.

Private Methods

Method Description
Init ( ) : void

The initialize.

Method Details

AghanimState() public static method

Checks if given hero has AghanimScepter
public static AghanimState ( this unit ) : bool
unit this /// The unit. ///
return bool

AttackBackswing() public static method

The attack backswing.
public static AttackBackswing ( this unit ) : double
unit this /// The unit. ///
return double

AttackPoint() public static method

The attack point.
public static AttackPoint ( this unit ) : double
unit this /// The unit. ///
return double

AttackRate() public static method

The attack rate.
public static AttackRate ( this unit ) : double
unit this /// The unit. ///
return double

BasePredict() public static method

The base predict.
public static BasePredict ( this unit, Unit source, float delay, float speed ) : System.Vector3
unit this /// The unit. ///
source Unit /// The source. ///
delay float /// The delay in milliseconds. ///
speed float /// The speed. ///
return System.Vector3

BasePredict() public static method

The base predict.
public static BasePredict ( this unit, float delay ) : System.Vector3
unit this /// The unit. ///
delay float /// The delay in milliseconds. ///
return System.Vector3

BestAATarget() public static method

The best aa target.
public static BestAATarget ( this unit, float bonusRange ) : Hero
unit this /// The unit. ///
bonusRange float /// The bonus range. ///
return Hero

CanAttack() public static method

Checks if given unit is able to attack
public static CanAttack ( this unit ) : bool
unit this /// The unit. ///
return bool

CanCast() public static method

Checks if given unit is able to cast spells
public static CanCast ( this unit ) : bool
unit this /// The unit. ///
return bool

CanDie() public static method

The can die.
public static CanDie ( this unit, string sourceAbilityName = null, bool ignoreReincarnation = false ) : bool
unit this /// The unit. ///
sourceAbilityName string /// The source ability name. ///
ignoreReincarnation bool /// The ignore reincarnation. ///
return bool

CanMove() public static method

Checks if given unit is able to move
public static CanMove ( this unit ) : bool
unit this /// The unit. ///
return bool

CanReincarnate() public static method

The can reincarnate.
public static CanReincarnate ( this unit ) : bool
unit this /// The unit. ///
return bool

CanUseItems() public static method

Checks if given unit is not muted
public static CanUseItems ( this unit ) : bool
unit this /// The unit. ///
return bool

ClosestToMouseTarget() public static method

The closest to mouse target.
public static ClosestToMouseTarget ( this source, float range = 1000 ) : Hero
source this /// The source. ///
range float /// The range. ///
return Hero

DamageTaken() public static method

Returns actual damage the unit takes
public static DamageTaken ( this target, float dmg, DamageType dmgType, Unit source, bool throughBKB = false, double minusArmor = 0d, double minusDamageResistancePerc = 0d, double minusMagicResistancePerc = 0d ) : float
target this /// damaged unit ///
dmg float /// amount of damage ///
dmgType DamageType /// Type of damage (Magical/Physical/Pure/Health removal) ///
source Unit /// source of the damage ///
throughBKB bool /// true if the damage pierces magic immunity ///
minusArmor double /// The minus Armor. ///
minusDamageResistancePerc double /// The minus Damage Resistance Percentage. ///
minusMagicResistancePerc double /// The minus Magic Resistance Percentage. ///
return float

DisableTarget() public static method

Uses available disable ability which takes least time to hit the target, chains with other disables
public static DisableTarget ( this unit, Unit target ) : bool
unit this /// The unit. ///
target Unit /// The target. ///
return bool

FindItem() public static method

The find item.
public static FindItem ( this unit, string name, System.Item &item, bool cache = false ) : System.Item
unit this /// The unit. ///
name string /// The name. ///
item System.Item /// The item. ///
cache bool /// The cache. ///
return System.Item

FindItem() public static method

Searches for a item in the units inventory with given name
public static FindItem ( this unit, string name, bool cache = false ) : System.Item
unit this /// The unit. ///
name string /// The name. ///
cache bool /// Store the item and use stored next time (Risk of EntityNotFoundException) ///
return System.Item

FindModifier() public static method

The has modifier.
public static FindModifier ( this unit, string modifierName ) : Modifier
unit this /// The unit. ///
modifierName string /// The modifier name. ///
return Modifier

FindRelativeAngle() public static method

The find relative angle.
public static FindRelativeAngle ( this unit, System.Vector3 pos ) : float
unit this /// The unit. ///
pos System.Vector3 /// The position. ///
return float

FindRelativeAngle() public static method

The find relative angle.
public static FindRelativeAngle ( this unit, System.Vector3 pos, float delta ) : float
unit this /// The unit. ///
pos System.Vector3 /// The pos. ///
delta float /// The alpha. ///
return float

FindSpell() public static method

The find spell.
public static FindSpell ( this unit, string name, Ability &spell ) : Ability
unit this /// The unit. ///
name string /// The name. ///
spell Ability /// The spell. ///
return Ability

FindSpell() public static method

Returns spell of the unit with given name if it exists
public static FindSpell ( this unit, string name, bool cache = false ) : Ability
unit this /// The unit. ///
name string /// The name. ///
cache bool /// Use cached spell (risk of EntityNotFoundException) ///
return Ability

GetAttackRange() public static method

Returns actual attack range of a unit
public static GetAttackRange ( this unit ) : float
unit this /// The unit. ///
return float

GetChanneledAbility() public static method

Finds spell/item which is currently being channeled by given unit
public static GetChanneledAbility ( this unit ) : Ability
unit this /// The unit. ///
return Ability

GetDagon() public static method

Finds a dagon in the units inventory
public static GetDagon ( this unit ) : System.Item
unit this /// The unit. ///
return System.Item

GetEnemyTeam() public static method

Returns Enemy Team of the unit
public static GetEnemyTeam ( this unit ) : Team
unit this /// The unit. ///
return Team

GetLeveledItem() public static method

Finds item with given name which has more than 1 level
public static GetLeveledItem ( this unit, string name ) : System.Item
unit this /// The unit. ///
name string /// The name. ///
return System.Item

GetTurnRate() public static method

The get turn rate.
public static GetTurnRate ( this unit, bool currentTurnRate = true ) : double
unit this /// The unit. ///
currentTurnRate bool /// The current turn rate. ///
return double

GetTurnTime() public static method

Calculates how much time it will take for given unit to turn to another entity
public static GetTurnTime ( this unit, System.Entity entity ) : double
unit this /// The unit. ///
entity System.Entity /// The unit 2. ///
return double

GetTurnTime() public static method

Calculates how much time it will take for given unit to turn to given vector
public static GetTurnTime ( this unit, System.Vector3 position ) : double
unit this /// The entity. ///
position System.Vector3 /// The position. ///
return double

HasItem() public static method

Returns if the target has the given Item
public static HasItem ( this unit, ClassID classId ) : bool
unit this /// The unit. ///
classId ClassID /// The class Id. ///
return bool

HasModifier() public static method

The has modifier.
public static HasModifier ( this unit, string modifierName ) : bool
unit this /// The unit. ///
modifierName string /// The modifier name. ///
return bool

HasModifiers() public static method

The has modifiers.
public static HasModifiers ( this unit, string modifierNames, bool hasAll = true ) : bool
unit this /// The unit. ///
modifierNames string /// The modifier names. ///
hasAll bool /// The has all. ///
return bool

InFront() public static method

The in front.
public static InFront ( this unit, float distance ) : System.Vector3
unit this /// The unit. ///
distance float /// The distance. ///
return System.Vector3

IsAttackImmune() public static method

Checks if unit is immune to auto attack
public static IsAttackImmune ( this unit ) : bool
unit this /// The unit. ///
return bool

IsAttacking() public static method

The is attacking.
public static IsAttacking ( this unit ) : bool
unit this /// The unit. ///
return bool

IsChanneling() public static method

Checks if unit is currently channeling
public static IsChanneling ( this unit ) : bool
unit this /// The unit. ///
return bool

IsDisarmed() public static method

The is disarmed.
public static IsDisarmed ( this unit ) : bool
unit this /// The unit. ///
return bool

IsHexed() public static method

The is hexed.
public static IsHexed ( this unit ) : bool
unit this /// The unit. ///
return bool

IsHexed() public static method

The is hexed.
public static IsHexed ( this unit, float &hexDuration ) : bool
unit this /// The unit. ///
hexDuration float /// The hex duration. ///
return bool

IsInvisible() public static method

The is invisible.
public static IsInvisible ( this unit ) : bool
unit this /// The unit. ///
return bool

IsInvul() public static method

The is invulnerable.
public static IsInvul ( this unit ) : bool
unit this /// The unit. ///
return bool

IsInvul() public static method

The is invulnerable.
public static IsInvul ( this unit, float &invulnerabilityDuration ) : bool
unit this /// The unit. ///
invulnerabilityDuration float /// The invulnerability duration. ///
return bool

IsLinkensProtected() public static method

The is linken protected.
public static IsLinkensProtected ( this unit ) : bool
unit this /// The unit. ///
return bool

IsMagicImmune() public static method

The is magic immune.
public static IsMagicImmune ( this unit ) : bool
unit this /// The unit. ///
return bool

IsPurgable() public static method

Checks if enemy have a modifier which can be purged
public static IsPurgable ( this unit ) : bool
unit this /// The unit. ///
return bool

IsRooted() public static method

The is rooted.
public static IsRooted ( this unit ) : bool
unit this /// The unit. ///
return bool

IsRooted() public static method

The is rooted.
public static IsRooted ( this unit, float &rootDuration ) : bool
unit this /// The unit. ///
rootDuration float /// The root duration. ///
return bool

IsSilenced() public static method

The is silenced.
public static IsSilenced ( this unit ) : bool
unit this /// The unit. ///
return bool

IsStunned() public static method

The is stunned.
public static IsStunned ( this unit ) : bool
unit this /// The unit. ///
return bool

IsStunned() public static method

The is stunned.
public static IsStunned ( this unit, float &stunDuration ) : bool
unit this /// The unit. ///
stunDuration float /// The stun duration. ///
return bool

IsUnitState() public static method

The is unit state.
public static IsUnitState ( this unit, UnitState state ) : bool
unit this /// The unit. ///
state UnitState /// The state. ///
return bool

IsValidTarget() public static method

The is valid target.
public static IsValidTarget ( this unit, float range = float.MaxValue, bool checkTeam = true, System.Vector3 from = newVector3() ) : bool
unit this /// The unit. ///
range float /// The range. ///
checkTeam bool /// The check team. ///
from System.Vector3 /// The from. ///
return bool

ManaBurnDamageTaken() public static method

Returns how much mana burn damage given unit receives
public static ManaBurnDamageTaken ( this unit, float burnAmount, double multiplier, DamageType dmgType, Unit source, bool throughBkb = false, double minusArmor = 0d, double minusDamageResistancePerc = 0d, double minusMagicResistancePerc = 0d ) : float
unit this /// The unit. ///
burnAmount float /// The burn Amount. ///
multiplier double /// The multiplier. ///
dmgType DamageType /// The dmg Type. ///
source Unit /// The source. ///
throughBkb bool /// The through Bkb. ///
minusArmor double /// The minus Armor. ///
minusDamageResistancePerc double /// The minus Damage Resistance Perc. ///
minusMagicResistancePerc double /// The minus Magic Resistance Perc. ///
return float

ManaBurnSpellDamageTaken() public static method

The mana burn spell damage taken.
public static ManaBurnSpellDamageTaken ( this unit, float burnAmount, double multiplier, DamageType dmgType, Unit source, string spellName, bool throughBkb = false, double minusArmor = 0d, double minusDamageResistancePerc = 0d, double minusMagicResistancePerc = 0d ) : float
unit this /// The unit. ///
burnAmount float /// The burn amount. ///
multiplier double /// The multiplier. ///
dmgType DamageType /// The dmg type. ///
source Unit /// The source. ///
spellName string /// The spell name. ///
throughBkb bool /// The through bkb. ///
minusArmor double /// The minus armor. ///
minusDamageResistancePerc double /// The minus damage resistance perc. ///
minusMagicResistancePerc double /// The minus magic resistance perc. ///
return float

Predict() public static method

Returns predicted location of a unit after given milliseconds
public static Predict ( this unit, float delay ) : System.Vector3
unit this /// The unit. ///
delay float /// The delay. ///
return System.Vector3

ProjectileSpeed() public static method

The projectile speed.
public static ProjectileSpeed ( this unit ) : double
unit this /// The unit. ///
return double

SilenceTarget() public static method

Uses available silence ability which takes least time to hit the target, chains with disables
public static SilenceTarget ( this unit, Unit target ) : bool
unit this /// The unit. ///
target Unit /// The target. ///
return bool

SlowTarget() public static method

Uses available slow ability which takes least time to hit the target, chains with other disables
public static SlowTarget ( this unit, Unit target ) : bool
unit this /// The unit. ///
target Unit /// The target. ///
return bool

SpellDamageTaken() public static method

The spell damage taken.
public static SpellDamageTaken ( this target, float dmg, DamageType dmgType, Unit source, string spellName, bool throughBKB = false, double minusArmor = 0d, double minusDamageResistancePerc = 0d, double minusMagicResistancePerc = 0d ) : float
target this /// The target. ///
dmg float /// The dmg. ///
dmgType DamageType /// The dmg type. ///
source Unit /// The source. ///
spellName string /// The spell name. ///
throughBKB bool /// The through bkb. ///
minusArmor double /// The minus armor. ///
minusDamageResistancePerc double /// The minus damage resistance perc. ///
minusMagicResistancePerc double /// The minus magic resistance perc. ///
return float

Vector2FromPolarAngle() public static method

The vector 2 from polar angle.
public static Vector2FromPolarAngle ( this unit, float delta = 0f, float radial = 1f ) : System.Vector2
unit this /// The unit. ///
delta float /// The delta. ///
radial float /// The radial. ///
return System.Vector2

Vector3FromPolarAngle() public static method

The vector 3 from polar angle.
public static Vector3FromPolarAngle ( this unit, float delta = 0f, float radial = 1f ) : System.Vector3
unit this /// The unit. ///
delta float /// The delta. ///
radial float /// The radial. ///
return System.Vector3