Skip to content

Centralize scoring configuration in taskConstants.ts #995

Description

@tickBit

Links

  • Current scoring values: src/common/values/scoring.values.ts
  • Target constants file: src/dailyTasks/consts/taskConstants.ts
  • Server task generation: src/dailyTasks/taskGenerator.service.ts
  • UI daily tasks: src/dailyTasks/uiDailyTasks/uiDailyTasks.ts
  • Default predefined tasks: src/box/dailyTask/defaultPredefinedDailyTasks.ts
  • Player battle scoring: src/rewarder/playerRewarder/points.ts
  • Clan battle scoring: src/rewarder/clanRewarder/points.ts
  • Matchmaking battle scoring: src/matchmaking/matchmaking.service.ts

General description

Centralize all daily task and battle scoring constants in src/dailyTasks/consts/taskConstants.ts.

After all references have been migrated, remove the duplicated src/common/values/scoring.values.ts file.

All currently active daily tasks are considered small:

  • Small daily task: +20 points
  • Daily task cancellation penalty: −10 points
  • Medium and big daily task constants are reserved for future use and remain 0

Battle leaderboard scoring must follow the linked scoring specification:

  • Random-pair win: +30 battle points
  • Random-pair loss: −20 battle points
  • Clan-pair win: +40 battle points
  • Clan-pair loss: −25 battle points

The intended structure should be similar to:

export const TASK_CONSTS = {
  AMOUNT: {
    MIN: 2,
    MAX: 20,
  },
  POINTS: {
    DAILY_TASK: {
      SMALL: 20,
      MEDIUM: 0, // Not in use yet
      BIG: 0, // Not in use yet
      CANCEL_PENALTY: 10,
    },
    BATTLE: {
      RANDOM_PAIR: {
        WIN: 30,
        LOSS: -20,
      },
      CLAN_PAIR: {
        WIN: 40,
        LOSS: -25,
      },
    },
  },
  COINS: {
    FACTOR: 0.5,
  },
  TIME: 1000 * 60,
};

This is a cross-cutting but mostly mechanical change affecting several production and test files. It should preferably be implemented with AI assistance to perform repository-wide reference discovery and consistent replacements, reducing the risk of missed imports, stale values, and inconsistent tests.

All AI-generated changes must still be reviewed and verified using repository-wide searches and the relevant automated test suites.

Things to notice

  • This issue should be implemented after all the daily tasks are implemented
  • Daily task rewards and battle leaderboard points are separate systems:
    • Daily tasks use regular points.
    • Battles use battlePoints.
  • All existing daily tasks must use TASK_CONSTS.POINTS.DAILY_TASK.SMALL.
  • MEDIUM and BIG are placeholders for future functionality and must not be used yet.
  • The battle-scoring flow must distinguish between random-pair and clan-pair matches.
  • Existing lower-bound behavior that prevents battle points from becoming negative must remain unchanged.
  • Generated server-task coins are calculated using points * TASK_CONSTS.COINS.FACTOR. With 20 points and a factor of 0.5, the generated reward is 10 coins.
  • The scoring specification contains an outdated +35 reference for a clan-pair win. The correct and confirmed value is +40.

Expected results over ten matches with a 50% win rate:

  • Random pair: 5 × 30 − 5 × 20 = +50
  • Clan pair: 5 × 40 − 5 × 25 = +75

Tasks

  • Replace the current TASK_CONSTS.POINTS structure with DAILY_TASK and BATTLE sections.
  • Add DAILY_TASK.SMALL with a value of 20.
  • Add DAILY_TASK.MEDIUM with a value of 0 and a comment stating that it is not in use yet.
  • Add DAILY_TASK.BIG with a value of 0 and a comment stating that it is not in use yet.
  • Add DAILY_TASK.CANCEL_PENALTY with a value of 10.
  • Add random-pair battle values: WIN: 30 and LOSS: -20.
  • Add clan-pair battle values: WIN: 40 and LOSS: -25.
  • Replace daily task scoring imports in taskGenerator.service.ts with TASK_CONSTS.
  • Replace daily task scoring imports in uiDailyTasks.ts with TASK_CONSTS.
  • Replace daily task scoring imports in defaultPredefinedDailyTasks.ts with TASK_CONSTS.
  • Update the player rewarder battle-point mapping to use TASK_CONSTS.
  • Update the clan rewarder battle-point mapping to use TASK_CONSTS.
  • Update matchmaking battle scoring to use the appropriate random-pair or clan-pair constants.
  • Propagate the pair type where needed so each battle-scoring consumer can select the correct constants.
  • Update production and test imports that currently reference scoring.values.ts.
  • Update scoring tests to cover the new daily task and battle constant structure.
  • Verify that all currently active daily tasks resolve to DAILY_TASK.SMALL.
  • Verify random-pair scoring: win +30, loss −20.
  • Verify clan-pair scoring: win +40, loss −25.
  • Verify that existing battle-point lower-bound behavior remains unchanged.
  • Delete src/common/values/scoring.values.ts after all references have been migrated.
  • Run a repository-wide search confirming that no Score or scoring.values.ts references remain.
  • Run the relevant daily task, rewarder, matchmaking, and integration test suites.

Activity

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

Metadata

Metadata

Assignees

Labels

changeChange of the existing functionality

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions