Exemplo n.º 1
0
        public void ProcessDamageTriggerWatchers(object target, MyDamageInformation info)
        {
            if (!_behavior.IsAIReady())
            {
                return;
            }

            //Logger.MsgDebug("Damage Trigger Count: " + this.DamageTriggers.Count.ToString(), DebugTypeEnum.Trigger);
            if (info.Amount <= 0)
            {
                return;
            }

            _settings.LastDamageTakenTime     = MyAPIGateway.Session.GameDateTime;
            _settings.TotalDamageAccumulated += info.Amount;
            _settings.LastDamagerEntity       = info.AttackerId;

            for (int i = 0; i < DamageTriggers.Count; i++)
            {
                //Logger.AddMsg("Got Trigger Profile", true);

                var trigger = DamageTriggers[i];

                var damageType = info.Type.ToString();

                if ((trigger.DamageTypes.Contains(damageType) || trigger.DamageTypes.Contains("Any")) && !trigger.ExcludedDamageTypes.Contains(damageType))
                {
                    if (trigger.UseTrigger == true)
                    {
                        trigger.ActivateTrigger();

                        if (trigger.Triggered == true)
                        {
                            Logger.MsgDebug("Process Damage Actions", DebugTypeEnum.Trigger);
                            ProcessTrigger(trigger, info.AttackerId);
                        }
                    }
                }
            }
        }