-----------------------------------	
-- Area: Fei'Yin	
--  MOB: Clockwork Pod
-- Note: Place holder Mind Hoarder 
-----------------------------------	

require("scripts/zones/FeiYin/MobIDs"); 
require("scripts/globals/keyitems");

-----------------------------------	
-- onMobDeath	
-----------------------------------	
	
function onMobDeath(mob,killer)	

    
    mob = mob:getID();    -- Get Clockwork Pod ID and check if it is MH's PH
    if (Mind_Hoarder_PH[mob] ~= nil) then   -- Check if Clockwork Pod is within the Mind_Hoarder_PH table
        printf("%u is a PH",mob);
         MH_ToD = GetServerVariable("[POP]Mind_Hoarder");  -- Get MH's previous ToD
          if (MH_ToD <= os.time(t) and GetMobAction(Mind_Hoarder) == 0) then     -- Check if MH window is open, and there is not an MH popped already(ACTION_NONE = 0)
           printf("MH window open");
            if (math.random(1,4) == 1) then  -- Give Clockwork Pod 10 percent chance to pop MH
                -- printf("MH will pop");
                UpdateNMSpawnPoint(Mind_Hoarder);
                GetMobByID(Mind_Hoarder):setRespawnTime(GetMobRespawnTime(mob));
                SetServerVariable("[PH]Mind_Hoarder", mob);
                DeterMob(mob, true);
                printf("Reached eof for Mind Hoarder");
            end
        end
    end
    -- Curses, Foiled A-Golem!?
	if (killer:hasKeyItem(SHANTOTTOS_NEW_SPELL)) then
		killer:delKeyItem(SHANTOTTOS_NEW_SPELL);
		killer:addKeyItem(SHANTOTTOS_EXSPELL);
	end
end;	