When used in an attack, cannons move along the path and attack all structures. They do simple blunt damage and do not have an AoE effect. Enemy units are ignored with the exception of mortars and monks that are attacked by cannons as well. At the castle gate, cannons often ignore towers right next to the gate and fire on the gate instead.
Cannons are the most effective way to take down structures as they all have a weakness to blunt damage. Cannons often need some management from the hero to avoid being killed by a stray pyromancer.
Cannons always fire at obstacles and traps in priority. After finishing them off, they move on to attack towers. Spikes are often used as a bait to attract cannons making it easy for pyromancers to damage cannons.
Defending cannons attack all enemy units including the hero. Their Elite Boost Storm Cannons is quite effective in defense.
Cannons never panic; neither because of fire nor because of a werewolf's howl.