From 2001c867cb7036685c55c9786e5c9ce99851d6ed Mon Sep 17 00:00:00 2001 From: Tetardtek Date: Wed, 25 Mar 2026 01:33:19 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20=C3=A9cran=20choix=20voie=20du=20Dao=20?= =?UTF-8?q?=E2=80=94=20s'affiche=20avant=20le=20premier=20combat=20tactiqu?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/TurnCombatPage.tsx | 65 +++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/frontend/src/pages/TurnCombatPage.tsx b/frontend/src/pages/TurnCombatPage.tsx index 1e57e89..95be85a 100644 --- a/frontend/src/pages/TurnCombatPage.tsx +++ b/frontend/src/pages/TurnCombatPage.tsx @@ -23,6 +23,19 @@ export function TurnCombatPage() { const { data: monsters } = useQuery({ queryKey: ['monsters'], queryFn: combatApi.monsters }); const { data: zones } = useQuery({ queryKey: ['zones'], queryFn: combatApi.zones }); const { data: spells } = useQuery({ queryKey: ['turnSpells'], queryFn: turnCombatApi.unlockedSpells }); + const { data: daoPaths } = useQuery({ queryKey: ['daoPaths'], queryFn: turnCombatApi.dao }); + + const hasDaoPath = daoPaths && daoPaths.length > 0 && daoPaths.some((p: any) => p.isPrimary || p.is_primary); + + const chooseDaoMut = useMutation({ + mutationFn: (path: string) => turnCombatApi.chooseDaoPath(path), + onSuccess: () => { + qc.invalidateQueries({ queryKey: ['daoPaths'] }); + qc.invalidateQueries({ queryKey: ['turnSpells'] }); + toast.success('Voie du Dao choisie !'); + }, + onError: (err: Error) => toast.error(err.message), + }); const endurance = char?.enduranceCurrent ?? 0; const canFight = endurance >= COMBAT_COST; @@ -65,6 +78,58 @@ export function TurnCombatPage() { actionMut.mutate({ type, spellId }); }; + // ========== PHASE: CHOOSE DAO PATH ========== + if (!hasDaoPath) { + const paths = [ + { id: 'ecoute', name: 'Écoute', color: '#88c8e8', icon: '👁️', archetype: 'Le stratège', + desc: 'Perception du flux, chant offensif, ancrage mémoriel. Tu deviens ce que Gorn t\'a appris : observer, comprendre.', + spell: 'Perception du Flux (révèle faiblesses, +20% dégâts)' }, + { id: 'resonance', name: 'Résonance', color: '#f4c94e', icon: '💪', archetype: 'Le protecteur', + desc: 'Onde de choc, bouclier, contre-attaque. Tu deviens ce que Vell a appris : la vraie force protège.', + spell: 'Onde de Choc (dégâts AoE, Force ×1.5)' }, + { id: 'harmonie', name: 'Harmonie', color: '#3ddc84', icon: '🎵', archetype: 'L\'harmoniste', + desc: 'Chant apaisant, purge, soin d\'équipe. Tu deviens ce que Mira est : le chant qui guérit.', + spell: 'Chant Apaisant (soin Int ×2 + 10% HP max)' }, + ]; + + return ( +
+

Le Dao du Courant s'éveille

+

+ Gorn est parti. Le Serment est prêté. Le courant coule en toi.
+ Quelle voie du Dao vas-tu suivre ? +

+
+ {paths.map(p => ( + + ))} +
+

+ Tu pourras explorer les autres voies plus tard — ta voie principale progresse plus vite. +

+
+ ); + } + // ========== PHASE: SELECT ========== if (phase === 'select') { const monstersByZone = new Map();