tune: lower wink probability from 30% to 5%

The original 30% per-render rate felt disturbing in practice. Default
mood is 80, so most admin/dashboard renders cleared the >=75 gate, and
~30% of those flipped to wink. Stacked across the main admin page +
dashboard widget visible on the same screen, the visible wink rate
felt closer to "stuck" than "playful" — buddy looked like he had one
eye closed all the time instead of occasionally cheeking out.

5% is true Easter-egg territory: rare enough to feel magical when it
lands, frequent enough you'll catch it after a few admin sessions.
Refresh ~20 times before expecting to see one.

CHANGES
- inc/state.php: mt_rand probability gate 30 -> 5
- inc/state.php: docstring updated to match new ~5% probability

NOT CHANGED
- Wink visuals (sprite.php) unchanged — still the same closed-eye arc,
  asymmetric smirk, rosier cheeks. Just rarer.
- Version constant + CHANGELOG entry left at v0.1.1 — this is a tuning
  hotfix, not new behavior worth a version bump. If we want a v0.1.2
  bump for hygiene, that's a separate commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-26 07:16:32 +01:00
parent 8c38d38a3a
commit f661eabba1
+5 -4
View File
@@ -106,12 +106,13 @@ function buddy_overall_mood( array $state ) {
* admin page. * admin page.
* *
* Easter-egg: when Buddy is genuinely happy (mood >= 75) there's a * Easter-egg: when Buddy is genuinely happy (mood >= 75) there's a
* ~30% chance per page-render of returning the "Cheeky" wink tone * ~5% chance per page-render of returning the "Cheeky" wink tone
* instead of the standard happy face. Gives the pet a touch of * instead of the standard happy face. Rare enough to feel magical
* personality — refresh the page enough and you'll catch the wink. * rather than disturbing — refresh the page a few dozen times and
* you'll catch it.
*/ */
function buddy_mood_label( $mood_score ) { function buddy_mood_label( $mood_score ) {
if ( $mood_score >= 75 && mt_rand( 1, 100 ) <= 30 ) { if ( $mood_score >= 75 && mt_rand( 1, 100 ) <= 5 ) {
return array( 'label' => __( 'Cheeky 😉', 'buddy' ), 'tone' => 'wink' ); return array( 'label' => __( 'Cheeky 😉', 'buddy' ), 'tone' => 'wink' );
} }
if ( $mood_score >= 80 ) { return array( 'label' => __( 'Thriving', 'buddy' ), 'tone' => 'happy' ); } if ( $mood_score >= 80 ) { return array( 'label' => __( 'Thriving', 'buddy' ), 'tone' => 'happy' ); }