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>
This commit is contained in:
Denis Defolie
2026-10-11 22:20:59 +02:00
parent 57182172a9
commit 65a0cb46f9
47 changed files with 897 additions and 36 deletions
+10
View File
@@ -29,6 +29,16 @@ func test_missions_are_filtered_by_the_level_of_their_rule() -> void:
assert_eq(ExerciseEngine.get_missions_for_level("CM1").size(), 0)
func test_reward_catalog_is_loaded_and_sorted_by_threshold() -> void:
var items := ExerciseEngine.get_reward_items()
assert_eq(items.size(), 10)
var counts: Array = items.map(func(i: Dictionary) -> int: return i["unlock"]["count"])
var sorted_counts := counts.duplicate()
sorted_counts.sort()
assert_eq(counts, sorted_counts)
assert_eq(items[0]["item_id"], "item_graine_magique", "seuil 3, ordre alphabetique")
func test_get_mission_returns_the_requested_mission() -> void:
var mission := ExerciseEngine.get_mission("mission_02_pont_des_phrases")
assert_eq(mission["exercise_type"], "sentence_correction")