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

Function MAI_Garg

Source/monster.cpp:3692–3729  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3690}
3691
3692void MAI_Garg(int i)
3693{
3694 MonsterStruct *Monst;
3695 int mx, my, dx, dy, md;
3696
3697 if ((DWORD)i >= MAXMONSTERS)
3698 app_fatal("MAI_Garg: Invalid monster %d", i);
3699
3700 Monst = &monster[i];
3701 dx = Monst->_mx - Monst->_lastx;
3702 dy = Monst->_my - Monst->_lasty;
3703 md = M_GetDir(i);
3704 if (Monst->_msquelch != 0 && Monst->_mFlags & MFLAG_ALLOW_SPECIAL) {
3705 M_Enemy(i);
3706 mx = Monst->_mx - Monst->_menemyx;
3707 my = Monst->_my - Monst->_menemyy;
3708 if (abs(mx) < Monst->_mint + 2 && abs(my) < Monst->_mint + 2) {
3709 Monst->_mFlags &= ~MFLAG_ALLOW_SPECIAL;
3710 }
3711 return;
3712 }
3713
3714 if (Monst->_mmode != MM_STAND || Monst->_msquelch == 0) {
3715 return;
3716 }
3717
3718 if (Monst->_mhitpoints<Monst->_mmaxhp>> 1 && !(Monst->_mFlags & MFLAG_NOHEAL))
3719 Monst->_mgoal = MGOAL_RETREAT;
3720 if (Monst->_mgoal == MGOAL_RETREAT) {
3721 if (abs(dx) >= Monst->_mint + 2 || abs(dy) >= Monst->_mint + 2) {
3722 Monst->_mgoal = MGOAL_NORMAL;
3723 M_StartHeal(i);
3724 } else if (!M_CallWalk(i, opposite[md])) {
3725 Monst->_mgoal = MGOAL_NORMAL;
3726 }
3727 }
3728 MAI_Round(i, FALSE);
3729}
3730
3731void MAI_RoundRanged(int i, int missile_type, BOOL checkdoors, int dam, int lessmissiles)
3732{

Callers

nothing calls this directly

Calls 6

app_fatalFunction · 0.85
M_GetDirFunction · 0.85
M_EnemyFunction · 0.85
M_StartHealFunction · 0.85
M_CallWalkFunction · 0.85
MAI_RoundFunction · 0.85

Tested by

no test coverage detected