Example #1
0
        public void ApplyStatusEffect(ActionType type, StatusEffect statusEffect, float deltaTime, CharacterHealth characterHealth, Limb targetLimb)
        {
            if (type == ActionType.OnDamaged && !statusEffect.HasRequiredAfflictions(characterHealth.Character.LastDamage))
            {
                return;
            }

            statusEffect.SetUser(Source);
            if (statusEffect.HasTargetType(StatusEffect.TargetType.Character))
            {
                statusEffect.Apply(type, deltaTime, characterHealth.Character, characterHealth.Character);
            }
            if (targetLimb != null && statusEffect.HasTargetType(StatusEffect.TargetType.Limb))
            {
                statusEffect.Apply(type, deltaTime, characterHealth.Character, targetLimb);
            }
            if (targetLimb != null && statusEffect.HasTargetType(StatusEffect.TargetType.AllLimbs))
            {
                statusEffect.Apply(type, deltaTime, targetLimb.character, targets: targetLimb.character.AnimController.Limbs);
            }
            if (statusEffect.HasTargetType(StatusEffect.TargetType.NearbyItems) ||
                statusEffect.HasTargetType(StatusEffect.TargetType.NearbyCharacters))
            {
                targets.Clear();
                targets.AddRange(statusEffect.GetNearbyTargets(characterHealth.Character.WorldPosition, targets));
                statusEffect.Apply(type, deltaTime, characterHealth.Character, targets);
            }
        }
Example #2
0
 public void ApplyStatusEffect(StatusEffect statusEffect, float deltaTime, CharacterHealth characterHealth, Limb targetLimb)
 {
     statusEffect.SetUser(Source);
     if (statusEffect.HasTargetType(StatusEffect.TargetType.Character))
     {
         statusEffect.Apply(ActionType.OnActive, deltaTime, characterHealth.Character, characterHealth.Character);
     }
     if (targetLimb != null && statusEffect.HasTargetType(StatusEffect.TargetType.Limb))
     {
         statusEffect.Apply(ActionType.OnActive, deltaTime, characterHealth.Character, targetLimb);
     }
     if (targetLimb != null && statusEffect.HasTargetType(StatusEffect.TargetType.AllLimbs))
     {
         statusEffect.Apply(ActionType.OnActive, deltaTime, targetLimb.character, targetLimb.character.AnimController.Limbs.Cast <ISerializableEntity>().ToList());
     }
     if (statusEffect.HasTargetType(StatusEffect.TargetType.NearbyItems) ||
         statusEffect.HasTargetType(StatusEffect.TargetType.NearbyCharacters))
     {
         var targets = new List <ISerializableEntity>();
         statusEffect.GetNearbyTargets(characterHealth.Character.WorldPosition, targets);
         statusEffect.Apply(ActionType.OnActive, deltaTime, targetLimb.character, targets);
     }
 }