How Do You Figure Out the Damage?
Usually the amount of damage an attack does won't depend on the order in which you do things. But if you have to figure out an attack in which a lot of different things might change the damage, follow these steps in order (skip any steps that don't apply to that attack).
Start with the base damage. This is the number written to the right of the attack, or, if that number has an x, -, +, or ? sign next to it, it's the amount of damage the attack text tells you to do.
Apply any effects the Active Pokémon has that will affect the base damage dealt (for example, Scyther's Swords Dance). Then if the base damage is 0 (or if the attack doesn't do any damage at all), just stop figuring the damage. You're done now. Otherwise, keep going.
Double the damage if the Defending Pokémon has a Weakness to the attacking Pokémon's type.
Subtract 30 damage if the Defending Pokémon has Resistance to the attacking Pokémon's type.
Figure out effects of Trainer cards attached to the attacking Pokémon.
Figure out effects of Trainer cards attached to the Defending Pokémon.
Apply any relevant effects resulting from the Defending Pokémon's last attack (for example, Onix's Harden) or any relevant Pokémon Powers.
For each 10 damage the attack ends up doing, put one damage counter on the Defending Pokémon. (If at this point the damage done turns out to be less than 0, don't do anything.)
Now that damage has been done, if the attack does anything other than damage, do all of that.