[hellfire] M_TryH2HHit
This commit is contained in:
parent
4dfc1f6674
commit
0c01aa9928
5 changed files with 76 additions and 25 deletions
|
|
@ -1474,7 +1474,7 @@ void InitMissiles()
|
|||
}
|
||||
}
|
||||
#ifdef HELLFIRE
|
||||
plr[myplr].wReflection = FALSE;
|
||||
plr[myplr].wReflections = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1616,7 +1616,7 @@ void missiles_reflection(int mi, int sx, int sy, int dx, int dy, int midir, char
|
|||
lvl = missile[mi]._mispllvl;
|
||||
else
|
||||
lvl = 2;
|
||||
plr[id].wReflection += lvl * plr[id]._pLevel;
|
||||
plr[id].wReflections += lvl * plr[id]._pLevel;
|
||||
UseMana(id, SPL_REFLECT);
|
||||
}
|
||||
missile[mi]._mirange = 0;
|
||||
|
|
@ -4448,7 +4448,7 @@ void mi_reflect(int i)
|
|||
}
|
||||
if (src != myplr && currlevel != plr[src].plrlevel)
|
||||
missile[i]._miDelFlag = TRUE;
|
||||
if ((WORD)plr[src].wReflection <= 0) {
|
||||
if (plr[src].wReflections <= 0) {
|
||||
missile[i]._miDelFlag = TRUE;
|
||||
NetSendCmd(TRUE, CMD_REFLECT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2556,12 +2556,20 @@ void M_TryH2HHit(int i, int pnum, int Hit, int MinDam, int MaxDam)
|
|||
int blk, blkper;
|
||||
int dam, mdam;
|
||||
int newx, newy;
|
||||
int j, misnum, ms_num, cur_ms_num, new_hp;
|
||||
int j, misnum, ms_num, cur_ms_num, new_hp, dir, ac;
|
||||
|
||||
if ((DWORD)i >= MAXMONSTERS)
|
||||
#ifdef HELLFIRE
|
||||
return;
|
||||
#else
|
||||
app_fatal("M_TryH2HHit: Invalid monster %d", i);
|
||||
#endif
|
||||
if (monster[i].MType == NULL)
|
||||
#ifdef HELLFIRE
|
||||
return;
|
||||
#else
|
||||
app_fatal("M_TryH2HHit: Monster %d \"%s\" MType NULL", i, monster[i].mName);
|
||||
#endif
|
||||
if (monster[i]._mFlags & MFLAG_TARGETS_MONSTER) {
|
||||
M_TryM2MHit(i, pnum, Hit, MinDam, MaxDam);
|
||||
return;
|
||||
|
|
@ -2577,12 +2585,18 @@ void M_TryH2HHit(int i, int pnum, int Hit, int MinDam, int MaxDam)
|
|||
#ifdef _DEBUG
|
||||
if (debug_mode_dollar_sign || debug_mode_key_inverted_v)
|
||||
hper = 1000;
|
||||
#endif
|
||||
ac = plr[pnum]._pIBonusAC + plr[pnum]._pIAC;
|
||||
#ifdef HELLFIRE
|
||||
if (plr[pnum].pDamAcFlags & 0x20 && monster[i].MData->mMonstClass == MC_DEMON)
|
||||
ac += 40;
|
||||
if (plr[pnum].pDamAcFlags & 0x40 && monster[i].MData->mMonstClass == MC_UNDEAD)
|
||||
ac += 20;
|
||||
#endif
|
||||
hit = Hit
|
||||
+ 2 * (monster[i].mLevel - plr[pnum]._pLevel)
|
||||
+ 30
|
||||
- plr[pnum]._pIBonusAC
|
||||
- plr[pnum]._pIAC
|
||||
- ac
|
||||
- plr[pnum]._pDexterity / 5;
|
||||
if (hit < 15)
|
||||
hit = 15;
|
||||
|
|
@ -2608,7 +2622,26 @@ void M_TryH2HHit(int i, int pnum, int Hit, int MinDam, int MaxDam)
|
|||
if (hper >= hit)
|
||||
return;
|
||||
if (blkper < blk) {
|
||||
StartPlrBlock(pnum, GetDirection(plr[pnum]._px, plr[pnum]._py, monster[i]._mx, monster[i]._my));
|
||||
dir = GetDirection(plr[pnum]._px, plr[pnum]._py, monster[i]._mx, monster[i]._my);
|
||||
StartPlrBlock(pnum, dir);
|
||||
#ifdef HELLFIRE
|
||||
if (pnum == myplr && plr[pnum].wReflections > 0) {
|
||||
plr[pnum].wReflections--;
|
||||
dam = random_(99, (MaxDam - MinDam + 1) << 6) + (MinDam << 6);
|
||||
dam += plr[pnum]._pIGetHit << 6;
|
||||
if (dam < 64)
|
||||
dam = 64;
|
||||
mdam = dam * (0.01 * (random_(100, 10) + 20));
|
||||
monster[i]._mhitpoints -= mdam;
|
||||
dam -= mdam;
|
||||
if (dam < 0)
|
||||
dam = 0;
|
||||
if (monster[i]._mhitpoints >> 6 <= 0)
|
||||
M_StartKill(i, pnum);
|
||||
else
|
||||
M_StartHit(i, pnum, mdam);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (monster[i].MType->mtype == MT_YZOMBIE && pnum == myplr) {
|
||||
|
|
@ -2624,20 +2657,21 @@ void M_TryH2HHit(int i, int pnum, int Hit, int MinDam, int MaxDam)
|
|||
ms_num = misnum;
|
||||
}
|
||||
if (plr[pnum]._pMaxHP > 64) {
|
||||
if (plr[pnum]._pMaxHPBase > 64) {
|
||||
new_hp = plr[pnum]._pMaxHP - 64;
|
||||
plr[pnum]._pMaxHP = new_hp;
|
||||
if (plr[pnum]._pHitPoints > new_hp) {
|
||||
plr[pnum]._pHitPoints = new_hp;
|
||||
#ifndef HELLFIRE
|
||||
if (plr[pnum]._pMaxHPBase > 64)
|
||||
#endif
|
||||
{
|
||||
plr[pnum]._pMaxHP -= 64;
|
||||
if (plr[pnum]._pHitPoints > plr[pnum]._pMaxHP) {
|
||||
plr[pnum]._pHitPoints = plr[pnum]._pMaxHP;
|
||||
if (cur_ms_num >= 0)
|
||||
missile[cur_ms_num]._miVar1 = new_hp;
|
||||
missile[cur_ms_num]._miVar1 = plr[pnum]._pHitPoints;
|
||||
}
|
||||
new_hp = plr[pnum]._pMaxHPBase - 64;
|
||||
plr[pnum]._pMaxHPBase = new_hp;
|
||||
if (plr[pnum]._pHPBase > new_hp) {
|
||||
plr[pnum]._pHPBase = new_hp;
|
||||
plr[pnum]._pMaxHPBase -= 64;
|
||||
if (plr[pnum]._pHPBase > plr[pnum]._pMaxHPBase) {
|
||||
plr[pnum]._pHPBase = plr[pnum]._pMaxHPBase;
|
||||
if (cur_ms_num >= 0)
|
||||
missile[cur_ms_num]._miVar2 = new_hp;
|
||||
missile[cur_ms_num]._miVar2 = plr[pnum]._pHPBase;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2647,6 +2681,20 @@ void M_TryH2HHit(int i, int pnum, int Hit, int MinDam, int MaxDam)
|
|||
if (dam < 64)
|
||||
dam = 64;
|
||||
if (pnum == myplr) {
|
||||
#ifdef HELLFIRE
|
||||
if (plr[pnum].wReflections > 0) {
|
||||
plr[pnum].wReflections--;
|
||||
mdam = dam * (0.01 * (random_(100, 10) + 20));
|
||||
monster[i]._mhitpoints -= mdam;
|
||||
dam -= mdam;
|
||||
if (dam < 0)
|
||||
dam = 0;
|
||||
if (monster[i]._mhitpoints >> 6 <= 0)
|
||||
M_StartKill(i, pnum);
|
||||
else
|
||||
M_StartHit(i, pnum, mdam);
|
||||
}
|
||||
#endif
|
||||
plr[pnum]._pHitPoints -= dam;
|
||||
plr[pnum]._pHPBase -= dam;
|
||||
}
|
||||
|
|
@ -2666,6 +2714,9 @@ void M_TryH2HHit(int i, int pnum, int Hit, int MinDam, int MaxDam)
|
|||
}
|
||||
if (plr[pnum]._pHitPoints >> 6 <= 0) {
|
||||
SyncPlrKill(pnum, 0);
|
||||
#ifdef HELLFIRE
|
||||
M_StartStand(i, monster[i]._mdir);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
StartPlrHit(pnum, dam, FALSE);
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ void PackPlayer(PkPlayerStruct *pPack, int pnum, BOOL manashield)
|
|||
pPack->pMemSpells = pPlayer->_pMemSpells;
|
||||
|
||||
#ifdef HELLFIRE
|
||||
for (i = 0; i <= 36; i++) // Should be MAX_SPELLS-1 but set to 36 to make save games compatible
|
||||
for (i = 0; i <= 36; i++) // Should be MAX_SPELLS-1 but set to 36 to make save games compatible
|
||||
pPack->pSplLvl[i] = pPlayer->_pSplLvl[i];
|
||||
char *p = pPack->pSplLvl2;
|
||||
for (i = 37; i < 47; i++)
|
||||
|
|
@ -120,7 +120,7 @@ void PackPlayer(PkPlayerStruct *pPack, int pnum, BOOL manashield)
|
|||
}
|
||||
|
||||
#ifdef HELLFIRE
|
||||
pPack->wReflection = pPlayer->wReflection;
|
||||
pPack->wReflections = pPlayer->wReflections;
|
||||
pPack->pDiabloKillLevel = pPlayer->pDiabloKillLevel;
|
||||
pPack->pDifficulty = pPlayer->pDifficulty;
|
||||
pPack->pDamAcFlags = pPlayer->pDamAcFlags;
|
||||
|
|
@ -288,7 +288,7 @@ void UnPackPlayer(PkPlayerStruct *pPack, int pnum, BOOL killok)
|
|||
|
||||
CalcPlrInv(pnum, FALSE);
|
||||
#ifdef HELLFIRE
|
||||
pPlayer->wReflection = pPack->wReflection;
|
||||
pPlayer->wReflections = pPack->wReflections;
|
||||
#endif
|
||||
pPlayer->pTownWarps = 0;
|
||||
pPlayer->pDungMsgs = 0;
|
||||
|
|
|
|||
|
|
@ -704,7 +704,7 @@ void ClearPlrRVars(PlayerStruct *p)
|
|||
p->bReserved[2] = 0;
|
||||
|
||||
#ifndef HELLFIRE
|
||||
p->wReflection = 0;
|
||||
p->wReflections = 0;
|
||||
#endif
|
||||
p->wReserved[0] = 0;
|
||||
p->wReserved[1] = 0;
|
||||
|
|
@ -934,7 +934,7 @@ void CreatePlayer(int pnum, char c)
|
|||
plr[pnum].pManaShield = FALSE;
|
||||
#else
|
||||
plr[pnum].pDamAcFlags = 0;
|
||||
plr[pnum].wReflection = 0;
|
||||
plr[pnum].wReflections = 0;
|
||||
#endif
|
||||
|
||||
InitDungMsgs(pnum);
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ typedef struct PlayerStruct {
|
|||
#endif
|
||||
BOOLEAN pManaShield;
|
||||
char bReserved[3];
|
||||
short wReflection;
|
||||
WORD wReflections;
|
||||
short wReserved[7];
|
||||
DWORD pDiabloKillLevel;
|
||||
int pDifficulty;
|
||||
|
|
@ -1500,7 +1500,7 @@ typedef struct PkPlayerStruct {
|
|||
#endif
|
||||
BOOLEAN pManaShield;
|
||||
char bReserved[3];
|
||||
short wReflection;
|
||||
WORD wReflections;
|
||||
short wReserved2;
|
||||
char pSplLvl2[10]; // Hellfire spells
|
||||
short wReserved8;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue