Ejemplo n.º 1
0
        private static void ReApply(Behaviour applied, Behaviour behaviour)
        {
            if (applied.ReApplyFlags.HasFlag(ReApplyBehaviourFlags.RefreshDuration))
            {
                applied.RefreshDuration(behaviour);
            }

            if (applied.ReApplyFlags.HasFlag(ReApplyBehaviourFlags.RefreshEffect))
            {
                applied.RefreshEffect(behaviour);
            }

            if (applied.ReApplyFlags.HasFlag(ReApplyBehaviourFlags.StackDuration))
            {
                applied.StackDuration(behaviour);
            }

            if (applied.ReApplyFlags.HasFlag(ReApplyBehaviourFlags.StackEffect))
            {
                applied.StackEffect(behaviour);
            }

            if (applied.StackCountMax > 0 && applied.StackCount < applied.StackCountMax)
            {
                applied.StackCount = Math.Min(applied.StackCount + behaviour.StackCount, applied.StackCountMax);
            }
        }
Ejemplo n.º 2
0
 private void OnAnyBehaviourApplied(Behaviour behaviour)
 {
     if (behaviour is ShieldBehaviour shieldBehaviour)
     {
         Restore(ResourceType.Rage, shieldBehaviour.Amount / CalculatePower() * 100);
     }
 }
Ejemplo n.º 3
0
        public void Apply(Behaviour behaviour, GameObject caster)
        {
            if (!behaviour.IsIgnoresImmunity &&
                Behaviours.Any(element => (element.StatusImmunity & behaviour.StatusFlags) > 0) ||
                CombatEncounter.Active == null && behaviour.IsPreventsMovement())
            {
                AnyBehaviourImmune?.Invoke(gameObject, behaviour);
                return;
            }

            BeforeBehaviourApplied(behaviour);

            var applied = Behaviours.FirstOrDefault(b => b.Id == behaviour.Id);

            if (applied != null)
            {
                ReApply(applied, behaviour);
                return;
            }

            Behaviours.Add(behaviour);
            Behaviours = Behaviours.OrderBy(b => b.RemainingDuration).ToList();

            behaviour.Removed += OnBehaviourRemoved;
            behaviour.Apply(caster, gameObject);

            AnyBehaviourApplied?.Invoke(behaviour);
            BehaviourApplied?.Invoke(behaviour);
        }
Ejemplo n.º 4
0
        private void OnBehaviourRemoved(Behaviour behaviour)
        {
            Behaviours.Remove(behaviour);
            behaviour.Removed -= OnBehaviourRemoved;

            BehaviourRemoved?.Invoke(behaviour);
            AnyBehaviourRemoved?.Invoke(behaviour);
        }
Ejemplo n.º 5
0
        private void OnBehaviourRemoved(Behaviour behaviour)
        {
            View.SetPoisoned(this.behaviours.IsPoisoned);

            if (!behaviour.Flags.HasFlag(BehaviourFlags.Hidden))
            {
                View.RemoveBehaviour(behaviour);
            }
        }
Ejemplo n.º 6
0
        private void OnBehaviourRemoved(Behaviour behaviour)
        {
            if (GetComponent <BehavioursComponent>().IsInvisible)
            {
                return;
            }

            Model.ChangeTransparency(1.0f);
        }
Ejemplo n.º 7
0
        private void OnBehaviourApplied(Behaviour behaviour)
        {
            if (!behaviour.StatusFlags.HasFlag(StatusFlags.Invisibility))
            {
                return;
            }

            Model.ChangeTransparency(0.25f);
        }
Ejemplo n.º 8
0
        private void BeforeBehaviourApplied(Behaviour applied)
        {
            if (!applied.IsPreventsActions())
            {
                return;
            }

            foreach (var behaviour in Behaviours.Where(behaviour => behaviour.Flags.HasFlag(BehaviourFlags.BreaksOnCrowdControl)).ToList())
            {
                RemoveAllStacks(behaviour.Id);
            }
        }
Ejemplo n.º 9
0
        private void OnBehaviourApplied(Behaviour behaviour)
        {
            if (behaviour.Flags.HasFlag(BehaviourFlags.Hidden))
            {
                return;
            }

            var behaviourView = Instantiate(this.behaviourPrefab, this.behaviourContainer);

            behaviourView.Initialize(behaviour);
            this.behaviourViews.Add(behaviourView);
        }
Ejemplo n.º 10
0
        private void OnBehaviourRemoved(Behaviour behaviour)
        {
            if (!(behaviour is BuffBehaviour))
            {
                return;
            }

            AddRow($"<color=#888888>[{DateTime.Now.ToLongTimeString()}]</color> " +
                   I18N.Instance.Get("ui_combat_log_buff_removed")
                   .ToString(new object[]
            {
                ColorBlue + behaviour.Name + EndColor,
                ColorRed + behaviour.Target.GetComponent <UnitComponent>().Name + EndColor,
            }));
        }
Ejemplo n.º 11
0
        private void OnBehaviourApplied(Behaviour behaviour)
        {
            if (behaviour.IsHidden || !behaviour.Target.IsVisible() || Game.Instance.State.IsTown)
            {
                return;
            }

            AddRow($"<color=#888888>[{DateTime.Now.ToLongTimeString()}]</color> " +
                   I18N.Instance.Get("ui_combat_log_buff_applied")
                   .ToString(new object[]
            {
                ColorYellow + behaviour.Caster.GetComponent <UnitComponent>().Name + EndColor,
                ColorBlue + behaviour.Name + EndColor,
                ColorYellow + behaviour.Target.GetComponent <UnitComponent>().Name + EndColor,
            }));
        }
Ejemplo n.º 12
0
        private void OnBehaviourRemoved(Behaviour behaviour)
        {
            if (behaviour.Flags.HasFlag(BehaviourFlags.Hidden))
            {
                return;
            }

            var behaviourView = this.behaviourViews.FirstOrDefault(view => view.Behaviour.Id == behaviour.Id);

            if (behaviourView == null)
            {
                return;
            }

            this.behaviourViews.Remove(behaviourView);

            behaviourView.Terminate();
            Destroy(behaviourView.gameObject);
        }
Ejemplo n.º 13
0
 public void RemoveStack(Behaviour behaviour, int stack = 1)
 {
     Behaviours.FirstOrDefault(b => b.Equals(behaviour))?.Remove(stack);
 }
Ejemplo n.º 14
0
        private void OnBehaviourApplied(Behaviour behaviour)
        {
            var text = new I18NString();

            if (behaviour.StatusFlags.HasFlag(StatusFlags.Disarm))
            {
                text = EnumTranslator.Translate(StatusFlags.Disarm);
            }

            if (behaviour.StatusFlags.HasFlag(StatusFlags.Swiftness))
            {
                text = EnumTranslator.Translate(StatusFlags.Swiftness);
            }

            if (behaviour.StatusFlags.HasFlag(StatusFlags.Immobilization))
            {
                text = EnumTranslator.Translate(StatusFlags.Immobilization);
            }

            if (behaviour.StatusFlags.HasFlag(StatusFlags.Invisibility))
            {
                text = EnumTranslator.Translate(StatusFlags.Invisibility);
            }

            if (behaviour.StatusFlags.HasFlag(StatusFlags.Invulnerability))
            {
                text = EnumTranslator.Translate(StatusFlags.Invulnerability);
            }

            if (behaviour.StatusFlags.HasFlag(StatusFlags.Silence))
            {
                text = EnumTranslator.Translate(StatusFlags.Silence);
            }

            if (behaviour.StatusFlags.HasFlag(StatusFlags.Confusion))
            {
                text = EnumTranslator.Translate(StatusFlags.Confusion);
            }

            if (behaviour.StatusFlags.HasFlag(StatusFlags.Slow))
            {
                text = EnumTranslator.Translate(StatusFlags.Slow);
            }

            if (behaviour.StatusFlags.HasFlag(StatusFlags.Stun))
            {
                text = EnumTranslator.Translate(StatusFlags.Stun);
            }

            if (behaviour.StatusFlags.HasFlag(StatusFlags.Weakness))
            {
                text = EnumTranslator.Translate(StatusFlags.Weakness);
            }

            if (text.IsNullOrEmpty())
            {
                return;
            }

            Enqueue(behaviour.Target, text, Color.white);
        }
Ejemplo n.º 15
0
 private void OnAnyBehaviourImmune(GameObject entity, Behaviour behaviour)
 {
     Enqueue(entity, I18N.Instance.Get("ui_immune"), Color.white);
 }