Files
Denis Defolie 65a0cb46f9 Add mission scoring, rewards collection and save schema v2
Phase "score et récompenses" of the post-0.1.0 plan (user feedback:
wants a more game-like experience with scoring and rewards).

- MissionScoring: 1-3 stars from how each exercise was solved (never
  speed; a finished mission always gives at least one star).
- Save schema v2: mission_results (best/last stars, completions) with a
  v1->v2 migration that keeps existing stars and items.
- Total only grows by the improvement over a mission's best score.
- Data-driven collection (data/rewards, reward_item schema, validated
  incl. mission cross-check) unlocked by RewardRules.
- Reward screen, collection screen, stars on the world map.
- Version 0.2.0.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-11 22:20:59 +02:00

26 lines
946 B
GDScript

extends GutTest
## Tests de MissionScoring : le score valorise la reussite sans aide, jamais
## la vitesse, et une mission terminee rapporte toujours au moins 1 etoile.
const FIRST := MissionScoring.OUTCOME_FIRST_TRY
const HELP := MissionScoring.OUTCOME_WITH_HELP
const REVEALED := MissionScoring.OUTCOME_REVEALED
func test_all_first_try_gives_three_stars() -> void:
assert_eq(MissionScoring.stars_for([FIRST, FIRST, FIRST]), 3)
func test_some_help_but_everything_found_gives_two_stars() -> void:
assert_eq(MissionScoring.stars_for([FIRST, HELP, FIRST]), 2)
assert_eq(MissionScoring.stars_for([HELP, HELP, HELP]), 2)
func test_a_revealed_answer_gives_one_star() -> void:
assert_eq(MissionScoring.stars_for([FIRST, FIRST, REVEALED]), 1)
assert_eq(MissionScoring.stars_for([REVEALED, REVEALED, REVEALED]), 1)
func test_a_finished_mission_never_gives_zero_stars() -> void:
assert_eq(MissionScoring.stars_for([]), 1)