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

Function M2MStartHit

Source/monster.cpp:1589–1633  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1587}
1588
1589void M2MStartHit(int mid, int i, int dam)
1590{
1591 if ((DWORD)mid >= MAXMONSTERS) {
1592 app_fatal("Invalid monster %d getting hit by monster", mid);
1593 }
1594
1595 if (monster[mid].MType == NULL) {
1596 app_fatal("Monster %d \"%s\" getting hit by monster: MType NULL", mid, monster[mid].mName);
1597 }
1598
1599 if (i >= 0)
1600 monster[i].mWhoHit |= 1 << i;
1601
1602 delta_monster_hp(mid, monster[mid]._mhitpoints, currlevel);
1603 NetSendCmdParam2(FALSE, CMD_MONSTDAMAGE, mid, dam);
1604 PlayEffect(mid, 1);
1605
1606 if (monster[mid].MType->mtype >= MT_SNEAK && monster[mid].MType->mtype <= MT_ILLWEAV || dam >> 6 >= monster[mid].mLevel + 3) {
1607 if (i >= 0)
1608 monster[mid]._mdir = (monster[i]._mdir - 4) & 7;
1609
1610 if (monster[mid].MType->mtype == MT_BLINK) {
1611 M_Teleport(mid);
1612 } else if (monster[mid].MType->mtype >= MT_NSCAV && monster[mid].MType->mtype <= MT_YSCAV) {
1613 monster[mid]._mgoal = MGOAL_NORMAL;
1614 }
1615
1616 if (monster[mid]._mmode != MM_STONE) {
1617 if (monster[mid].MType->mtype != MT_GOLEM) {
1618 NewMonsterAnim(mid, &monster[mid].MType->Anims[MA_GOTHIT], monster[mid]._mdir);
1619 monster[mid]._mmode = MM_GOTHIT;
1620 }
1621
1622 monster[mid]._mxoff = 0;
1623 monster[mid]._myoff = 0;
1624 monster[mid]._mx = monster[mid]._moldx;
1625 monster[mid]._my = monster[mid]._moldy;
1626 monster[mid]._mfutx = monster[mid]._moldx;
1627 monster[mid]._mfuty = monster[mid]._moldy;
1628 M_CheckEFlag(mid);
1629 M_ClearSquares(mid);
1630 dMonster[monster[mid]._mx][monster[mid]._my] = mid + 1;
1631 }
1632 }
1633}
1634
1635void MonstStartKill(int i, int pnum, BOOL sendmsg)
1636{

Callers 2

M_TryM2MHitFunction · 0.85
MissToMonstFunction · 0.85

Calls 8

app_fatalFunction · 0.85
delta_monster_hpFunction · 0.85
NetSendCmdParam2Function · 0.85
PlayEffectFunction · 0.85
M_TeleportFunction · 0.85
NewMonsterAnimFunction · 0.85
M_CheckEFlagFunction · 0.85
M_ClearSquaresFunction · 0.85

Tested by

no test coverage detected