Skip to content

[Bug report] Damage/Defense/Anti-Magic party-wide buffs apply also to enemies #408

@Silver-D

Description

@Silver-D

When Damage/Defense/Anti-Magic party-wide buffs are active, the buff values apply to both parties.
I was really on the fence to submit this bug, as people are probably going to hate this. It kind of messes with the balance of combat, but, as I understand it, party-wide buffs only supposed to apply to your party members, right?
And since you fixed my report for #402 (thank you!!!) I figured what the hell, I might as well submit this one too.
Due to the nature of this fix, please feel free to ignore it and close it as Wont fix (haha), and/or change my "fixes" as you see fit. Anyway.

In Battle.cs in function int CalculatePhysicalDamage(Character attacker, Character target) we increase both
attackDamage and defense regardless who is attacking or getting attacked. My fix:

if (attackDamage > 0 && attacker is PartyMember) // ADDED FIX : attacker is PartyMember
                attackDamage = (attackDamage * (100 + (int)game.CurrentSavegame.GetActiveSpellLevel(ActiveSpellType.Attack))) / 100;
if (defense > 0 && target is PartyMember) // ADDED FIX : target is PartyMember
                defense = (defense * (100 + (int)game.CurrentSavegame.GetActiveSpellLevel(ActiveSpellType.Protection))) / 100;

Similarly, in function bool CheckSpell

uint antiMagicBuffValue = (target is PartyMember) ? game.CurrentSavegame.GetActiveSpellLevel(ActiveSpellType.AntiMagic) : 0; // ADDED FIX : (target is PartyMember) ? 

** To Reproduce:**

Simply add log outputs after original lines of code, apply the three party-wide buffs, get into combat, and see that attackDamage, defense, and antiMagicBuffValue get increased for both player and enemy parties.

Note that I am not 100% sure about antiMagicBuffValue - and I won't have time to confirm this for a while, but the fix is in my git diff, so I'm almost sure that I did confirm it when I first stumbled onto these 3 issues.
Used console to get into a fight and confirmed that antiMagicBuffValue gets applied to enemies when casting magic/items (like holy horns) on them while the A-M party buff is active

Desktop (please complete the following information):

  • Linux (Fedora 43)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingfixed in code or dataFixed in code/data but not released yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions