Exemplo n.º 1
0
        private void OnEntityTakeDamage(BaseCombatEntity entity, HitInfo hitInfo)
        {
            if (entity == null || hitInfo == null)
            {
                return;
            }

            String target = entity is BasePlayer ? "player" : entity is BuildingBlock ? "building" : entity is BaseNPC ? "animal" : entity is Barricade ? "barricade" : "none";

            DamageReceiver receiver = config.forName(target);

            if (receiver == null)
            {
                return;
            }

            DamageType type = hitInfo.damageTypes.GetMajorityDamageType();

            if (type == null)
            {
                return;
            }


            float modifier;

            if (receiver.list.TryGetValue(type, out modifier))
            {
                hitInfo.damageTypes.Scale(type, modifier);
            }
        }