public ScriptedAI(CreatureObject parent) : base(parent) { _creature = parent; parent.OnDestroy += ScriptedAI_OnDestroy; parent.OnInitialize += ScriptedAI_OnInitialize; }
private void ScriptedAI_OnDestroy() { _stats = null; _threat = null; _tEntry = null; _target = null; _creature = null; _movement = null; }
private void StatsMgr_OnDestroy() { CleanModifers(); _view = null; _stats = null; _player = null; _creature = null; _modifers = null; }
public ThreatMgr(CreatureObject parent) : base(parent) { m_creature = parent; m_threat = new ConcurrentDictionary <CreatureObject, float>(); parent.OnDespawn += ThreatMgr_OnDespawn; parent.OnDestroy += ThreatMgr_OnDestroy; parent.OnInitialize += ThreatMgr_OnInitialize; }
public void Kill(CreatureObject killer) { lock (this) { if (_dead) { return; } _dead = true; } OnKilled?.Invoke(killer); }
public StatsMgr(CreatureObject parent) : base(parent) { _creature = parent; _modifers = new List <TimedModifer>(); _stats = new Dictionary <Stats, StatValue>(); _auras = new Dictionary <uint, List <Tuple <Stats, float, bool> > >(); stats_ser = new SER_Stats(_stats); parent.OnSpawn += StatsMgr_OnSpawn; parent.OnDespawn += StatsMgr_OnDespawn; parent.OnDestroy += StatsMgr_OnDestroy; }
private void ThreatMgr_OnDamageReceived(CreatureObject arg1, float arg2) { if (m_threat.ContainsKey(arg1)) { m_threat[arg1] += arg2; } else { m_threat[arg1] = arg2; arg1.View.SetCombat(arg1.Owner, true); } }
public void DoDamage(CreatureObject other, float damage, bool isMagic = false) { if (_creature.IsDead) { return; } StatValue hStat = _stats[Stats.Health]; StatValue pStat = isMagic ? _stats[Stats.MagicResist] : _stats[Stats.Armor]; hStat.DecreaseCurrent(damage = CalculateDamage(other.Stats.Level, damage, pStat.Max)); OnDamageReceived?.Invoke(other, damage); _view.SendStatUpdate(Stats.Health, hStat); if (hStat.Current == 0f) { _creature.Kill(other); } }
public void DoMeleeAttackIfReady() { if (_target != null && _aTime <= 0) { _aTime = _stats.AttackRate; if (_target.IsDead) { _threat.Remove(_target); _target = null; } else if (Vector3.DistanceSquared(_movement.Position, _target.Position) <= (Constants.MaxMeleeCombatDistanceSquared + Constants.EpsilonX1)) { _creature.View.PerformSkill(_tEntry.Fill(_target)); _target.Stats.DoDamage(_creature, _stats.MeleeDamage); if (_target.IsDead) { _threat.Remove(_target); } } } }
private void MovementGenerator_OnDestroy() { _creature = null; }
public MovementGenerator(CreatureObject parent) : base(parent) { _creature = parent; parent.OnDestroy += MovementGenerator_OnDestroy; }
public void DoHeal(CreatureObject other, float amount) { _stats[Stats.Health].IncreaseCurrent(amount); OnHealReceived?.Invoke(other, amount); }
public abstract bool SelectTarget(out CreatureObject target);
public void Remove(CreatureObject creature) { m_threat.TryRemove(creature, out _); creature.View.SetCombat(creature.Owner, false); }
public void Remove(CreatureObject creature) { _threat.Remove(creature); creature.View.SetCombat(creature.Owner, false); }