Exemple #1
0
        public void CollectDamages(Creature creature, List <Damage> mainDamages, List <Damage> successfulSavedDamages, int savingThrow, CreatureSize creatureSize)
        {
            hitPointChange = 0;
            foreach (Damage damage in successfulSavedDamages)
            {
                if (damage.Saves(savingThrow))
                {
                    if (damage.Conditions != Conditions.None)
                    {
                        if (damage.IncludeCreatureSizes.HasFlag(creatureSize))
                        {
                            conditionsAdded |= damage.Conditions;
                        }
                    }
                    if (damage.DamageType != DamageType.None && !creature.IsImmuneTo(damage.DamageType, damage.AttackKind))
                    {
                        damageTypes    |= damage.DamageType;
                        hitPointChange += (int)-Math.Round(damage.GetDamageRoll());
                    }
                }
            }

            foreach (Damage damage in mainDamages)
            {
                if (!damage.Saves(savingThrow))
                {
                    if (damage.Conditions != Conditions.None)
                    {
                        if (damage.IncludeCreatureSizes.HasFlag(creatureSize))
                        {
                            conditionsAdded |= damage.Conditions;
                            damageTypes     |= DamageType.Condition;
                        }
                    }
                    DamageType damageType = damage.DamageType & ~(DamageType.Condition | DamageType.None);
                    if (damageType != DamageType.None && !creature.IsImmuneTo(damageType, damage.AttackKind))
                    {
                        damageTypes    |= damageType;
                        hitPointChange += (int)-Math.Round(damage.GetDamageRoll());
                    }
                }
            }
        }