Skip to content

Multiplied attack and defence, which nothing folded in - #2332

Merged
erwan-joly merged 1 commit into
NosCoreIO:masterfrom
denislauri1999:pr/multiplying-attack-and-defence
Aug 28, 2026
Merged

Multiplied attack and defence, which nothing folded in#2332
erwan-joly merged 1 commit into
NosCoreIO:masterfrom
denislauri1999:pr/multiplying-attack-and-defence

Conversation

@denislauri1999

@denislauri1999 denislauri1999 commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

BCard types 34 and 35 — "attack power is multiplied by %s" and "defence is multiplied by %s" — are declared in BCardEffect and were absent from the fold in BattleStatsProvider. A card promising a fivefold defence changed nothing, and nothing raised.

They are the only two families that state a factor rather than a percentage. Their values are small whole numbers, so reading one as a percentage would turn the strongest card of the family into five per cent; and the decreasing half says "divided by", so it halves rather than subtracting two.

"All" and the per-kind subtype add into one factor, the way the flat halves of types 3 and 9 already do.

Left out, deliberately

  • 35/51-52 — "damage is reduced by %s%% per debuff stack, up to %s%%": a rate and a ceiling, not a factor, and there is no count of stacks to feed it.
  • 34/41-42CombatStats has no magic attack field for them to land in.
  • 34/51-52 — these scale with missing HP, which is a different shape again.

What was tested

  • 10 unit tests in MultiplyingStatTests: the "all" subtype reaching all three defences, each per-kind subtype reaching only its own, the attack factor moving both ends of the roll, the halving, the identity at 1, and "all" plus a kind adding into one factor.
  • Measured red-before by making the fold a no-op: 8 of the 10 failed; with the fold in place, NosCore.GameObject.Tests is 452 passed, 0 failed, and dotnet build NosCore.sln is 0 warnings, 0 errors.
  • No in-game verification — I did not run a client for this. Checks added to the combat section of documentation/manual-test-plan.md; they are deliberately coarse, because a fivefold defence should be visible in a single exchange rather than needing measurement.

Summary by CodeRabbit

  • New Features

    • Added support for multiplying attack and defence stats through factor-based effects.
    • Supports overall and melee, ranged, or magic-specific defence adjustments.
    • Negative factors reduce stats by division, while a factor of one leaves them unchanged.
  • Documentation

    • Added a manual testing checklist for multiplied attack and defence effects.

BCard types 34 and 35 - "attack power is multiplied by %s" and "defence
is multiplied by %s" - were declared in BCardEffect and absent from the
fold, so a card promising a fivefold defence changed nothing.

They are the only two families that state a FACTOR rather than a
percentage, and their values are small whole numbers: read as percentages
the strongest of them would be worth five per cent. The decreasing half
says "divided by", so it halves rather than subtracting.

"All" and the per-kind subtype add into one factor, the way the flat
halves of types 3 and 9 already do.

35/51-52 stays out: it says "damage is reduced by %s%% per debuff stack,
up to %s%%", which is a rate and a ceiling rather than a factor, and
there is no count of stacks to feed it. 34/41-42 and 34/51-52 stay out
too - CombatStats has no magic attack field for the first pair to land
in, and the second pair scales with missing HP.

10 tests. Manual checks added to the combat section of the test plan:
these are meant to be obvious rather than subtle, so a fivefold defence
should be visible in one exchange.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 07126aae-9796-4240-9ecc-e3826a7792bb

📥 Commits

Reviewing files that changed from the base of the PR and between 3b6a18a and b6dd58b.

📒 Files selected for processing (3)
  • documentation/manual-test-plan.md
  • src/NosCore.GameObject/Services/BattleService/BattleStatsProvider.cs
  • test/NosCore.GameObject.Tests/Services/BattleService/MultiplyingStatTests.cs

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


Walkthrough

Changes

Multiplicative Battle Stats

Layer / File(s) Summary
Factor accumulation and effect mapping
src/NosCore.GameObject/Services/BattleService/BattleStatsProvider.cs
CardTotals now stores attack and defence factors. BCard types 34 and 35 map their subtype-specific effects to these totals.
Factor application in stat calculations
src/NosCore.GameObject/Services/BattleService/BattleStatsProvider.cs
Attack and defence statistics use ByFactor. Positive factors multiply values, and negative factors divide values by their magnitude.
Factor behavior validation
test/NosCore.GameObject.Tests/Services/BattleService/MultiplyingStatTests.cs, documentation/manual-test-plan.md
Tests and manual checks cover attack and defence subtypes, combined factors, identity factors, multiplication, and halving behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to b6dd5

The PR enables the existing attack and defence multiplier effects in combat calculations and adds focused automated coverage. No actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant CardEffects
  participant CardTotals
  participant BattleStatsProvider
  CardEffects->>CardTotals: Accumulate attack and defence factors
  CardTotals->>BattleStatsProvider: Provide summed factor totals
  BattleStatsProvider->>BattleStatsProvider: Apply factors to computed stats
Loading

Suggested reviewers: erwan-joly

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 2 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title identifies the main change: folding multiplied attack and defence effects. The wording is awkward but remains related and sufficiently descriptive.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 2 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

- [ ] An "all elements" effect applies to each of fire, water, light and dark rather than
being ignored

### Multiplied attack and defence — BCard types 34 and 35

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i missed this file likely this should be in conversation on git not in a md file

@erwan-joly
erwan-joly merged commit cffb3cb into NosCoreIO:master Aug 28, 2026
2 checks passed
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.

2 participants