25 20, 16, 16, 16, 4, 4, 4, 12, 12, 12,
26 12, 12, 12, 12, 12, 21, 21, 25, 12, 28,
27 28, 28, 0, 0, 0, 32, 0, 0, 0, 24,
28 24, 26, 2, 25, 22, 23, 24, 25, 27, 27,
29 29, 0, 0, 0, 12, 12, 12, 12, 12, 0,
30 8, 8, 0, 8, 8, 8, 8, 8, 8, 6,
31 8, 8, 8, 6, 8, 8, 6, 8, 8, 6,
32 6, 6, 8, 8, 8, 5, 9, 13, 13, 13,
33 5, 5, 5, 15, 5, 5, 18, 18, 18, 30,
34 5, 5, 14, 5, 14, 13, 16, 18, 5, 5,
35 7, 1, 3, 17, 1, 15, 10, 14, 3, 11,
36 8, 0, 1, 7, 0, 7, 15, 7, 3, 3,
37 3, 6, 6, 11, 11, 11, 31, 14, 14, 14,
38 6, 6, 7, 3, 8, 14, 0, 14, 14, 0,
39 33, 1, 1, 1, 1, 1, 7, 7, 7, 14,
40 14, 17, 17, 17, 0, 34, 1, 0, 3, 17,
41 8, 8, 6, 1, 3, 3, 11, 3, 4
229 for (j = 0; j < rnd; j++) {
319 unsigned __int64 spl = 0;
350 spl |= (
unsigned __int64)1 << (itm->
_iSpell - 1);
385 if (mind == 0 && maxd == 0) {
415 if (
plr[p]._pLightRad != lrad && p ==
myplr) {
458 && !(spl & ((
unsigned __int64)1 << (
plr[p]._pRSpell - 1)))) {
503 imana += (madd << 6);
508 if (p ==
myplr && (
plr[p]._pHitPoints >> 6) <= 0) {
580 if (
plr[p]._pgfxnum != g && Loadgfx) {
620 if (
plr[p].InvList[i]._iStatFlag)
627 if (
plr[p].SpdList[j]._iStatFlag)
632 if (!(
plr[p]._pScrlSpells & 1 << (
plr[p]._pRSpell - 1))) {
694 }
while (changeflag);
754 if (
plr[p].InvList[i]._iMinMag + 20 *
plr[p].InvList[i]._iMinMag / 100 > 255) {
786 memset(h, 0,
sizeof(*h));
833 if (
item[ii]._iSeed == s)
838 if (
plr[pnum].InvList[i]._iSeed == s)
874 memset(&
plr[p].InvGrid, 0,
sizeof(
plr[p].InvGrid));
890 switch (
plr[p]._pClass) {
899 if (!debug_mode_key_w) {
942 if (!debug_mode_key_w) {
984 if (
object[oi]._oSolidFlag)
988 if (
dObject[i + 1][j + 1] > 0 &&
object[
dObject[i + 1][j + 1] - 1]._oSelFlag != 0)
991 if (
dObject[i + 1][j + 1] < 0 &&
object[-(
dObject[i + 1][j + 1] + 1)]._oSelFlag != 0)
996 &&
object[
dObject[i + 1][j] - 1]._oSelFlag != 0
997 &&
object[
dObject[i][j + 1] - 1]._oSelFlag != 0) {
1011 for (j = y - 1; j <= y + 1; j++) {
1013 for (i = x - 1; i <= x + 1; i++) {
1021 for (j = 0; j < 3; j++) {
1022 for (i = 0; i < 3; i++) {
1053 dItem[xx][yy] = inum + 1;
1064 for (k = 2; k < 50; k++) {
1065 for (j = -k; j <= k; j++) {
1067 for (i = -k; i <= k; i++) {
1072 dItem[xx][yy] = inum + 1;
1085 for (k = 1; k < 50; k++) {
1086 for (j = -k; j <= k; j++) {
1088 for (i = -k; i <= k; i++) {
1169 if (tmp == 0 || onlygood) {
1188 sprintf(istr,
"%s %s",
PL_Prefix[preidx].PLName,
item[i]._iIName);
1189 strcpy(
item[i]._iIName, istr);
1205 sprintf(istr,
"%s %s",
PL_Prefix[preidx].PLName,
item[i]._iIName);
1206 strcpy(
item[i]._iIName, istr);
1208 sprintf(istr,
"%s of %s",
item[i]._iIName,
spelldata[bs].sNameText);
1209 strcpy(
item[i]._iIName, istr);
1211 strcpy(
item[i]._iName,
item[i]._iIName);
1218 int l, rv, s, minc, maxc, v, bs;
1246 sprintf(istr,
"%s of %s",
item[i]._iName,
spelldata[bs].sNameText);
1248 sprintf(istr,
"Staff of %s",
spelldata[bs].sNameText);
1249 strcpy(
item[i]._iName, istr);
1250 strcpy(
item[i]._iIName, istr);
1348 return param1 +
random_(22, param2 - param1 + 1);
1351 int PLVal(
int pv,
int p1,
int p2,
int minv,
int maxv)
1357 return minv + (maxv - minv) * (100 * (pv - p1) / (p2 - p1)) / 100;
1360 void SaveItemPower(
int i,
int power,
int param1,
int param2,
int minval,
int maxval,
int multval)
1364 r =
RndPL(param1, param2);
1379 r =
RndPL(param1, param2);
1398 r2 =
RndPL(76, 100);
1434 if (
item[i]._iPLFR < 0)
1436 if (
item[i]._iPLLR < 0)
1438 if (
item[i]._iPLMR < 0)
1526 if (
item[i]._iMaxDur < 1)
1656 if (
item[i]._iPLFR < 0)
1660 if (
item[i]._iVAdd1 ||
item[i]._iVMult1) {
1671 int pre, post, nt, nl, j, preidx, sufidx;
1678 if (pre != 0 && post == 0) {
1687 if (!onlygood &&
random_(0, 3))
1705 sprintf(istr,
"%s %s",
PL_Prefix[preidx].PLName,
item[i]._iIName);
1706 strcpy(
item[i]._iIName, istr);
1733 sprintf(istr,
"%s of %s",
item[i]._iIName,
PL_Suffix[sufidx].PLName);
1734 strcpy(
item[i]._iIName, istr);
1750 sprintf(istr,
"%s %s",
PL_Prefix[preidx].PLName,
item[i]._iIName);
1751 strcpy(
item[i]._iIName, istr);
1754 sprintf(istr,
"%s of %s",
item[i]._iIName,
PL_Suffix[sufidx].PLName);
1755 strcpy(
item[i]._iIName, istr);
1758 if (preidx != -1 || sufidx != -1)
1768 switch (
item[i]._itype) {
1825 if ((
monster[m].MData->mTreasure & 0x8000) != 0)
1828 if (
monster[m].MData->mTreasure & 0x4000)
1853 return ril[
random_(24, ri)] + 1;
1956 memset(uok, 0,
sizeof(uok));
2040 void SetupAllItems(
int ii,
int idx,
int iseed,
int lvl,
int uper,
int onlygood, BOOL recreate, BOOL pregen)
2102 int ii, onlygood, idx;
2201 if (lvl > 1 && !
random_(34, 3))
2226 void CreateTypeItem(
int x,
int y, BOOL onlygood,
int itype,
int imisc, BOOL sendmsg, BOOL delta)
2251 void RecreateItem(
int ii,
int idx, WORD icreateinfo,
int iseed,
int ivalue)
2253 int uper, onlygood, recreate;
2272 if (icreateinfo & 0x7C00) {
2274 }
else if ((icreateinfo & 0x0180) == 0x0180) {
2281 if (icreateinfo & 0x0100)
2283 if (icreateinfo & 0x80)
2285 if (icreateinfo & 0x40)
2287 if (icreateinfo & 0x0200)
2289 if (icreateinfo & 0x8000)
2291 SetupAllItems(ii, idx, iseed, icreateinfo & 0x3F, uper, onlygood, recreate, pregen);
2297 void RecreateEar(
int ii, WORD ic,
int iseed,
int Id,
int dur,
int mdur,
int ch,
int mch,
int ivalue,
int ibuff)
2300 tempstr[0] = (ic >> 8) & 0x7F;
2302 tempstr[2] = (iseed >> 24) & 0x7F;
2303 tempstr[3] = (iseed >> 16) & 0x7F;
2304 tempstr[4] = (iseed >> 8) & 0x7F;
2311 tempstr[11] = (ivalue >> 8) & 0x7F;
2312 tempstr[12] = (ibuff >> 24) & 0x7F;
2313 tempstr[13] = (ibuff >> 16) & 0x7F;
2314 tempstr[14] = (ibuff >> 8) & 0x7F;
2333 if (tries > 1000 && randarea > 1)
2338 for (i = 0; i < randarea && !failed; i++) {
2339 for (j = 0; j < randarea && !failed; j++) {
2354 dItem[x][y] = i + 1;
2374 for (i = 0; i <
nobjects && !ostand; i++) {
2376 ostand =
object[ii]._otype ==
OBJ_STAND;
2382 xx =
object[ii]._ox;
2383 yy =
object[ii]._oy;
2441 for (idoppelx = 16; idoppelx < 96; idoppelx++) {
2460 if (
item[ii]._iAnimFlag) {
2463 if (
item[ii]._iSelFlag == 1 &&
item[ii]._iAnimFrame == 11)
2465 if (
item[ii]._iSelFlag == 2 &&
item[ii]._iAnimFrame == 21)
2468 if (
item[ii]._iAnimFrame ==
item[ii]._iAnimLen >> 1)
2471 if (
item[ii]._iAnimFrame >=
item[ii]._iAnimLen) {
2486 for (i = 0; i < 35; i++) {
2501 if (
item[i]._iIdentified)
2568 rep += lvl +
random_(37, lvl);
2627 strcpy(
tempstr,
"fully recover life");
2631 strcpy(
tempstr,
"recover partial life");
2635 strcpy(
tempstr,
"recover life");
2639 strcpy(
tempstr,
"deadly heal");
2643 strcpy(
tempstr,
"recover mana");
2647 strcpy(
tempstr,
"fully recover mana");
2651 strcpy(
tempstr,
"increase strength");
2655 strcpy(
tempstr,
"increase magic");
2659 strcpy(
tempstr,
"increase dexterity");
2663 strcpy(
tempstr,
"increase vitality");
2667 strcpy(
tempstr,
"decrease strength");
2671 strcpy(
tempstr,
"decrease strength");
2675 strcpy(
tempstr,
"decrease dexterity");
2679 strcpy(
tempstr,
"decrease vitality");
2683 strcpy(
tempstr,
"recover life and mana");
2687 strcpy(
tempstr,
"fully recover life and mana");
2722 sprintf(
tempstr,
"Resist Fire : 75%% MAX");
2728 sprintf(
tempstr,
"Resist Lightning : 75%% MAX");
2734 sprintf(
tempstr,
"Resist Magic : 75%% MAX");
2740 sprintf(
tempstr,
"Resist All : 75%% MAX");
2744 strcpy(
tempstr,
"spells are increased 1 level");
2746 strcpy(
tempstr,
"spells are increased 2 levels");
2748 strcpy(
tempstr,
"spells are decreased 1 level");
2751 strcpy(
tempstr,
"Extra charges");
2795 strcpy(
tempstr,
"high durability");
2798 strcpy(
tempstr,
"decreased durability");
2801 strcpy(
tempstr,
"indestructible");
2816 strcpy(
tempstr,
"attacker takes 1-3 damage");
2819 strcpy(
tempstr,
"user loses all mana");
2822 strcpy(
tempstr,
"you can't heal");
2825 strcpy(
tempstr,
"absorbs half of trap damage");
2828 strcpy(
tempstr,
"knocks target back");
2831 strcpy(
tempstr,
"+200% damage vs. demons");
2834 strcpy(
tempstr,
"All Resistance equals 0");
2837 strcpy(
tempstr,
"hit monster doesn't heal");
2841 strcpy(
tempstr,
"hit steals 3% mana");
2843 strcpy(
tempstr,
"hit steals 5% mana");
2847 strcpy(
tempstr,
"hit steals 3% life");
2849 strcpy(
tempstr,
"hit steals 5% life");
2852 strcpy(
tempstr,
"damages target's armor");
2856 strcpy(
tempstr,
"quick attack");
2858 strcpy(
tempstr,
"fast attack");
2860 strcpy(
tempstr,
"faster attack");
2862 strcpy(
tempstr,
"fastest attack");
2866 strcpy(
tempstr,
"fast hit recovery");
2868 strcpy(
tempstr,
"faster hit recovery");
2870 strcpy(
tempstr,
"fastest hit recovery");
2873 strcpy(
tempstr,
"fast block");
2879 strcpy(
tempstr,
"fires random speed arrows");
2882 sprintf(
tempstr,
"unusual item damage");
2885 strcpy(
tempstr,
"altered durability");
2888 strcpy(
tempstr,
"Faster attack swing");
2891 strcpy(
tempstr,
"one handed sword");
2894 strcpy(
tempstr,
"constantly lose hit points");
2897 strcpy(
tempstr,
"life stealing");
2900 strcpy(
tempstr,
"no strength requirement");
2903 strcpy(
tempstr,
"see with infravision");
2909 strcpy(
tempstr,
"Armor class added to life");
2912 strcpy(
tempstr,
"10% of mana added to armor");
2921 strcpy(
tempstr,
"Another ability (NW)");
2934 int len, width, sx, sy, i, k;
2943 for (i = 0; i < len; i++)
2946 k = (257 - width) >> 1;
2950 for (i = 0; i < len; i++) {
2953 if (c && k <= 257) {
2971 memcpy(dst, src, 266);
3012 strcpy(
tempstr,
"Right-click to read");
3016 strcpy(
tempstr,
"Right-click to read, then");
3018 strcpy(
tempstr,
"left-click to target");
3023 strcpy(
tempstr,
"Right click to use");
3027 strcpy(
tempstr,
"Right click to read");
3031 strcpy(
tempstr,
"Right click to view");
3051 sprintf(
tempstr,
"armor: %i Indestructible", x->
_iAC);
3105 sprintf(
tempstr,
"armor: %i Indestructible", x->
_iAC);
3140 l = ((j >> 1) +
random_(39, j)) << 6;
3146 if (
plr[p]._pHitPoints >
plr[p]._pMaxHP)
3149 if (
plr[p]._pHPBase >
plr[p]._pMaxHPBase)
3160 l = ((j >> 1) +
random_(40, j)) << 6;
3167 if (
plr[p]._pMana >
plr[p]._pMaxMana)
3170 if (
plr[p]._pManaBase >
plr[p]._pMaxManaBase)
3196 l = ((j >> 1) +
random_(39, j)) << 6;
3202 if (
plr[p]._pHitPoints >
plr[p]._pMaxHP)
3205 if (
plr[p]._pHPBase >
plr[p]._pMaxHPBase)
3209 l = ((j >> 1) +
random_(40, j)) << 6;
3216 if (
plr[p]._pMana >
plr[p]._pMaxMana)
3219 if (
plr[p]._pManaBase >
plr[p]._pMaxManaBase)
3270 if (
plr[p]._pSplLvl[spl] < 15)
3273 if (
plr[p]._pMana >
plr[p]._pMaxMana)
3276 if (
plr[p]._pManaBase >
plr[p]._pMaxManaBase)
3299 if (
plr[
myplr]._pStrength < h->_iMinStr)
3301 if (
plr[
myplr]._pMagic < h->_iMinMag)
3303 if (
plr[
myplr]._pDexterity < h->_iMinDex)
3347 return ril[
random_(50, ri)] + 1;
3370 while (j > 0 && !sorted) {
3372 for (k = 0; k < j; k++) {
3387 for (i = 0; i < iCnt; i++) {
3446 return ril[
random_(50, ri)] + 1;
3535 return ril[
random_(51, ri)] + 1;
3549 while (j > 3 && !sorted) {
3551 for (k = 3; k < j; k++) {
3598 for (i = 3; i < iCnt; i++) {
3611 }
while (
item[0]._iIvalue > 140000);
3619 for (i = iCnt; i < 20; i++)
3638 return ril[
random_(49, ri)] + 1;
3652 }
while (
item[0]._iIvalue > 90000);
3719 return ril[
random_(50, ri)] + 1;
3733 while (j > 2 && !sorted) {
3735 for (k = 2; k < j; k++) {
3747 int i, nsi, srnd, itype;
3770 for (i = srnd; i < nsi; i++) {
3780 for (i = nsi; i < 20; i++) {
3876 if (icreateinfo & 0x400)
3878 else if (icreateinfo & 0x800)
3880 else if (icreateinfo & 0x1000)
3882 else if (icreateinfo & 0x2000)
3884 else if (icreateinfo & 0x4000)
3902 for (i = 0; i < 20; i++) {
3907 for (i = 0; i < 20; i++) {
3966 if (
item[ii]._iCurs == icurs)
3993 if (
item[ii]._iCurs == icurs)
4011 dwTicks = SDL_GetTicks();
4014 if (dwTicks -
itemrecord[i].dwTimestamp > 6000) {
4043 dwTicks = SDL_GetTicks();
4061 dwTicks = SDL_GetTicks();
4064 if (dwTicks -
itemrecord[i].dwTimestamp > 6000) {