Yes, if it was used to make the attack you will have to discard it.
Energy cards are attached to a Pokémon to enable it to attack. There are two types of Energy cards: Basic Energy cards and Special Energy cards. There are eight different Basic Energy types: Grass, Fire, Water, Lightning, Psychic, Fighting, Darkness, and Metal. Darkness and Metal Energy could only be provided through Special Energy cards until the Diamond & Pearl expansion set, where they became Basic Energy types. Basic Energy cards only provide one Energy of the specified type, while Special Energy cards have additional benefits and varying Energy provisions. Additionally, the amount of Basic Energy cards allowed in a deck is unrestricted, while Special Energy cards follow the standard rule restricting the number of cards with the same name in a deck to four.
Some attacks require a certain type and amount of Energy, depending on the type of attack and the Pokémon using it. If an attack requires Basic Energy, then that type and amount of Energy must be attached to the Pokémon, whereas if the attack has a Colorless Energy requirement, that requirement can be met by any Energy card. Colorless Energy is neither a Basic nor a Special Energy type and can be provided through both Basic and Special Energy cards. However, the Double Colorless Energy (released as the first Special Energy in Base Set) can count as only colorless Energy. -Source
At no point in the descriptions of energy cards does it say that special energy cards are exempt from the discarding rule.