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

Function MAI_Zombie

Source/monster.cpp:2899–2942  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2897}
2898
2899void MAI_Zombie(int i)
2900{
2901 MonsterStruct *Monst;
2902 int mx, my;
2903 int md, v;
2904
2905 if ((DWORD)i >= MAXMONSTERS) {
2906 app_fatal("MAI_Zombie: Invalid monster %d", i);
2907 }
2908
2909 Monst = &monster[i];
2910 if (Monst->_mmode != MM_STAND) {
2911 return;
2912 }
2913
2914 mx = Monst->_mx;
2915 my = Monst->_my;
2916 if (!(dFlags[mx][my] & BFLAG_VISIBLE)) {
2917 return;
2918 }
2919
2920 mx = mx - Monst->_menemyx;
2921 my = my - Monst->_menemyy;
2922 md = Monst->_mdir;
2923 v = random_(103, 100);
2924 if (abs(mx) >= 2 || abs(my) >= 2) {
2925 if (v < 2 * Monst->_mint + 10) {
2926 if (abs(mx) >= 2 * Monst->_mint + 4 || abs(my) >= 2 * Monst->_mint + 4) {
2927 if (random_(104, 100) < 2 * Monst->_mint + 20) {
2928 md = random_(104, 8);
2929 }
2930 M_DumbWalk(i, md);
2931 } else {
2932 md = M_GetDir(i);
2933 M_CallWalk(i, md);
2934 }
2935 }
2936 } else if (v < 2 * Monst->_mint + 10) {
2937 M_StartAttack(i);
2938 }
2939
2940 if (Monst->_mmode == MM_STAND)
2941 Monst->_mAnimData = Monst->MType->Anims[MA_STAND].Data[Monst->_mdir];
2942}
2943
2944void MAI_SkelSd(int i)
2945{

Callers

nothing calls this directly

Calls 6

app_fatalFunction · 0.85
random_Function · 0.85
M_DumbWalkFunction · 0.85
M_GetDirFunction · 0.85
M_CallWalkFunction · 0.85
M_StartAttackFunction · 0.85

Tested by

no test coverage detected