[Enhancement]: Add Damage Calculator page #39

Open
opened 2025-07-04 07:37:32 +00:00 by je-sendra · 0 comments
je-sendra commented 2025-07-04 07:37:32 +00:00 (Migrated from autotime-api.vewtech.net)

(Optional) Contact Details

No response

Summary

Add a page that allows calculating the damage an attack from a Loomian would do to another Loomian

Detailed description

Make a page that allows users to calculate the damage a complex set (including Loomian, ability, item, moves and stats modifiers) would do to another set.

(Optional) Technical description

I think the best design for this functionality would be:

  1. Create an AbilityEffect and MoveEffect enum. This would store ability effects and secondary move effects. For example, a value for AbilityEffect could be Awakening, and a value for MoveEffect could be DartBurst. First values (0 equivalents) should be None. We do not need to create values for effects that don't affect damage calculation.
  2. Add an EntityFramework migration to create an Effect column of type AbilityEffect to the LoomianAbility entity, and a Power column of type int and an Effect column of type MoveEffect to the LoomianMove entity.
  3. Create a DamageCalculationResult class with information about the dealt damage.
  4. Create an IDamageCalculator interface with methods like ApplyAttackerAbility(AbilityEffect abilityEffect) and CalculateDamage(). This could use the lazy evaluation pattern. The CalculateDamage() method should return a OperationResult<DamageCalculationResult> instance.
  5. Create an IDamageCalculationService class that encapsulates the calls to the IDamageCalculator.
  6. Register the IDamageCalculationService in the WebUi project.
  7. In the damage calc page, injct and use the IDamageCalculationService to perform calculations.

Damage calculation should not need to use WebApi. All logic processing should be able to be done on the WebUi project (even though adding it in ClassLib might be a good practice). This also means the response DTOs for moves and abilities need to be modified to return their new properties, allowing the WebUi to calc damage without further intervention of the WebApi.

### (Optional) Contact Details _No response_ ### Summary Add a page that allows calculating the damage an attack from a Loomian would do to another Loomian ### Detailed description Make a page that allows users to calculate the damage a complex set (including Loomian, ability, item, moves and stats modifiers) would do to another set. ### (Optional) Technical description I think the best design for this functionality would be: 1. Create an `AbilityEffect` and `MoveEffect` enum. This would store ability effects and secondary move effects. For example, a value for `AbilityEffect` could be `Awakening`, and a value for `MoveEffect` could be `DartBurst`. First values (0 equivalents) should be `None`. We do not need to create values for effects that don't affect damage calculation. 2. Add an EntityFramework migration to create an `Effect` column of type `AbilityEffect` to the `LoomianAbility` entity, and a `Power` column of type `int` and an `Effect` column of type `MoveEffect` to the `LoomianMove` entity. 3. Create a `DamageCalculationResult` class with information about the dealt damage. 4. Create an `IDamageCalculator` interface with methods like `ApplyAttackerAbility(AbilityEffect abilityEffect)` and `CalculateDamage()`. This could use the lazy evaluation pattern. The `CalculateDamage()` method should return a `OperationResult<DamageCalculationResult>` instance. 5. Create an `IDamageCalculationService` class that encapsulates the calls to the `IDamageCalculator`. 6. Register the `IDamageCalculationService` in the `WebUi` project. 7. In the damage calc page, injct and use the `IDamageCalculationService` to perform calculations. Damage calculation should not need to use WebApi. All logic processing should be able to be done on the WebUi project (even though adding it in ClassLib might be a good practice). This also means the response DTOs for moves and abilities need to be modified to return their new properties, allowing the WebUi to calc damage without further intervention of the WebApi.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
LokiShell/Charwiki#39
No description provided.