File size: 11,133 Bytes
a59b710
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# Copyright (c) 2026. ShinChan Life Simulator β€” OpenEnv Hackathon.
# All rights reserved.

"""
NPC Character System for ShinChan Life Simulator.

Contains personality profiles and reaction logic for all characters
in Shin-chan's world. Each character has defined personality traits,
triggers, and reaction patterns that determine how they respond to
the agent's actions.
"""

from __future__ import annotations

from dataclasses import dataclass, field


@dataclass
class Character:
    """A character in Shin-chan's world with personality and reaction logic."""

    id: str
    name: str
    relationship_to_shinchan: str
    personality: str
    anger_triggers: list[str] = field(default_factory=list)
    happy_triggers: list[str] = field(default_factory=list)
    reaction_style: str = ""
    catchphrases: list[str] = field(default_factory=list)
    initial_relationship: float = 0.5  # 0.0 = hostile, 1.0 = best friends

    def get_reaction(self, action_name: str, action_tags: list[str]) -> tuple[str, float]:
        """
        Generate a reaction to Shin-chan's action.

        Returns:
            Tuple of (reaction_text, relationship_change)
        """
        # Check for anger triggers
        for tag in action_tags:
            if tag in self.anger_triggers:
                return self._angry_reaction(action_name), -0.15

        # Check for happy triggers
        for tag in action_tags:
            if tag in self.happy_triggers:
                return self._happy_reaction(action_name), 0.10

        # Neutral reaction
        return self._neutral_reaction(action_name), 0.0

    def _angry_reaction(self, action_name: str) -> str:
        return f"{self.name} is upset! {self.reaction_style}"

    def _happy_reaction(self, action_name: str) -> str:
        return f"{self.name} is pleased! They appreciate Shin-chan's effort."

    def _neutral_reaction(self, action_name: str) -> str:
        return f"{self.name} watches quietly."


# ============================================================================
# CHARACTER DATABASE
# ============================================================================

CHARACTERS: dict[str, Character] = {
    "misae": Character(
        id="misae",
        name="Misae Nohara (Mom)",
        relationship_to_shinchan="Mother",
        personality=(
            "Short-tempered but deeply loving. Wants Shin-chan to be responsible "
            "and well-behaved. Quick to anger but also quick to forgive. She works "
            "hard to manage the household and worries about Shin-chan's future."
        ),
        anger_triggers=[
            "lying", "being_lazy", "embarrassing", "wasting_money",
            "skipping_homework", "being_rude", "making_mess", "disobedient",
            "sneaking", "ignoring_duties",
        ],
        happy_triggers=[
            "doing_homework", "being_honest", "helping_house", "being_responsible",
            "caring_for_himawari", "being_polite", "saving_money", "studying",
            "cleaning", "apologizing",
        ],
        reaction_style="Explosive anger β†’ loud scolding β†’ eventual forgiveness.",
        catchphrases=[
            "SHIN-CHAN!! πŸ’’",
            "How many times do I have to tell you?!",
            "That's it, no dinner for you!",
            "Maybe you're growing up after all... *sniff*",
        ],
        initial_relationship=0.7,
    ),
    "hiroshi": Character(
        id="hiroshi",
        name="Hiroshi Nohara (Dad)",
        relationship_to_shinchan="Father",
        personality=(
            "Hardworking salaryman who is often tired but loves his family dearly. "
            "More lenient than Misae. Enjoys his small pleasures (beer, manga). "
            "Sometimes acts as an accomplice to Shin-chan's antics."
        ),
        anger_triggers=[
            "wasting_money", "being_rude", "embarrassing", "lying",
        ],
        happy_triggers=[
            "being_honest", "being_responsible", "caring_for_family",
            "helping_house", "being_brave", "showing_maturity",
        ],
        reaction_style="Sighs and gentle scolding, sometimes secretly amused.",
        catchphrases=[
            "Shin-chan, you rascal...",
            "Your mother is going to kill us both.",
            "That's my boy!",
            "*sigh* Where did I go wrong...",
        ],
        initial_relationship=0.75,
    ),
    "himawari": Character(
        id="himawari",
        name="Himawari Nohara (Baby Sister)",
        relationship_to_shinchan="Baby sister",
        personality=(
            "Cute baby who loves shiny things and handsome men. Often cries when "
            "neglected. Looks up to Shin-chan despite his antics. Can be surprisingly "
            "perceptive for a baby."
        ),
        anger_triggers=[
            "ignoring_duties", "being_selfish", "stealing_food", "being_mean",
        ],
        happy_triggers=[
            "caring_for_himawari", "sharing", "playing_together", "being_gentle",
        ],
        reaction_style="Cries loudly or giggles happily β€” no in-between.",
        catchphrases=["Waaah! 😭", "Tee hee! 😊", "*grabs shiny thing*"],
        initial_relationship=0.6,
    ),
    "kazama": Character(
        id="kazama",
        name="Kazama Toru",
        relationship_to_shinchan="Best friend",
        personality=(
            "Studious, serious, and ambitious. The most mature of Shin-chan's friend "
            "group. Gets easily annoyed by Shin-chan's antics but secretly values "
            "their friendship. Dreams of becoming an elite businessman."
        ),
        anger_triggers=[
            "being_lazy", "not_studying", "embarrassing", "being_rude",
            "cheating", "lying",
        ],
        happy_triggers=[
            "studying", "being_honest", "teamwork", "showing_effort",
            "being_brave", "helping_friends",
        ],
        reaction_style="Lectures Shin-chan but secretly cares.",
        catchphrases=[
            "Nohara, you idiot!",
            "I'm not your friend! ...Well, maybe a little.",
            "You should study more like me.",
            "I guess that was... pretty cool of you.",
        ],
        initial_relationship=0.65,
    ),
    "nene": Character(
        id="nene",
        name="Sakurada Nene",
        relationship_to_shinchan="Friend",
        personality=(
            "Appears sweet and girly but has a hidden fierce side. Loves playing "
            "'real house' (with extreme realism). Can be bossy and gets angry "
            "when things don't go her way. Punches her stuffed rabbit when upset."
        ),
        anger_triggers=[
            "being_rude", "refusing_to_play", "lying", "being_mean",
            "embarrassing",
        ],
        happy_triggers=[
            "playing_together", "being_polite", "helping_friends",
            "being_honest", "showing_empathy",
        ],
        reaction_style="Sweet on the surface, then suddenly furious. Punches Mr. Rabbit.",
        catchphrases=[
            "Let's play REAL house!",
            "Mr. Rabbit... *punch punch punch*",
            "Shin-chan, you're so mean!",
            "That's actually really nice of you.",
        ],
        initial_relationship=0.55,
    ),
    "bo": Character(
        id="bo",
        name="Tooru Bo (Bo-chan)",
        relationship_to_shinchan="Friend",
        personality=(
            "Quiet, mysterious, and zen-like. Rarely speaks but when he does, "
            "it's profound (or completely random). Has a calming presence. "
            "Often just says '...' but somehow communicates perfectly."
        ),
        anger_triggers=["being_mean", "bullying"],
        happy_triggers=[
            "being_honest", "showing_kindness", "being_brave", "teamwork",
        ],
        reaction_style="Silent nod of approval, or a quiet '...'",
        catchphrases=["...", "...!!", "Mm.", "...that was good."],
        initial_relationship=0.6,
    ),
    "masao": Character(
        id="masao",
        name="Sato Masao",
        relationship_to_shinchan="Friend",
        personality=(
            "Timid, easily scared, and often crying. A crybaby who gets picked on "
            "but is genuinely kind-hearted. Looks up to others for protection. "
            "Despite his fears, he can be surprisingly loyal."
        ),
        anger_triggers=["bullying", "being_mean", "lying"],
        happy_triggers=[
            "helping_friends", "being_brave", "showing_kindness",
            "sharing", "protecting_others",
        ],
        reaction_style="Cries easily but shows gratitude through tears.",
        catchphrases=[
            "Waaah, I'm scared! 😭",
            "Shin-chan, help me!",
            "Thank you... *sniff*",
            "You're so cool, Shin-chan!",
        ],
        initial_relationship=0.6,
    ),
    "yoshinaga": Character(
        id="yoshinaga",
        name="Yoshinaga Midori (Teacher)",
        relationship_to_shinchan="Kindergarten teacher",
        personality=(
            "Kind but strict kindergarten teacher at Futaba Kindergarten. Unmarried "
            "and a bit insecure about it (Shin-chan often brings this up). Patient "
            "but has her limits. Genuinely cares about her students' growth."
        ),
        anger_triggers=[
            "being_rude", "skipping_homework", "cheating", "embarrassing",
            "disobedient", "making_mess",
        ],
        happy_triggers=[
            "studying", "doing_homework", "being_polite", "showing_effort",
            "being_honest", "helping_friends",
        ],
        reaction_style="Patient sighing, then firm but caring discipline.",
        catchphrases=[
            "Shin-chan, please behave!",
            "Don't bring up my love life! 😀",
            "I'm proud of you today.",
            "That's what learning is all about!",
        ],
        initial_relationship=0.5,
    ),
    "shiro": Character(
        id="shiro",
        name="Shiro (Dog)",
        relationship_to_shinchan="Pet dog",
        personality=(
            "Incredibly smart and loyal dog. Often more sensible than Shin-chan. "
            "Patient, obedient, and sometimes the voice of reason (in dog form). "
            "Gets sad when neglected but always forgives."
        ),
        anger_triggers=["ignoring_duties", "being_mean"],
        happy_triggers=[
            "caring_for_shiro", "playing_together", "being_responsible",
            "sharing",
        ],
        reaction_style="Wags tail happily or whimpers sadly.",
        catchphrases=["Wan! πŸ•", "*wag wag*", "*whimper*", "*happy bark!*"],
        initial_relationship=0.7,
    ),
}


def get_character(character_id: str) -> Character | None:
    """Get a character by their ID."""
    return CHARACTERS.get(character_id)


def get_all_characters() -> dict[str, Character]:
    """Get all characters."""
    return CHARACTERS.copy()


def get_characters_by_ids(character_ids: list[str]) -> list[Character]:
    """Get multiple characters by their IDs."""
    return [CHARACTERS[cid] for cid in character_ids if cid in CHARACTERS]