Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ikonomov committed Nov 13, 2024
1 parent a79f1d3 commit 12bb187
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 30 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Note: You'll need access to the data from the original game. If you don't have a
* Damage versus demons affix [+200%]:
* Deadly Hunter: +50%
* Civerb's Cudgel: +150%
* Damage from Fire and Lightning affixes is applied twice.
* Damage is applied 7 times for Lightning and 9 times for Fire affixes.
* Set to minimum values:
* Staff charges.
* Armor class for shields and armor.
Expand All @@ -68,6 +68,10 @@ Note: You'll need access to the data from the original game. If you don't have a
* Affixes with a range of values.
* Burgundy affix has been renamed to Russet.
* All unique items are findable.
* Slain Hero drops:
* Warrior: Full Plate Mail in Nightmare and Hell difficulty
* Rogue: Long War Bow in Nightmare and Hell difficulty
* Sorcerer: Book of Fireball in Nightmare and Book of Chain Lightning in Hell difficulty
* Town portal scrolls dropped as special items (from chests and barrels, replacing Mana or Healing potions) can be found on levels 2-8 [2-15].
* Maximum base item ilvl for dungeon drops (not from monsters): +15 in Nightmare difficulty; +30 in Hell
* Maximum affix ilvl:
Expand Down Expand Up @@ -183,7 +187,7 @@ Note: You'll need access to the data from the original game. If you don't have a
* Maximum affix qlvl:
* Adria: 2×ilvl+1 [2×ilvl]
* Griswold: 32 [30]
* Wirt: clvl [2×clvl]
* Wirt: (45×clvl/(clvl+40))×2+1 [2×clvl]
#### Shrines:
* Fascinating, Ornate and Sacred reduce magic by -2% (-1 minimum) [-10% mana].
* Abandoned, Creepy, Eerie and Quiet increase attributes by 1 [2].
Expand Down
2 changes: 1 addition & 1 deletion Source/itemdat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ const ItemData AllItemsList[] = {
/* */ { IDROP_DOUBLE, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_HUNTERS_BOW, ItemType::Bow, UITYPE_LONGBOW, N_("Long Bow"), N_("Bow"), 5, 35, 1, 6, 0, 0, 25, 0, 30, ItemSpecialEffect::None, IMISC_NONE, SpellID::Null, false, 250 },
/* */ { IDROP_DOUBLE, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_COMPOSITE_BOW, ItemType::Bow, UITYPE_COMPBOW, N_("Composite Bow"), N_("Bow"), 7, 45, 3, 6, 0, 0, 25, 0, 40, ItemSpecialEffect::None, IMISC_NONE, SpellID::Null, false, 600 },
/* */ { IDROP_DOUBLE, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_SHORT_BATTLE_BOW, ItemType::Bow, UITYPE_NONE, N_("Short Battle Bow"), N_("Bow"), 9, 45, 3, 7, 0, 0, 30, 0, 50, ItemSpecialEffect::None, IMISC_NONE, SpellID::Null, false, 750 },
/* */ { IDROP_DOUBLE, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_LONG_WAR_BOW, ItemType::Bow, UITYPE_BATTLEBOW, N_("Long Battle Bow"), N_("Bow"), 11, 50, 1, 10, 0, 0, 30, 0, 60, ItemSpecialEffect::None, IMISC_NONE, SpellID::Null, false, 1000 },
/* */ { IDROP_DOUBLE, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_LONG_BATTLE_BOW, ItemType::Bow, UITYPE_BATTLEBOW, N_("Long Battle Bow"), N_("Bow"), 11, 50, 1, 10, 0, 0, 30, 0, 60, ItemSpecialEffect::None, IMISC_NONE, SpellID::Null, false, 1000 },
/* */ { IDROP_DOUBLE, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_SHORT_WAR_BOW, ItemType::Bow, UITYPE_NONE, N_("Short War Bow"), N_("Bow"), 15, 55, 4, 8, 0, 0, 35, 0, 70, ItemSpecialEffect::None, IMISC_NONE, SpellID::Null, false, 1500 },
/* */ { IDROP_DOUBLE, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_LONG_WAR_BOW, ItemType::Bow, UITYPE_WARBOW, N_("Long War Bow"), N_("Bow"), 19, 60, 1, 14, 0, 0, 45, 0, 80, ItemSpecialEffect::None, IMISC_NONE, SpellID::Null, false, 2000 },
/* */ { IDROP_REGULAR, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_SHORT_STAFF, ItemType::Staff, UITYPE_SHORTSTAFF, N_("Short Staff"), N_("Staff"), 1, 25, 2, 4, 0, 0, 0, 0, 0, ItemSpecialEffect::None, IMISC_STAFF, SpellID::Null, false, 30 },
Expand Down
3 changes: 2 additions & 1 deletion Source/itemdat.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ enum item_cursor_graphic : uint8_t {
ICURS_KITE_SHIELD = 113,
ICURS_SCALE_MAIL = 114,
ICURS_SHORT_BOW = 118,
ICURS_LONG_WAR_BOW = 119,
ICURS_LONG_BATTLE_BOW = 119,
ICURS_LONG_WAR_BOW = 120,
ICURS_WAR_HAMMER = 121,
ICURS_MAUL = 122,
ICURS_LONG_STAFF = 123,
Expand Down
18 changes: 11 additions & 7 deletions Source/items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2179,7 +2179,8 @@ void RecreateBoyItem(const Player &player, Item &item, int lvl, int iseed)
SetRndSeed(iseed);
_item_indexes itype = RndBoyItem(player, lvl);
GetItemAttrs(item, itype, lvl);
GetItemBonus(player, item, lvl / 2, lvl, true, true);
int ilvl_boy = (45 * lvl / (lvl + 40)) * 2 + 1;
GetItemBonus(player, item, ilvl_boy / 2, ilvl_boy, true, true);

item._iSeed = iseed;
item._iCreateInfo = lvl | CF_BOY;
Expand Down Expand Up @@ -2253,16 +2254,17 @@ void CreateMagicItem(Point position, int lvl, ItemType itemType, int imid, int i
while (true) {
item = {};

int ilvl_diff;
switch (sgGameInitInfo.nDifficulty) {
case DIFF_NIGHTMARE:
lvl += 5;
ilvl_diff = lvl + 5;
break;
case DIFF_HELL:
lvl += 10;
ilvl_diff = lvl + 10;
break;
}

SetupAllItems(*MyPlayer, item, idx, AdvanceRndSeed(), 2 * lvl - 1, 1, true, false, delta);
SetupAllItems(*MyPlayer, item, idx, AdvanceRndSeed(), 2 * ilvl_diff - 1, 1, true, false, delta);
if (item._iCurs == icurs)
break;

Expand Down Expand Up @@ -2352,8 +2354,9 @@ std::string GetTranslatedItemNameMagical(const Item &item, bool hellfireItem, bo
maxlvl = lvl;
} else if ((item._iCreateInfo & CF_BOY) != 0) {
DiscardRandomValues(2); // RndVendorItem and GetItemAttrs
minlvl = lvl / 2;
maxlvl = lvl;
int ilvl_boy = (45 * lvl / (lvl + 40)) * 2 + 1;
minlvl = ilvl_boy / 2;
maxlvl = ilvl_boy;
} else if ((item._iCreateInfo & CF_WITCH) != 0) {
DiscardRandomValues(2); // RndVendorItem and GetItemAttrs
int iblvl = -1;
Expand Down Expand Up @@ -4452,7 +4455,8 @@ void SpawnBoy(int lvl)
SetRndSeed(boyitem._iSeed);
_item_indexes itype = RndBoyItem(*MyPlayer, lvl);
GetItemAttrs(boyitem, itype, lvl);
GetItemBonus(*MyPlayer, boyitem, lvl / 2, lvl, true, true);
int ilvl_boy = (45 * lvl / (lvl + 40)) * 2 + 1;
GetItemBonus(*MyPlayer, boyitem, ilvl_boy / 2, ilvl_boy, true, true);

if (!gbIsHellfire) {
if (boyitem._iIvalue > 100000) {
Expand Down
56 changes: 40 additions & 16 deletions Source/missiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2814,9 +2814,15 @@ void ProcessElementalArrow(Missile &missile)
if (!missile.IsTrap()) {
// BUGFIX: damage of missile should be encoded in missile struct; player can be dead/have left the game before missile arrives.
const Player &player = Players[p];
int eDoubleDamage = RandomIntBetween(player._pILMinDam, player._pILMaxDam);
eMind = player._pILMinDam + eDoubleDamage;
eMaxd = player._pILMaxDam + eDoubleDamage;
int l_extra_dam = 0;
int l_extra_dam_c = 0;
int l_extra_dam_n = GenerateRnd(7);
while (l_extra_dam_c != l_extra_dam_n) {
l_extra_dam += RandomIntBetween(player._pILMinDam, player._pILMaxDam);
l_extra_dam_c++;
}
eMind = player._pILMinDam + l_extra_dam;
eMaxd = player._pILMaxDam + l_extra_dam;
} else {
eMind = GenerateRnd(10) + 1 + currlevel;
eMaxd = GenerateRnd(10) + 1 + currlevel * 2;
Expand All @@ -2828,9 +2834,15 @@ void ProcessElementalArrow(Missile &missile)
if (!missile.IsTrap()) {
// BUGFIX: damage of missile should be encoded in missile struct; player can be dead/have left the game before missile arrives.
const Player &player = Players[p];
int eDoubleDamage = RandomIntBetween(player._pIFMinDam, player._pIFMaxDam);
eMind = player._pIFMinDam + eDoubleDamage;
eMaxd = player._pIFMaxDam + eDoubleDamage;
int f_extra_dam = 0;
int f_extra_dam_c = 0;
int f_extra_dam_n = GenerateRnd(9);
while (f_extra_dam_c != f_extra_dam_n) {
f_extra_dam += RandomIntBetween(player._pIFMinDam, player._pIFMaxDam);
f_extra_dam_c++;
}
eMind = player._pIFMinDam + f_extra_dam;
eMaxd = player._pIFMaxDam + f_extra_dam;
} else {
eMind = GenerateRnd(10) + 1 + currlevel;
eMaxd = GenerateRnd(10) + 1 + currlevel * 2;
Expand Down Expand Up @@ -3544,16 +3556,16 @@ void ProcessChainLightning(Missile &missile)
Direction dir = GetDirection(position, dst);
AddMissile(position, dst, dir, MissileID::LightningControl, TARGET_MONSTERS, id, 1, missile._mispllvl);
int rad = std::min<int>(missile._mispllvl + 3, MaxCrawlRadius);
int maxTargets = 2 + missile._mispllvl / 5;
int targetCount = 0;
int max_targets = 2 + missile._mispllvl / 5;
int target_count = 0;
Crawl(1, rad, [&](Displacement displacement) {
Point target = position + displacement;
if (InDungeonBounds(target) && dMonster[target.x][target.y] > 0) {
dir = GetDirection(position, target);
AddMissile(position, target, dir, MissileID::LightningControl, TARGET_MONSTERS, id, 1, missile._mispllvl);
targetCount++;
target_count++;
}
return targetCount >= maxTargets;
return target_count >= max_targets;
});
missile._mirange--;
if (missile._mirange == 0)
Expand All @@ -3571,15 +3583,27 @@ void ProcessWeaponExplosion(Missile &missile)
DamageType damageType;
if (missile.var2 == 1) {
// BUGFIX: damage of missile should be encoded in missile struct; player can be dead/have left the game before missile arrives.
int eDoubleDamage = RandomIntBetween(player._pIFMinDam, player._pIFMaxDam);
mind = player._pIFMinDam + eDoubleDamage;
maxd = player._pIFMaxDam + eDoubleDamage;
int f_extra_dam = 0;
int f_extra_dam_c = 0;
int f_extra_dam_n = GenerateRnd(9);
while (f_extra_dam_c != f_extra_dam_n) {
f_extra_dam += RandomIntBetween(player._pIFMinDam, player._pIFMaxDam);
f_extra_dam_c++;
}
mind = player._pIFMinDam + f_extra_dam;
maxd = player._pIFMaxDam + f_extra_dam;
damageType = DamageType::Fire;
} else {
// BUGFIX: damage of missile should be encoded in missile struct; player can be dead/have left the game before missile arrives.
int eDoubleDamage = RandomIntBetween(player._pILMinDam, player._pILMaxDam);
mind = player._pILMinDam + eDoubleDamage;
maxd = player._pILMaxDam + eDoubleDamage;
int l_extra_dam = 0;
int l_extra_dam_c = 0;
int l_extra_dam_n = GenerateRnd(7);
while (l_extra_dam_c != l_extra_dam_n) {
l_extra_dam += RandomIntBetween(player._pILMinDam, player._pILMaxDam);
l_extra_dam_c++;
}
mind = player._pILMinDam + l_extra_dam;
maxd = player._pILMaxDam + l_extra_dam;
damageType = DamageType::Lightning;
}
CheckMissileCol(missile, damageType, mind, maxd, false, missile.position.tile, false);
Expand Down
20 changes: 17 additions & 3 deletions Source/objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2239,11 +2239,25 @@ void OperateSlainHero(const Player &player, Object &corpse, bool sendmsg)
SetRndSeed(corpse._oRndSeed);

if (player._pClass == HeroClass::Warrior) {
CreateMagicArmor(corpse.position, ItemType::HeavyArmor, ICURS_BREAST_PLATE, sendmsg, false);
if (sgGameInitInfo.nDifficulty == DIFF_NORMAL) {
CreateMagicArmor(corpse.position, ItemType::HeavyArmor, ICURS_BREAST_PLATE, sendmsg, false);
} else {
CreateMagicArmor(corpse.position, ItemType::HeavyArmor, ICURS_FULL_PLATE_MAIL, sendmsg, false);
}
} else if (player._pClass == HeroClass::Rogue) {
CreateMagicWeapon(corpse.position, ItemType::Bow, ICURS_LONG_WAR_BOW, sendmsg, false);
if (sgGameInitInfo.nDifficulty == DIFF_NORMAL) {
CreateMagicWeapon(corpse.position, ItemType::Bow, ICURS_LONG_BATTLE_BOW, sendmsg, false);
} else {
CreateMagicWeapon(corpse.position, ItemType::Bow, ICURS_LONG_WAR_BOW, sendmsg, false);
}
} else if (player._pClass == HeroClass::Sorcerer) {
CreateSpellBook(corpse.position, SpellID::Lightning, sendmsg, false);
if (sgGameInitInfo.nDifficulty == DIFF_NORMAL) {
CreateSpellBook(corpse.position, SpellID::Lightning, sendmsg, false);
} else if (sgGameInitInfo.nDifficulty == DIFF_NIGHTMARE) {
CreateSpellBook(corpse.position, SpellID::Fireball, sendmsg, false);
} else {
CreateSpellBook(corpse.position, SpellID::ChainLightning, sendmsg, false);
}
} else if (player._pClass == HeroClass::Monk) {
CreateMagicWeapon(corpse.position, ItemType::Staff, ICURS_WAR_STAFF, sendmsg, false);
} else if (player._pClass == HeroClass::Bard) {
Expand Down

0 comments on commit 12bb187

Please sign in to comment.