Skip to content

Commit

Permalink
[hellfire] SpawnWitch
Browse files Browse the repository at this point in the history
  • Loading branch information
AJenbo committed Dec 27, 2020
1 parent 557af48 commit 448281a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
36 changes: 32 additions & 4 deletions Source/items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5272,9 +5272,15 @@ void WitchBookLevel(int ii)

void SpawnWitch(int lvl)
{
int i, iCnt;
int i, j, iCnt;
int idata, maxlvl;

j = 3;
#ifdef HELLFIRE
iCnt = random_(51, 15) + 10;
int books = random_(3, 4);
#endif

GetItemAttrs(0, IDI_MANA, 1);
witchitem[0] = item[0];
witchitem[0]._iCreateInfo = lvl;
Expand All @@ -5287,9 +5293,31 @@ void SpawnWitch(int lvl)
witchitem[2] = item[0];
witchitem[2]._iCreateInfo = lvl;
witchitem[2]._iStatFlag = TRUE;

#ifdef HELLFIRE
int bCnt;
for (i = 114, bCnt = 0; i <= 117 && bCnt < books; ++i) {
if (WitchItemOk(i)
&& lvl >= AllItemsList[i].iMinMLvl) {
item[0]._iSeed = GetRndSeed();
SetRndSeed(item[0]._iSeed);
volatile int junk = random_(0, 1);

GetItemAttrs(0, i, lvl);
witchitem[j] = item[0];
witchitem[j]._iCreateInfo = lvl | CF_WITCH;
witchitem[j]._iIdentified = TRUE;
WitchBookLevel(j);
witchitem[j]._iStatFlag = StoreStatOk(&witchitem[j]);
j++;
bCnt++;
}
}
#else
iCnt = random_(51, 8) + 10;
#endif

for (i = 3; i < iCnt; i++) {
for (i = j; i < iCnt; i++) {
do {
item[0]._iSeed = GetRndSeed();
SetRndSeed(item[0]._iSeed);
Expand All @@ -5306,15 +5334,15 @@ void SpawnWitch(int lvl)
#else
GetItemBonus(0, idata, maxlvl >> 1, maxlvl, TRUE);
#endif
} while (item[0]._iIvalue > 140000);
} while (item[0]._iIvalue > WITCH_MAX_VALUE);
witchitem[i] = item[0];
witchitem[i]._iCreateInfo = lvl | CF_WITCH;
witchitem[i]._iIdentified = TRUE;
WitchBookLevel(i);
witchitem[i]._iStatFlag = StoreStatOk(&witchitem[i]);
}

for (i = iCnt; i < 20; i++)
for (i = iCnt; i < WITCH_ITEMS; i++)
witchitem[i]._itype = ITYPE_NONE;

SortWitch();
Expand Down
2 changes: 2 additions & 0 deletions defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
#define NUMLEVELS 25
#define BOY_MAX_VALUE 200000
#define WITCH_ITEMS 25
#define WITCH_MAX_VALUE 200000
#define SMITH_ITEMS 25
#define SMITH_PREMIUM_ITEMS 15
#define SMITH_MAX_VALUE 200000
Expand All @@ -111,6 +112,7 @@
#define NUMLEVELS 17
#define BOY_MAX_VALUE 90000
#define WITCH_ITEMS 20
#define WITCH_MAX_VALUE 140000
#define SMITH_ITEMS 20
#define SMITH_PREMIUM_ITEMS 6
#define SMITH_MAX_VALUE 140000
Expand Down

0 comments on commit 448281a

Please sign in to comment.