public override void Unapply()
        {
            if (m_modifier_id == 0)
            {
                return;
            }
            Entity owner_entity = GetOwnerEntity();
            DamageModificationComponent damage_modification_component = owner_entity.GetComponent(DamageModificationComponent.ID) as DamageModificationComponent;

            if (damage_modification_component == null)
            {
                return;
            }
            damage_modification_component.RemoveModifier(m_modifier_id);
            m_modifier_id = 0;
        }
Пример #2
0
        FixPoint CalculateFinalDamageAmount(Damage damage, Entity attacker)
        {
            FixPoint damage_amount = damage.m_damage_amount;

            if (attacker != null)
            {
                DamageModificationComponent attacker_cmp = attacker.GetComponent(DamageModificationComponent.ID) as DamageModificationComponent;
                if (attacker_cmp != null)
                {
                    damage_amount = attacker_cmp.ApplyModifiersToDamage(damage, damage_amount, ParentObject, true);
                }
            }
            DamageModificationComponent self_cmp = ParentObject.GetComponent(DamageModificationComponent.ID) as DamageModificationComponent;

            if (self_cmp != null)
            {
                damage_amount = self_cmp.ApplyModifiersToDamage(damage, damage_amount, attacker, false);
            }
            return(damage_amount);
        }
        public override void Apply()
        {
            if (m_modifier_type == 0)
            {
                return;
            }
            Entity owner_entity = GetOwnerEntity();
            DamageModificationComponent damage_modification_component = owner_entity.GetComponent(DamageModificationComponent.ID) as DamageModificationComponent;

            if (damage_modification_component == null)
            {
                return;
            }
            DamageModifier modifier = DamageModifier.Create(m_modifier_type);

            if (modifier == null)
            {
                return;
            }
            m_modifier_id = GetLogicWorld().GenerateDamageModifierID();
            modifier.Contruct(m_modifier_id, m_variables);
            damage_modification_component.AddModifier(modifier);
        }