func int c_cannpccollidewithspell(var int spelltype) {
if(c_npcisdown(self)) {
return coll_donothing;
};
if((spelltype != spl_zap) || (spelltype != spl_chargezap) || (spelltype != spl_lightningflash)) {
if(c_bodystatecontains(self, bs_swim) || c_bodystatecontains(self, bs_dive)) {
return coll_donothing;
};
};
if(c_isfirespell(spelltype)) {
if(self.protection[3] == prot_immune) {
if(npc_isplayer(other)) {
printcenter(print_spellnoteffective, font_screen, 3);
};
return coll_donothing;
};
}
else if(c_isflyspell(spelltype)) {
if(self.protection[4] == prot_immune) {
if(npc_isplayer(other)) {
printcenter(print_spellnoteffective, font_screen, 3);
};
return coll_donothing;
};
}
else if(self.protection[5] == prot_immune) {
if(npc_isplayer(other)) {
printcenter(print_spellnoteffective, font_screen, 3);
};
return coll_donothing;
};
else if(_damagetype_ == dam_fire) {
if((_target_.protection[3] != prot_immune) && (_damagevalue_ > (_target_.protection[3] * _protection_))) {
_result_ = _damagevalue_ - (_target_.protection[3] * _protection_);
b_magichurtnpcosta(_source_, _target_, _result_);
}
else if(npc_isplayer(_source_) && (_source_.aivar[7] == hlp_getinstanceid(_target_))) {
printcenter(я28155, font_screen, 3);
};
}
else if(_damagetype_ == dam_magic) {
if((_target_.protection[5] != prot_immune) && (_damagevalue_ > (_target_.protection[5] * _protection_))) {
_result_ = _damagevalue_ - (_target_.protection[5] * _protection_);
b_magichurtnpcosta(_source_, _target_, _result_);
}
else if(npc_isplayer(_source_) && (_source_.aivar[7] == hlp_getinstanceid(_target_))) {
printcenter(я28156, font_screen, 3);
};
}
else if(_damagetype_ == dam_fly) {
if((_target_.protection[4] != prot_immune) && (_damagevalue_ > (_target_.protection[4] * _protection_))) {
_result_ = _damagevalue_ - (_target_.protection[4] * _protection_);
b_magichurtnpcosta(_source_, _target_, _result_);
}
else if(npc_isplayer(_source_) && (_source_.aivar[7] == hlp_getinstanceid(_target_))) {
printcenter(я28157, font_screen, 3);
};
}