Browse Source

[hellfire] SpawnBoy

pull/956/head
Anders Jenbo 5 years ago
parent
commit
557af48363
  1. 104
      Source/items.cpp
  2. 2
      defs.h

104
Source/items.cpp

@ -5344,6 +5344,31 @@ void SpawnBoy(int lvl)
{
int itype;
#ifdef HELLFIRE
int ivalue;
int count = 0;
int strength = get_max_strength(plr[myplr]._pClass);
int dexterity = get_max_dexterity(plr[myplr]._pClass);
int magic = get_max_magic(plr[myplr]._pClass);
int pc = plr[myplr]._pClass;
if (strength < plr[myplr]._pStrength) {
strength = plr[myplr]._pStrength;
}
strength *= 1.2;
if (dexterity < plr[myplr]._pDexterity) {
dexterity = plr[myplr]._pDexterity;
}
dexterity *= 1.2;
if (magic < plr[myplr]._pMagic) {
magic = plr[myplr]._pMagic;
}
magic *= 1.2;
#endif
if (boylevel < (lvl >> 1) || boyitem._itype == ITYPE_NONE) {
do {
item[0]._iSeed = GetRndSeed();
@ -5352,10 +5377,87 @@ void SpawnBoy(int lvl)
GetItemAttrs(0, itype, lvl);
#ifdef HELLFIRE
GetItemBonus(0, itype, lvl, 2 * lvl, TRUE, TRUE);
ivalue = 0;
int itemType = item[0]._itype;
switch (itemType) {
case ITYPE_LARMOR:
case ITYPE_MARMOR:
case ITYPE_HARMOR:
ivalue = get_armor_max_value(myplr);
break;
case ITYPE_SHIELD:
ivalue = get_shield_max_value(myplr);
break;
case ITYPE_AXE:
ivalue = get_axe_max_value(myplr);
break;
case ITYPE_BOW:
ivalue = get_bow_max_value(myplr);
break;
case ITYPE_MACE:
ivalue = get_mace_max_value(myplr);
break;
case ITYPE_SWORD:
ivalue = get_sword_max_value(myplr);
break;
case ITYPE_HELM:
ivalue = get_helm_max_value(myplr);
break;
case ITYPE_STAFF:
ivalue = get_staff_max_value(myplr);
break;
case ITYPE_RING:
ivalue = get_ring_max_value(myplr);
break;
case ITYPE_AMULET:
ivalue = get_amulet_max_value(myplr);
break;
}
ivalue *= 0.8;
count++;
if (count < 200) {
switch (pc) {
case PC_WARRIOR:
if (itemType == ITYPE_BOW || itemType == ITYPE_STAFF)
ivalue = INT_MAX;
break;
case PC_ROGUE:
if (itemType == ITYPE_SWORD || itemType == ITYPE_STAFF || itemType == ITYPE_AXE || itemType == ITYPE_MACE || itemType == ITYPE_SHIELD)
ivalue = INT_MAX;
break;
case PC_SORCERER:
if (itemType == ITYPE_STAFF || itemType == ITYPE_AXE || itemType == ITYPE_BOW || itemType == ITYPE_MACE)
ivalue = INT_MAX;
break;
case PC_MONK:
if (itemType == ITYPE_BOW || itemType == ITYPE_MARMOR || itemType == ITYPE_SHIELD || itemType == ITYPE_MACE)
ivalue = INT_MAX;
break;
case PC_BARD:
if (itemType == ITYPE_AXE || itemType == ITYPE_MACE || itemType == ITYPE_STAFF)
ivalue = INT_MAX;
break;
case PC_BARBARIAN:
if (itemType == ITYPE_BOW || itemType == ITYPE_STAFF)
ivalue = INT_MAX;
break;
}
}
} while ((item[0]._iIvalue > BOY_MAX_VALUE
|| item[0]._iMinStr > strength
|| item[0]._iMinMag > magic
|| item[0]._iMinDex > dexterity
|| item[0]._iIvalue < ivalue)
&& count < 250);
#else
GetItemBonus(0, itype, lvl, 2 * lvl, TRUE);
} while (item[0]._iIvalue > BOY_MAX_VALUE);
#endif
} while (item[0]._iIvalue > 90000);
boyitem = item[0];
boyitem._iCreateInfo = lvl | CF_BOY;
boyitem._iIdentified = TRUE;

2
defs.h

@ -100,6 +100,7 @@
// todo: enums
#ifdef HELLFIRE
#define NUMLEVELS 25
#define BOY_MAX_VALUE 200000
#define WITCH_ITEMS 25
#define SMITH_ITEMS 25
#define SMITH_PREMIUM_ITEMS 15
@ -108,6 +109,7 @@
#define STORE_LINES 104
#else
#define NUMLEVELS 17
#define BOY_MAX_VALUE 90000
#define WITCH_ITEMS 20
#define SMITH_ITEMS 20
#define SMITH_PREMIUM_ITEMS 6

Loading…
Cancel
Save