bool ShowIcon(LiveEffectBundle bundle)
        {
            // At least one effect with remaining rounds must want to show an icon, or be from an equipped item
            foreach (IEntityEffect effect in bundle.liveEffects)
            {
                if ((effect.Properties.ShowSpellIcon && effect.RoundsRemaining > 0) || bundle.fromEquippedItem != null)
                {
                    return(true);
                }
            }

            return(false);
        }
Example #2
0
        public void UpdateIcons()
        {
            ClearIcons();

            // Get all effect bundles currently operating on player
            EntityEffectManager playerEffectManager = GameManager.Instance.PlayerEffectManager;

            LiveEffectBundle[] effectBundles = playerEffectManager.EffectBundles;
            if (effectBundles == null || effectBundles.Length == 0)
            {
                return;
            }

            // Sort icons into active spells in self and other icon lists
            int poolIndex = 0;

            for (int i = 0; i < effectBundles.Length; i++)
            {
                LiveEffectBundle bundle = effectBundles[i];

                // Don't add effect icon for instant spells, must have at least 1 round remaining or be from an equipped item
                if (!ShowIcon(bundle))
                {
                    continue;
                }

                // Setup icon information and sort into self (player is caster) or other (player not caster)
                // Need to check where spells cast by RDB actions are placed (e.g. click skull to cast levitate)
                // And offensive spells the player catches themselves with
                // Will need to refine how this works as more effects and situations become available
                ActiveSpellIcon item = new ActiveSpellIcon();
                item.displayName = bundle.name;
                item.iconIndex   = bundle.iconIndex;
                item.icon        = bundle.icon;
                item.poolIndex   = poolIndex++;
                item.expiring    = (GetMaxRoundsRemaining(bundle) <= 2) ? true : false;
                item.isItem      = (effectBundles[i].fromEquippedItem != null);
                if (bundle.caster == null || bundle.caster != GameManager.Instance.PlayerEntityBehaviour)
                {
                    activeOtherList.Add(item);
                }
                else
                {
                    activeSelfList.Add(item);
                }
            }

            // Update icon panels in pooled collection
            AlignIcons(activeSelfList, classicSelfStartX, classicSelfStartY, classicIconDim, classicIconDim, classicHorzSpacing);
            AlignIcons(activeOtherList, classicOtherStartX, classicOtherStartY, classicIconDim, classicIconDim, classicHorzSpacing);
        }
Example #3
0
        bool ShowIcon(LiveEffectBundle bundle)
        {
            // At least one effect with remaining rounds must want to show an icon, or be from an equipped item
            // Never show passive items specials icon, this is an internal system effect only
            foreach (IEntityEffect effect in bundle.liveEffects)
            {
                if (effect.Properties.ShowSpellIcon && (effect.RoundsRemaining > 0 || bundle.fromEquippedItem != null))
                {
                    return(true);
                }
            }

            return(false);
        }
        int GetMaxRoundsRemaining(LiveEffectBundle bundle)
        {
            // Get most remaining rounds of all effects
            // A spell can have multiple effects with different round durations
            int maxRoundsRemaining = 0;

            foreach (IEntityEffect effect in bundle.liveEffects)
            {
                if (effect.RoundsRemaining > maxRoundsRemaining)
                {
                    maxRoundsRemaining = effect.RoundsRemaining;
                }
            }

            return(maxRoundsRemaining);
        }
 void UpdateIcons(LiveEffectBundle bundleAdded)
 {
     UpdateIcons();
 }