Browse Source

[hellfire] CalcPlrItemVals

pull/876/head
qndel 6 years ago committed by Anders Jenbo
parent
commit
92c4824820
  1. 176
      Source/items.cpp
  2. 3
      Source/items.h
  3. 4
      Source/player.cpp

176
Source/items.cpp

@ -23,6 +23,9 @@ ItemStruct CornerItemMaybe;
#endif
BYTE *itemanims[ITEMTYPES];
BOOL UniqueItemFlag[128];
#ifdef HELLFIRE
int auricGold = 10000;
#endif
int numitems;
int gnNumGetRecords;
@ -645,6 +648,10 @@ void CalcPlrItemVals(int p, BOOL Loadgfx)
int iflgs = ISPL_NONE; // item_special_effect flags
#ifdef HELLFIRE
int pDamAcFlags = 0;
#endif
int sadd = 0; // added strength
int madd = 0; // added magic
int dadd = 0; // added dexterity
@ -676,8 +683,8 @@ void CalcPlrItemVals(int p, BOOL Loadgfx)
ItemStruct *itm = &plr[p].InvBody[i];
if (itm->_itype != ITYPE_NONE && itm->_iStatFlag) {
mind += itm->_iMinDam;
tac += itm->_iAC;
mind += itm->_iMinDam;
maxd += itm->_iMaxDam;
if (itm->_iSpell != SPL_NULL) {
@ -693,8 +700,10 @@ void CalcPlrItemVals(int p, BOOL Loadgfx)
tmpac = 1;
bac += tmpac;
}
dmod += itm->_iPLDamMod;
iflgs |= itm->_iFlags;
#ifdef HELLFIRE
pDamAcFlags |= plr[p].pDamAcFlags;
#endif
sadd += itm->_iPLStr;
madd += itm->_iPLMag;
dadd += itm->_iPLDex;
@ -702,6 +711,7 @@ void CalcPlrItemVals(int p, BOOL Loadgfx)
fr += itm->_iPLFR;
lr += itm->_iPLLR;
mr += itm->_iPLMR;
dmod += itm->_iPLDamMod;
ghit += itm->_iPLGetHit;
lrad += itm->_iPLLight;
ihp += itm->_iPLHP;
@ -727,17 +737,42 @@ void CalcPlrItemVals(int p, BOOL Loadgfx)
if (plr[p].InvBody[INVLOC_HAND_RIGHT]._itype == ITYPE_SHIELD && plr[p].InvBody[INVLOC_HAND_RIGHT]._iStatFlag) {
maxd = 3;
}
#ifdef HELLFIRE
if (plr[p]._pClass == PC_MONK) {
if (plr[p]._pLevel >> 1 >= 1)
mind = plr[p]._pLevel >> 1;
if (maxd <= plr[p]._pLevel)
maxd = plr[p]._pLevel;
}
#endif
}
#ifdef HELLFIRE
if ((plr[p]._pSpellFlags & 2) == 2) {
sadd += 2 * plr[p]._pLevel;
dadd += plr[p]._pLevel + plr[p]._pLevel / 2;
vadd += 2 * plr[p]._pLevel;
}
if ((plr[p]._pSpellFlags & 4) == 4) {
sadd -= 2 * plr[p]._pLevel;
dadd -= plr[p]._pLevel + plr[p]._pLevel / 2;
vadd -= 2 * plr[p]._pLevel;
}
#endif
plr[p]._pIMinDam = mind;
plr[p]._pIMaxDam = maxd;
plr[p]._pIAC = tac;
plr[p]._pIBonusDam = bdam;
plr[p]._pIBonusToHit = btohit;
plr[p]._pIBonusAC = bac;
plr[p]._pIFlags = iflgs;
plr[p]._pIGetHit = ghit;
plr[p]._pIMinDam = mind;
#ifdef HELLFIRE
plr[p].pDamAcFlags = pDamAcFlags;
#endif
plr[p]._pIBonusDamMod = dmod;
plr[p]._pIGetHit = ghit;
if (lrad < 2) {
lrad = 2;
@ -781,7 +816,50 @@ void CalcPlrItemVals(int p, BOOL Loadgfx)
if (plr[p]._pClass == PC_ROGUE) {
plr[p]._pDamageMod = plr[p]._pLevel * (plr[p]._pStrength + plr[p]._pDexterity) / 200;
} else {
}
#ifdef HELLFIRE
else if (plr[p]._pClass == PC_MONK) {
if (plr[p].InvBody[INVLOC_HAND_LEFT]._itype != ITYPE_STAFF) {
if (plr[p].InvBody[INVLOC_HAND_RIGHT]._itype != ITYPE_STAFF && (plr[p].InvBody[INVLOC_HAND_LEFT]._itype != ITYPE_NONE || plr[p].InvBody[INVLOC_HAND_RIGHT]._itype != ITYPE_NONE)) {
plr[p]._pDamageMod = plr[p]._pLevel * (plr[p]._pStrength + plr[p]._pDexterity) / 300;
} else {
plr[p]._pDamageMod = plr[p]._pLevel * (plr[p]._pStrength + plr[p]._pDexterity) / 150;
}
} else {
plr[p]._pDamageMod = plr[p]._pLevel * (plr[p]._pStrength + plr[p]._pDexterity) / 150;
}
} else if (plr[p]._pClass == PC_BARD) {
if (plr[p].InvBody[INVLOC_HAND_LEFT]._itype == ITYPE_SWORD || plr[p].InvBody[INVLOC_HAND_RIGHT]._itype == ITYPE_SWORD)
plr[p]._pDamageMod = plr[p]._pLevel * (plr[p]._pStrength + plr[p]._pDexterity) / 150;
else if (plr[p].InvBody[INVLOC_HAND_LEFT]._itype == ITYPE_BOW || plr[p].InvBody[INVLOC_HAND_RIGHT]._itype == ITYPE_BOW) {
plr[p]._pDamageMod = plr[p]._pLevel * (plr[p]._pStrength + plr[p]._pDexterity) / 250;
} else {
plr[p]._pDamageMod = plr[p]._pLevel * plr[p]._pStrength / 100;
}
} else if (plr[p]._pClass == PC_BARBARIAN) {
if (plr[p].InvBody[INVLOC_HAND_LEFT]._itype == ITYPE_AXE || plr[p].InvBody[INVLOC_HAND_RIGHT]._itype == ITYPE_AXE) {
plr[p]._pDamageMod = plr[p]._pLevel * plr[p]._pStrength / 75;
} else if (plr[p].InvBody[INVLOC_HAND_LEFT]._itype == ITYPE_MACE || plr[p].InvBody[INVLOC_HAND_RIGHT]._itype == ITYPE_MACE) {
plr[p]._pDamageMod = plr[p]._pLevel * plr[p]._pStrength / 75;
} else if (plr[p].InvBody[INVLOC_HAND_LEFT]._itype == ITYPE_BOW || plr[p].InvBody[INVLOC_HAND_RIGHT]._itype == ITYPE_BOW) {
plr[p]._pDamageMod = plr[p]._pLevel * plr[p]._pStrength / 300;
} else {
plr[p]._pDamageMod = plr[p]._pLevel * plr[p]._pStrength / 100;
}
if (plr[p].InvBody[INVLOC_HAND_LEFT]._itype == ITYPE_SHIELD || plr[p].InvBody[INVLOC_HAND_RIGHT]._itype == ITYPE_SHIELD) {
if (plr[p].InvBody[INVLOC_HAND_LEFT]._itype == ITYPE_SHIELD)
plr[p]._pIAC -= plr[p].InvBody[INVLOC_HAND_LEFT]._iAC / 2;
else if (plr[p].InvBody[INVLOC_HAND_RIGHT]._itype == ITYPE_SHIELD)
plr[p]._pIAC -= plr[p].InvBody[INVLOC_HAND_RIGHT]._iAC / 2;
} else if (plr[p].InvBody[INVLOC_HAND_LEFT]._itype != ITYPE_STAFF && plr[p].InvBody[INVLOC_HAND_RIGHT]._itype != ITYPE_STAFF && plr[p].InvBody[INVLOC_HAND_LEFT]._itype != ITYPE_BOW && plr[p].InvBody[INVLOC_HAND_RIGHT]._itype != ITYPE_BOW) {
plr[p]._pDamageMod += plr[p]._pLevel * plr[p]._pVitality / 100;
}
plr[p]._pIAC += plr[p]._pLevel/4;
}
#endif
else {
plr[p]._pDamageMod = plr[p]._pLevel * plr[p]._pStrength / 100;
}
@ -798,6 +876,20 @@ void CalcPlrItemVals(int p, BOOL Loadgfx)
plr[p]._pISplLvlAdd = spllvladd;
plr[p]._pIEnAc = enac;
#ifdef HELLFIRE
if (plr[p]._pClass == PC_BARBARIAN) {
mr += plr[p]._pLevel;
fr += plr[p]._pLevel;
lr += plr[p]._pLevel;
}
if ((plr[p]._pSpellFlags & 4) == 4) {
mr -= plr[p]._pLevel;
fr -= plr[p]._pLevel;
lr -= plr[p]._pLevel;
}
#endif
if (iflgs & ISPL_ALLRESZERO) {
// reset resistances to zero if the respective special effect is active
mr = 0;
@ -823,7 +915,14 @@ void CalcPlrItemVals(int p, BOOL Loadgfx)
if (plr[p]._pClass == PC_WARRIOR) {
vadd *= 2;
}
#ifdef HELLFIRE
if (plr[p]._pClass == PC_BARBARIAN) {
vadd *= 3;
}
if (plr[p]._pClass == PC_ROGUE || plr[p]._pClass == PC_MONK || plr[p]._pClass == PC_BARD) {
#else
if (plr[p]._pClass == PC_ROGUE) {
#endif
vadd += vadd >> 1;
}
ihp += (vadd << 6);
@ -831,13 +930,26 @@ void CalcPlrItemVals(int p, BOOL Loadgfx)
if (plr[p]._pClass == PC_SORCERER) {
madd *= 2;
}
#ifdef HELLFIRE
if (plr[p]._pClass == PC_ROGUE || plr[p]._pClass == PC_MONK) {
#else
if (plr[p]._pClass == PC_ROGUE) {
#endif
madd += madd >> 1;
}
#ifdef HELLFIRE
else if (plr[p]._pClass == PC_BARD) {
madd += madd >> 2 + madd >> 1;
}
#endif
imana += (madd << 6);
plr[p]._pHitPoints = ihp + plr[p]._pHPBase;
plr[p]._pMaxHP = ihp + plr[p]._pMaxHPBase;
#ifdef HELLFIRE
if (plr[p]._pHitPoints > plr[p]._pMaxHP)
plr[p]._pHitPoints = plr[p]._pMaxHP;
#endif
if (p == myplr && (plr[p]._pHitPoints >> 6) <= 0) {
SetPlayerHitPoints(p, 0);
@ -845,6 +957,10 @@ void CalcPlrItemVals(int p, BOOL Loadgfx)
plr[p]._pMana = imana + plr[p]._pManaBase;
plr[p]._pMaxMana = imana + plr[p]._pMaxManaBase;
#ifdef HELLFIRE
if (plr[p]._pMana > plr[p]._pMaxMana)
plr[p]._pMana = plr[p]._pMaxMana;
#endif
plr[p]._pIFMinDam = fmin;
plr[p]._pIFMaxDam = fmax;
@ -858,6 +974,24 @@ void CalcPlrItemVals(int p, BOOL Loadgfx)
}
plr[p]._pBlockFlag = FALSE;
#ifdef HELLFIRE
if (plr[p]._pClass == PC_MONK) {
if (plr[p].InvBody[INVLOC_HAND_LEFT]._itype == ITYPE_STAFF && plr[p].InvBody[INVLOC_HAND_LEFT]._iStatFlag) {
plr[p]._pBlockFlag = TRUE;
plr[p]._pIFlags |= ISPL_FASTBLOCK;
}
if (plr[p].InvBody[INVLOC_HAND_RIGHT]._itype == ITYPE_STAFF && plr[p].InvBody[INVLOC_HAND_RIGHT]._iStatFlag) {
plr[p]._pBlockFlag = TRUE;
plr[p]._pIFlags |= ISPL_FASTBLOCK;
}
if (plr[p].InvBody[INVLOC_HAND_LEFT]._itype == ITYPE_NONE && plr[p].InvBody[5]._itype == ITYPE_NONE)
plr[p]._pBlockFlag = TRUE;
if (plr[p].InvBody[INVLOC_HAND_LEFT]._iClass == ICLASS_WEAPON && plr[p].InvBody[INVLOC_HAND_LEFT]._iLoc != ILOC_TWOHAND && plr[p].InvBody[INVLOC_HAND_RIGHT]._itype == ITYPE_NONE)
plr[p]._pBlockFlag = TRUE;
if (plr[p].InvBody[INVLOC_HAND_RIGHT]._iClass == ICLASS_WEAPON && plr[p].InvBody[INVLOC_HAND_RIGHT]._iLoc != ILOC_TWOHAND && plr[p].InvBody[INVLOC_HAND_LEFT]._itype == ITYPE_NONE)
plr[p]._pBlockFlag = TRUE;
}
#endif
plr[p]._pwtype = WT_MELEE;
g = 0;
@ -903,12 +1037,30 @@ void CalcPlrItemVals(int p, BOOL Loadgfx)
}
#ifndef SPAWN
#ifdef HELLFIRE
if (plr[p].InvBody[INVLOC_CHEST]._itype == ITYPE_HARMOR && plr[p].InvBody[INVLOC_CHEST]._iStatFlag) {
if (plr[p]._pClass == PC_MONK && plr[p].InvBody[INVLOC_CHEST]._iMagical == ITEM_QUALITY_UNIQUE)
plr[p]._pIAC += plr[p]._pLevel >> 1;
g += ANIM_ID_HEAVY_ARMOR;
} else if (plr[p].InvBody[INVLOC_CHEST]._itype == ITYPE_MARMOR && plr[p].InvBody[INVLOC_CHEST]._iStatFlag) {
if (plr[p]._pClass == PC_MONK) {
if (plr[p].InvBody[INVLOC_CHEST]._iMagical == ITEM_QUALITY_UNIQUE)
plr[p]._pIAC += plr[p]._pLevel << 1;
else
plr[p]._pIAC += plr[p]._pLevel >> 1;
}
g += ANIM_ID_MEDIUM_ARMOR;
} else if (plr[p]._pClass == PC_MONK) {
plr[p]._pIAC += plr[p]._pLevel << 1;
}
#else
if (plr[p].InvBody[INVLOC_CHEST]._itype == ITYPE_MARMOR && plr[p].InvBody[INVLOC_CHEST]._iStatFlag) {
g += ANIM_ID_MEDIUM_ARMOR;
}
if (plr[p].InvBody[INVLOC_CHEST]._itype == ITYPE_HARMOR && plr[p].InvBody[INVLOC_CHEST]._iStatFlag) {
g += ANIM_ID_HEAVY_ARMOR;
}
#endif
#endif
if (plr[p]._pgfxnum != g && Loadgfx) {
@ -937,8 +1089,22 @@ void CalcPlrItemVals(int p, BOOL Loadgfx)
if (missile[mi]._mitype == MIS_MANASHIELD && missile[mi]._misource == p) {
missile[mi]._miVar1 = plr[p]._pHitPoints;
missile[mi]._miVar2 = plr[p]._pHPBase;
#ifdef HELLFIRE
break;
#endif
}
}
#ifdef HELLFIRE
if (plr[p].InvBody[INVLOC_AMULET]._itype == ITYPE_NONE || plr[p].InvBody[INVLOC_AMULET].IDidx != IDI_AURIC) {
int half = MaxGold;
MaxGold = auricGold / 2;
if (half != MaxGold)
StripTopGold(p);
} else {
MaxGold = auricGold;
}
#endif
drawmanaflag = TRUE;
drawhpflag = TRUE;

3
Source/items.h

@ -21,6 +21,9 @@ extern ItemStruct CornerItemMaybe;
#endif
extern BYTE *itemanims[ITEMTYPES];
extern BOOL UniqueItemFlag[128];
#ifdef HELLFIRE
extern int auricGold;
#endif
extern int numitems;
extern int gnNumGetRecords;

4
Source/player.cpp

@ -3662,8 +3662,8 @@ void ValidatePlayer()
for (i = 0; i < plr[myplr]._pNumInv; i++) {
if (plr[myplr].InvList[i]._itype == ITYPE_GOLD) {
#ifdef HELLFIRE
if (plr[myplr].InvList[i]._ivalue > MaxGold) {
plr[myplr].InvList[i]._ivalue = MaxGold;
if (plr[myplr].InvList[i]._ivalue > auricGold) { // BUGFIX: change to MaxGold? Why would auricGold be used here?
plr[myplr].InvList[i]._ivalue = auricGold; // BUGFIX: change to MaxGold? Why would auricGold be used here?
#else
if (plr[myplr].InvList[i]._ivalue > GOLD_MAX_LIMIT) {
plr[myplr].InvList[i]._ivalue = GOLD_MAX_LIMIT;

Loading…
Cancel
Save