Help on the wizards haunt

Hi, please format your code:

Thanks
Danny