# ============================================================
# Gym 10.2 — Portrait Switching (Mid-Text Emotions)
# ============================================================
# Demonstrates changing a character's portrait expression
# in the middle of a text event using [portrait=name].
# Also: variable-driven portrait selection.
# ============================================================

leave --All--

join Miko (neutral) center [animation="Fade In"]

Advisor (pl5): Portrait switching is what makes characters feel alive.
Advisor (pl5): Watch Miko's expression change as she speaks.

[wait time="1.0"]

# ---- Single emotion change ----
Miko (neutral): I'll start calm...[portrait=joy] and suddenly I'm happy!

[wait time="1.0"]

# ---- Emotional arc in one line ----
Miko (neutral): Watch this:[portrait=shock] Whoa![portrait=anger] That makes me mad!\
[portrait=smile] But I'm a forgiving person.[portrait=joy] And now I'm happy!

[wait time="1.5"]

# ---- With pauses between emotions ----
Miko (joy): Let me tell you a story.[pause=0.8][portrait=neutral] It starts normally.\
[pause=0.8][portrait=shock] Then something shocking happens!\
[pause=0.8][portrait=smile] But it has a happy ending.

[wait time="2.0"]

Advisor (pl5): The [portrait=name] tag switches the current speaker's portrait.
Advisor (doubt): It happens instantly when the text reveal reaches that point.

# ---- Variable-driven portrait ----
leave Miko
[wait time="0.5"]

set {Gym.demo_flag} = true

if {Gym.demo_flag}:
    join Miko (joy) center [animation="Fade In"]
    Miko (joy): The variable was TRUE, so I'm happy!
else:
    join Miko (anger) center [animation="Fade In"]
    Miko (anger): The variable was FALSE, so I'm angry!

[wait time="1.0"]

Miko (smile): You can also use variables directly in portrait expressions.
Advisor (pl5): In a character event, use curly braces and parentheses.
Advisor (doubt): But that needs to be set up in the character event, not in text.

[wait time="1.0"]

# ---- Clean up ----
leave --All--
[wait time="0.5"]

jump gym10_main/menu
