MCPcopy Create free account
hub / github.com/diasurgical/devilution / MAI_Zhar

Function MAI_Zhar

Source/monster.cpp:4231–4277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4229}
4230
4231void MAI_Zhar(int i)
4232{
4233 int mx, my, _mx, _my, md;
4234 MonsterStruct *Monst;
4235
4236 if ((DWORD)i >= MAXMONSTERS)
4237 app_fatal("MAI_Zhar: Invalid monster %d", i);
4238
4239 Monst = &monster[i];
4240 if (monster[i]._mmode != MM_STAND) {
4241 return;
4242 }
4243
4244 mx = Monst->_mx;
4245 my = Monst->_my;
4246 md = M_GetDir(i);
4247 if (Monst->mtalkmsg == QUEST_ZHAR1 && !(dFlags[mx][my] & BFLAG_VISIBLE) && Monst->_mgoal == MGOAL_TALKING) {
4248 Monst->mtalkmsg = QUEST_ZHAR2;
4249 Monst->_mgoal = MGOAL_INQUIRING;
4250 }
4251
4252 if (dFlags[mx][my] & BFLAG_VISIBLE) {
4253 _mx = Monst->_mx - Monst->_menemyx;
4254 _my = Monst->_my - Monst->_menemyy;
4255 if (abs(_mx) > abs(_my))
4256 abs(_mx);
4257 else
4258 abs(_my);
4259#ifndef SPAWN
4260 if (Monst->mtalkmsg == QUEST_ZHAR2) {
4261 if (!effect_is_playing(USFX_ZHAR2) && Monst->_mgoal == MGOAL_TALKING) {
4262 Monst->_msquelch = UCHAR_MAX;
4263 Monst->mtalkmsg = 0;
4264 Monst->_mgoal = MGOAL_NORMAL;
4265 }
4266 }
4267#endif
4268 }
4269
4270 if (Monst->_mgoal == MGOAL_NORMAL || Monst->_mgoal == MGOAL_RETREAT || Monst->_mgoal == MGOAL_MOVE)
4271 MAI_Counselor(i);
4272
4273 Monst->_mdir = md;
4274
4275 if (monster[i]._mmode == MM_STAND)
4276 Monst->_mAnimData = Monst->MType->Anims[MA_STAND].Data[md];
4277}
4278
4279void MAI_SnotSpil(int i)
4280{

Callers

nothing calls this directly

Calls 4

app_fatalFunction · 0.85
M_GetDirFunction · 0.85
effect_is_playingFunction · 0.85
MAI_CounselorFunction · 0.85

Tested by

no test coverage detected