Fixed Bug 8109

elemental's action could cause itself to be destroyed (e.g. due to target's reflect) and would thus cause sd->ed to be null, and would cause a crash when trying to access sd->ed->db, so moving the duration check to prior to elemental's action trigger.
Special Thanks to OmegaRed.
http://hercules.ws/board/tracker/issue-8109-mapserver-crash-skill-so-el-action

Signed-off-by: shennetsind <ind@henn.et>
Fixed a skill_castend_nodamage_id warning for SO_ELEMENTAL_SHIELD

skill_castend_nodamage_id: Unknown skill used:5008

Signed-off-by: shennetsind <ind@henn.et>