Skip to content

Elemental resistance, which the fold had no case for - #2307

Open
denislauri1999 wants to merge 3 commits into
NosCoreIO:masterfrom
denislauri1999:pr/element-resistance
Open

Elemental resistance, which the fold had no case for#2307
denislauri1999 wants to merge 3 commits into
NosCoreIO:masterfrom
denislauri1999:pr/element-resistance

Conversation

@denislauri1999

Copy link
Copy Markdown
Contributor

BCard type 13, "Changes elemental resistance"561 declarations, 408 on items and 153 on cards — and the buff fold had no case for it. A resistance buff changed nothing.

Almost everything needed was already there: the four fields exist on CombatStats and are already read in ComputeElementalDamage as a percentage taken off the incoming elemental damage. Only the step that fills them was missing.

11: All elemental resistance is increased by %s.
21: Fire resistance is increased by %s.
31: Water resistance is increased by %s.
41: Light resistance is increased by %s.
51: Shadow resistance is increased by %s.

Not to be confused with type 7 in the case just below it: that is the attacker's element rate, this is the defender's resistance to it.

Two notes:

  • "All" adds to each of the four rather than living in a fifth field. The damage step reads one resistance, chosen by the attacker's element, so a separate total would have to be remembered at every one of those reads.
  • Unlike the types where the file repeats the same sentence in both slots, this one really does pair increase with decrease — "increased by %s" against "decreased by %s" — so X2 subtracts.

Writing it on the buff fold rather than beside the equipment means the item half arrives with no further work, since the worn pieces' BCards go through the same place.

Checked by breaking it

"All" not reaching every element fails two tests; reading the decrease as an increase fails one.

BCard type 13, "Changes elemental resistance": 561 declarations, 408 on items
and 153 on cards, and the buff fold had no case for it. A resistance buff
changed nothing.

The four fields it feeds already exist on CombatStats and are already read in
ComputeElementalDamage, as a percentage taken off the incoming elemental damage.
Only the step that fills them was missing.

Not to be confused with type 7 in the case below it: that is the attacker's
element rate, this is the defender's resistance to it.

"All elemental resistance" adds to each of the four rather than living in a
fifth field. The damage step reads one resistance, chosen by the attacker's
element, so a separate total would have to be remembered at every one of those
reads.

Unlike the types where the file repeats the same sentence in both slots, this
one really does pair increase with decrease - "increased by %s" against
"decreased by %s" - so X2 subtracts.

Writing this on the buff fold rather than beside the equipment means the item
half arrives with no further work: the worn pieces' BCards go through the same
place.

Two ways of getting it wrong were checked: "all" not reaching every element
fails two tests, reading the decrease as an increase fails one.
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 2 minutes.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b13a90a5-5bc1-4080-872e-8be8ed5fc5d5

📥 Commits

Reviewing files that changed from the base of the PR and between 55dc38c and 6a86645.

📒 Files selected for processing (2)
  • src/NosCore.GameObject/Services/BattleService/BattleStatsProvider.cs
  • test/NosCore.GameObject.Tests/Services/BattleService/ElementResistanceTests.cs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

NosCoreIO#2305 inserisce il suo caso esattamente allo stesso punto di ancoraggio, e due
inserimenti sulla stessa riga git non li sa fondere: chi li fonde entrambi si
trova un conflitto su BattleStatsProvider senza che ci sia niente da decidere.

Stesso codice, ancoraggio diverso. Nel file il caso resta accanto a Element, che
e' dove ha senso leggerlo: uno e' il tasso elementale dell'attaccante, l'altro la
resistenza di chi para.
Restavano la riga delle variabili locali e il blocco 'stats with': NosCoreIO#2305
aggiunge la sua riga esattamente dopo le stesse due, e git non fonde due
inserimenti sullo stesso punto.

Stesso codice, sopra invece che sotto. Le quattro resistenze finiscono anche in
un posto piu' sensato del blocco, accanto alle altre difese.
@denislauri1999

Copy link
Copy Markdown
Contributor Author

Heads-up for whoever merges: this compiles on its own but not alongside another of my open PRs, and git will not warn you — the merge is clean and the break shows up at build time.

BattleStatsProvider gains an IEquipmentStatsService parameter in #2293. The tests this PR adds construct it with one argument, so after both land they need new Mock<IEquipmentStatsService>().Object as a second.

I found it by merging all nine of today's branches onto a scratch branch: with those two lines fixed the lot builds at zero warnings and passes 983 tests. Pairwise git merge-tree says every combination is clean, which is true and not enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant