Add an ability based on non-target ability (e.g. thunder clap) and remove all the effect + nullify the mana cost.
Then create a trigger that for each cast of this ability checks if conditions are fulfilled (if the player has 50 lumber) and if yes, then sets gold to Current Gold + 25 and lumber to Current Lumber - 50. You can also add cool effects like floating text, etc.