protected virtual void OnDestructibleEntersRange(Destructible u, Destructible enterer) { if (enterer is Unit) { OnUnitEntersRange((Unit)enterer); } }
public virtual bool IsInEffectiveRange(Destructible target, float tolerance) { return(Common.Math.CircleArcIntersection(Common.Math.ToVector2(target.Position), target.HitRadius, Common.Math.ToVector2(MediatorOffsetedPosition), EffectiveRange * tolerance, Mediator.LookatDir, EffectiveAngle)); }
protected virtual void OnDestructibleExitsRange(Destructible u, Destructible exiter) { if (exiter is Unit) { OnUnitExitsRange((Unit)exiter); } }
public override bool IsEffectiveTowardsTarget(Vector3 targetPosition, Destructible targetEntity) { if (!(targetEntity is Unit)) { return(false); } return(((Unit)targetEntity).CanAddBuff(Buff) && base.IsEffectiveTowardsTarget(targetPosition, targetEntity)); }
bool PassesValidTarget(Destructible target) { if ((ValidTargets & Targets.None) != 0) { return(false); } if ((ValidTargets & Targets.All) != 0) { return(true); } if ((ValidTargets & Targets.Ground) != 0) { return(true); } bool isUnit = target is Unit; if (isUnit && (ValidTargets & Targets.Units) != 0) { return(true); } if (target == Performer && (ValidTargets & Targets.Self) != 0) { return(true); } if (isUnit && target.State == UnitState.RaisableCorpse && (ValidTargets & Targets.RaisableCorpses) != 0) { return(true); } if (isUnit && target.State == UnitState.Dead && (ValidTargets & Targets.Dead) != 0) { return(true); } if (!target.CanBeDestroyed) { return(false); } bool isHostile = Mechanics.TeamReleations.IsHostile(Performer.Team, target.Team); if (isHostile && (ValidTargets & Targets.Enemies) != 0) { return(true); } if (!isHostile && (ValidTargets & Targets.Friendlies) != 0) { return(true); } return(false); }
public virtual bool IsInGroup(Destructible destructible) { foreach (var v in GetDestructibles()) { if (v == destructible) { return(true); } } return(false); }
void NNObject_ExitsRange(Destructible arg1, Destructible arg2) { if (!IsValidTarget(arg2)) { return; } if (arg2 is Unit) { OnUnitExitsRange((Unit)arg2); } }
protected virtual int CalculateDamage(Destructible target) { if (IsCritting) { return((int)(Damage * CritDamageMultiplier * Math.Pow(1 + CritRowMultiplier, nCritsInRow))); } else { return(Damage); } }
protected void TryHit(Destructible target) { if (!IsInEffectiveRange(target)) { return; } if (!CanHit(target)) { return; } Hit(target); }
public override bool IsPerformableTowardsTarget(Vector3 targetPosition, Destructible targetEntity) { float d; if (targetEntity != null) { d = targetEntity.HitDistance(Mediator.Translation); } else { d = (Mediator.Translation - targetPosition).Length(); } return(d < PerformableRange && Performer.State == UnitState.Alive && //Performer.MotionUnit.IsOnGround && base.IsPerformableTowardsTarget(targetPosition, targetEntity)); }
IState TryFindBetterState(IState state, Destructible target) { foreach (var a in Abilities) { if (a.IsValidTarget(target)) { var s = new TryPerformAbility(this) { Ability = a, Chasing = target }; if (state.IsBetterState(s)) { state = s; } } } return(state); }
private void Hit(Destructible target) { int damage = CalculateDamage(target); if (IsCritting) { target.Hit(Performer, damage, CritAttackType, this); } else { target.Hit(Performer, damage, AttackType, this); } if (ApplyBuffToTargets != null && target is Unit) { var b = (Buff)ApplyBuffToTargets.Clone(); ((Unit)target).AddBuff(b, (Unit)Performer, Mediator); } OnHit(target); }
public override float AIPriority(Unit performer, Vector3 targetPosition, Destructible targetUnit) { if (IsPerforming) { return(2); } if (!IsValidTarget(targetUnit)) { return(-100); } if (!IsEffectiveTowardsTarget(targetPosition, targetUnit)) { return(-50); } if (CurrentCooldown >= 0) { return(0.1f); } if (!IsInEffectiveRange(targetUnit)) { return(0.5f); } return(1); }
protected abstract int GetValue(Destructible d);
protected override void SetValue(Destructible d, int value) { var u = d as Unit; u.CanPerformAbilitiesBlockers = value; }
protected virtual void OnHit(Destructible target) { }
protected override int GetValue(Destructible d) { var u = d as Unit; return(u.CanControlRotationBlockers); }
protected virtual bool CanHit(Destructible target) { return(true); }
public virtual bool AIIsInEffectiveRange(Destructible target) { return(IsInEffectiveRange(target, AIEffectiveRangeTolerance)); }
/// <summary> /// Used mainly by the AI to determin if we wan to use this ability /// </summary> public virtual bool IsEffectiveTowardsTarget(Vector3 targetPosition, Destructible targetEntity) { return(IsPerformableTowardsTarget(targetPosition, targetEntity)); }
protected override int GetValue(Destructible d) { var u = d as Unit; return(u.CanPerformAbilitiesBlockers); }
public override bool IsEffectiveTowardsTarget(Vector3 targetPosition, Destructible targetEntity) { return(targetEntity != null && base.IsEffectiveTowardsTarget(targetPosition, targetEntity)); }
protected virtual int GetMaxValue(Destructible d) { return(GetValue(d)); }
protected virtual void OnKillsDestructible(Destructible target) { }
protected override void SetValue(Destructible d, int value) { var u = d as Unit; u.CanControlRotationBlockers = value; }
protected override void OnDestructibleExitsRange(Destructible u, Destructible exiter) { base.OnDestructibleExitsRange(u, exiter); inRangeLastChangedFrame = Game.Instance.FrameId; }
public override float AIPriority(Unit performer, Vector3 targetPosition, Destructible targetUnit) { float d = Math.Max(1, (targetUnit.Position - Game.Instance.Map.MainCharacter.Position).Length()); return(base.AIPriority(performer, targetPosition, targetUnit) + 0.01f / d); }
public bool IsInEffectiveRange(Destructible target) { return(IsInEffectiveRange(target, 1)); }
public virtual float AIPriority(Unit performer, Vector3 targetPosition, Destructible targetEntity) { return(1); }
protected abstract void SetValue(Destructible d, int value);