Using a microcontroller to produce a shock
Take a look at flyback transformers. These can boost a low voltage up to a high enough voltage to shock someone. Many novelties like shocking lighters use flyback transformers to generate the shock. Here is a very cheap one on amazon...

https://www.amazon.com/Forum-Novelties-63503-Amazing-Lighter/dp/B000K8ET9K/

Maybe try to get a hold of one of these an open it up to see how it works, and the even salvage parts from it. You can use a transistor to generate the input current to the transformer under the control of a micro-controller. 

Another way to generate high voltages with a micro-controller is to use a diode based voltage multiplier... 

https://en.wikipedia.org/wiki/Voltage_multiplier

If you connect the input of one of these multipliers to a GPIO pin of the micro-controller, you can charge up the multiplier by toggling the output pin up and down. If you pick small capacitors, you can limit the amount of energy stored in the system to help keep it safe.

Finally, you can generate high voltages by physically hitting a peizo element with something like a solenoid. This is how barbeque lighters generate their spark. Try to find one of these lighters and open it up and play with the striking mechanism inside to see how it works. 

Of course be careful too.