Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract hardcoded starting skill/spell/items and combat bonuses #6530

Merged
merged 9 commits into from
Sep 20, 2023
41 changes: 22 additions & 19 deletions Packaging/resources/assets/txtdata/classes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,25 @@ There is one folder per class.

### attributes.tsv

Attribute | Description
-------------:|--------------------------------------
`baseStr` | Class Starting Strength Stat, uint8_t
`baseMag` | Class Starting Magic Stat, uint8_t
`baseDex` | Class Starting Dexterity Stat, uint8_t
`baseVit` | Class Starting Vitality Stat, uint8_t
`maxStr` | Class Maximum Strength Stat, uint8_t
`maxMag` | Class Maximum Magic Stat, uint8_t
`maxDex` | Class Maximum Dexterity Stat, uint8_t
`maxVit` | Class Maximum Vitality Stat, uint8_t
`blockBonus` | Class Block Bonus, %
`adjLife` | Class Life Adjustment, decimal
`adjMana` | Class Mana Adjustment, decimal
`lvlLife` | Life gained on level up, decimal
`lvlMana` | Mana gained on level up, decimal
`chrLife` | Life from base Vitality, decimal
`chrMana` | Mana from base Magic, decimal
`itmLife` | Life from item bonus Vitality, decimal
`itmMana` | Mana from item bonus Magic, decimal
Attribute | Description
------------------:|--------------------------------------
`baseStr` | Class Starting Strength Stat, uint8_t
`baseMag` | Class Starting Magic Stat, uint8_t
`baseDex` | Class Starting Dexterity Stat, uint8_t
`baseVit` | Class Starting Vitality Stat, uint8_t
`maxStr` | Class Maximum Strength Stat, uint8_t
`maxMag` | Class Maximum Magic Stat, uint8_t
`maxDex` | Class Maximum Dexterity Stat, uint8_t
`maxVit` | Class Maximum Vitality Stat, uint8_t
`blockBonus` | Class Block Bonus, %
`adjLife` | Class Life Adjustment, decimal
`adjMana` | Class Mana Adjustment, decimal
`lvlLife` | Life gained on level up, decimal
`lvlMana` | Mana gained on level up, decimal
`chrLife` | Life from base Vitality, decimal
`chrMana` | Mana from base Magic, decimal
`itmLife` | Life from item bonus Vitality, decimal
`itmMana` | Mana from item bonus Magic, decimal
`baseMagicToHit` | Starting chance to hit with spells/scrolls, %
`baseMeleeToHit` | Starting chance to hit with melee weapons/fists, %
`baseRangedToHit` | Starting chance to hit with ranged weapons, %
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ chrLife 2
chrMana 1
itmLife 2.5
itmMana 1
baseMagicToHit 50
baseMeleeToHit 50
baseRangedToHit 50
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ chrLife 1
chrMana 1.5
itmLife 1.5
itmMana 1.75
baseMagicToHit 60
baseMeleeToHit 50
baseRangedToHit 60
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ chrLife 1
chrMana 1
itmLife 1.5
itmMana 1.5
baseMagicToHit 50
baseMeleeToHit 50
baseRangedToHit 50
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ chrLife 1
chrMana 1
itmLife 1.5
itmMana 1.5
baseMagicToHit 50
baseMeleeToHit 50
baseRangedToHit 70
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ chrLife 1
chrMana 2
itmLife 1
itmMana 2
baseMagicToHit 70
baseMeleeToHit 50
baseRangedToHit 50
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ chrLife 2
chrMana 1
itmLife 2
itmMana 1
baseMagicToHit 50
baseMeleeToHit 70
baseRangedToHit 60
4 changes: 2 additions & 2 deletions Source/DiabloUI/diabloui.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ void UiTitleDialog();
void UnloadUiGFX();
void UiInitialize();
bool UiValidPlayerName(std::string_view name); /* check */
void UiSelHeroMultDialog(bool (*fninfo)(bool (*fninfofunc)(_uiheroinfo *)), bool (*fncreate)(_uiheroinfo *), bool (*fnremove)(_uiheroinfo *), void (*fnstats)(unsigned int, _uidefaultstats *), _selhero_selections *dlgresult, uint32_t *saveNumber);
void UiSelHeroSingDialog(bool (*fninfo)(bool (*fninfofunc)(_uiheroinfo *)), bool (*fncreate)(_uiheroinfo *), bool (*fnremove)(_uiheroinfo *), void (*fnstats)(unsigned int, _uidefaultstats *), _selhero_selections *dlgresult, uint32_t *saveNumber, _difficulty *difficulty);
void UiSelHeroMultDialog(bool (*fninfo)(bool (*fninfofunc)(_uiheroinfo *)), bool (*fncreate)(_uiheroinfo *), bool (*fnremove)(_uiheroinfo *), void (*fnstats)(HeroClass, _uidefaultstats *), _selhero_selections *dlgresult, uint32_t *saveNumber);
void UiSelHeroSingDialog(bool (*fninfo)(bool (*fninfofunc)(_uiheroinfo *)), bool (*fncreate)(_uiheroinfo *), bool (*fnremove)(_uiheroinfo *), void (*fnstats)(HeroClass, _uidefaultstats *), _selhero_selections *dlgresult, uint32_t *saveNumber, _difficulty *difficulty);
bool UiCreditsDialog();
bool UiSupportDialog();
bool UiMainMenuDialog(const char *name, _mainmenu_selections *pdwResult, int attractTimeOut);
Expand Down
10 changes: 5 additions & 5 deletions Source/DiabloUI/hero/selhero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ bool selhero_isMultiPlayer;

bool (*gfnHeroInfo)(bool (*fninfofunc)(_uiheroinfo *));
bool (*gfnHeroCreate)(_uiheroinfo *);
void (*gfnHeroStats)(unsigned int, _uidefaultstats *);
void (*gfnHeroStats)(HeroClass, _uidefaultstats *);

namespace {

Expand Down Expand Up @@ -226,7 +226,7 @@ void SelheroClassSelectorFocus(int value)
const auto heroClass = static_cast<HeroClass>(vecSelHeroDlgItems[value]->m_value);

_uidefaultstats defaults;
gfnHeroStats(static_cast<unsigned int>(heroClass), &defaults);
gfnHeroStats(heroClass, &defaults);

selhero_heroInfo.level = 1;
selhero_heroInfo.heroclass = heroClass;
Expand Down Expand Up @@ -546,7 +546,7 @@ void selhero_List_Init()
static void UiSelHeroDialog(
bool (*fninfo)(bool (*fninfofunc)(_uiheroinfo *)),
bool (*fncreate)(_uiheroinfo *),
void (*fnstats)(unsigned int, _uidefaultstats *),
void (*fnstats)(HeroClass, _uidefaultstats *),
bool (*fnremove)(_uiheroinfo *),
_selhero_selections *dlgresult,
uint32_t *saveNumber)
Expand Down Expand Up @@ -607,7 +607,7 @@ void UiSelHeroSingDialog(
bool (*fninfo)(bool (*fninfofunc)(_uiheroinfo *)),
bool (*fncreate)(_uiheroinfo *),
bool (*fnremove)(_uiheroinfo *),
void (*fnstats)(unsigned int, _uidefaultstats *),
void (*fnstats)(HeroClass, _uidefaultstats *),
_selhero_selections *dlgresult,
uint32_t *saveNumber,
_difficulty *difficulty)
Expand All @@ -621,7 +621,7 @@ void UiSelHeroMultDialog(
bool (*fninfo)(bool (*fninfofunc)(_uiheroinfo *)),
bool (*fncreate)(_uiheroinfo *),
bool (*fnremove)(_uiheroinfo *),
void (*fnstats)(unsigned int, _uidefaultstats *),
void (*fnstats)(HeroClass, _uidefaultstats *),
_selhero_selections *dlgresult,
uint32_t *saveNumber)
{
Expand Down
4 changes: 2 additions & 2 deletions Source/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ std::string TextCmdArenaPot(const std::string_view parameter)
GenerateNewSeed(item);
item.updateRequiredStatsCacheForPlayer(myPlayer);

if (!AutoPlaceItemInBelt(myPlayer, item, true) && !AutoPlaceItemInInventory(myPlayer, item, true)) {
if (!AutoPlaceItemInBelt(myPlayer, item, true, true) && !AutoPlaceItemInInventory(myPlayer, item, true, true)) {
break; // inventory is full
}
}
Expand Down Expand Up @@ -1212,7 +1212,7 @@ void DrawInfoBox(const Surface &out)
InfoColor = UiFlags::ColorWhitegold;
auto &target = Players[pcursplr];
InfoString = std::string_view(target._pName);
AddPanelString(fmt::format(fmt::runtime(_("{:s}, Level: {:d}")), _(PlayersData[static_cast<std::size_t>(target._pClass)].className), target.getCharacterLevel()));
AddPanelString(fmt::format(fmt::runtime(_("{:s}, Level: {:d}")), target.getClassName(), target.getCharacterLevel()));
AddPanelString(fmt::format(fmt::runtime(_("Hit Points {:d} of {:d}")), target._pHitPoints >> 6, target._pMaxHP >> 6));
}
}
Expand Down
2 changes: 1 addition & 1 deletion Source/controls/plrctrls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,7 @@ void StashMove(AxisDirection dir)
} else if (dir.y == AxisDirectionY_DOWN) {
if (ActiveStashSlot.y < 10 - itemSize.height) {
ActiveStashSlot.y++;
} else if ((holdItem.isEmpty() || CanBePlacedOnBelt(holdItem)) && ActiveStashSlot.x > 1) {
} else if ((holdItem.isEmpty() || CanBePlacedOnBelt(*MyPlayer, holdItem)) && ActiveStashSlot.x > 1) {
int beltSlot = ActiveStashSlot.x - 2;
Slot = SLOTXY_BELT_FIRST + beltSlot;
ActiveStashSlot = InvalidStashPoint;
Expand Down
3 changes: 1 addition & 2 deletions Source/discord/discord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ std::string GetLocationString()

std::string GetCharacterString()
{
const std::string_view charClassStr = _(PlayersData[static_cast<int>(MyPlayer->_pClass)].className);
return fmt::format(fmt::runtime(_(/* TRANSLATORS: Discord character, i.e. "Lv 6 Warrior" */ "Lv {} {}")), tracked_data.playerLevel, charClassStr);
return fmt::format(fmt::runtime(_(/* TRANSLATORS: Discord character, i.e. "Lv 6 Warrior" */ "Lv {} {}")), tracked_data.playerLevel, MyPlayer->getClassName());
}

std::string GetDetailString()
Expand Down
Loading
Loading