Sure! It's easy enough, just insert the CheckCast part, and add the bits of code into the same similar spots as in the example.
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Targeting;
using Server.Multis;
using Server.Regions;
using Server.Mobiles;
using...