Example #1
0
        public HealthBar(Entity entity, HealthBarsSettings settings)
        {
            Entity    = entity;
            _distance = new TimeCache <float>(() => entity.DistancePlayer, 200);

            // If ignored entity found, skip
            foreach (var _entity in IgnoreEntitiesList)
            {
                if (entity.Path.Contains(_entity))
                {
                    return;
                }
            }

            Update(entity, settings);

            //CanNotDie = entity.GetComponent<Stats>().StatDictionary.ContainsKey(GameStat.CannotDie);
            CanNotDie = entity.Path.StartsWith("Metadata/Monsters/Totems/Labyrinth");

            if (entity.HasComponent <ObjectMagicProperties>() && entity.GetComponent <ObjectMagicProperties>().Mods.Contains("MonsterConvertsOnDeath_"))
            {
                OnHostileChange = () =>
                {
                    if (_init)
                    {
                        Update(Entity, settings);
                    }
                };
            }
        }
Example #2
0
        public void Update(Entity entity, HealthBarsSettings settings)
        {
            if (entity.HasComponent <Player>())
            {
                Type     = CreatureType.Player;
                Settings = settings.Players;
            }
            else if (entity.HasComponent <Monster>())
            {
                if (entity.IsHostile)
                {
                    var objectMagicProperties = entity.GetComponent <ObjectMagicProperties>();

                    if (objectMagicProperties != null)
                    {
                        switch (objectMagicProperties.Rarity)
                        {
                        case MonsterRarity.White:
                            Type     = CreatureType.Normal;
                            Settings = settings.NormalEnemy;
                            break;

                        case MonsterRarity.Magic:
                            Type     = CreatureType.Magic;
                            Settings = settings.MagicEnemy;
                            break;

                        case MonsterRarity.Rare:
                            Settings = settings.RareEnemy;
                            Type     = CreatureType.Rare;
                            break;

                        case MonsterRarity.Unique:
                            Settings = settings.UniqueEnemy;
                            Type     = CreatureType.Unique;
                            break;

                        default:
                            Settings = settings.Minions;
                            Type     = CreatureType.Minion;
                            break;
                        }
                    }
                }
                else
                {
                    Type     = CreatureType.Minion;
                    Settings = settings.Minions;
                }
            }

            _lastHp = GetFullHp();
            MaxHp   = Life.MaxHP;
            _init   = true;
        }
Example #3
0
        public HealthBar(Entity entity, HealthBarsSettings settings)
        {
            if (entity == null)
            {
                return;
            }

            Entity    = entity;
            _distance = new TimeCache <float>(() => entity.DistancePlayer, 200);

            // If ignored entity found, skip
            foreach (var _entity in IgnoreEntitiesList)
            {
                if (entity.Path.Contains(_entity))
                {
                    return;
                }
            }

            if (Entity.Path.StartsWith("Metadata/Monsters/AtlasExiles/BasiliskInfluenceMonsters/BasiliskBurrowingViper") &&
                (Entity.Rarity != MonsterRarity.Unique))
            {
                return;
            }

            Update(entity, settings);

            var _canNotDie = entity?.GetComponent <Stats>()?.StatDictionary?.ContainsKey(GameStat.CannotDie);

            if (_canNotDie == null)
            {
                CanNotDie = entity.Path.StartsWith("Metadata/Monsters/Totems/Labyrinth");
            }
            else
            {
                CanNotDie = (bool)_canNotDie;
            }

            var mods = entity?.GetComponent <ObjectMagicProperties>()?.Mods;

            if (mods != null && mods.Contains("MonsterConvertsOnDeath_"))
            {
                OnHostileChange = () =>
                {
                    if (_init)
                    {
                        Update(Entity, settings);
                    }
                };
            }
        }