Skip to content

Commit

Permalink
Bugfix: Corruption item power
Browse files Browse the repository at this point in the history
  • Loading branch information
kphoenix137 authored and AJenbo committed Sep 17, 2024
1 parent 36af39d commit b0cb1b9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Source/engine/render/scrollrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1682,7 +1682,7 @@ void DrawAndBlit()
if (*sgOptions.Gameplay.showHealthValues)
DrawFlaskValues(out, { mainPanel.position.x + 134, mainPanel.position.y + 28 }, MyPlayer->_pHitPoints >> 6, MyPlayer->_pMaxHP >> 6);
if (*sgOptions.Gameplay.showManaValues)
DrawFlaskValues(out, { mainPanel.position.x + mainPanel.size.width - 138, mainPanel.position.y + 28 }, MyPlayer->_pMana >> 6, MyPlayer->_pMaxMana >> 6);
DrawFlaskValues(out, { mainPanel.position.x + mainPanel.size.width - 138, mainPanel.position.y + 28 }, HasAnyOf(InspectPlayer->_pIFlags, ItemSpecialEffect::NoMana) ? 0 : MyPlayer->_pMana >> 6, HasAnyOf(InspectPlayer->_pIFlags, ItemSpecialEffect::NoMana) ? 0 : MyPlayer->_pMaxMana >> 6);

DrawCursor(out);

Expand Down
7 changes: 5 additions & 2 deletions Source/panels/charpanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "playerdat.hpp"
#include "utils/algorithm/container.hpp"
#include "utils/display.h"
#include "utils/enum_traits.h"
#include "utils/format_int.hpp"
#include "utils/language.h"
#include "utils/str_cat.hpp"
Expand Down Expand Up @@ -74,6 +75,8 @@ UiFlags GetValueColor(int value, bool flip = false)

UiFlags GetMaxManaColor()
{
if (HasAnyOf(InspectPlayer->_pIFlags, ItemSpecialEffect::NoMana))
return UiFlags::ColorRed;
return InspectPlayer->_pMaxMana > InspectPlayer->_pMaxManaBase ? UiFlags::ColorBlue : UiFlags::ColorWhite;
}

Expand Down Expand Up @@ -184,9 +187,9 @@ PanelEntry panelEntries[] = {
{ "", { 135, 284 }, 45, 0,
[]() { return StyledText { (InspectPlayer->_pHitPoints != InspectPlayer->_pMaxHP ? UiFlags::ColorRed : GetMaxHealthColor()), StrCat(InspectPlayer->_pHitPoints >> 6) }; } },
{ N_("Mana"), { LeftColumnLabelX, 312 }, 45, LeftColumnLabelWidth,
[]() { return StyledText { GetMaxManaColor(), StrCat(InspectPlayer->_pMaxMana >> 6) }; } },
[]() { return StyledText { GetMaxManaColor(), StrCat(HasAnyOf(InspectPlayer->_pIFlags, ItemSpecialEffect::NoMana) ? 0 : InspectPlayer->_pMaxMana >> 6) }; } },
{ "", { 135, 312 }, 45, 0,
[]() { return StyledText { (InspectPlayer->_pMana != InspectPlayer->_pMaxMana ? UiFlags::ColorRed : GetMaxManaColor()), StrCat(InspectPlayer->_pMana >> 6) }; } },
[]() { return StyledText { (InspectPlayer->_pMana != InspectPlayer->_pMaxMana ? UiFlags::ColorRed : GetMaxManaColor()), StrCat(HasAnyOf(InspectPlayer->_pIFlags, ItemSpecialEffect::NoMana) ? 0 : InspectPlayer->_pMana >> 6) }; } },

{ N_("Resist magic"), { RightColumnLabelX, 256 }, 57, RightColumnLabelWidth,
[]() { return GetResistInfo(InspectPlayer->_pMagResist); } },
Expand Down
8 changes: 3 additions & 5 deletions Source/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2771,7 +2771,7 @@ void ApplyPlrDamage(DamageType damageType, Player &player, int dam, int minHP /*
if (&player == MyPlayer && player._pHitPoints > 0) {
AddFloatingNumber(damageType, player, totalDamage);
}
if (totalDamage > 0 && player.pManaShield) {
if (totalDamage > 0 && player.pManaShield && HasNoneOf(player._pIFlags, ItemSpecialEffect::NoMana)) {
uint8_t manaShieldLevel = player._pSplLvl[static_cast<int8_t>(SpellID::ManaShield)];
if (manaShieldLevel > 0) {
totalDamage += totalDamage / -player.GetManaShieldDamageReduction();
Expand Down Expand Up @@ -2982,10 +2982,8 @@ void ProcessPlayers()
if (HasAnyOf(player._pIFlags, ItemSpecialEffect::DrainLife) && leveltype != DTYPE_TOWN) {
ApplyPlrDamage(DamageType::Physical, player, 0, 0, 4);
}
if (HasAnyOf(player._pIFlags, ItemSpecialEffect::NoMana) && player._pManaBase > 0) {
player._pManaBase -= player._pMana;
player._pMana = 0;
RedrawComponent(PanelDrawComponent::Mana);
if (player.pManaShield && HasAnyOf(player._pIFlags, ItemSpecialEffect::NoMana)) {
NetSendCmd(true, CMD_REMSHIELD);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Source/spells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ SpellCheckResult CheckSpell(const Player &player, SpellID sn, SpellType st, bool
return SpellCheckResult::Fail_Level0;
}

if (player._pMana < GetManaAmount(player, sn)) {
if (player._pMana < GetManaAmount(player, sn) || HasAnyOf(player._pIFlags, ItemSpecialEffect::NoMana)) {
return SpellCheckResult::Fail_NoMana;
}

Expand Down

0 comments on commit b0cb1b9

Please sign in to comment.