This commit is contained in:
33333-33333 2026-06-19 23:22:15 +09:00
commit 33234f32ae
18 changed files with 1390 additions and 573 deletions

24
.htaccess Normal file
View file

@ -0,0 +1,24 @@
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/html "access plus 0 seconds"
ExpiresByType text/css "access plus 0 seconds"
ExpiresByType application/javascript "access plus 0 seconds"
ExpiresByType application/json "access plus 0 seconds"
ExpiresByType image/png "access plus 30 days"
ExpiresByType image/webp "access plus 30 days"
ExpiresByType audio/mpeg "access plus 30 days"
ExpiresByType audio/wav "access plus 30 days"
</IfModule>
<IfModule mod_headers.c>
<FilesMatch "\.(html?|css|js|json)$">
Header set Cache-Control "no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "0"
</FilesMatch>
<FilesMatch "\.(png|webp|mp3|wav)$">
Header set Cache-Control "public, max-age=2592000"
</FilesMatch>
</IfModule>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/css application/javascript application/json text/plain
</IfModule>

324
README.md
View file

@ -1,210 +1,210 @@
# たりないコロニー観察所
# &#x305F;&#x308A;&#x306A;&#x3044;&#x30B3;&#x30ED;&#x30CB;&#x30FC;&#x89B3;&#x5BDF;&#x6240;
ブラウザで動く、観察主体の小さなコロニーゲームです。
外部ライブラリやサーバーは不要です。
&#x30D6;&#x30E9;&#x30A6;&#x30B6;&#x3067;&#x52D5;&#x304F;&#x3001;&#x89B3;&#x5BDF;&#x4E3B;&#x4F53;&#x306E;&#x5C0F;&#x3055;&#x306A;&#x30B3;&#x30ED;&#x30CB;&#x30FC;&#x30B2;&#x30FC;&#x30E0;&#x3067;&#x3059;&#x3002;
&#x5916;&#x90E8;&#x30E9;&#x30A4;&#x30D6;&#x30E9;&#x30EA;&#x3084;&#x30B5;&#x30FC;&#x30D0;&#x30FC;&#x306F;&#x4E0D;&#x8981;&#x3067;&#x3059;&#x3002;
## 起動方法
## &#x8D77;&#x52D5;&#x65B9;&#x6CD5;
1. ZIPを展開
2. `index.html` をブラウザで開く
1. ZIP&#x3092;&#x5C55;&#x958B;
2. `index.html` &#x3092;&#x30D6;&#x30E9;&#x30A6;&#x30B6;&#x3067;&#x958B;&#x304F;
Chrome / Edge / Firefox / Safari の近年版を想定しています。
Chrome / Edge / Firefox / Safari &#x306E;&#x8FD1;&#x5E74;&#x7248;&#x3092;&#x60F3;&#x5B9A;&#x3057;&#x3066;&#x3044;&#x307E;&#x3059;&#x3002;
## ゲーム内容
## &#x30B2;&#x30FC;&#x30E0;&#x5185;&#x5BB9;
「たりない」たちが観察皿の中で勝手に暮らします。
基本は眺めるだけですが、餌・水・草・石・寝床・などを配置して軽く介入できます。
&#x300C;&#x305F;&#x308A;&#x306A;&#x3044;&#x300D;&#x305F;&#x3061;&#x304C;&#x89B3;&#x5BDF;&#x76BF;&#x306E;&#x4E2D;&#x3067;&#x52DD;&#x624B;&#x306B;&#x66AE;&#x3089;&#x3057;&#x307E;&#x3059;&#x3002;
&#x57FA;&#x672C;&#x306F;&#x773A;&#x3081;&#x308B;&#x3060;&#x3051;&#x3067;&#x3059;&#x304C;&#x3001;&#x990C;&#x30FB;&#x6C34;&#x30FB;&#x8349;&#x30FB;&#x77F3;&#x30FB;&#x5BDD;&#x5E8A;&#x30FB;&#x306A;&#x3069;&#x3092;&#x914D;&#x7F6E;&#x3057;&#x3066;&#x8EFD;&#x304F;&#x4ECB;&#x5165;&#x3067;&#x304D;&#x307E;&#x3059;&#x3002;
## 主な要素
## &#x4E3B;&#x306A;&#x8981;&#x7D20;
- 9種類のたりない画像を使用
- 空腹・孤独・眠気・不安・たりない度
- 餌探し、睡眠、群れ寄り、パニック、繁殖、死亡
- 死後の「たりない跡」と草の発生
- 個体選択による詳細観察
- 観察ログ
- 一時停止 / 速度変更 / 保存 / 読込
- localStorageによるブラウザ内セーブ
- 9&#x7A2E;&#x985E;&#x306E;&#x305F;&#x308A;&#x306A;&#x3044;&#x753B;&#x50CF;&#x3092;&#x4F7F;&#x7528;
- &#x7A7A;&#x8179;&#x30FB;&#x5B64;&#x72EC;&#x30FB;&#x7720;&#x6C17;&#x30FB;&#x4E0D;&#x5B89;&#x30FB;&#x305F;&#x308A;&#x306A;&#x3044;&#x5EA6;
- &#x990C;&#x63A2;&#x3057;&#x3001;&#x7761;&#x7720;&#x3001;&#x7FA4;&#x308C;&#x5BC4;&#x308A;&#x3001;&#x30D1;&#x30CB;&#x30C3;&#x30AF;&#x3001;&#x7E41;&#x6B96;&#x3001;&#x6B7B;&#x4EA1;
- &#x6B7B;&#x5F8C;&#x306E;&#x300C;&#x305F;&#x308A;&#x306A;&#x3044;&#x8DE1;&#x300D;&#x3068;&#x8349;&#x306E;&#x767A;&#x751F;
- &#x500B;&#x4F53;&#x9078;&#x629E;&#x306B;&#x3088;&#x308B;&#x8A73;&#x7D30;&#x89B3;&#x5BDF;
- &#x89B3;&#x5BDF;&#x30ED;&#x30B0;
- &#x4E00;&#x6642;&#x505C;&#x6B62; / &#x901F;&#x5EA6;&#x5909;&#x66F4; / &#x4FDD;&#x5B58; / &#x8AAD;&#x8FBC;
- localStorage&#x306B;&#x3088;&#x308B;&#x30D6;&#x30E9;&#x30A6;&#x30B6;&#x5185;&#x30BB;&#x30FC;&#x30D6;
## 操作
## &#x64CD;&#x4F5C;
- 観察:個体クリックで詳細表示
- ふつうの餌 / あまい餌 / 水滴 / 草 / ぬくい石 / ふわふわ:キャンバスクリックで配置
- つつく:個体をクリックして一時的に不安を上げる
- 迷い込み:指定位置に新しいたりないを追加
- &#x89B3;&#x5BDF;&#xFF1A;&#x500B;&#x4F53;&#x30AF;&#x30EA;&#x30C3;&#x30AF;&#x3067;&#x8A73;&#x7D30;&#x8868;&#x793A;
- &#x3075;&#x3064;&#x3046;&#x306E;&#x990C; / &#x3042;&#x307E;&#x3044;&#x990C; / &#x6C34;&#x6EF4; / &#x8349; / &#x306C;&#x304F;&#x3044;&#x77F3; / &#x3075;&#x308F;&#x3075;&#x308F;&#xFF1A;&#x30AD;&#x30E3;&#x30F3;&#x30D0;&#x30B9;&#x30AF;&#x30EA;&#x30C3;&#x30AF;&#x3067;&#x914D;&#x7F6E;
- &#x3064;&#x3064;&#x304F;&#xFF1A;&#x500B;&#x4F53;&#x3092;&#x30AF;&#x30EA;&#x30C3;&#x30AF;&#x3057;&#x3066;&#x4E00;&#x6642;&#x7684;&#x306B;&#x4E0D;&#x5B89;&#x3092;&#x4E0A;&#x3052;&#x308B;
- &#x8FF7;&#x3044;&#x8FBC;&#x307F;&#xFF1A;&#x6307;&#x5B9A;&#x4F4D;&#x7F6E;&#x306B;&#x65B0;&#x3057;&#x3044;&#x305F;&#x308A;&#x306A;&#x3044;&#x3092;&#x8FFD;&#x52A0;
## 素材について
## &#x7D20;&#x6750;&#x306B;&#x3064;&#x3044;&#x3066;
同梱画像は本プロトタイプ用に加工した「たりない」素材です。
公開・配布・商用利用を行う場合は、元画像作成者・権利者の許諾範囲に従ってください。
&#x540C;&#x68B1;&#x753B;&#x50CF;&#x306F;&#x672C;&#x30D7;&#x30ED;&#x30C8;&#x30BF;&#x30A4;&#x30D7;&#x7528;&#x306B;&#x52A0;&#x5DE5;&#x3057;&#x305F;&#x300C;&#x305F;&#x308A;&#x306A;&#x3044;&#x300D;&#x7D20;&#x6750;&#x3067;&#x3059;&#x3002;
&#x516C;&#x958B;&#x30FB;&#x914D;&#x5E03;&#x30FB;&#x5546;&#x7528;&#x5229;&#x7528;&#x3092;&#x884C;&#x3046;&#x5834;&#x5408;&#x306F;&#x3001;&#x5143;&#x753B;&#x50CF;&#x4F5C;&#x6210;&#x8005;&#x30FB;&#x6A29;&#x5229;&#x8005;&#x306E;&#x8A31;&#x8AFE;&#x7BC4;&#x56F2;&#x306B;&#x5F93;&#x3063;&#x3066;&#x304F;&#x3060;&#x3055;&#x3044;&#x3002;
## ファイル構成
## &#x30D5;&#x30A1;&#x30A4;&#x30EB;&#x69CB;&#x6210;
```text
tarinai_colony_game/
├─ index.html
├─ css/
│ └─ styles.css
├─ js/
│ └─ game.js
├─ assets/
│ └─ sprites/
│ ├─ tarinai_01_smile.png
│ ├─ ...
│ └─ _contact_sheet.png
└─ docs/
└─ design_notes.md
&#x251C;&#x2500; index.html
&#x251C;&#x2500; css/
&#x2502; &#x2514;&#x2500; styles.css
&#x251C;&#x2500; js/
&#x2502; &#x2514;&#x2500; game.js
&#x251C;&#x2500; assets/
&#x2502; &#x2514;&#x2500; sprites/
&#x2502; &#x251C;&#x2500; tarinai_01_smile.png
&#x2502; &#x251C;&#x2500; ...
&#x2502; &#x2514;&#x2500; _contact_sheet.png
&#x2514;&#x2500; docs/
&#x2514;&#x2500; design_notes.md
```
## 今後の拡張候補
## &#x4ECA;&#x5F8C;&#x306E;&#x62E1;&#x5F35;&#x5019;&#x88DC;
- 個体ごとの家系図
- 図鑑・実績
- より精密なコロニー分裂
- 草・死跡・餌の生態循環
- 音と環境変化
- 画像素材の追加差分
- &#x500B;&#x4F53;&#x3054;&#x3068;&#x306E;&#x5BB6;&#x7CFB;&#x56F3;
- &#x56F3;&#x9451;&#x30FB;&#x5B9F;&#x7E3E;
- &#x3088;&#x308A;&#x7CBE;&#x5BC6;&#x306A;&#x30B3;&#x30ED;&#x30CB;&#x30FC;&#x5206;&#x88C2;
- &#x8349;&#x30FB;&#x6B7B;&#x8DE1;&#x30FB;&#x990C;&#x306E;&#x751F;&#x614B;&#x5FAA;&#x74B0;
- &#x97F3;&#x3068;&#x74B0;&#x5883;&#x5909;&#x5316;
- &#x753B;&#x50CF;&#x7D20;&#x6750;&#x306E;&#x8FFD;&#x52A0;&#x5DEE;&#x5206;
## 更新内容(最新版)
## &#x66F4;&#x65B0;&#x5185;&#x5BB9;&#xFF08;&#x6700;&#x65B0;&#x7248;&#xFF09;
- たりないの表示サイズを大幅に縮小
- 右移動時に左右反転
- 食事中の専用エフェクト
- つつきすぎによる死亡演出06→09→死亡
- 死亡時の緑のしぶき跡
- 感情に応じたスプライト自動切替
- 昼夜サイクルと時間HUD
- &#x305F;&#x308A;&#x306A;&#x3044;&#x306E;&#x8868;&#x793A;&#x30B5;&#x30A4;&#x30BA;&#x3092;&#x5927;&#x5E45;&#x306B;&#x7E2E;&#x5C0F;
- &#x53F3;&#x79FB;&#x52D5;&#x6642;&#x306B;&#x5DE6;&#x53F3;&#x53CD;&#x8EE2;
- &#x98DF;&#x4E8B;&#x4E2D;&#x306E;&#x5C02;&#x7528;&#x30A8;&#x30D5;&#x30A7;&#x30AF;&#x30C8;
- &#x3064;&#x3064;&#x304D;&#x3059;&#x304E;&#x306B;&#x3088;&#x308B;&#x6B7B;&#x4EA1;&#x6F14;&#x51FA;&#xFF08;06&#x2192;09&#x2192;&#x6B7B;&#x4EA1;&#xFF09;
- &#x6B7B;&#x4EA1;&#x6642;&#x306E;&#x7DD1;&#x306E;&#x3057;&#x3076;&#x304D;&#x8DE1;
- &#x611F;&#x60C5;&#x306B;&#x5FDC;&#x3058;&#x305F;&#x30B9;&#x30D7;&#x30E9;&#x30A4;&#x30C8;&#x81EA;&#x52D5;&#x5207;&#x66FF;
- &#x663C;&#x591C;&#x30B5;&#x30A4;&#x30AF;&#x30EB;&#x3068;&#x6642;&#x9593;HUD
## 更新内容v3
## &#x66F4;&#x65B0;&#x5185;&#x5BB9;&#xFF08;v3&#xFF09;
- 出生・死亡バランスを再調整:飢餓速度を下げ、寿命と上限個体数を増やし、観察が長く続くように調整
- 図鑑を追加:観測済みスプライト、イベント、死因を記録
- 系譜を追加:繁殖時に親子関係・世代・出生時刻を保存
- 選択個体に親・子数・気分・つつき耐久を表示
- Web Audioによる簡易効果音を追加(音 ON ボタンで有効化)
- 昼夜サイクルをログ・図鑑イベントにも反映
- 食事、繁殖、死亡、つつき、時間帯切替のイベント記録を追加
- &#x51FA;&#x751F;&#x30FB;&#x6B7B;&#x4EA1;&#x30D0;&#x30E9;&#x30F3;&#x30B9;&#x3092;&#x518D;&#x8ABF;&#x6574;&#xFF1A;&#x98E2;&#x9913;&#x901F;&#x5EA6;&#x3092;&#x4E0B;&#x3052;&#x3001;&#x5BFF;&#x547D;&#x3068;&#x4E0A;&#x9650;&#x500B;&#x4F53;&#x6570;&#x3092;&#x5897;&#x3084;&#x3057;&#x3001;&#x89B3;&#x5BDF;&#x304C;&#x9577;&#x304F;&#x7D9A;&#x304F;&#x3088;&#x3046;&#x306B;&#x8ABF;&#x6574;
- &#x56F3;&#x9451;&#x3092;&#x8FFD;&#x52A0;&#xFF1A;&#x89B3;&#x6E2C;&#x6E08;&#x307F;&#x30B9;&#x30D7;&#x30E9;&#x30A4;&#x30C8;&#x3001;&#x30A4;&#x30D9;&#x30F3;&#x30C8;&#x3001;&#x6B7B;&#x56E0;&#x3092;&#x8A18;&#x9332;
- &#x7CFB;&#x8B5C;&#x3092;&#x8FFD;&#x52A0;&#xFF1A;&#x7E41;&#x6B96;&#x6642;&#x306B;&#x89AA;&#x5B50;&#x95A2;&#x4FC2;&#x30FB;&#x4E16;&#x4EE3;&#x30FB;&#x51FA;&#x751F;&#x6642;&#x523B;&#x3092;&#x4FDD;&#x5B58;
- &#x9078;&#x629E;&#x500B;&#x4F53;&#x306B;&#x89AA;&#x30FB;&#x5B50;&#x6570;&#x30FB;&#x6C17;&#x5206;&#x30FB;&#x3064;&#x3064;&#x304D;&#x8010;&#x4E45;&#x3092;&#x8868;&#x793A;
- Web Audio&#x306B;&#x3088;&#x308B;&#x7C21;&#x6613;&#x52B9;&#x679C;&#x97F3;&#x3092;&#x8FFD;&#x52A0;&#xFF08;&#x97F3; ON &#x30DC;&#x30BF;&#x30F3;&#x3067;&#x6709;&#x52B9;&#x5316;&#xFF09;
- &#x663C;&#x591C;&#x30B5;&#x30A4;&#x30AF;&#x30EB;&#x3092;&#x30ED;&#x30B0;&#x30FB;&#x56F3;&#x9451;&#x30A4;&#x30D9;&#x30F3;&#x30C8;&#x306B;&#x3082;&#x53CD;&#x6620;
- &#x98DF;&#x4E8B;&#x3001;&#x7E41;&#x6B96;&#x3001;&#x6B7B;&#x4EA1;&#x3001;&#x3064;&#x3064;&#x304D;&#x3001;&#x6642;&#x9593;&#x5E2F;&#x5207;&#x66FF;&#x306E;&#x30A4;&#x30D9;&#x30F3;&#x30C8;&#x8A18;&#x9332;&#x3092;&#x8FFD;&#x52A0;
## 更新内容v4
## &#x66F4;&#x65B0;&#x5185;&#x5BB9;&#xFF08;v4&#xFF09;
- 選択個体パネルから「足りないもの」「考えていること」を削除
- 系譜をリスト形式から樹状図形式へ変更
- 子個体が成長するまで親に追従する挙動を追加
- 食事エフェクト量を抑制し、餌・あまい餌・草の色を反映
- 昼夜サイクルの光を地面・アイテム・たりない本体へ反映
- 近距離・低機嫌・過密時に発生する喧嘩を追加
- 喧嘩イベントを図鑑イベントへ記録
- 保存キーは `tarinai-colony-save-v4`
- &#x9078;&#x629E;&#x500B;&#x4F53;&#x30D1;&#x30CD;&#x30EB;&#x304B;&#x3089;&#x300C;&#x8DB3;&#x308A;&#x306A;&#x3044;&#x3082;&#x306E;&#x300D;&#x300C;&#x8003;&#x3048;&#x3066;&#x3044;&#x308B;&#x3053;&#x3068;&#x300D;&#x3092;&#x524A;&#x9664;
- &#x7CFB;&#x8B5C;&#x3092;&#x30EA;&#x30B9;&#x30C8;&#x5F62;&#x5F0F;&#x304B;&#x3089;&#x6A39;&#x72B6;&#x56F3;&#x5F62;&#x5F0F;&#x3078;&#x5909;&#x66F4;
- &#x5B50;&#x500B;&#x4F53;&#x304C;&#x6210;&#x9577;&#x3059;&#x308B;&#x307E;&#x3067;&#x89AA;&#x306B;&#x8FFD;&#x5F93;&#x3059;&#x308B;&#x6319;&#x52D5;&#x3092;&#x8FFD;&#x52A0;
- &#x98DF;&#x4E8B;&#x30A8;&#x30D5;&#x30A7;&#x30AF;&#x30C8;&#x91CF;&#x3092;&#x6291;&#x5236;&#x3057;&#x3001;&#x990C;&#x30FB;&#x3042;&#x307E;&#x3044;&#x990C;&#x30FB;&#x8349;&#x306E;&#x8272;&#x3092;&#x53CD;&#x6620;
- &#x663C;&#x591C;&#x30B5;&#x30A4;&#x30AF;&#x30EB;&#x306E;&#x5149;&#x3092;&#x5730;&#x9762;&#x30FB;&#x30A2;&#x30A4;&#x30C6;&#x30E0;&#x30FB;&#x305F;&#x308A;&#x306A;&#x3044;&#x672C;&#x4F53;&#x3078;&#x53CD;&#x6620;
- &#x8FD1;&#x8DDD;&#x96E2;&#x30FB;&#x4F4E;&#x6A5F;&#x5ACC;&#x30FB;&#x904E;&#x5BC6;&#x6642;&#x306B;&#x767A;&#x751F;&#x3059;&#x308B;&#x55A7;&#x5629;&#x3092;&#x8FFD;&#x52A0;
- &#x55A7;&#x5629;&#x30A4;&#x30D9;&#x30F3;&#x30C8;&#x3092;&#x56F3;&#x9451;&#x30A4;&#x30D9;&#x30F3;&#x30C8;&#x3078;&#x8A18;&#x9332;
- &#x4FDD;&#x5B58;&#x30AD;&#x30FC;&#x306F; `tarinai-colony-save-v4`
## 更新内容v5
## &#x66F4;&#x65B0;&#x5185;&#x5BB9;&#xFF08;v5&#xFF09;
- 草は自然発生するように変更
- 草は自然には消えず、少しずつ伸びる
- 草を食べると残量が減り、表示される本数も減る
- 暗い時間帯にスプライトの透過部分へ矩形状の色が乗る問題を修正
- HUDの観察日を「1日目」表記へ変更
- HUDの「明るさ」表示を時刻表記へ変更
- 図鑑UIを完全に削除
- 系譜を右パネルからメイン画面下部へ移動
- 保存キーは `tarinai-colony-save-v5`
- &#x8349;&#x306F;&#x81EA;&#x7136;&#x767A;&#x751F;&#x3059;&#x308B;&#x3088;&#x3046;&#x306B;&#x5909;&#x66F4;
- &#x8349;&#x306F;&#x81EA;&#x7136;&#x306B;&#x306F;&#x6D88;&#x3048;&#x305A;&#x3001;&#x5C11;&#x3057;&#x305A;&#x3064;&#x4F38;&#x3073;&#x308B;
- &#x8349;&#x3092;&#x98DF;&#x3079;&#x308B;&#x3068;&#x6B8B;&#x91CF;&#x304C;&#x6E1B;&#x308A;&#x3001;&#x8868;&#x793A;&#x3055;&#x308C;&#x308B;&#x672C;&#x6570;&#x3082;&#x6E1B;&#x308B;
- &#x6697;&#x3044;&#x6642;&#x9593;&#x5E2F;&#x306B;&#x30B9;&#x30D7;&#x30E9;&#x30A4;&#x30C8;&#x306E;&#x900F;&#x904E;&#x90E8;&#x5206;&#x3078;&#x77E9;&#x5F62;&#x72B6;&#x306E;&#x8272;&#x304C;&#x4E57;&#x308B;&#x554F;&#x984C;&#x3092;&#x4FEE;&#x6B63;
- HUD&#x306E;&#x89B3;&#x5BDF;&#x65E5;&#x3092;&#x300C;1&#x65E5;&#x76EE;&#x300D;&#x8868;&#x8A18;&#x3078;&#x5909;&#x66F4;
- HUD&#x306E;&#x300C;&#x660E;&#x308B;&#x3055;&#x300D;&#x8868;&#x793A;&#x3092;&#x6642;&#x523B;&#x8868;&#x8A18;&#x3078;&#x5909;&#x66F4;
- &#x56F3;&#x9451;UI&#x3092;&#x5B8C;&#x5168;&#x306B;&#x524A;&#x9664;
- &#x7CFB;&#x8B5C;&#x3092;&#x53F3;&#x30D1;&#x30CD;&#x30EB;&#x304B;&#x3089;&#x30E1;&#x30A4;&#x30F3;&#x753B;&#x9762;&#x4E0B;&#x90E8;&#x3078;&#x79FB;&#x52D5;
- &#x4FDD;&#x5B58;&#x30AD;&#x30FC;&#x306F; `tarinai-colony-save-v5`
## 更新内容v6
## &#x66F4;&#x65B0;&#x5185;&#x5BB9;&#xFF08;v6&#xFF09;
- 喧嘩中に頭突き攻撃を行うように変更
- 草と石が昼夜サイクルの光に反応するように変更
- 睡眠中は完全に移動停止
- 09_stretch が見えるよう、つつき耐久を 9 段階に調整
- 3 回目以降: 06_cry
- 6 回目以降: 09_stretch
- 9 回目: 死亡
- たりないがカーソルに反応
- 好意的な個体は 01_smile で寄ってくる
- 敵対的・不安定な個体は逃げる
- 保存キーは `tarinai-colony-save-v6`
- &#x55A7;&#x5629;&#x4E2D;&#x306B;&#x982D;&#x7A81;&#x304D;&#x653B;&#x6483;&#x3092;&#x884C;&#x3046;&#x3088;&#x3046;&#x306B;&#x5909;&#x66F4;
- &#x8349;&#x3068;&#x77F3;&#x304C;&#x663C;&#x591C;&#x30B5;&#x30A4;&#x30AF;&#x30EB;&#x306E;&#x5149;&#x306B;&#x53CD;&#x5FDC;&#x3059;&#x308B;&#x3088;&#x3046;&#x306B;&#x5909;&#x66F4;
- &#x7761;&#x7720;&#x4E2D;&#x306F;&#x5B8C;&#x5168;&#x306B;&#x79FB;&#x52D5;&#x505C;&#x6B62;
- 09_stretch &#x304C;&#x898B;&#x3048;&#x308B;&#x3088;&#x3046;&#x3001;&#x3064;&#x3064;&#x304D;&#x8010;&#x4E45;&#x3092; 9 &#x6BB5;&#x968E;&#x306B;&#x8ABF;&#x6574;
- 3 &#x56DE;&#x76EE;&#x4EE5;&#x964D;: 06_cry
- 6 &#x56DE;&#x76EE;&#x4EE5;&#x964D;: 09_stretch
- 9 &#x56DE;&#x76EE;: &#x6B7B;&#x4EA1;
- &#x305F;&#x308A;&#x306A;&#x3044;&#x304C;&#x30AB;&#x30FC;&#x30BD;&#x30EB;&#x306B;&#x53CD;&#x5FDC;
- &#x597D;&#x610F;&#x7684;&#x306A;&#x500B;&#x4F53;&#x306F; 01_smile &#x3067;&#x5BC4;&#x3063;&#x3066;&#x304F;&#x308B;
- &#x6575;&#x5BFE;&#x7684;&#x30FB;&#x4E0D;&#x5B89;&#x5B9A;&#x306A;&#x500B;&#x4F53;&#x306F;&#x9003;&#x3052;&#x308B;
- &#x4FDD;&#x5B58;&#x30AD;&#x30FC;&#x306F; `tarinai-colony-save-v6`
## 更新内容v7
## &#x66F4;&#x65B0;&#x5185;&#x5BB9;&#xFF08;v7&#xFF09;
- メイン画面の外観を「庭の観察」テイストへ刷新
- 空・日差し・庭枠・土の質感・周辺の草花を追加
- たりないに接地影を追加
- 石・草・各アイテムにも影と周囲とのなじみを追加
- 選択リングを観察レンズ風の二重リングに変更
- 子個体と親個体の関係が見えやすいよう、近距離時に薄い追従ガイド線を追加
- 右上HUDと全体UIを庭の観察ート風に調整
- 保存キーは `tarinai-colony-save-v7`
- &#x30E1;&#x30A4;&#x30F3;&#x753B;&#x9762;&#x306E;&#x5916;&#x89B3;&#x3092;&#x300C;&#x5EAD;&#x306E;&#x89B3;&#x5BDF;&#x300D;&#x30C6;&#x30A4;&#x30B9;&#x30C8;&#x3078;&#x5237;&#x65B0;
- &#x7A7A;&#x30FB;&#x65E5;&#x5DEE;&#x3057;&#x30FB;&#x5EAD;&#x67A0;&#x30FB;&#x571F;&#x306E;&#x8CEA;&#x611F;&#x30FB;&#x5468;&#x8FBA;&#x306E;&#x8349;&#x82B1;&#x3092;&#x8FFD;&#x52A0;
- &#x305F;&#x308A;&#x306A;&#x3044;&#x306B;&#x63A5;&#x5730;&#x5F71;&#x3092;&#x8FFD;&#x52A0;
- &#x77F3;&#x30FB;&#x8349;&#x30FB;&#x5404;&#x30A2;&#x30A4;&#x30C6;&#x30E0;&#x306B;&#x3082;&#x5F71;&#x3068;&#x5468;&#x56F2;&#x3068;&#x306E;&#x306A;&#x3058;&#x307F;&#x3092;&#x8FFD;&#x52A0;
- &#x9078;&#x629E;&#x30EA;&#x30F3;&#x30B0;&#x3092;&#x89B3;&#x5BDF;&#x30EC;&#x30F3;&#x30BA;&#x98A8;&#x306E;&#x4E8C;&#x91CD;&#x30EA;&#x30F3;&#x30B0;&#x306B;&#x5909;&#x66F4;
- &#x5B50;&#x500B;&#x4F53;&#x3068;&#x89AA;&#x500B;&#x4F53;&#x306E;&#x95A2;&#x4FC2;&#x304C;&#x898B;&#x3048;&#x3084;&#x3059;&#x3044;&#x3088;&#x3046;&#x3001;&#x8FD1;&#x8DDD;&#x96E2;&#x6642;&#x306B;&#x8584;&#x3044;&#x8FFD;&#x5F93;&#x30AC;&#x30A4;&#x30C9;&#x7DDA;&#x3092;&#x8FFD;&#x52A0;
- &#x53F3;&#x4E0A;HUD&#x3068;&#x5168;&#x4F53;UI&#x3092;&#x5EAD;&#x306E;&#x89B3;&#x5BDF;&#x30CE;&#x30FC;&#x30C8;&#x98A8;&#x306B;&#x8ABF;&#x6574;
- &#x4FDD;&#x5B58;&#x30AD;&#x30FC;&#x306F; `tarinai-colony-save-v7`
## 更新内容v8
## &#x66F4;&#x65B0;&#x5185;&#x5BB9;&#xFF08;v8&#xFF09;
- アニメーションを調整し、呼吸感・移動感・喧嘩時の勢いを強化
- 庭素材を追加(小石・苔・クローバー・落ち葉・周辺の草花)
- 太陽や月そのものは描かず、時間帯に応じた投影影を追加
- ずんちを追加。食事を重ねると排泄し、庭に残る
- 09_stretch が通常個体でもはっきり表示されるよう補強
- 系譜の接続線を太く・連続的にして見やすく修正
- 未使用だった図鑑系の状態管理や関連スタイルを削除
- 保存キーは `tarinai-colony-save-v8`
- &#x30A2;&#x30CB;&#x30E1;&#x30FC;&#x30B7;&#x30E7;&#x30F3;&#x3092;&#x8ABF;&#x6574;&#x3057;&#x3001;&#x547C;&#x5438;&#x611F;&#x30FB;&#x79FB;&#x52D5;&#x611F;&#x30FB;&#x55A7;&#x5629;&#x6642;&#x306E;&#x52E2;&#x3044;&#x3092;&#x5F37;&#x5316;
- &#x5EAD;&#x7D20;&#x6750;&#x3092;&#x8FFD;&#x52A0;&#xFF08;&#x5C0F;&#x77F3;&#x30FB;&#x82D4;&#x30FB;&#x30AF;&#x30ED;&#x30FC;&#x30D0;&#x30FC;&#x30FB;&#x843D;&#x3061;&#x8449;&#x30FB;&#x5468;&#x8FBA;&#x306E;&#x8349;&#x82B1;&#xFF09;
- &#x592A;&#x967D;&#x3084;&#x6708;&#x305D;&#x306E;&#x3082;&#x306E;&#x306F;&#x63CF;&#x304B;&#x305A;&#x3001;&#x6642;&#x9593;&#x5E2F;&#x306B;&#x5FDC;&#x3058;&#x305F;&#x6295;&#x5F71;&#x5F71;&#x3092;&#x8FFD;&#x52A0;
- &#x305A;&#x3093;&#x3061;&#x3092;&#x8FFD;&#x52A0;&#x3002;&#x98DF;&#x4E8B;&#x3092;&#x91CD;&#x306D;&#x308B;&#x3068;&#x6392;&#x6CC4;&#x3057;&#x3001;&#x5EAD;&#x306B;&#x6B8B;&#x308B;
- 09_stretch &#x304C;&#x901A;&#x5E38;&#x500B;&#x4F53;&#x3067;&#x3082;&#x306F;&#x3063;&#x304D;&#x308A;&#x8868;&#x793A;&#x3055;&#x308C;&#x308B;&#x3088;&#x3046;&#x88DC;&#x5F37;
- &#x7CFB;&#x8B5C;&#x306E;&#x63A5;&#x7D9A;&#x7DDA;&#x3092;&#x592A;&#x304F;&#x30FB;&#x9023;&#x7D9A;&#x7684;&#x306B;&#x3057;&#x3066;&#x898B;&#x3084;&#x3059;&#x304F;&#x4FEE;&#x6B63;
- &#x672A;&#x4F7F;&#x7528;&#x3060;&#x3063;&#x305F;&#x56F3;&#x9451;&#x7CFB;&#x306E;&#x72B6;&#x614B;&#x7BA1;&#x7406;&#x3084;&#x95A2;&#x9023;&#x30B9;&#x30BF;&#x30A4;&#x30EB;&#x3092;&#x524A;&#x9664;
- &#x4FDD;&#x5B58;&#x30AD;&#x30FC;&#x306F; `tarinai-colony-save-v8`
## 更新内容v9
## &#x66F4;&#x65B0;&#x5185;&#x5BB9;&#xFF08;v9&#xFF09;
- 投影影が見えにくい問題を修正
- blur フィルタ依存をやめ、軽量な楕円影へ変更
- たりない・石・草・アイテムの影を濃く調整
- 重すぎる問題を軽量化
- 庭背景の粒・草花・落ち葉描画数を削減
- filter blur を廃止
- 草の自動発生上限と発生頻度を抑制
- アイテム上限を削減
- 食事パーティクル頻度を抑制
- 死亡後の緑のしぶきが時間経過でゆっくり薄く消えるように変更
- 保存キーは `tarinai-colony-save-v9`
- &#x6295;&#x5F71;&#x5F71;&#x304C;&#x898B;&#x3048;&#x306B;&#x304F;&#x3044;&#x554F;&#x984C;&#x3092;&#x4FEE;&#x6B63;
- blur &#x30D5;&#x30A3;&#x30EB;&#x30BF;&#x4F9D;&#x5B58;&#x3092;&#x3084;&#x3081;&#x3001;&#x8EFD;&#x91CF;&#x306A;&#x6955;&#x5186;&#x5F71;&#x3078;&#x5909;&#x66F4;
- &#x305F;&#x308A;&#x306A;&#x3044;&#x30FB;&#x77F3;&#x30FB;&#x8349;&#x30FB;&#x30A2;&#x30A4;&#x30C6;&#x30E0;&#x306E;&#x5F71;&#x3092;&#x6FC3;&#x304F;&#x8ABF;&#x6574;
- &#x91CD;&#x3059;&#x304E;&#x308B;&#x554F;&#x984C;&#x3092;&#x8EFD;&#x91CF;&#x5316;
- &#x5EAD;&#x80CC;&#x666F;&#x306E;&#x7C92;&#x30FB;&#x8349;&#x82B1;&#x30FB;&#x843D;&#x3061;&#x8449;&#x63CF;&#x753B;&#x6570;&#x3092;&#x524A;&#x6E1B;
- filter blur &#x3092;&#x5EC3;&#x6B62;
- &#x8349;&#x306E;&#x81EA;&#x52D5;&#x767A;&#x751F;&#x4E0A;&#x9650;&#x3068;&#x767A;&#x751F;&#x983B;&#x5EA6;&#x3092;&#x6291;&#x5236;
- &#x30A2;&#x30A4;&#x30C6;&#x30E0;&#x4E0A;&#x9650;&#x3092;&#x524A;&#x6E1B;
- &#x98DF;&#x4E8B;&#x30D1;&#x30FC;&#x30C6;&#x30A3;&#x30AF;&#x30EB;&#x983B;&#x5EA6;&#x3092;&#x6291;&#x5236;
- &#x6B7B;&#x4EA1;&#x5F8C;&#x306E;&#x7DD1;&#x306E;&#x3057;&#x3076;&#x304D;&#x304C;&#x6642;&#x9593;&#x7D4C;&#x904E;&#x3067;&#x3086;&#x3063;&#x304F;&#x308A;&#x8584;&#x304F;&#x6D88;&#x3048;&#x308B;&#x3088;&#x3046;&#x306B;&#x5909;&#x66F4;
- &#x4FDD;&#x5B58;&#x30AD;&#x30FC;&#x306F; `tarinai-colony-save-v9`
## 更新内容v10
## &#x66F4;&#x65B0;&#x5185;&#x5BB9;&#xFF08;v10&#xFF09;
- 新規スプライト5枚を追加
- `10_hurt`: 痛い時・喧嘩中に打たれた時
- `11_weak`: 低体力時
- `12_back`: 奥方向へ進む時
- `13_flee`: 喧嘩に負けて敗走する時
- `14_zunda_eat`: ずんだ餅を食べる時
- 追加画像はすべて透明PNG化し、`512x468` のキャンバスへ正規化
- 追加スプライトは行動専用扱いにし、通常個体の基本タイプとしてはランダム出現しないように調整
- &#x65B0;&#x898F;&#x30B9;&#x30D7;&#x30E9;&#x30A4;&#x30C8;5&#x679A;&#x3092;&#x8FFD;&#x52A0;
- `10_hurt`: &#x75DB;&#x3044;&#x6642;&#x30FB;&#x55A7;&#x5629;&#x4E2D;&#x306B;&#x6253;&#x305F;&#x308C;&#x305F;&#x6642;
- `11_weak`: &#x4F4E;&#x4F53;&#x529B;&#x6642;
- `12_back`: &#x5965;&#x65B9;&#x5411;&#x3078;&#x9032;&#x3080;&#x6642;
- `13_flee`: &#x55A7;&#x5629;&#x306B;&#x8CA0;&#x3051;&#x3066;&#x6557;&#x8D70;&#x3059;&#x308B;&#x6642;
- `14_zunda_eat`: &#x305A;&#x3093;&#x3060;&#x9905;&#x3092;&#x98DF;&#x3079;&#x308B;&#x6642;
- &#x8FFD;&#x52A0;&#x753B;&#x50CF;&#x306F;&#x3059;&#x3079;&#x3066;&#x900F;&#x660E;PNG&#x5316;&#x3057;&#x3001;`512x468` &#x306E;&#x30AD;&#x30E3;&#x30F3;&#x30D0;&#x30B9;&#x3078;&#x6B63;&#x898F;&#x5316;
- &#x8FFD;&#x52A0;&#x30B9;&#x30D7;&#x30E9;&#x30A4;&#x30C8;&#x306F;&#x884C;&#x52D5;&#x5C02;&#x7528;&#x6271;&#x3044;&#x306B;&#x3057;&#x3001;&#x901A;&#x5E38;&#x500B;&#x4F53;&#x306E;&#x57FA;&#x672C;&#x30BF;&#x30A4;&#x30D7;&#x3068;&#x3057;&#x3066;&#x306F;&#x30E9;&#x30F3;&#x30C0;&#x30E0;&#x51FA;&#x73FE;&#x3057;&#x306A;&#x3044;&#x3088;&#x3046;&#x306B;&#x8ABF;&#x6574;
## 更新内容v11
## &#x66F4;&#x65B0;&#x5185;&#x5BB9;&#xFF08;v11&#xFF09;
- 個体ごとの性格を追加
- 臆病、食いしん坊、眠たがり、寂しがり、怒りっぽい、マイペース
- 性格は睡眠、喧嘩、ずんだ餅反応、恐怖、対個体行動へ影響
- 選択パネルに観察理由を追加
- 現在の行動理由
- 対象
- 仲の良い個体
- 避けている個体
- 喧嘩記憶
- 関係性と喧嘩記憶を追加
- 近くで過ごす個体同士は親和度が上がる
- 喧嘩に負けた相手を記憶し、しばらく避けやすくなる
- 勝敗はログと選択パネルに反映
- hay bed に快適度・混雑ペナルティを追加
- 空いているベッドを選びやすくなる
- 混雑時は回復効率が下がり、ストレスが上がる
- 草の生態系を強化
- 雨、水、ずんち由来の肥沃地で育ちやすくなる
- 強い晴天で水分がないと弱りやすくなる
- 草の周辺ではストレス・恐怖が少し下がる
- 表情スプライトの優先順位を整理
- ずんだ餅、被ダメージ、敗走、恐怖、低体力、睡眠、喧嘩、奥移動、通常の順に競合解決
- ログを種類別に色分け
- 誕生、死亡、喧嘩、食事、草、環境、関係、観察
- 喧嘩で転ぶ演出を追加
- 打撃時に低確率で転ぶ
- 敗北時に転倒し、土煙が出る
- 保存キーは `tarinai-colony-save-v11`
- &#x500B;&#x4F53;&#x3054;&#x3068;&#x306E;&#x6027;&#x683C;&#x3092;&#x8FFD;&#x52A0;
- &#x81C6;&#x75C5;&#x3001;&#x98DF;&#x3044;&#x3057;&#x3093;&#x574A;&#x3001;&#x7720;&#x305F;&#x304C;&#x308A;&#x3001;&#x5BC2;&#x3057;&#x304C;&#x308A;&#x3001;&#x6012;&#x308A;&#x3063;&#x307D;&#x3044;&#x3001;&#x30DE;&#x30A4;&#x30DA;&#x30FC;&#x30B9;
- &#x6027;&#x683C;&#x306F;&#x7761;&#x7720;&#x3001;&#x55A7;&#x5629;&#x3001;&#x305A;&#x3093;&#x3060;&#x9905;&#x53CD;&#x5FDC;&#x3001;&#x6050;&#x6016;&#x3001;&#x5BFE;&#x500B;&#x4F53;&#x884C;&#x52D5;&#x3078;&#x5F71;&#x97FF;
- &#x9078;&#x629E;&#x30D1;&#x30CD;&#x30EB;&#x306B;&#x89B3;&#x5BDF;&#x7406;&#x7531;&#x3092;&#x8FFD;&#x52A0;
- &#x73FE;&#x5728;&#x306E;&#x884C;&#x52D5;&#x7406;&#x7531;
- &#x5BFE;&#x8C61;
- &#x4EF2;&#x306E;&#x826F;&#x3044;&#x500B;&#x4F53;
- &#x907F;&#x3051;&#x3066;&#x3044;&#x308B;&#x500B;&#x4F53;
- &#x55A7;&#x5629;&#x8A18;&#x61B6;
- &#x95A2;&#x4FC2;&#x6027;&#x3068;&#x55A7;&#x5629;&#x8A18;&#x61B6;&#x3092;&#x8FFD;&#x52A0;
- &#x8FD1;&#x304F;&#x3067;&#x904E;&#x3054;&#x3059;&#x500B;&#x4F53;&#x540C;&#x58EB;&#x306F;&#x89AA;&#x548C;&#x5EA6;&#x304C;&#x4E0A;&#x304C;&#x308B;
- &#x55A7;&#x5629;&#x306B;&#x8CA0;&#x3051;&#x305F;&#x76F8;&#x624B;&#x3092;&#x8A18;&#x61B6;&#x3057;&#x3001;&#x3057;&#x3070;&#x3089;&#x304F;&#x907F;&#x3051;&#x3084;&#x3059;&#x304F;&#x306A;&#x308B;
- &#x52DD;&#x6557;&#x306F;&#x30ED;&#x30B0;&#x3068;&#x9078;&#x629E;&#x30D1;&#x30CD;&#x30EB;&#x306B;&#x53CD;&#x6620;
- hay bed &#x306B;&#x5FEB;&#x9069;&#x5EA6;&#x30FB;&#x6DF7;&#x96D1;&#x30DA;&#x30CA;&#x30EB;&#x30C6;&#x30A3;&#x3092;&#x8FFD;&#x52A0;
- &#x7A7A;&#x3044;&#x3066;&#x3044;&#x308B;&#x30D9;&#x30C3;&#x30C9;&#x3092;&#x9078;&#x3073;&#x3084;&#x3059;&#x304F;&#x306A;&#x308B;
- &#x6DF7;&#x96D1;&#x6642;&#x306F;&#x56DE;&#x5FA9;&#x52B9;&#x7387;&#x304C;&#x4E0B;&#x304C;&#x308A;&#x3001;&#x30B9;&#x30C8;&#x30EC;&#x30B9;&#x304C;&#x4E0A;&#x304C;&#x308B;
- &#x8349;&#x306E;&#x751F;&#x614B;&#x7CFB;&#x3092;&#x5F37;&#x5316;
- &#x96E8;&#x3001;&#x6C34;&#x3001;&#x305A;&#x3093;&#x3061;&#x7531;&#x6765;&#x306E;&#x80A5;&#x6C83;&#x5730;&#x3067;&#x80B2;&#x3061;&#x3084;&#x3059;&#x304F;&#x306A;&#x308B;
- &#x5F37;&#x3044;&#x6674;&#x5929;&#x3067;&#x6C34;&#x5206;&#x304C;&#x306A;&#x3044;&#x3068;&#x5F31;&#x308A;&#x3084;&#x3059;&#x304F;&#x306A;&#x308B;
- &#x8349;&#x306E;&#x5468;&#x8FBA;&#x3067;&#x306F;&#x30B9;&#x30C8;&#x30EC;&#x30B9;&#x30FB;&#x6050;&#x6016;&#x304C;&#x5C11;&#x3057;&#x4E0B;&#x304C;&#x308B;
- &#x8868;&#x60C5;&#x30B9;&#x30D7;&#x30E9;&#x30A4;&#x30C8;&#x306E;&#x512A;&#x5148;&#x9806;&#x4F4D;&#x3092;&#x6574;&#x7406;
- &#x305A;&#x3093;&#x3060;&#x9905;&#x3001;&#x88AB;&#x30C0;&#x30E1;&#x30FC;&#x30B8;&#x3001;&#x6557;&#x8D70;&#x3001;&#x6050;&#x6016;&#x3001;&#x4F4E;&#x4F53;&#x529B;&#x3001;&#x7761;&#x7720;&#x3001;&#x55A7;&#x5629;&#x3001;&#x5965;&#x79FB;&#x52D5;&#x3001;&#x901A;&#x5E38;&#x306E;&#x9806;&#x306B;&#x7AF6;&#x5408;&#x89E3;&#x6C7A;
- &#x30ED;&#x30B0;&#x3092;&#x7A2E;&#x985E;&#x5225;&#x306B;&#x8272;&#x5206;&#x3051;
- &#x8A95;&#x751F;&#x3001;&#x6B7B;&#x4EA1;&#x3001;&#x55A7;&#x5629;&#x3001;&#x98DF;&#x4E8B;&#x3001;&#x8349;&#x3001;&#x74B0;&#x5883;&#x3001;&#x95A2;&#x4FC2;&#x3001;&#x89B3;&#x5BDF;
- &#x55A7;&#x5629;&#x3067;&#x8EE2;&#x3076;&#x6F14;&#x51FA;&#x3092;&#x8FFD;&#x52A0;
- &#x6253;&#x6483;&#x6642;&#x306B;&#x4F4E;&#x78BA;&#x7387;&#x3067;&#x8EE2;&#x3076;
- &#x6557;&#x5317;&#x6642;&#x306B;&#x8EE2;&#x5012;&#x3057;&#x3001;&#x571F;&#x7159;&#x304C;&#x51FA;&#x308B;
- &#x4FDD;&#x5B58;&#x30AD;&#x30FC;&#x306F; `tarinai-colony-save-v11`

View file

@ -350,14 +350,14 @@ h1 {
.tool[data-tool="bed"] { --tool-icon: url("../assets/ui/tool_bed.png"); }
.tool[data-tool="ball"] { --tool-icon: none; }
.tool[data-tool="ball"]::before {
content: "";
content: "\26bd ";
background: none;
font-size: 24px;
line-height: 1;
filter: drop-shadow(0 2px 3px rgba(52,40,26,0.12));
}
.tool[data-tool="ball"]::after {
content: "";
content: "\26bd ";
background: none;
font-size: 48px;
line-height: 1;
@ -372,14 +372,14 @@ h1 {
}
.tool[data-tool="poke"] { --tool-icon: none; }
.tool[data-tool="poke"]::before {
content: "👈";
content: "\1f448 ";
background: none;
font-size: 25px;
line-height: 1;
filter: drop-shadow(0 2px 3px rgba(52,40,26,0.12));
}
.tool[data-tool="poke"]::after {
content: "👈";
content: "\1f448 ";
background: none;
font-size: 48px;
line-height: 1;
@ -392,6 +392,74 @@ h1 {
width: 54px;
height: 54px;
}
.tool[data-tool="pinch"] { --tool-icon: none; }
.tool[data-tool="pinch"]::before {
content: "\1f90f ";
background: none;
font-size: 25px;
line-height: 1;
filter: drop-shadow(0 2px 3px rgba(52,40,26,0.12));
}
.tool[data-tool="pinch"]::after {
content: "\1f90f ";
background: none;
font-size: 48px;
line-height: 1;
opacity: 0.10;
right: -6px;
left: auto;
top: 50%;
bottom: auto;
transform: translateY(-50%);
width: 54px;
height: 54px;
}
.tool[data-tool="love_mochi"] { --tool-icon: none; }
.tool[data-tool="love_mochi"]::before {
content: "\1f495 ";
background: none;
font-size: 24px;
line-height: 1;
filter: drop-shadow(0 2px 3px rgba(52,40,26,0.12));
}
.tool[data-tool="love_mochi"]::after {
content: "\1f495 ";
background: none;
font-size: 46px;
line-height: 1;
opacity: 0.10;
right: -6px;
left: auto;
top: 50%;
bottom: auto;
transform: translateY(-50%);
width: 54px;
height: 54px;
}
.tool[data-tool="fight_mochi"] { --tool-icon: none; }
.tool[data-tool="fight_mochi"]::before {
content: "\1f4a2 ";
background: none;
font-size: 24px;
line-height: 1;
filter: drop-shadow(0 2px 3px rgba(52,40,26,0.12));
}
.tool[data-tool="fight_mochi"]::after {
content: "\1f4a2 ";
background: none;
font-size: 46px;
line-height: 1;
opacity: 0.10;
right: -6px;
left: auto;
top: 50%;
bottom: auto;
transform: translateY(-50%);
width: 54px;
height: 54px;
}
.tool[data-tool="delete"] { --tool-icon: url("../assets/ui/tool_delete.png"); }
.tool[data-tool="new"] { --tool-icon: url("../assets/ui/tool_new.png"); }
.tool.selected {
@ -429,8 +497,8 @@ h1 {
font-weight: 700;
font-size: 12px;
}
.tool-category-toggle::before { content: ""; display: inline-block; width: 16px; color: var(--muted); }
.tool-category.collapsed .tool-category-toggle::before { content: ""; }
.tool-category-toggle::before { content: "\25be "; display: inline-block; width: 16px; color: var(--muted); }
.tool-category.collapsed .tool-category-toggle::before { content: "\25b8 "; }
.tool-category-body { padding: 8px; }
.tool-category.collapsed .tool-category-body { display: none; }
.tool-size-badge {
@ -844,6 +912,7 @@ body::before {
overflow: visible;
pointer-events: none;
z-index: 1;
isolation: isolate;
}
.lineage-render-status {
position: sticky;
@ -860,6 +929,22 @@ body::before {
border: 1px solid rgba(84,68,48,0.10);
box-shadow: 0 4px 10px rgba(64,48,32,0.06);
}
.lineage-stale-status {
position: sticky;
top: 0;
left: 0;
z-index: 6;
width: max-content;
max-width: calc(100% - 12px);
margin: 0 0 8px;
padding: 6px 10px;
border-radius: 999px;
font-size: 12px;
color: rgba(92, 75, 52, 0.82);
background: rgba(255, 249, 232, 0.92);
border: 1px solid rgba(150, 115, 46, 0.16);
box-shadow: 0 4px 10px rgba(64,48,32,0.05);
}
.lineage-family-tree .lineage-links path {
fill: none;
stroke: rgba(107, 88, 61, 0.58);
@ -883,11 +968,28 @@ body::before {
min-height: 68px;
box-sizing: border-box;
align-items: flex-start;
background: linear-gradient(180deg, #fffdf8, #f8f1e5);
box-shadow: 0 2px 5px rgba(64,48,32,0.035);
contain: layout paint style;
z-index: 2;
isolation: isolate;
}
.lineage-family-tree .tree-node.child {
border-color: rgba(103,178,44,0.34);
}
.lineage-family-tree .tree-node.dead {
opacity: 1;
filter: none;
}
.lineage-family-tree .tree-node[data-family-tarinai-id]:hover {
transform: none;
}
.lineage-family-tree .tree-node .family-portrait {
right: 0;
bottom: -6px;
width: 58px;
height: 58px;
}
.lineage-family-tree .tree-generation-label {
position: absolute;
left: 10px;

View file

@ -7,14 +7,12 @@ Use this map to open the smallest relevant file first.
- `js/items.js`: `Item` lifecycle, item save/load restore, grass and zunchi behavior, and item drawing.
- `js/tarinai.js`: `Tarinai` state, AI, movement, eating, fighting, panic, reproduction-adjacent behavior, and drawing.
- `js/world.js`: `World` state, save/load, spawning, family registry normalization, spatial queries, tools, weather, and update loop coordination.
- `js/sim.js`: compatibility export for `window.TarinaiSim`.
## UI And Rendering
- `js/render.js`: canvas scene rendering, lighting, weather visuals, HUD, and selected-card overlay.
- `js/ui.js`: DOM references, selected/log panels, labels, save/load buttons, tool controls, canvas input, and UI event binding.
- `js/ui_charts.js`: colony history aggregation and chart rendering.
- `js/ui_family.js`: family tree components, layout, archive rendering, and validation helper.
- `js/ui_exports.js`: compatibility export for `window.TarinaiUI`.
## Common Tasks
- Change hunger, sleep, fighting, panic, eating, or movement: start with `js/tarinai.js`.

View file

@ -1,163 +1,163 @@
# たりないコロニー観察所:仕様メモ
# &#x305F;&#x308A;&#x306A;&#x3044;&#x30B3;&#x30ED;&#x30CB;&#x30FC;&#x89B3;&#x5BDF;&#x6240;&#xFF1A;&#x4ED5;&#x69D8;&#x30E1;&#x30E2;
## コンセプト
## &#x30B3;&#x30F3;&#x30BB;&#x30D7;&#x30C8;
「不足を解決するゲーム」ではなく、
「不足を抱えた生き物が、それでも勝手に暮らす様子を眺めるゲーム」。
&#x300C;&#x4E0D;&#x8DB3;&#x3092;&#x89E3;&#x6C7A;&#x3059;&#x308B;&#x30B2;&#x30FC;&#x30E0;&#x300D;&#x3067;&#x306F;&#x306A;&#x304F;&#x3001;
&#x300C;&#x4E0D;&#x8DB3;&#x3092;&#x62B1;&#x3048;&#x305F;&#x751F;&#x304D;&#x7269;&#x304C;&#x3001;&#x305D;&#x308C;&#x3067;&#x3082;&#x52DD;&#x624B;&#x306B;&#x66AE;&#x3089;&#x3059;&#x69D8;&#x5B50;&#x3092;&#x773A;&#x3081;&#x308B;&#x30B2;&#x30FC;&#x30E0;&#x300D;&#x3002;
プレイヤーは神ではなく、観察者兼飼育係程度の立場。
すべてを最適化するより、少し足りない状態の揺らぎを観察することを主目的にする。
&#x30D7;&#x30EC;&#x30A4;&#x30E4;&#x30FC;&#x306F;&#x795E;&#x3067;&#x306F;&#x306A;&#x304F;&#x3001;&#x89B3;&#x5BDF;&#x8005;&#x517C;&#x98FC;&#x80B2;&#x4FC2;&#x7A0B;&#x5EA6;&#x306E;&#x7ACB;&#x5834;&#x3002;
&#x3059;&#x3079;&#x3066;&#x3092;&#x6700;&#x9069;&#x5316;&#x3059;&#x308B;&#x3088;&#x308A;&#x3001;&#x5C11;&#x3057;&#x8DB3;&#x308A;&#x306A;&#x3044;&#x72B6;&#x614B;&#x306E;&#x63FA;&#x3089;&#x304E;&#x3092;&#x89B3;&#x5BDF;&#x3059;&#x308B;&#x3053;&#x3068;&#x3092;&#x4E3B;&#x76EE;&#x7684;&#x306B;&#x3059;&#x308B;&#x3002;
## 現在実装しているループ
## &#x73FE;&#x5728;&#x5B9F;&#x88C5;&#x3057;&#x3066;&#x3044;&#x308B;&#x30EB;&#x30FC;&#x30D7;
1. 個体が空腹・孤独・眠気・不安を内部状態として持つ
2. 状態に応じて餌・仲間・寝床を探す
3. プレイヤーは環境にアイテムを置いて介入する
4. 介入と個体行動により、繁殖・死亡・観察ログが生まれる
5. 死亡個体は「たりない跡」を残し、環境に記録として残る
1. &#x500B;&#x4F53;&#x304C;&#x7A7A;&#x8179;&#x30FB;&#x5B64;&#x72EC;&#x30FB;&#x7720;&#x6C17;&#x30FB;&#x4E0D;&#x5B89;&#x3092;&#x5185;&#x90E8;&#x72B6;&#x614B;&#x3068;&#x3057;&#x3066;&#x6301;&#x3064;
2. &#x72B6;&#x614B;&#x306B;&#x5FDC;&#x3058;&#x3066;&#x990C;&#x30FB;&#x4EF2;&#x9593;&#x30FB;&#x5BDD;&#x5E8A;&#x3092;&#x63A2;&#x3059;
3. &#x30D7;&#x30EC;&#x30A4;&#x30E4;&#x30FC;&#x306F;&#x74B0;&#x5883;&#x306B;&#x30A2;&#x30A4;&#x30C6;&#x30E0;&#x3092;&#x7F6E;&#x3044;&#x3066;&#x4ECB;&#x5165;&#x3059;&#x308B;
4. &#x4ECB;&#x5165;&#x3068;&#x500B;&#x4F53;&#x884C;&#x52D5;&#x306B;&#x3088;&#x308A;&#x3001;&#x7E41;&#x6B96;&#x30FB;&#x6B7B;&#x4EA1;&#x30FB;&#x89B3;&#x5BDF;&#x30ED;&#x30B0;&#x304C;&#x751F;&#x307E;&#x308C;&#x308B;
5. &#x6B7B;&#x4EA1;&#x500B;&#x4F53;&#x306F;&#x300C;&#x305F;&#x308A;&#x306A;&#x3044;&#x8DE1;&#x300D;&#x3092;&#x6B8B;&#x3057;&#x3001;&#x74B0;&#x5883;&#x306B;&#x8A18;&#x9332;&#x3068;&#x3057;&#x3066;&#x6B8B;&#x308B;
## 個体状態
## &#x500B;&#x4F53;&#x72B6;&#x614B;
| 状態 | 内容 |
| &#x72B6;&#x614B; | &#x5185;&#x5BB9; |
|---|---|
| 空腹 | 高いほど餌・草を探す。上がりすぎると死亡 |
| 孤独 | 高いほど仲間に寄る。近くに仲間がいると下がる |
| 眠気残量 | 低いほど寝る。寝床があると回復が速い |
| 不安 | 高いほど慌てる。水・石・寝床などで下がる |
| たりない度 | 上記の総合的な不安定さ |
| &#x7A7A;&#x8179; | &#x9AD8;&#x3044;&#x307B;&#x3069;&#x990C;&#x30FB;&#x8349;&#x3092;&#x63A2;&#x3059;&#x3002;&#x4E0A;&#x304C;&#x308A;&#x3059;&#x304E;&#x308B;&#x3068;&#x6B7B;&#x4EA1; |
| &#x5B64;&#x72EC; | &#x9AD8;&#x3044;&#x307B;&#x3069;&#x4EF2;&#x9593;&#x306B;&#x5BC4;&#x308B;&#x3002;&#x8FD1;&#x304F;&#x306B;&#x4EF2;&#x9593;&#x304C;&#x3044;&#x308B;&#x3068;&#x4E0B;&#x304C;&#x308B; |
| &#x7720;&#x6C17;&#x6B8B;&#x91CF; | &#x4F4E;&#x3044;&#x307B;&#x3069;&#x5BDD;&#x308B;&#x3002;&#x5BDD;&#x5E8A;&#x304C;&#x3042;&#x308B;&#x3068;&#x56DE;&#x5FA9;&#x304C;&#x901F;&#x3044; |
| &#x4E0D;&#x5B89; | &#x9AD8;&#x3044;&#x307B;&#x3069;&#x614C;&#x3066;&#x308B;&#x3002;&#x6C34;&#x30FB;&#x77F3;&#x30FB;&#x5BDD;&#x5E8A;&#x306A;&#x3069;&#x3067;&#x4E0B;&#x304C;&#x308B; |
| &#x305F;&#x308A;&#x306A;&#x3044;&#x5EA6; | &#x4E0A;&#x8A18;&#x306E;&#x7DCF;&#x5408;&#x7684;&#x306A;&#x4E0D;&#x5B89;&#x5B9A;&#x3055; |
## 個体タイプ
## &#x500B;&#x4F53;&#x30BF;&#x30A4;&#x30D7;
9枚のスプライトに対応。
9&#x679A;&#x306E;&#x30B9;&#x30D7;&#x30E9;&#x30A4;&#x30C8;&#x306B;&#x5BFE;&#x5FDC;&#x3002;
- にこたりない
- いかりたりない
- うるうるたりない
- じとたりない
- よだれたりない
- ぐしゃたりない
- すやたりない
- ぽかんたりない
- のびたりない
- &#x306B;&#x3053;&#x305F;&#x308A;&#x306A;&#x3044;
- &#x3044;&#x304B;&#x308A;&#x305F;&#x308A;&#x306A;&#x3044;
- &#x3046;&#x308B;&#x3046;&#x308B;&#x305F;&#x308A;&#x306A;&#x3044;
- &#x3058;&#x3068;&#x305F;&#x308A;&#x306A;&#x3044;
- &#x3088;&#x3060;&#x308C;&#x305F;&#x308A;&#x306A;&#x3044;
- &#x3050;&#x3057;&#x3083;&#x305F;&#x308A;&#x306A;&#x3044;
- &#x3059;&#x3084;&#x305F;&#x308A;&#x306A;&#x3044;
- &#x307D;&#x304B;&#x3093;&#x305F;&#x308A;&#x306A;&#x3044;
- &#x306E;&#x3073;&#x305F;&#x308A;&#x306A;&#x3044;
各タイプは、空腹速度・社交性・睡眠傾向・不安耐性・移動速度に差がある。
&#x5404;&#x30BF;&#x30A4;&#x30D7;&#x306F;&#x3001;&#x7A7A;&#x8179;&#x901F;&#x5EA6;&#x30FB;&#x793E;&#x4EA4;&#x6027;&#x30FB;&#x7761;&#x7720;&#x50BE;&#x5411;&#x30FB;&#x4E0D;&#x5B89;&#x8010;&#x6027;&#x30FB;&#x79FB;&#x52D5;&#x901F;&#x5EA6;&#x306B;&#x5DEE;&#x304C;&#x3042;&#x308B;&#x3002;
## 介入アイテム
## &#x4ECB;&#x5165;&#x30A2;&#x30A4;&#x30C6;&#x30E0;
| アイテム | 役割 |
| &#x30A2;&#x30A4;&#x30C6;&#x30E0; | &#x5F79;&#x5272; |
|---|---|
| ふつうの餌 | 空腹を直接下げる |
| あまい餌 | 空腹と不安を下げるが依存的な挙動を生みやすい |
| 水滴 | 不安を下げる。時間で蒸発する |
| 草 | 軽い餌・落ち着き場・死後の循環要素 |
| ぬくい石 | 周辺温度を上げ、不安を下げる |
| ふわふわ | 寝床。睡眠回復を強める |
| つつく | 個体に一時的な不安と速度を与える |
| 迷い込み | 新規個体を追加する |
| &#x3075;&#x3064;&#x3046;&#x306E;&#x990C; | &#x7A7A;&#x8179;&#x3092;&#x76F4;&#x63A5;&#x4E0B;&#x3052;&#x308B; |
| &#x3042;&#x307E;&#x3044;&#x990C; | &#x7A7A;&#x8179;&#x3068;&#x4E0D;&#x5B89;&#x3092;&#x4E0B;&#x3052;&#x308B;&#x304C;&#x4F9D;&#x5B58;&#x7684;&#x306A;&#x6319;&#x52D5;&#x3092;&#x751F;&#x307F;&#x3084;&#x3059;&#x3044; |
| &#x6C34;&#x6EF4; | &#x4E0D;&#x5B89;&#x3092;&#x4E0B;&#x3052;&#x308B;&#x3002;&#x6642;&#x9593;&#x3067;&#x84B8;&#x767A;&#x3059;&#x308B; |
| &#x8349; | &#x8EFD;&#x3044;&#x990C;&#x30FB;&#x843D;&#x3061;&#x7740;&#x304D;&#x5834;&#x30FB;&#x6B7B;&#x5F8C;&#x306E;&#x5FAA;&#x74B0;&#x8981;&#x7D20; |
| &#x306C;&#x304F;&#x3044;&#x77F3; | &#x5468;&#x8FBA;&#x6E29;&#x5EA6;&#x3092;&#x4E0A;&#x3052;&#x3001;&#x4E0D;&#x5B89;&#x3092;&#x4E0B;&#x3052;&#x308B; |
| &#x3075;&#x308F;&#x3075;&#x308F; | &#x5BDD;&#x5E8A;&#x3002;&#x7761;&#x7720;&#x56DE;&#x5FA9;&#x3092;&#x5F37;&#x3081;&#x308B; |
| &#x3064;&#x3064;&#x304F; | &#x500B;&#x4F53;&#x306B;&#x4E00;&#x6642;&#x7684;&#x306A;&#x4E0D;&#x5B89;&#x3068;&#x901F;&#x5EA6;&#x3092;&#x4E0E;&#x3048;&#x308B; |
| &#x8FF7;&#x3044;&#x8FBC;&#x307F; | &#x65B0;&#x898F;&#x500B;&#x4F53;&#x3092;&#x8FFD;&#x52A0;&#x3059;&#x308B; |
## 生死
## &#x751F;&#x6B7B;
死亡条件は現在、主に以下。
&#x6B7B;&#x4EA1;&#x6761;&#x4EF6;&#x306F;&#x73FE;&#x5728;&#x3001;&#x4E3B;&#x306B;&#x4EE5;&#x4E0B;&#x3002;
- 空腹過多
- 寿命
- 不安過多
- 空腹と眠気の複合
- &#x7A7A;&#x8179;&#x904E;&#x591A;
- &#x5BFF;&#x547D;
- &#x4E0D;&#x5B89;&#x904E;&#x591A;
- &#x7A7A;&#x8179;&#x3068;&#x7720;&#x6C17;&#x306E;&#x8907;&#x5408;
死亡時には「たりない跡」が生成され、一定確率で草も発生する。
これは観察ゲームとして「失敗」ではなく、生態系の記録として扱う。
&#x6B7B;&#x4EA1;&#x6642;&#x306B;&#x306F;&#x300C;&#x305F;&#x308A;&#x306A;&#x3044;&#x8DE1;&#x300D;&#x304C;&#x751F;&#x6210;&#x3055;&#x308C;&#x3001;&#x4E00;&#x5B9A;&#x78BA;&#x7387;&#x3067;&#x8349;&#x3082;&#x767A;&#x751F;&#x3059;&#x308B;&#x3002;
&#x3053;&#x308C;&#x306F;&#x89B3;&#x5BDF;&#x30B2;&#x30FC;&#x30E0;&#x3068;&#x3057;&#x3066;&#x300C;&#x5931;&#x6557;&#x300D;&#x3067;&#x306F;&#x306A;&#x304F;&#x3001;&#x751F;&#x614B;&#x7CFB;&#x306E;&#x8A18;&#x9332;&#x3068;&#x3057;&#x3066;&#x6271;&#x3046;&#x3002;
## 繁殖
## &#x7E41;&#x6B96;
近距離にいる2個体が、以下を満たすと低確率で新個体が発生する。
&#x8FD1;&#x8DDD;&#x96E2;&#x306B;&#x3044;&#x308B;2&#x500B;&#x4F53;&#x304C;&#x3001;&#x4EE5;&#x4E0B;&#x3092;&#x6E80;&#x305F;&#x3059;&#x3068;&#x4F4E;&#x78BA;&#x7387;&#x3067;&#x65B0;&#x500B;&#x4F53;&#x304C;&#x767A;&#x751F;&#x3059;&#x308B;&#x3002;
- 空腹が高すぎない
- 眠気残量が十分ある
- 繁殖クールダウンが終わっている
- コロニーが過密でない
- &#x7A7A;&#x8179;&#x304C;&#x9AD8;&#x3059;&#x304E;&#x306A;&#x3044;
- &#x7720;&#x6C17;&#x6B8B;&#x91CF;&#x304C;&#x5341;&#x5206;&#x3042;&#x308B;
- &#x7E41;&#x6B96;&#x30AF;&#x30FC;&#x30EB;&#x30C0;&#x30A6;&#x30F3;&#x304C;&#x7D42;&#x308F;&#x3063;&#x3066;&#x3044;&#x308B;
- &#x30B3;&#x30ED;&#x30CB;&#x30FC;&#x304C;&#x904E;&#x5BC6;&#x3067;&#x306A;&#x3044;
子は親のタイプ・足りないものを一部継承し、低確率で変異する。
&#x5B50;&#x306F;&#x89AA;&#x306E;&#x30BF;&#x30A4;&#x30D7;&#x30FB;&#x8DB3;&#x308A;&#x306A;&#x3044;&#x3082;&#x306E;&#x3092;&#x4E00;&#x90E8;&#x7D99;&#x627F;&#x3057;&#x3001;&#x4F4E;&#x78BA;&#x7387;&#x3067;&#x5909;&#x7570;&#x3059;&#x308B;&#x3002;
## 設計上の注意
## &#x8A2D;&#x8A08;&#x4E0A;&#x306E;&#x6CE8;&#x610F;
- 完全な最適化ゲームに寄せすぎない
- 数値を見せつつ、ログ文で生態観察感を出す
- 介入は強いが万能ではない
- 死亡や衰退も観察価値として扱う
- 「むらさき」は画像作成者名のため、ゲーム内の異常現象名には使用していない
- &#x5B8C;&#x5168;&#x306A;&#x6700;&#x9069;&#x5316;&#x30B2;&#x30FC;&#x30E0;&#x306B;&#x5BC4;&#x305B;&#x3059;&#x304E;&#x306A;&#x3044;
- &#x6570;&#x5024;&#x3092;&#x898B;&#x305B;&#x3064;&#x3064;&#x3001;&#x30ED;&#x30B0;&#x6587;&#x3067;&#x751F;&#x614B;&#x89B3;&#x5BDF;&#x611F;&#x3092;&#x51FA;&#x3059;
- &#x4ECB;&#x5165;&#x306F;&#x5F37;&#x3044;&#x304C;&#x4E07;&#x80FD;&#x3067;&#x306F;&#x306A;&#x3044;
- &#x6B7B;&#x4EA1;&#x3084;&#x8870;&#x9000;&#x3082;&#x89B3;&#x5BDF;&#x4FA1;&#x5024;&#x3068;&#x3057;&#x3066;&#x6271;&#x3046;
- &#x300C;&#x3080;&#x3089;&#x3055;&#x304D;&#x300D;&#x306F;&#x753B;&#x50CF;&#x4F5C;&#x6210;&#x8005;&#x540D;&#x306E;&#x305F;&#x3081;&#x3001;&#x30B2;&#x30FC;&#x30E0;&#x5185;&#x306E;&#x7570;&#x5E38;&#x73FE;&#x8C61;&#x540D;&#x306B;&#x306F;&#x4F7F;&#x7528;&#x3057;&#x3066;&#x3044;&#x306A;&#x3044;
## v3設計メモ
## v3&#x8A2D;&#x8A08;&#x30E1;&#x30E2;
- 観察時間を伸ばすため、空腹・孤独の上昇をやや抑制し、寿命を長めにした。
- 図鑑は「達成」ではなく観察記録として扱う。スプライト、イベント、死因をゆるく解放する。
- 系譜は全個体を複雑なツリーで描画せず、出生ログとして読みやすさを優先した。
- 音は外部素材を使わず、Web Audioの短い合成音で実装した。ブラウザ仕様上、音 ON を押すまで鳴らない。
- &#x89B3;&#x5BDF;&#x6642;&#x9593;&#x3092;&#x4F38;&#x3070;&#x3059;&#x305F;&#x3081;&#x3001;&#x7A7A;&#x8179;&#x30FB;&#x5B64;&#x72EC;&#x306E;&#x4E0A;&#x6607;&#x3092;&#x3084;&#x3084;&#x6291;&#x5236;&#x3057;&#x3001;&#x5BFF;&#x547D;&#x3092;&#x9577;&#x3081;&#x306B;&#x3057;&#x305F;&#x3002;
- &#x56F3;&#x9451;&#x306F;&#x300C;&#x9054;&#x6210;&#x300D;&#x3067;&#x306F;&#x306A;&#x304F;&#x89B3;&#x5BDF;&#x8A18;&#x9332;&#x3068;&#x3057;&#x3066;&#x6271;&#x3046;&#x3002;&#x30B9;&#x30D7;&#x30E9;&#x30A4;&#x30C8;&#x3001;&#x30A4;&#x30D9;&#x30F3;&#x30C8;&#x3001;&#x6B7B;&#x56E0;&#x3092;&#x3086;&#x308B;&#x304F;&#x89E3;&#x653E;&#x3059;&#x308B;&#x3002;
- &#x7CFB;&#x8B5C;&#x306F;&#x5168;&#x500B;&#x4F53;&#x3092;&#x8907;&#x96D1;&#x306A;&#x30C4;&#x30EA;&#x30FC;&#x3067;&#x63CF;&#x753B;&#x305B;&#x305A;&#x3001;&#x51FA;&#x751F;&#x30ED;&#x30B0;&#x3068;&#x3057;&#x3066;&#x8AAD;&#x307F;&#x3084;&#x3059;&#x3055;&#x3092;&#x512A;&#x5148;&#x3057;&#x305F;&#x3002;
- &#x97F3;&#x306F;&#x5916;&#x90E8;&#x7D20;&#x6750;&#x3092;&#x4F7F;&#x308F;&#x305A;&#x3001;Web Audio&#x306E;&#x77ED;&#x3044;&#x5408;&#x6210;&#x97F3;&#x3067;&#x5B9F;&#x88C5;&#x3057;&#x305F;&#x3002;&#x30D6;&#x30E9;&#x30A6;&#x30B6;&#x4ED5;&#x69D8;&#x4E0A;&#x3001;&#x97F3; ON &#x3092;&#x62BC;&#x3059;&#x307E;&#x3067;&#x9CF4;&#x3089;&#x306A;&#x3044;&#x3002;
## v4 仕様追記
## v4 &#x4ED5;&#x69D8;&#x8FFD;&#x8A18;
### 子の追従
繁殖で生まれた子は `childGrowTime` の間、親のどちらか近い方を追従する。成長すると通常AIへ移行する。
### &#x5B50;&#x306E;&#x8FFD;&#x5F93;
&#x7E41;&#x6B96;&#x3067;&#x751F;&#x307E;&#x308C;&#x305F;&#x5B50;&#x306F; `childGrowTime` &#x306E;&#x9593;&#x3001;&#x89AA;&#x306E;&#x3069;&#x3061;&#x3089;&#x304B;&#x8FD1;&#x3044;&#x65B9;&#x3092;&#x8FFD;&#x5F93;&#x3059;&#x308B;&#x3002;&#x6210;&#x9577;&#x3059;&#x308B;&#x3068;&#x901A;&#x5E38;AI&#x3078;&#x79FB;&#x884C;&#x3059;&#x308B;&#x3002;
### 系譜
系譜は `family` レジストリで保持し、親子関係を樹状図で表示する。表示時は同じ個体を重複させず、共有された親子関係は複数の接続線で表す。
### &#x7CFB;&#x8B5C;
&#x7CFB;&#x8B5C;&#x306F; `family` &#x30EC;&#x30B8;&#x30B9;&#x30C8;&#x30EA;&#x3067;&#x4FDD;&#x6301;&#x3057;&#x3001;&#x89AA;&#x5B50;&#x95A2;&#x4FC2;&#x3092;&#x6A39;&#x72B6;&#x56F3;&#x3067;&#x8868;&#x793A;&#x3059;&#x308B;&#x3002;&#x8868;&#x793A;&#x6642;&#x306F;&#x540C;&#x3058;&#x500B;&#x4F53;&#x3092;&#x91CD;&#x8907;&#x3055;&#x305B;&#x305A;&#x3001;&#x5171;&#x6709;&#x3055;&#x308C;&#x305F;&#x89AA;&#x5B50;&#x95A2;&#x4FC2;&#x306F;&#x8907;&#x6570;&#x306E;&#x63A5;&#x7D9A;&#x7DDA;&#x3067;&#x8868;&#x3059;&#x3002;
### 食事エフェクト
食事パーティクルは表示頻度を抑え、対象アイテムの色を反映する。
### &#x98DF;&#x4E8B;&#x30A8;&#x30D5;&#x30A7;&#x30AF;&#x30C8;
&#x98DF;&#x4E8B;&#x30D1;&#x30FC;&#x30C6;&#x30A3;&#x30AF;&#x30EB;&#x306F;&#x8868;&#x793A;&#x983B;&#x5EA6;&#x3092;&#x6291;&#x3048;&#x3001;&#x5BFE;&#x8C61;&#x30A2;&#x30A4;&#x30C6;&#x30E0;&#x306E;&#x8272;&#x3092;&#x53CD;&#x6620;&#x3059;&#x308B;&#x3002;
### 喧嘩
近距離、低気分、怒り個体、過密などを条件に小さな喧嘩が発生する。喧嘩中は 02_angry を優先表示し、互いにノックバックする。
### &#x55A7;&#x5629;
&#x8FD1;&#x8DDD;&#x96E2;&#x3001;&#x4F4E;&#x6C17;&#x5206;&#x3001;&#x6012;&#x308A;&#x500B;&#x4F53;&#x3001;&#x904E;&#x5BC6;&#x306A;&#x3069;&#x3092;&#x6761;&#x4EF6;&#x306B;&#x5C0F;&#x3055;&#x306A;&#x55A7;&#x5629;&#x304C;&#x767A;&#x751F;&#x3059;&#x308B;&#x3002;&#x55A7;&#x5629;&#x4E2D;&#x306F; 02_angry &#x3092;&#x512A;&#x5148;&#x8868;&#x793A;&#x3057;&#x3001;&#x4E92;&#x3044;&#x306B;&#x30CE;&#x30C3;&#x30AF;&#x30D0;&#x30C3;&#x30AF;&#x3059;&#x308B;&#x3002;
### 昼夜
夜間・夕方の色を背景だけでなく、観察皿・アイテム・たりない本体にも重ねる。
### &#x663C;&#x591C;
&#x591C;&#x9593;&#x30FB;&#x5915;&#x65B9;&#x306E;&#x8272;&#x3092;&#x80CC;&#x666F;&#x3060;&#x3051;&#x3067;&#x306A;&#x304F;&#x3001;&#x89B3;&#x5BDF;&#x76BF;&#x30FB;&#x30A2;&#x30A4;&#x30C6;&#x30E0;&#x30FB;&#x305F;&#x308A;&#x306A;&#x3044;&#x672C;&#x4F53;&#x306B;&#x3082;&#x91CD;&#x306D;&#x308B;&#x3002;
## v5 仕様追記
## v5 &#x4ED5;&#x69D8;&#x8FFD;&#x8A18;
###
草はコロニー内に自動で発生する。草アイテムは `amount` を草量として持ち、時間でゆっくり伸びる。食べられると `amount` が減り、描画本数も減る。
### &#x8349;
&#x8349;&#x306F;&#x30B3;&#x30ED;&#x30CB;&#x30FC;&#x5185;&#x306B;&#x81EA;&#x52D5;&#x3067;&#x767A;&#x751F;&#x3059;&#x308B;&#x3002;&#x8349;&#x30A2;&#x30A4;&#x30C6;&#x30E0;&#x306F; `amount` &#x3092;&#x8349;&#x91CF;&#x3068;&#x3057;&#x3066;&#x6301;&#x3061;&#x3001;&#x6642;&#x9593;&#x3067;&#x3086;&#x3063;&#x304F;&#x308A;&#x4F38;&#x3073;&#x308B;&#x3002;&#x98DF;&#x3079;&#x3089;&#x308C;&#x308B;&#x3068; `amount` &#x304C;&#x6E1B;&#x308A;&#x3001;&#x63CF;&#x753B;&#x672C;&#x6570;&#x3082;&#x6E1B;&#x308B;&#x3002;
### 昼夜の描画修正
スプライト本体への色補正は `source-atop` の矩形塗りを廃止し、`ctx.filter` に変更した。これにより透過部分へ矩形状の色が乗る問題を避ける。
### &#x663C;&#x591C;&#x306E;&#x63CF;&#x753B;&#x4FEE;&#x6B63;
&#x30B9;&#x30D7;&#x30E9;&#x30A4;&#x30C8;&#x672C;&#x4F53;&#x3078;&#x306E;&#x8272;&#x88DC;&#x6B63;&#x306F; `source-atop` &#x306E;&#x77E9;&#x5F62;&#x5857;&#x308A;&#x3092;&#x5EC3;&#x6B62;&#x3057;&#x3001;`ctx.filter` &#x306B;&#x5909;&#x66F4;&#x3057;&#x305F;&#x3002;&#x3053;&#x308C;&#x306B;&#x3088;&#x308A;&#x900F;&#x904E;&#x90E8;&#x5206;&#x3078;&#x77E9;&#x5F62;&#x72B6;&#x306E;&#x8272;&#x304C;&#x4E57;&#x308B;&#x554F;&#x984C;&#x3092;&#x907F;&#x3051;&#x308B;&#x3002;
### 系譜
図鑑UIは削除し、系譜のみをメイン画面下部に配置する。
### &#x7CFB;&#x8B5C;
&#x56F3;&#x9451;UI&#x306F;&#x524A;&#x9664;&#x3057;&#x3001;&#x7CFB;&#x8B5C;&#x306E;&#x307F;&#x3092;&#x30E1;&#x30A4;&#x30F3;&#x753B;&#x9762;&#x4E0B;&#x90E8;&#x306B;&#x914D;&#x7F6E;&#x3059;&#x308B;&#x3002;
## v6 仕様追記
## v6 &#x4ED5;&#x69D8;&#x8FFD;&#x8A18;
### 頭突き喧嘩
喧嘩中は一定周期で相手へ突進し、近距離でノックバックと喧嘩エフェクトを発生させる。
### &#x982D;&#x7A81;&#x304D;&#x55A7;&#x5629;
&#x55A7;&#x5629;&#x4E2D;&#x306F;&#x4E00;&#x5B9A;&#x5468;&#x671F;&#x3067;&#x76F8;&#x624B;&#x3078;&#x7A81;&#x9032;&#x3057;&#x3001;&#x8FD1;&#x8DDD;&#x96E2;&#x3067;&#x30CE;&#x30C3;&#x30AF;&#x30D0;&#x30C3;&#x30AF;&#x3068;&#x55A7;&#x5629;&#x30A8;&#x30D5;&#x30A7;&#x30AF;&#x30C8;&#x3092;&#x767A;&#x751F;&#x3055;&#x305B;&#x308B;&#x3002;
### 睡眠
睡眠状態では速度をゼロにし、移動処理を行わない。寝床が近くても寝ながら移動しない。
### &#x7761;&#x7720;
&#x7761;&#x7720;&#x72B6;&#x614B;&#x3067;&#x306F;&#x901F;&#x5EA6;&#x3092;&#x30BC;&#x30ED;&#x306B;&#x3057;&#x3001;&#x79FB;&#x52D5;&#x51E6;&#x7406;&#x3092;&#x884C;&#x308F;&#x306A;&#x3044;&#x3002;&#x5BDD;&#x5E8A;&#x304C;&#x8FD1;&#x304F;&#x3066;&#x3082;&#x5BDD;&#x306A;&#x304C;&#x3089;&#x79FB;&#x52D5;&#x3057;&#x306A;&#x3044;&#x3002;
### カーソル反応
カーソルが近い場合、気分の良い個体は笑顔で寄り、不安・怒り・つつき記憶のある個体は逃げる。
### &#x30AB;&#x30FC;&#x30BD;&#x30EB;&#x53CD;&#x5FDC;
&#x30AB;&#x30FC;&#x30BD;&#x30EB;&#x304C;&#x8FD1;&#x3044;&#x5834;&#x5408;&#x3001;&#x6C17;&#x5206;&#x306E;&#x826F;&#x3044;&#x500B;&#x4F53;&#x306F;&#x7B11;&#x9854;&#x3067;&#x5BC4;&#x308A;&#x3001;&#x4E0D;&#x5B89;&#x30FB;&#x6012;&#x308A;&#x30FB;&#x3064;&#x3064;&#x304D;&#x8A18;&#x61B6;&#x306E;&#x3042;&#x308B;&#x500B;&#x4F53;&#x306F;&#x9003;&#x3052;&#x308B;&#x3002;
## v7 ビジュアル改修
## v7 &#x30D3;&#x30B8;&#x30E5;&#x30A2;&#x30EB;&#x6539;&#x4FEE;
- 背景をシャーレ風から庭の観察区画風へ変更。
- 地面は木枠に囲まれた明るい土床とし、細かな土粒、苔色のムラ、縁の草、野花を加えた。
- たりないとアイテムの接地影を追加し、庭の上に実在している感覚を強めた。
- 右上HUDと下部ラベルを観察札のような見た目へ調整。
- 親子の追従を視認しやすくするため、近距離では薄い点線ガイドを描く。
- &#x80CC;&#x666F;&#x3092;&#x30B7;&#x30E3;&#x30FC;&#x30EC;&#x98A8;&#x304B;&#x3089;&#x5EAD;&#x306E;&#x89B3;&#x5BDF;&#x533A;&#x753B;&#x98A8;&#x3078;&#x5909;&#x66F4;&#x3002;
- &#x5730;&#x9762;&#x306F;&#x6728;&#x67A0;&#x306B;&#x56F2;&#x307E;&#x308C;&#x305F;&#x660E;&#x308B;&#x3044;&#x571F;&#x5E8A;&#x3068;&#x3057;&#x3001;&#x7D30;&#x304B;&#x306A;&#x571F;&#x7C92;&#x3001;&#x82D4;&#x8272;&#x306E;&#x30E0;&#x30E9;&#x3001;&#x7E01;&#x306E;&#x8349;&#x3001;&#x91CE;&#x82B1;&#x3092;&#x52A0;&#x3048;&#x305F;&#x3002;
- &#x305F;&#x308A;&#x306A;&#x3044;&#x3068;&#x30A2;&#x30A4;&#x30C6;&#x30E0;&#x306E;&#x63A5;&#x5730;&#x5F71;&#x3092;&#x8FFD;&#x52A0;&#x3057;&#x3001;&#x5EAD;&#x306E;&#x4E0A;&#x306B;&#x5B9F;&#x5728;&#x3057;&#x3066;&#x3044;&#x308B;&#x611F;&#x899A;&#x3092;&#x5F37;&#x3081;&#x305F;&#x3002;
- &#x53F3;&#x4E0A;HUD&#x3068;&#x4E0B;&#x90E8;&#x30E9;&#x30D9;&#x30EB;&#x3092;&#x89B3;&#x5BDF;&#x672D;&#x306E;&#x3088;&#x3046;&#x306A;&#x898B;&#x305F;&#x76EE;&#x3078;&#x8ABF;&#x6574;&#x3002;
- &#x89AA;&#x5B50;&#x306E;&#x8FFD;&#x5F93;&#x3092;&#x8996;&#x8A8D;&#x3057;&#x3084;&#x3059;&#x304F;&#x3059;&#x308B;&#x305F;&#x3081;&#x3001;&#x8FD1;&#x8DDD;&#x96E2;&#x3067;&#x306F;&#x8584;&#x3044;&#x70B9;&#x7DDA;&#x30AC;&#x30A4;&#x30C9;&#x3092;&#x63CF;&#x304F;&#x3002;
## v8 ビジュアル / 実装改修
## v8 &#x30D3;&#x30B8;&#x30E5;&#x30A2;&#x30EB; / &#x5B9F;&#x88C5;&#x6539;&#x4FEE;
- 直射日光・月光の方向をもとに、たりないとアイテムへ投影影を付与。
- 背景では天体本体は描かず、空色と影方向のみで昼夜を表現する。
- 食事の蓄積で「ずんち」を排泄する消化処理を追加。
- 09_stretch は通常描画でも横にやや広く扱い、視認性を上げた。
- 系譜ツリーの接続線は擬似要素を再設計し、途切れにくい連結表現へ変更。
- 旧図鑑用の状態管理codexと未使用スタイルを整理。
- &#x76F4;&#x5C04;&#x65E5;&#x5149;&#x30FB;&#x6708;&#x5149;&#x306E;&#x65B9;&#x5411;&#x3092;&#x3082;&#x3068;&#x306B;&#x3001;&#x305F;&#x308A;&#x306A;&#x3044;&#x3068;&#x30A2;&#x30A4;&#x30C6;&#x30E0;&#x3078;&#x6295;&#x5F71;&#x5F71;&#x3092;&#x4ED8;&#x4E0E;&#x3002;
- &#x80CC;&#x666F;&#x3067;&#x306F;&#x5929;&#x4F53;&#x672C;&#x4F53;&#x306F;&#x63CF;&#x304B;&#x305A;&#x3001;&#x7A7A;&#x8272;&#x3068;&#x5F71;&#x65B9;&#x5411;&#x306E;&#x307F;&#x3067;&#x663C;&#x591C;&#x3092;&#x8868;&#x73FE;&#x3059;&#x308B;&#x3002;
- &#x98DF;&#x4E8B;&#x306E;&#x84C4;&#x7A4D;&#x3067;&#x300C;&#x305A;&#x3093;&#x3061;&#x300D;&#x3092;&#x6392;&#x6CC4;&#x3059;&#x308B;&#x6D88;&#x5316;&#x51E6;&#x7406;&#x3092;&#x8FFD;&#x52A0;&#x3002;
- 09_stretch &#x306F;&#x901A;&#x5E38;&#x63CF;&#x753B;&#x3067;&#x3082;&#x6A2A;&#x306B;&#x3084;&#x3084;&#x5E83;&#x304F;&#x6271;&#x3044;&#x3001;&#x8996;&#x8A8D;&#x6027;&#x3092;&#x4E0A;&#x3052;&#x305F;&#x3002;
- &#x7CFB;&#x8B5C;&#x30C4;&#x30EA;&#x30FC;&#x306E;&#x63A5;&#x7D9A;&#x7DDA;&#x306F;&#x64EC;&#x4F3C;&#x8981;&#x7D20;&#x3092;&#x518D;&#x8A2D;&#x8A08;&#x3057;&#x3001;&#x9014;&#x5207;&#x308C;&#x306B;&#x304F;&#x3044;&#x9023;&#x7D50;&#x8868;&#x73FE;&#x3078;&#x5909;&#x66F4;&#x3002;
- &#x65E7;&#x56F3;&#x9451;&#x7528;&#x306E;&#x72B6;&#x614B;&#x7BA1;&#x7406;&#xFF08;codex&#xFF09;&#x3068;&#x672A;&#x4F7F;&#x7528;&#x30B9;&#x30BF;&#x30A4;&#x30EB;&#x3092;&#x6574;&#x7406;&#x3002;
## v9 修正
## v9 &#x4FEE;&#x6B63;
- `ctx.filter = blur(...)` を使った影を廃止し、低負荷な楕円描画へ変更。
- 背景装飾のループ数を削減し、毎フレームの描画負荷を下げた。
- 死亡時の `splat` は amount を連続的なアルファ値へ反映し、数分かけてフェードアウトする。
- `ctx.filter = blur(...)` &#x3092;&#x4F7F;&#x3063;&#x305F;&#x5F71;&#x3092;&#x5EC3;&#x6B62;&#x3057;&#x3001;&#x4F4E;&#x8CA0;&#x8377;&#x306A;&#x6955;&#x5186;&#x63CF;&#x753B;&#x3078;&#x5909;&#x66F4;&#x3002;
- &#x80CC;&#x666F;&#x88C5;&#x98FE;&#x306E;&#x30EB;&#x30FC;&#x30D7;&#x6570;&#x3092;&#x524A;&#x6E1B;&#x3057;&#x3001;&#x6BCE;&#x30D5;&#x30EC;&#x30FC;&#x30E0;&#x306E;&#x63CF;&#x753B;&#x8CA0;&#x8377;&#x3092;&#x4E0B;&#x3052;&#x305F;&#x3002;
- &#x6B7B;&#x4EA1;&#x6642;&#x306E; `splat` &#x306F; amount &#x3092;&#x9023;&#x7D9A;&#x7684;&#x306A;&#x30A2;&#x30EB;&#x30D5;&#x30A1;&#x5024;&#x3078;&#x53CD;&#x6620;&#x3057;&#x3001;&#x6570;&#x5206;&#x304B;&#x3051;&#x3066;&#x30D5;&#x30A7;&#x30FC;&#x30C9;&#x30A2;&#x30A6;&#x30C8;&#x3059;&#x308B;&#x3002;

View file

@ -3,17 +3,16 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>たりない観察</title>
<link rel="stylesheet" href="css/styles.css" />
<title>&#x305F;&#x308A;&#x306A;&#x3044;&#x89B3;&#x5BDF;</title>
<link rel="stylesheet" href="css/styles.css?v=9.0.0" />
</head>
<body>
<div id="app">
<header class="topbar">
<div class="top-left">
<a class="btn room-link" href="https://host.nishi.boats/~333/">333の部屋に移動</a>
<a class="btn room-link" href="https://host.nishi.boats/~333/">333&#x306E;&#x90E8;&#x5C4B;&#x306B;&#x79FB;&#x52D5;</a>
<div class="brand">
<h1>たりない観察</h1>
<p class="subtitle">操作: 左クリックで選択・配置 / つまむでドラッグ / 右ドラッグでパン / ホイールで拡大縮小</p>
<h1>&#x305F;&#x308A;&#x306A;&#x3044;&#x89B3;&#x5BDF;</h1>
</div>
</div>
<div class="top-actions">
@ -21,7 +20,7 @@
<button id="speedBtn" class="btn">&#x901F;&#x5EA6; x1</button>
<button id="ecologyBtn" class="btn">&#x305F;&#x308A;&#x306A;&#x3044;&#x306E;&#x751F;&#x614B;</button>
<button id="soundBtn" class="btn">&#x97F3; OFF</button>
<button id="creditsBtn" class="btn">クレジット</button>
<button id="creditsBtn" class="btn">&#x30AF;&#x30EC;&#x30B8;&#x30C3;&#x30C8;</button>
<button id="resetBtn" class="btn danger">&#x30EA;&#x30BB;&#x30C3;&#x30C8;</button>
</div>
</header>
@ -43,7 +42,7 @@
<button class="tool selected" data-tool="observe"><span>O</span>&#x89B3;&#x5BDF;</button>
<button class="tool" data-tool="delete"><span>D</span>&#x524A;&#x9664;</button>
<button class="tool" data-tool="poke"><span>P</span>&#x3064;&#x3064;&#x304F;</button>
<button class="tool" data-tool="pinch"><span>T</span>&#x3064;&#x307E;&#x3080;</button>
<button class="tool" data-tool="pinch"><span>&#x1F90F;</span>&#x3064;&#x307E;&#x3080;</button>
<button class="tool" data-tool="new"><span>N</span>&#x8FFD;&#x52A0;</button>
</div>
</section>
@ -52,8 +51,8 @@
<div class="tool-grid tool-category-body">
<button class="tool" data-tool="zunchi"><span>Z</span>&#x305A;&#x3093;&#x3061;</button>
<button class="tool" data-tool="sweet"><span>S</span>&#x305A;&#x3093;&#x3060;&#x9905;</button>
<button class="tool" data-tool="love_mochi"><span>M</span>&#x5A9A;&#x85AC;&#x9905;</button>
<button class="tool" data-tool="fight_mochi"><span>K</span>&#x55A7;&#x5629;&#x9905;</button>
<button class="tool" data-tool="love_mochi"><span>H</span>&#x3078;&#x3053;&#x9905;</button>
<button class="tool" data-tool="fight_mochi"><span>K</span>&#x3051;&#x3093;&#x304B;&#x9905;</button>
<button class="tool" data-tool="water"><span>W</span>&#x6C34;</button>
<button class="tool" data-tool="grass"><span>G</span>&#x8349;</button>
</div>
@ -124,78 +123,76 @@
<div id="creditsDialog" class="field-dialog hidden" role="dialog" aria-modal="true" aria-labelledby="creditsDialogTitle">
<div class="field-dialog-panel credits-dialog-panel">
<h2 id="creditsDialogTitle">クレジット</h2>
<h2 id="creditsDialogTitle">&#x30AF;&#x30EC;&#x30B8;&#x30C3;&#x30C8;</h2>
<div class="credits-content">
<p><strong>製作:</strong> 333</p>
<p><strong>たりない:</strong> むらさき氏</p>
<p><strong>効果音:</strong> VOICEVOX: ずんだもん 効果音ラボ: <a href="https://soundeffect-lab.info/" target="_blank" rel="noopener">https://soundeffect-lab.info/</a></p>
<p><strong>&#x88FD;&#x4F5C;:</strong> 333</p>
<p><strong>&#x305F;&#x308A;&#x306A;&#x3044;:</strong> &#x3080;&#x3089;&#x3055;&#x304D;&#x6C0F;</p>
<p><strong>&#x52B9;&#x679C;&#x97F3;:</strong> VOICEVOX: &#x305A;&#x3093;&#x3060;&#x3082;&#x3093;&#x3000;&#x52B9;&#x679C;&#x97F3;&#x30E9;&#x30DC;: <a href="https://soundeffect-lab.info/" target="_blank" rel="noopener">https://soundeffect-lab.info/</a></p>
</div>
<div class="field-dialog-actions credits-actions">
<button id="creditsCloseBtn" class="btn" type="button">閉じる</button>
<button id="creditsCloseBtn" class="btn" type="button">&#x9589;&#x3058;&#x308B;</button>
</div>
</div>
</div>
<div id="archiveResetDialog" class="field-dialog hidden" role="dialog" aria-modal="true" aria-labelledby="archiveResetDialogTitle">
<div class="field-dialog-panel archive-reset-dialog-panel">
<h2 id="archiveResetDialogTitle">家系図をリセットしますか?</h2>
<p class="hint">現在の親子関係と世代情報を消去します。個体そのものや庭の状態は消えません。</p>
<h2 id="archiveResetDialogTitle">&#x5BB6;&#x7CFB;&#x56F3;&#x3092;&#x30EA;&#x30BB;&#x30C3;&#x30C8;&#x3057;&#x307E;&#x3059;&#x304B;&#xFF1F;</h2>
<p class="hint">&#x73FE;&#x5728;&#x306E;&#x89AA;&#x5B50;&#x95A2;&#x4FC2;&#x3068;&#x4E16;&#x4EE3;&#x60C5;&#x5831;&#x3092;&#x6D88;&#x53BB;&#x3057;&#x307E;&#x3059;&#x3002;&#x500B;&#x4F53;&#x305D;&#x306E;&#x3082;&#x306E;&#x3084;&#x5EAD;&#x306E;&#x72B6;&#x614B;&#x306F;&#x6D88;&#x3048;&#x307E;&#x305B;&#x3093;&#x3002;</p>
<div class="field-dialog-actions archive-reset-actions">
<button id="archiveResetCancelBtn" class="btn" type="button">キャンセル</button>
<button id="archiveResetConfirmBtn" class="btn danger" type="button">リセットする</button>
<button id="archiveResetCancelBtn" class="btn" type="button">&#x30AD;&#x30E3;&#x30F3;&#x30BB;&#x30EB;</button>
<button id="archiveResetConfirmBtn" class="btn danger" type="button">&#x30EA;&#x30BB;&#x30C3;&#x30C8;&#x3059;&#x308B;</button>
</div>
</div>
</div>
<div id="ecologyDialog" class="field-dialog hidden" role="dialog" aria-modal="true" aria-labelledby="ecologyDialogTitle">
<div class="field-dialog-panel ecology-dialog-panel">
<h2 id="ecologyDialogTitle">たりないの生態</h2>
<h2 id="ecologyDialogTitle">&#x305F;&#x308A;&#x306A;&#x3044;&#x306E;&#x751F;&#x614B;</h2>
<div class="ecology-grid">
<section class="ecology-card">
<img src="assets/sprites/tarinai_05_drool.png" alt="">
<div><strong>食べる</strong><p>お腹がすくと食べ物や草を探します。食べられない時間が長いと弱っていきます。</p></div>
<img data-src="assets/sprites/tarinai_05_drool.png" loading="lazy" decoding="async" alt="">
<div><strong>&#x98DF;&#x3079;&#x308B;</strong><p>&#x304A;&#x8179;&#x304C;&#x3059;&#x304F;&#x3068;&#x98DF;&#x3079;&#x7269;&#x3084;&#x8349;&#x3092;&#x63A2;&#x3057;&#x307E;&#x3059;&#x3002;&#x98DF;&#x3079;&#x3089;&#x308C;&#x306A;&#x3044;&#x6642;&#x9593;&#x304C;&#x9577;&#x3044;&#x3068;&#x5F31;&#x3063;&#x3066;&#x3044;&#x304D;&#x307E;&#x3059;&#x3002;</p></div>
</section>
<section class="ecology-card">
<img src="assets/sprites/tarinai_07_sleep.png" alt="">
<div><strong>眠る</strong><p>疲れるとその場や寝床で眠ります。休めると元気を取り戻します。</p></div>
<img data-src="assets/sprites/tarinai_07_sleep.png" loading="lazy" decoding="async" alt="">
<div><strong>&#x7720;&#x308B;</strong><p>&#x75B2;&#x308C;&#x308B;&#x3068;&#x305D;&#x306E;&#x5834;&#x3084;&#x5BDD;&#x5E8A;&#x3067;&#x7720;&#x308A;&#x307E;&#x3059;&#x3002;&#x4F11;&#x3081;&#x308B;&#x3068;&#x5143;&#x6C17;&#x3092;&#x53D6;&#x308A;&#x623B;&#x3057;&#x307E;&#x3059;&#x3002;</p></div>
</section>
<section class="ecology-card">
<img src="assets/sprites/tarinai_21_normal_happy.png" alt="">
<div><strong>なつく</strong><p>気分がよい個体はカーソルや仲間に寄ってきます。やさしく構うと落ち着きやすくなります。</p></div>
<img data-src="assets/sprites/tarinai_21_normal_happy.png" loading="lazy" decoding="async" alt="">
<div><strong>&#x306A;&#x3064;&#x304F;</strong><p>&#x6C17;&#x5206;&#x304C;&#x3088;&#x3044;&#x500B;&#x4F53;&#x306F;&#x30AB;&#x30FC;&#x30BD;&#x30EB;&#x3084;&#x4EF2;&#x9593;&#x306B;&#x5BC4;&#x3063;&#x3066;&#x304D;&#x307E;&#x3059;&#x3002;&#x3084;&#x3055;&#x3057;&#x304F;&#x69CB;&#x3046;&#x3068;&#x843D;&#x3061;&#x7740;&#x304D;&#x3084;&#x3059;&#x304F;&#x306A;&#x308A;&#x307E;&#x3059;&#x3002;</p></div>
</section>
<section class="ecology-card">
<img src="assets/sprites/tarinai_24_stress_dizzy.png" alt="">
<div><strong>関係が変わる</strong><p>近くで過ごすうちに仲良しや苦手が生まれます。強いストレスは行動や表情に出ます。</p></div>
<img data-src="assets/sprites/tarinai_24_stress_dizzy.png" loading="lazy" decoding="async" alt="">
<div><strong>&#x95A2;&#x4FC2;&#x304C;&#x5909;&#x308F;&#x308B;</strong><p>&#x8FD1;&#x304F;&#x3067;&#x904E;&#x3054;&#x3059;&#x3046;&#x3061;&#x306B;&#x4EF2;&#x826F;&#x3057;&#x3084;&#x82E6;&#x624B;&#x304C;&#x751F;&#x307E;&#x308C;&#x307E;&#x3059;&#x3002;&#x5F37;&#x3044;&#x30B9;&#x30C8;&#x30EC;&#x30B9;&#x306F;&#x884C;&#x52D5;&#x3084;&#x8868;&#x60C5;&#x306B;&#x51FA;&#x307E;&#x3059;&#x3002;</p></div>
</section>
<section class="ecology-card">
<img src="assets/sprites/tarinai_27_birth_ritual.png" alt="">
<div><strong>増える</strong><p>落ち着いた相手どうしから新しい個体が生まれ、家系図に親子関係が残ります。</p></div>
<img data-src="assets/sprites/tarinai_27_birth_ritual.png" loading="lazy" decoding="async" alt="">
<div><strong>&#x5897;&#x3048;&#x308B;</strong><p>&#x843D;&#x3061;&#x7740;&#x3044;&#x305F;&#x76F8;&#x624B;&#x3069;&#x3046;&#x3057;&#x304B;&#x3089;&#x65B0;&#x3057;&#x3044;&#x500B;&#x4F53;&#x304C;&#x751F;&#x307E;&#x308C;&#x3001;&#x5BB6;&#x7CFB;&#x56F3;&#x306B;&#x89AA;&#x5B50;&#x95A2;&#x4FC2;&#x304C;&#x6B8B;&#x308A;&#x307E;&#x3059;&#x3002;</p></div>
</section>
<section class="ecology-card">
<img src="assets/sprites/tarinai_18_fear.png" alt="">
<div><strong>環境の影響</strong><p>雨や食べ物不足、つつき、喧嘩などで暮らしぶりが変わります。庭の配置も大切です。</p></div>
<img data-src="assets/sprites/tarinai_18_fear.png" loading="lazy" decoding="async" alt="">
<div><strong>&#x74B0;&#x5883;&#x306E;&#x5F71;&#x97FF;</strong><p>&#x96E8;&#x3084;&#x98DF;&#x3079;&#x7269;&#x4E0D;&#x8DB3;&#x3001;&#x3064;&#x3064;&#x304D;&#x3001;&#x55A7;&#x5629;&#x306A;&#x3069;&#x3067;&#x66AE;&#x3089;&#x3057;&#x3076;&#x308A;&#x304C;&#x5909;&#x308F;&#x308A;&#x307E;&#x3059;&#x3002;&#x5EAD;&#x306E;&#x914D;&#x7F6E;&#x3082;&#x5927;&#x5207;&#x3067;&#x3059;&#x3002;</p></div>
</section>
</div>
<div class="field-dialog-actions">
<button id="ecologyCloseBtn" class="btn" type="button">閉じる</button>
<button id="ecologyCloseBtn" class="btn" type="button">&#x9589;&#x3058;&#x308B;</button>
</div>
</div>
</div>
<script src="js/data.js"></script>
<script src="js/math.js"></script>
<script src="js/assets.js"></script>
<script src="js/audio.js"></script>
<script src="js/render.js"></script>
<script src="js/sim_core.js"></script>
<script src="js/items.js"></script>
<script src="js/tarinai.js"></script>
<script src="js/world.js"></script>
<script src="js/sim.js"></script>
<script src="js/ui.js"></script>
<script src="js/ui_charts.js"></script>
<script src="js/ui_family.js"></script>
<script src="js/ui_exports.js"></script>
<script src="js/main.js"></script>
<script src="js/data.js?v=9.0.0"></script>
<script src="js/math.js?v=9.0.0"></script>
<script src="js/assets.js?v=9.0.0"></script>
<script src="js/audio.js?v=9.0.0"></script>
<script src="js/render.js?v=9.0.0"></script>
<script src="js/sim_core.js?v=9.0.0"></script>
<script src="js/items.js?v=9.0.0"></script>
<script src="js/tarinai.js?v=9.0.0"></script>
<script src="js/world.js?v=9.0.0"></script>
<script src="js/ui.js?v=9.0.0"></script>
<script src="js/ui_charts.js?v=9.0.0"></script>
<script src="js/ui_family.js?v=9.0.0"></script>
<script src="js/main.js?v=9.0.0"></script>
</body>
</html>

View file

@ -2,10 +2,15 @@
const images = new Map();
const imageBoundsCache = new WeakMap();
const imageMetrics = new Map();
const imagePromises = new Map();
const imageAssetIndex = new Map();
const scaledSpriteCache = new Map();
const stainOverlayCache = new Map();
const INITIAL_IMAGE_IDS = new Set(["smile", "zunchi", "zunchi_02"]);
const EARLY_IMAGE_IDS = new Set(["smile", "angry", "teary", "jito", "drool", "cry", "sleep", "pokan", "normal_smirk", "normal_tongue", "normal_happy", "weak", "hurt", "hurt2", "zunchi", "zunchi_02"]);
function trimCanvasCache(cache, limit = 420) {
while (cache.size > limit) {
const first = cache.keys().next().value;
@ -79,32 +84,111 @@ function getCachedStainOverlayCanvas(id, img, w, h, stain = 0, seed = 0.5) {
return canvas;
}
function loadImages() {
const assets = [...SPRITES, ...DECOR_ASSETS];
let loaded = 0;
return new Promise((resolve) => {
for (const s of assets) {
const img = new Image();
img.onload = img.onerror = () => {
const w = img.naturalWidth || img.width || ALPHA_BOUNDS[s.id]?.imageW || 512;
const h = img.naturalHeight || img.height || ALPHA_BOUNDS[s.id]?.imageH || 512;
const bounds = ALPHA_BOUNDS[s.id] || { x: 0, y: 0, w, h, imageW: w, imageH: h };
imageMetrics.set(s.id, {
w,
h,
ratio: h / Math.max(w, 1),
visibleBottomRatio: (bounds.y + bounds.h) / Math.max(bounds.imageH, 1),
});
loaded += 1;
if (loaded === assets.length) resolve();
};
img.alphaBounds = ALPHA_BOUNDS[s.id] || null;
img.src = s.path;
images.set(s.id, img);
}
function primeImageMetrics(asset) {
if (!asset || imageMetrics.has(asset.id)) return;
const bounds = ALPHA_BOUNDS[asset.id];
const w = bounds?.imageW || 512;
const h = bounds?.imageH || 512;
imageMetrics.set(asset.id, {
w,
h,
ratio: h / Math.max(w, 1),
visibleBottomRatio: bounds ? (bounds.y + bounds.h) / Math.max(bounds.imageH, 1) : 1,
});
}
function setupAssetIndex() {
if (imageAssetIndex.size) return;
for (const asset of [...SPRITES, ...DECOR_ASSETS]) {
imageAssetIndex.set(asset.id, asset);
primeImageMetrics(asset);
}
}
function markImageLoaded(asset, img) {
const w = img.naturalWidth || img.width || ALPHA_BOUNDS[asset.id]?.imageW || 512;
const h = img.naturalHeight || img.height || ALPHA_BOUNDS[asset.id]?.imageH || 512;
const bounds = ALPHA_BOUNDS[asset.id] || { x: 0, y: 0, w, h, imageW: w, imageH: h };
imageMetrics.set(asset.id, {
w,
h,
ratio: h / Math.max(w, 1),
visibleBottomRatio: (bounds.y + bounds.h) / Math.max(bounds.imageH, 1),
});
}
function isImageReady(id) {
const img = images.get(id);
return !!(img && img.complete && (img.naturalWidth || img.width));
}
function loadImageAsset(asset, priority = "auto") {
if (!asset) return Promise.resolve(null);
setupAssetIndex();
primeImageMetrics(asset);
if (isImageReady(asset.id)) return Promise.resolve(images.get(asset.id));
if (imagePromises.has(asset.id)) return imagePromises.get(asset.id);
const img = images.get(asset.id) || new Image();
img.decoding = "async";
if ("fetchPriority" in img) img.fetchPriority = priority;
img.alphaBounds = ALPHA_BOUNDS[asset.id] || null;
images.set(asset.id, img);
const promise = new Promise((resolve) => {
img.onload = () => { markImageLoaded(asset, img); resolve(img); };
img.onerror = () => { resolve(null); };
});
imagePromises.set(asset.id, promise);
if (!img.src) img.src = asset.path;
return promise;
}
function ensureImage(id) {
setupAssetIndex();
const asset = imageAssetIndex.get(id);
if (!asset) return null;
primeImageMetrics(asset);
const existing = images.get(id);
if (!existing || !existing.src) loadImageAsset(asset, "low");
return images.get(id) || null;
}
function getRenderableImage(id, fallbackId = "smile") {
if (id) ensureImage(id);
if (isImageReady(id)) return images.get(id);
if (fallbackId && fallbackId !== id) ensureImage(fallbackId);
if (isImageReady(fallbackId)) return images.get(fallbackId);
return null;
}
function loadImages(ids = null) {
setupAssetIndex();
const requested = ids ? new Set(ids) : INITIAL_IMAGE_IDS;
const tasks = [];
for (const id of requested) {
const asset = imageAssetIndex.get(id);
if (asset) tasks.push(loadImageAsset(asset, "high"));
}
return Promise.all(tasks).then(() => undefined);
}
function startBackgroundImageLoading() {
setupAssetIndex();
const allAssets = [...SPRITES, ...DECOR_ASSETS];
const loadGroup = (ids, priority = "low") => {
for (const id of ids) {
const asset = imageAssetIndex.get(id);
if (asset) loadImageAsset(asset, priority);
}
};
const schedule = window.requestIdleCallback
? (fn, timeout = 1200) => window.requestIdleCallback(fn, { timeout })
: (fn) => setTimeout(fn, 60);
schedule(() => loadGroup(EARLY_IMAGE_IDS, "auto"), 450);
schedule(() => {
for (const asset of allAssets) loadImageAsset(asset, "low");
}, 2200);
}
function imageAlphaBounds(img) {
if (!img) return null;
if (img.alphaBounds) return img.alphaBounds;
@ -119,7 +203,12 @@ function imageAlphaBounds(img) {
}
function getImageMetrics(idOrImg) {
if (typeof idOrImg === "string") return imageMetrics.get(idOrImg) || null;
if (typeof idOrImg === "string") {
setupAssetIndex();
const asset = imageAssetIndex.get(idOrImg);
if (asset) primeImageMetrics(asset);
return imageMetrics.get(idOrImg) || null;
}
if (!idOrImg) return null;
for (const [id, img] of images) {
if (img === idOrImg) return imageMetrics.get(id) || null;
@ -129,5 +218,6 @@ function getImageMetrics(idOrImg) {
return w && h ? { w, h, ratio: h / w, visibleBottomRatio: 1 } : null;
}
setupAssetIndex();
window.TarinaiAssets = { images, imageBoundsCache, imageMetrics, scaledSpriteCache, stainOverlayCache, loadImages, imageAlphaBounds, getImageMetrics, getCachedSpriteCanvas, getCachedStainOverlayCanvas };
window.TarinaiAssets = { images, imageBoundsCache, imageMetrics, imagePromises, scaledSpriteCache, stainOverlayCache, loadImages, startBackgroundImageLoading, ensureImage, isImageReady, getRenderableImage, imageAlphaBounds, getImageMetrics, getCachedSpriteCanvas, getCachedStainOverlayCanvas };

View file

@ -72,6 +72,8 @@ const CONFIG = {
initialPopulation: 18,
maxPopulation: Number.MAX_SAFE_INTEGER,
itemLimit: 260,
fenceLimit: 72,
maxFenceCollisionChecks: 18,
zunchiLimit: 56,
traceLimit: 64,
splatLimit: 48,

View file

@ -120,6 +120,8 @@ class Item {
if (this.y < p) { this.y = p; this.vy = Math.abs(this.vy || 0) * 0.72; this.spinVelocity *= -0.72; }
if (this.y > worldRef.h - p) { this.y = worldRef.h - p; this.vy = -Math.abs(this.vy || 0) * 0.72; this.spinVelocity *= -0.72; }
this.resolveBallObstacleCollisions(dt, worldRef);
this.x = clamp(this.x, p, worldRef.w - p);
this.y = clamp(this.y, p, worldRef.h - p);
clampVelocity();
const groundFriction = Math.pow(0.72, dt);
this.vx *= groundFriction;
@ -135,6 +137,8 @@ class Item {
const speed = Math.hypot(this.vx || 0, this.vy || 0);
const searchRadius = Math.max(130, (this.r || 18) + speed * Math.max(dt || 0.016, 0.016) + 96);
const items = worldRef.nearbyItems(this.x, this.y, searchRadius) || [];
let fenceChecks = 0;
const maxFenceChecks = CONFIG.maxFenceCollisionChecks ?? 18;
for (const it of items) {
if (!it || it === this || it.dead) continue;
if (it.type === "bed") {
@ -142,6 +146,8 @@ class Item {
} else if (it.type === "stone") {
this.resolveBallCircleBounce(it, (it.r || 20) * 1.08 + (this.r || 18), 0.82, worldRef);
} else if (it.type === "fence_v" || it.type === "fence_h") {
if (fenceChecks >= maxFenceChecks) continue;
fenceChecks += 1;
this.resolveBallFenceBounce(it, worldRef);
}
}
@ -467,7 +473,7 @@ class Item {
const shadow = projectedShadowParams(lightState, Math.max(0.4, this.r / 18));
if (this.type !== "trace" && this.type !== "splat") {
const zunchiId = this.type === "zunchi" ? (this.zunchiVariant || "zunchi") : null;
const zunchiImg = zunchiId ? (images.get(zunchiId) || images.get("zunchi")) : null;
const zunchiImg = zunchiId ? (typeof getRenderableImage === "function" ? getRenderableImage(zunchiId, "zunchi") : (images.get(zunchiId) || images.get("zunchi"))) : null;
if (zunchiImg) {
const metrics = getImageMetrics(zunchiId || "zunchi") || getImageMetrics("zunchi");
const ratio = metrics?.ratio || 178 / 236;
@ -528,7 +534,7 @@ class Item {
ctx.font = `${Math.round((this.r || 13) * 1.15)}px sans-serif`;
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText("", 0, 1);
ctx.fillText("\u2764", 0, 1);
ctx.fillStyle = "rgba(255,255,255,0.55)";
ctx.beginPath();
ctx.ellipse(-this.r * 0.28, -this.r * 0.18, this.r * 0.23, this.r * 0.10, -0.35, 0, Math.PI * 2);
@ -538,7 +544,7 @@ class Item {
ctx.font = `${Math.round((this.r || 13) * 1.02)}px sans-serif`;
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText("", 0, 1);
ctx.fillText("\u2726", 0, 1);
ctx.strokeStyle = "rgba(168,76,42,0.72)";
ctx.lineWidth = 1.4;
ctx.beginPath();
@ -637,7 +643,7 @@ class Item {
ctx.font = `${Math.round((this.r || 18) * 2.0)}px "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif`;
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText("", 0, 1);
ctx.fillText("\u26bd", 0, 1);
if (moving > 0.55) {
ctx.globalAlpha = 0.14 + moving * 0.10;
ctx.shadowColor = "transparent";

View file

@ -48,5 +48,6 @@ loadImages().then(() => {
render();
renderStats();
syncTopButtons();
if (typeof startBackgroundImageLoading === "function") startBackgroundImageLoading();
loop();
});

View file

@ -681,9 +681,9 @@ function drawSelectedCard(ctx, world, lighting) {
const w = world.viewportW || world.w;
const h = world.viewportH || world.h;
const cardW = 152;
const cardH = 66;
const cardH = 80;
let x = t.x + 18;
let y = t.y - 86;
let y = t.y - 100;
x = clamp(x, 10, w - cardW - 10);
y = clamp(y, 10, h - cardH - 10);
ctx.save();
@ -699,8 +699,10 @@ function drawSelectedCard(ctx, world, lighting) {
const child = t.juvenile && t.parentToFollow?.() ? " / \u5b50" : "";
const zHint = t.digest > 4.9 ? " / \u305a\u3093\u3061" : "";
ctx.fillText(`${stateLabel(t.state)}${child}${zHint}`, x + 10, y + 35);
const personality = t.personalityLabel ? t.personalityLabel() : (t.personality || "\u4e0d\u660e");
ctx.fillText(`\u6027\u683c ${personality}`, x + 10, y + 52);
const genLabel = (t.displayGeneration && t.displayGeneration()) ? ` \u4e16\u4ee3 ${t.generation}` : "";
ctx.fillText(`\u6c17\u5206 ${fmt(t.mood)}${genLabel} \u4f53\u529b ${fmt(t.energy)}`, x + 10, y + 52);
ctx.fillText(`\u6c17\u5206 ${fmt(t.mood)}${genLabel} \u4f53\u529b ${fmt(t.energy)}`, x + 10, y + 68);
ctx.restore();
}

View file

@ -1,3 +1,3 @@
"use strict";
"use strict";
window.TarinaiSim = { makeName, makeTrait, PERSONALITIES, SpatialGrid, Effect, Item, Tarinai, World, world };

View file

@ -30,11 +30,18 @@ class Tarinai {
this.energy = opts.energy ?? rand(54, 98);
this.stress = opts.stress ?? rand(0, 20);
this.hpBarTimer = opts.hpBarTimer ?? 0;
this.stressBarTimer = opts.stressBarTimer ?? 0;
this.affection = opts.affection ?? rand(0, 30);
this.need = opts.need || pick(NEEDS);
this.state = opts.state || "idle";
this.dead = !!opts.dead;
this.deathReason = opts.deathReason || "";
this.lastDamageCause = opts.lastDamageCause || "";
this.lastDamageAmount = opts.lastDamageAmount ?? 0;
this.lastDamageAt = opts.lastDamageAt ?? -999;
this.lastMajorDamageCause = opts.lastMajorDamageCause || "";
this.lastMajorDamageAmount = opts.lastMajorDamageAmount ?? 0;
this.lastMajorDamageAt = opts.lastMajorDamageAt ?? -999;
this.thought = "";
this.target = null;
this.targetKey = "";
@ -79,7 +86,7 @@ class Tarinai {
this.formerName = opts.formerName || null;
this.loveMochiTimer = opts.loveMochiTimer ?? 0;
this.fightMochiTimer = opts.fightMochiTimer ?? 0;
if (this.isZunchiSlave) this.name = "ずんちどれい";
if (this.isZunchiSlave) this.name = "\u305a\u3093\u3061\u3069\u308c\u3044";
this.tempComfort = opts.tempComfort ?? 0.62;
this.tempTimer = opts.tempTimer ?? stableUnit(this.id, "temp-start") * 0.55;
this.parents = opts.parents || [];
@ -127,8 +134,8 @@ class Tarinai {
return {
id: this.id, name: this.name, type: this.type, x: this.x, y: this.y, vx: this.vx, vy: this.vy,
scale: this.scale, age: this.age, lifeSpan: this.lifeSpan, generation: this.generation, hasPaired: this.hasPaired,
dead: this.dead, deathReason: this.deathReason,
hunger: this.hunger, loneliness: this.loneliness, energy: this.energy, stress: this.stress, hpBarTimer: this.hpBarTimer,
dead: this.dead, deathReason: this.deathReason, lastDamageCause: this.lastDamageCause, lastDamageAmount: this.lastDamageAmount, lastDamageAt: this.lastDamageAt, lastMajorDamageCause: this.lastMajorDamageCause, lastMajorDamageAmount: this.lastMajorDamageAmount, lastMajorDamageAt: this.lastMajorDamageAt,
hunger: this.hunger, loneliness: this.loneliness, energy: this.energy, stress: this.stress, hpBarTimer: this.hpBarTimer, stressBarTimer: this.stressBarTimer,
affection: this.affection, need: this.need, state: this.state,
goodMode: this.goodMode, facing: this.facing, visualFacing: this.visualFacing, facingLockUntil: this.facingLockUntil, eatTimer: this.eatTimer,
foodReactTimer: this.foodReactTimer, surpriseTimer: this.surpriseTimer, fearTimer: this.fearTimer,
@ -266,7 +273,7 @@ class Tarinai {
poke() {
audio.poke();
this.damage(rand(9, 16), "\u3064\u3064\u304b\u308c\u3059\u304e");
this.stress = clamp(this.stress + 22, 0, 130);
this.addStress(22, { threshold: 8 });
this.surpriseTimer = 0.55;
this.fearTimer = Math.max(this.fearTimer, 1.2);
this.pokeFlashTimer = 0.55;
@ -281,18 +288,119 @@ class Tarinai {
this.hpBarTimer = Math.max(this.hpBarTimer || 0, duration);
}
showStressBar(duration = 4.2) {
this.stressBarTimer = Math.max(this.stressBarTimer || 0, duration);
}
addStress(amount, opts = {}) {
const delta = Math.max(0, amount || 0);
if (delta <= 0) return 0;
const before = this.stress || 0;
this.stress = clamp(before + delta, 0, 130);
const gained = Math.max(0, this.stress - before);
const threshold = opts.threshold ?? 8;
if (gained >= threshold) this.showStressBar(opts.duration ?? 4.2);
return gained;
}
damageCauseLabel(reason = "") {
const text = String(reason || "");
if (!text) return "";
if (text.includes("\u3067\u8870\u5f31")) return text.replace(/\u3067\u8870\u5f31.*$/, "");
if (/\u55a7\u5629|fight|headbutt/.test(text)) return "\u55a7\u5629";
if (/\u7206\u7af9|firecracker|explosion/.test(text)) return "\u7206\u7af9";
if (/\u3064\u3064\u304b\u308c|\u3064\u3064\u304d|poke/.test(text)) return "\u3064\u3064\u304b\u308c\u3059\u304e\u305f";
if (/\u305a\u3093\u3061\u75c5|zunchi_sick|zunchi.*\u75c5/.test(text)) return "\u305a\u3093\u3061\u75c5";
if (/\u75c5/.test(text)) {
const disease = text.match(/([^\u3001\u3002\s]+\u75c5)/);
return disease ? disease[1] : "\u305a\u3093\u3061\u75c5";
}
if (/\u98e2|\u7a7a\u8179|\u98df\u3079\u7269|hunger/.test(text)) return "\u98e2\u9913";
if (/\u30b9\u30c8\u30ec\u30b9|stress/.test(text)) return "\u30b9\u30c8\u30ec\u30b9\u904e\u591a";
if (/\u30dc\u30fc\u30eb|\u843d\u3061|\u843d\u4e0b|\u77f3|\u9053\u5177|\u4e8b\u6545|\u5f53\u305f|\u885d\u7a81|ball|drop|stone|accident/.test(text)) return "\u4e8b\u6545";
if (/\u5bff\u547d/.test(text)) return "\u5bff\u547d";
return "";
}
recentDamageCause(maxAge = 10) {
const now = this.world?.time || 0;
if (this.lastDamageCause && now - (this.lastDamageAt || -999) <= maxAge) return this.lastDamageCause;
return "";
}
rememberDamage(amount, reason = "") {
const cause = this.damageCauseLabel(reason) || "\u4e8b\u6545";
const now = this.world?.time || 0;
this.lastDamageCause = cause;
this.lastDamageAmount = Math.max(0, amount || 0);
this.lastDamageAt = now;
if (this.lastDamageAmount >= 10 || this.lastDamageAmount >= Math.max(6, (this.energy || 0) * 0.36)) {
this.lastMajorDamageCause = cause;
this.lastMajorDamageAmount = this.lastDamageAmount;
this.lastMajorDamageAt = now;
}
return cause;
}
weakenedDeathReasonFor(cause = "") {
const text = String(cause || "").trim();
if (!text) return "";
return text.includes("\u3067\u8870\u5f31") ? text : `${text}\u3067\u8870\u5f31`;
}
dominantDeathCause(reason = "", opts = {}) {
const text = String(reason || "").trim();
const direct = this.damageCauseLabel(text);
const now = this.world?.time || 0;
const recentMajor = this.lastMajorDamageCause && now - (this.lastMajorDamageAt || -999) <= 10;
const recent = this.recentDamageCause ? this.recentDamageCause(20) : "";
const fighting = this.fightTimer > 0.04 || this.defeatedTimer > 0.04 || this.defeatedById || this.fightWinnerId || recent === "\u55a7\u5629";
if (recentMajor && (!direct || direct === this.lastMajorDamageCause || opts.fromDamage || this.energy <= 22 || this.mood <= 20 || this.stress >= 118)) {
return this.weakenedDeathReasonFor(this.lastMajorDamageCause);
}
if (direct && direct !== "\u30b9\u30c8\u30ec\u30b9\u904e\u591a") return direct;
if (this.zunchiDisease && ((this.zunchiDiseaseSeverity || 0) >= 0.30 || /\u75c5|zunchi/.test(text))) return "\u305a\u3093\u3061\u75c5";
if (this.hunger >= 108 || (this.hunger >= 94 && this.energy <= 26) || /\u98e2|\u7a7a\u8179|hunger/.test(text)) return "\u98e2\u9913";
if (fighting && (this.energy <= 44 || this.stress >= 112 || this.mood <= 22 || opts.fromDamage)) return "\u55a7\u5629";
if (recent && recent !== "\u30b9\u30c8\u30ec\u30b9\u904e\u591a" && (this.energy <= 34 || this.mood <= 20 || this.stress >= 118 || opts.fromDamage)) return recent;
if (text.includes("\u5bff\u547d")) return "\u5bff\u547d";
if (direct) return direct;
if (this.stress >= 118 || /\u30b9\u30c8\u30ec\u30b9|stress|\u6c17\u5206/.test(text)) return "\u30b9\u30c8\u30ec\u30b9\u904e\u591a";
if (this.energy <= 0.5) return "\u4e8b\u6545";
return "";
}
normalizeDeathReason(reason = "", opts = {}) {
const text = String(reason || "").trim();
if (text.includes("\u3067\u8870\u5f31")) return text;
const cause = this.dominantDeathCause(text, opts) || "\u4e8b\u6545";
if (cause.includes("\u3067\u8870\u5f31")) return cause;
const now = this.world?.time || 0;
const recentMajor = this.lastMajorDamageCause && now - (this.lastMajorDamageAt || -999) <= 10;
const canWeaken = cause && !cause.endsWith("\u75c5") && cause !== "\u98e2\u9913" && cause !== "\u30b9\u30c8\u30ec\u30b9\u904e\u591a" && cause !== "\u5bff\u547d";
if (canWeaken && (opts.weakened || (recentMajor && cause === this.lastMajorDamageCause))) return this.weakenedDeathReasonFor(cause);
return cause;
}
damage(amount, reason = "") {
const before = this.energy;
this.energy = clamp(this.energy - Math.max(0, amount || 0), 0, 100);
if (this.energy < before - 0.01) this.showHpBar();
if (this.energy <= 0.5 && reason) this.die(reason);
const loss = Math.max(0, amount || 0);
this.energy = clamp(this.energy - loss, 0, 100);
const actualLoss = Math.max(0, before - this.energy);
let cause = "";
if (actualLoss > 0.01) {
cause = this.rememberDamage(actualLoss, reason);
this.showHpBar();
}
if (this.energy <= 0.5) {
const majorNow = actualLoss >= Math.max(10, before * 0.42);
this.die(this.normalizeDeathReason(reason || cause, { fromDamage: true, weakened: majorNow }));
}
}
recoverHealth(amount) {
if (this.dead) return;
const before = this.energy;
this.energy = clamp(this.energy + Math.max(0, amount || 0), 0, 100);
if (this.energy > before + 0.01 && before < 99.5) this.showHpBar(2.4);
}
familyJoined() {
@ -421,12 +529,8 @@ class Tarinai {
briefDeathReason(reason = this.deathReason) {
const text = String(reason || "");
if (!text) return "";
if (text.includes("食べ物がたりない")) return "飢え";
if (text.includes("寿命")) return "寿命";
if (text.includes("ストレス")) return "過ストレス";
if (text.includes("疲れ")) return "衰弱";
if (text.includes("つつかれ")) return "つつき";
return text.length > 10 ? `${text.slice(0, 10)}` : text;
const normalized = this.normalizeDeathReason ? this.normalizeDeathReason(text) : text;
return normalized.length > 12 ? `${normalized.slice(0, 12)}\u2026` : normalized;
}
variantSprite(category) {
@ -452,8 +556,8 @@ class Tarinai {
this.zunchiDiseaseCooldown = 12;
this.fearTimer = Math.max(this.fearTimer || 0, 0.35);
this.surpriseTimer = Math.max(this.surpriseTimer || 0, 0.45);
this.thought = "ずんち病にかかった";
this.world?.spawnBubble?.(this.x, this.y - this.radius * 1.20, "うぅ…", "rgba(38,82,38,0.82)");
this.thought = "\u305a\u3093\u3061\u75c5\u306b\u304b\u304b\u3063\u305f";
this.world?.spawnBubble?.(this.x, this.y - this.radius * 1.20, "\u3046\u3045\u2026", "rgba(38,82,38,0.82)");
return true;
}
@ -464,8 +568,8 @@ class Tarinai {
this.zunchiDiseaseCooldown = 18;
this.zunchiStain = clamp((this.zunchiStain || 0) - 35, 0, 100);
this.stress = clamp(this.stress - 8, 0, 130);
this.thought = reason || "ずんち病が治まった";
this.world?.spawnBubble?.(this.x, this.y - this.radius * 1.18, "はう", "rgba(62,104,62,0.78)");
this.thought = reason || "\u305a\u3093\u3061\u75c5\u304c\u6cbb\u307e\u3063\u305f";
this.world?.spawnBubble?.(this.x, this.y - this.radius * 1.18, "\u306f\u3046", "rgba(62,104,62,0.78)");
return true;
}
@ -491,16 +595,16 @@ class Tarinai {
}
if (!this.zunchiDisease && this.zunchiStain > 82 && Math.random() < dt * clamp((this.zunchiStain - 82) / 18, 0, 1) * 0.045) {
this.infectZunchiDisease(null, true);
this.world?.log?.(`${this.name}はずんち病を発症した。`, "accident");
this.world?.log?.(`${this.name}\u306f\u305a\u3093\u3061\u75c5\u3092\u767a\u75c7\u3057\u305f\u3002`, "accident");
}
if (this.zunchiDisease) {
this.zunchiDiseaseSeverity = clamp((this.zunchiDiseaseSeverity || 0.7) + dt * 0.002, 0, 1.25);
this.stress = clamp(this.stress + dt * 0.22 * this.zunchiDiseaseSeverity, 0, 130);
this.zunchiDiseaseSeverity = clamp((this.zunchiDiseaseSeverity || 0.7) + dt * 0.004, 0, 1.25);
this.stress = clamp(this.stress + dt * (0.28 + 0.18 * this.zunchiDiseaseSeverity), 0, 130);
this.energy = clamp(this.energy - dt * 0.035 * this.zunchiDiseaseSeverity, 0, 100);
if (this.energy > 82) this.zunchiDiseaseSeverity = Math.max(0, this.zunchiDiseaseSeverity - dt * (this.energy > 94 ? 0.020 : 0.010));
this.emitZunchiDiseaseEffect(dt);
if (this.zunchiDiseaseSeverity <= 0.04) {
if (this.recoverZunchiDisease("体力が戻り、ずんち病が治まった")) this.world?.log?.(`${this.name}のずんち病が治まった。`, "accident");
if (this.recoverZunchiDisease("\u4f53\u529b\u304c\u623b\u308a\u3001\u305a\u3093\u3061\u75c5\u304c\u6cbb\u307e\u3063\u305f")) this.world?.log?.(`${this.name}\u306e\u305a\u3093\u3061\u75c5\u304c\u6cbb\u307e\u3063\u305f\u3002`, "accident");
}
}
}
@ -521,7 +625,7 @@ class Tarinai {
if (this.isZunchiSlave) return false;
this.formerName = this.formerName || this.name;
this.isZunchiSlave = true;
this.name = "ずんちどれい";
this.name = "\u305a\u3093\u3061\u3069\u308c\u3044";
this.birthRitualTimer = 0;
this.birthPartnerId = null;
this.birthRitualLeader = false;
@ -529,7 +633,7 @@ class Tarinai {
this.target = null;
this.reproductionTimer = Math.max(this.reproductionTimer || 0, CONFIG.reproductionCooldown + rand(8, 18));
this.loveMochiTimer = 0;
this.stress = clamp(this.stress + 14, 0, 130);
this.addStress(14, { threshold: 8 });
this.hunger = Math.max(this.hunger, 40);
this.visibleSpriteId = "zunchi_slave";
this.spriteLockUntil = 0;
@ -597,9 +701,14 @@ class Tarinai {
this.blastSpinTimer = Math.max(0, (this.blastSpinTimer || 0) - dt);
this.postBirthPeaceTimer = Math.max(0, (this.postBirthPeaceTimer || 0) - dt);
this.hpBarTimer = Math.max(0, (this.hpBarTimer || 0) - dt);
this.stressBarTimer = Math.max(0, (this.stressBarTimer || 0) - dt);
this.updateZunchiDisease(dt);
this.loveMochiTimer = Math.max(0, (this.loveMochiTimer || 0) - dt);
this.fightMochiTimer = Math.max(0, (this.fightMochiTimer || 0) - dt);
if (this.fightMochiTimer > 0.04) {
this.stress = clamp(this.stress + dt * 0.11, 0, 130);
if (this.state !== "fight") this.fearTimer = Math.max(this.fearTimer || 0, 0.10);
}
if (this.intimidateTimer <= 0.04) this.intimidateTargetId = null;
if (this.birthRitualTimer > 0) {
const beforeBirthTimer = this.birthRitualTimer;
@ -713,7 +822,7 @@ class Tarinai {
this.maintainTargetProgress(dt);
this.move(dt);
if (this.world.resolveFenceCollision) this.world.resolveFenceCollision(this);
this.checkLife();
this.checkLife(dt);
}
applyEnvironment(dt) {
@ -757,7 +866,7 @@ class Tarinai {
}
sleepFurnitureLabel(target) {
return "干草寝床";
return "\u5e72\u8349\u5bdd\u5e8a";
}
sleepSpotFor(bed) {
@ -873,6 +982,22 @@ class Tarinai {
? dayP >= this.sleepStart && dayP < this.sleepEnd
: dayP >= this.sleepStart || dayP < this.sleepEnd;
if (this.hasFightMochiEffect() && this.fightTimer <= 0.04 && this.intimidateTimer <= 0.04 && this.defeatedTimer <= 0.04) {
const opponent = this.world.nearestOther(this, 320);
if (opponent) {
const d = dist(this, opponent);
if (d <= Math.max(48, this.radius + opponent.radius + 18)) {
if (this.world.startForcedFight?.(this, opponent)) return;
}
this.state = "seek_friend";
this.target = opponent;
this.goodMode = "angry";
this.thought = "\u3051\u3093\u304b\u9905\u3067\u76f8\u624b\u3092\u63a2\u3057\u3066\u3044\u308b";
if (Math.random() < dt * 0.24) this.bubble("!", 1.4, "rgba(160,74,45,0.78)");
return;
}
}
const recentRival = this.recentFightRival ? this.recentFightRival(60, 170) : null;
const feared = this.strongestRelation("fear");
if (!wasSleeping && (recentRival || (feared && feared.score > 12))) {
@ -892,12 +1017,12 @@ class Tarinai {
if (water && !water.dead) {
this.state = "seek_water";
this.target = water;
this.thought = "ずんち病で水を探している";
this.thought = "\u305a\u3093\u3061\u75c5\u3067\u6c34\u3092\u63a2\u3057\u3066\u3044\u308b";
return;
}
this.state = "zunchi_sick";
this.target = null;
this.thought = "ずんち病で当てもなく彷徨っている";
this.thought = "\u305a\u3093\u3061\u75c5\u3067\u5f53\u3066\u3082\u306a\u304f\u5f77\u5fa8\u3063\u3066\u3044\u308b";
if (Math.random() < dt * 0.35) this.wanderAngle += rand(-2.4, 2.4);
return;
}
@ -908,7 +1033,7 @@ class Tarinai {
this.state = "seek_food";
this.target = specialMochi;
this.foodReactTimer = Math.max(this.foodReactTimer, 0.34);
this.thought = specialMochi.type === "love_mochi" ? "媚薬餅を探している" : "喧嘩餅を探している";
this.thought = specialMochi.type === "love_mochi" ? "\u3078\u3053\u9905\u3092\u63a2\u3057\u3066\u3044\u308b" : "\u3051\u3093\u304b\u9905\u3092\u63a2\u3057\u3066\u3044\u308b";
return;
}
} else if (this.hunger > 20) {
@ -917,7 +1042,7 @@ class Tarinai {
this.state = "seek_food";
this.target = zOnly;
this.foodReactTimer = Math.max(this.foodReactTimer, 0.30);
this.thought = "ずんちを探している";
this.thought = "\u305a\u3093\u3061\u3092\u63a2\u3057\u3066\u3044\u308b";
return;
}
}
@ -952,7 +1077,7 @@ class Tarinai {
if (distXY(this.x, this.y, spot.x, spot.y) > this.radius + 10) {
this.state = "seek_bed";
this.target = bed;
this.thought = `${this.sleepFurnitureLabel(bed)}へ向かっている`;
this.thought = `${this.sleepFurnitureLabel(bed)}\u3078\u5411\u304b\u3063\u3066\u3044\u308b`;
return;
}
}
@ -963,7 +1088,7 @@ class Tarinai {
this.nextSleepBubbleAt = this.world.time + 4.5;
this.world.spawnBubble(this.x, this.y - this.radius * 1.18, "Zzz...", "rgba(65,70,92,0.72)");
}
this.thought = bed ? "ベッドの近くで眠っている" : "眠っている";
this.thought = bed ? "\u30d9\u30c3\u30c9\u306e\u8fd1\u304f\u3067\u7720\u3063\u3066\u3044\u308b" : "\u7720\u3063\u3066\u3044\u308b";
return;
}
@ -1007,7 +1132,7 @@ class Tarinai {
this.state = "play_ball";
this.target = ball;
this.goodMode = "smile";
this.thought = this.personality === "playful" ? "ボールに引き寄せられている" : "転がるものが気になっている";
this.thought = this.personality === "playful" ? "\u30dc\u30fc\u30eb\u306b\u5f15\u304d\u5bc4\u305b\u3089\u308c\u3066\u3044\u308b" : "\u8ee2\u304c\u308b\u3082\u306e\u304c\u6c17\u306b\u306a\u3063\u3066\u3044\u308b";
return;
}
}
@ -1130,13 +1255,15 @@ class Tarinai {
this.hunger -= eating * 0.82;
this.recoverHealth(eating * 0.24);
this.affection += eating * 0.04;
this.stress = clamp(this.stress - eating * 0.25, 0, 130);
if (it.type === "love_mochi") {
this.stress = clamp(this.stress - eating * 0.25, 0, 130);
this.loveMochiTimer = Math.max(this.loveMochiTimer || 0, 42 + rand(4, 12));
this.bubble("", 2.4, "rgba(190,82,132,0.78)");
this.bubble("\u2661", 2.4, "rgba(190,82,132,0.78)");
this.lastMealColor = "#ff7bab";
} else {
this.fightMochiTimer = Math.max(this.fightMochiTimer || 0, 36 + rand(4, 10));
this.stress = clamp(this.stress + eating * 0.22, 0, 130);
this.fearTimer = Math.max(this.fearTimer || 0, 0.32);
this.fightMochiTimer = Math.max(this.fightMochiTimer || 0, 52 + rand(10, 18));
this.bubble("!", 2.0, "rgba(180,86,52,0.80)");
this.lastMealColor = "#e07c43";
}
@ -1150,7 +1277,7 @@ class Tarinai {
this.makePoop(eating * 0.20);
if (this.world.time > this.nextEatSound) { audio.eat(); this.nextEatSound = this.world.time + 0.42; }
if (this.world.time - this.lastLog > 9 && Math.random() < 0.02) {
this.world.log(`${this.name}${it.type === "love_mochi" ? "媚薬餅" : "喧嘩餅"}をしばらく味わった。`, "food");
this.world.log(`${this.name}\u306f${it.type === "love_mochi" ? "\u3078\u3053\u9905" : "\u3051\u3093\u304b\u9905"}\u3092\u3057\u3070\u3089\u304f\u5473\u308f\u3063\u305f\u3002`, "food");
this.lastLog = this.world.time;
}
break;
@ -1200,7 +1327,7 @@ class Tarinai {
this.lastMealColor = "#6b8d3f";
this.eatTimer = Math.max(this.eatTimer, 0.24);
this.eatCooldown = rand(0.9, 1.4);
this.bubble(this.isZunchiSlave ? "もぐ" : "...", 2.2, "rgba(74,91,50,0.78)");
this.bubble(this.isZunchiSlave ? "\u3082\u3050" : "...", 2.2, "rgba(74,91,50,0.78)");
const mouth = this.mouthPosition(it);
this.world.spawnEatEffect(mouth.x, mouth.y, "#6b8d3f");
if (this.world.time > this.nextEatSound) { audio.eat(); this.nextEatSound = this.world.time + 0.7; }
@ -1215,8 +1342,8 @@ class Tarinai {
this.zunchiStain = clamp((this.zunchiStain || 0) - dt * 10.5, 0, 100);
if (this.zunchiDisease) {
this.zunchiDiseaseSeverity = Math.max(0, (this.zunchiDiseaseSeverity || 1) - dt * (this.energy > 70 ? 0.050 : 0.028));
if (this.zunchiDiseaseSeverity <= 0.04 && this.recoverZunchiDisease("水でずんち病が治まった")) {
this.world.log(`${this.name}は水でずんち病が治まった。`, "accident");
if (this.zunchiDiseaseSeverity <= 0.04 && this.recoverZunchiDisease("\u6c34\u3067\u305a\u3093\u3061\u75c5\u304c\u6cbb\u307e\u3063\u305f")) {
this.world.log(`${this.name}\u306f\u6c34\u3067\u305a\u3093\u3061\u75c5\u304c\u6cbb\u307e\u3063\u305f\u3002`, "accident");
}
}
it.amount -= dt * 2.4;
@ -1277,11 +1404,16 @@ class Tarinai {
if (d < 0.01 || d > 74) continue;
closeCount += 1;
const fightMochiContact = this.hasFightMochiEffect() || o.hasFightMochiEffect();
if (fightMochiContact && d <= Math.max(42, this.radius + o.radius + 16)) {
if (this.world.startForcedFight?.(this, o)) continue;
}
if (this.zunchiDisease && !o.zunchiDisease && (o.zunchiDiseaseCooldown || 0) <= 0 && d < 54 && Math.random() < dt * 0.065 * clamp(1 - d / 58, 0.12, 1)) {
if (o.infectZunchiDisease(this)) this.world.log(`${this.name}のずんち病が${o.name}にうつった。`, "accident");
if (o.infectZunchiDisease(this)) this.world.log(`${this.name}\u306e\u305a\u3093\u3061\u75c5\u304c${o.name}\u306b\u3046\u3064\u3063\u305f\u3002`, "accident");
}
if (o.zunchiDisease && !this.zunchiDisease && (this.zunchiDiseaseCooldown || 0) <= 0 && d < 54 && Math.random() < dt * 0.065 * clamp(1 - d / 58, 0.12, 1)) {
if (this.infectZunchiDisease(o)) this.world.log(`${o.name}のずんち病が${this.name}にうつった。`, "accident");
if (this.infectZunchiDisease(o)) this.world.log(`${o.name}\u306e\u305a\u3093\u3061\u75c5\u304c${this.name}\u306b\u3046\u3064\u3063\u305f\u3002`, "accident");
}
const pairBond = this.world.areCoParents?.(this, o);
@ -1326,8 +1458,8 @@ class Tarinai {
o.vy += ny * rand(34, 64);
this.stress = clamp(this.stress + 1.6, 0, 130);
o.stress = clamp(o.stress + 2.8, 0, 130);
this.damage(1.2);
o.damage(1.6);
this.damage(1.2, "\u55a7\u5629");
o.damage(1.6, "\u55a7\u5629");
this.hurtTimer = Math.max(this.hurtTimer, 1.4);
o.hurtTimer = Math.max(o.hurtTimer, 1.8);
this.adjustRelation(o, -0.16, 0.12, "fight");
@ -1385,7 +1517,7 @@ class Tarinai {
move(dt) {
let ax = 0, ay = 0;
const baseSpeed = 46.5 * 1.5 * this.trait.speed * (this.energy < 20 ? 0.42 : 1) * (this.fallTimer > 0 ? 0.35 : 1);
const baseSpeed = 46.5 * 1.5 * this.trait.speed * (this.zunchiDisease ? 0.5 : 1) * (this.energy < 20 ? 0.42 : 1) * (this.fallTimer > 0 ? 0.35 : 1);
if (this.state === "sleep") {
const bedComfort = this.isSleepFurniture(this.target) ? this.world.bedComfort(this.target) : 0.72;
@ -1542,19 +1674,32 @@ class Tarinai {
if (this.y > maxY) { this.y = maxY; this.vy = -Math.abs(this.vy) * 0.5; this.wanderAngle = rand(-2.2, -0.7); this.surpriseTimer = 0.15; }
}
checkLife() {
checkLife(dt = 0.016) {
let reason = "";
if (this.hunger >= 108) reason = "\u98df\u3079\u7269\u304c\u305f\u308a\u306a\u3044";
if (this.energy <= 0) {
reason = this.dominantDeathCause("", { lowHealth: true }) || "\u4e8b\u6545";
}
else if (this.hunger >= 108) reason = "\u98e2\u9913";
else if (this.age >= this.lifeSpan) reason = "\u5bff\u547d";
else if (this.stress >= 124) reason = "\u30b9\u30c8\u30ec\u30b9\u304c\u591a\u3059\u304e\u308b";
else if (this.energy <= 0 && this.hunger > 90) reason = "\u75b2\u308c\u3068\u7a7a\u8179\u304c\u91cd\u306a\u3063\u305f";
else if (this.stress >= 124) {
reason = this.dominantDeathCause("\u30b9\u30c8\u30ec\u30b9\u904e\u591a", { stressDeath: true }) || "\u30b9\u30c8\u30ec\u30b9\u904e\u591a";
}
else if (this.mood <= 20) {
const lowMood = clamp((20 - this.mood) / 20, 0, 1);
const bodyLoad = clamp((this.hunger - 72) / 42, 0, 1) * 0.018 + clamp((28 - this.energy) / 28, 0, 1) * 0.020 + clamp((this.stress - 86) / 44, 0, 1) * 0.022;
const deathRisk = 0.010 + lowMood * 0.060 + bodyLoad;
if (Math.random() < Math.max(0, dt) * deathRisk) {
reason = this.dominantDeathCause("", { lowMood: true }) || "\u30b9\u30c8\u30ec\u30b9\u904e\u591a";
}
}
if (reason) this.die(reason);
}
die(reason) {
if (this.dead) return;
const finalReason = this.normalizeDeathReason ? this.normalizeDeathReason(reason) : (reason || "\u4e8b\u6545");
this.dead = true;
this.deathReason = reason;
this.deathReason = finalReason;
this.world.deadCount += 1;
this.world.items.push(new Item("trace", this.x, this.y));
this.world.items.push(new Item("splat", this.x, this.y));
@ -1562,9 +1707,9 @@ class Tarinai {
const spot = this.world.findGrassPlantingSpot(this.x, this.y, { allowOriginal: false, minRadius: 26, maxRadius: 76 });
if (spot) this.world.items.push(new Item("grass", spot.x, spot.y));
}
this.world.markDead(this, reason);
this.world.markDead(this, finalReason);
audio.death();
this.world.log(`${this.name}\u306f\u9759\u304b\u306a\u75d5\u8de1\u3092\u6b8b\u3057\u305f\u3002\u7406\u7531: ${reason}`, "death");
this.world.log(`${this.name}\u306f\u9759\u304b\u306a\u75d5\u8de1\u3092\u6b8b\u3057\u305f\u3002\u6b7b\u56e0: ${finalReason}`, "death");
if (this.world.selected === this) this.world.selected = null;
}
@ -1572,8 +1717,8 @@ class Tarinai {
if (this.dead) return;
const lightState = lighting || getLightingState(this.world);
const sprite = this.spriteId();
const img = images.get(sprite) || images.get(this.type);
const metrics = getImageMetrics(sprite) || getImageMetrics(this.type);
const img = typeof getRenderableImage === "function" ? getRenderableImage(sprite, "smile") : (images.get(sprite) || images.get(this.type));
const metrics = getImageMetrics(sprite) || getImageMetrics(this.type) || getImageMetrics("smile");
const w = metrics?.w || 512;
const h = metrics?.h || 512;
const moveSpeed = Math.hypot(this.vx, this.vy);
@ -1623,12 +1768,16 @@ class Tarinai {
const shadow = projectedShadowParams(lightState, 0.95 + this.scale * 0.8);
const shadowContactY = this.y + bob + (drawH / squish) * 0.30;
drawImageProjectedShadow(ctx, img, this.x, shadowContactY, drawW * squish, drawH / squish, shadow, {
faceRight,
alpha: shadow.alpha * (this.state === "sleep" ? 1.10 : 0.92),
widthScale: this.state === "sleep" ? 1.12 : 1,
heightScale: this.state === "sleep" ? 0.88 : 1,
});
if (img) {
drawImageProjectedShadow(ctx, img, this.x, shadowContactY, drawW * squish, drawH / squish, shadow, {
faceRight,
alpha: shadow.alpha * (this.state === "sleep" ? 1.10 : 0.92),
widthScale: this.state === "sleep" ? 1.12 : 1,
heightScale: this.state === "sleep" ? 0.88 : 1,
});
} else {
drawProjectedShadow(ctx, this.x, shadowContactY, drawW * 0.52, drawH * 0.13, { ...shadow, alpha: shadow.alpha * 0.82 });
}
drawCreatureGlow(ctx, this, drawW, drawH, lightState);
if (this.birthRitualTimer > 0.04 && this.birthRitualLeader) {
const partner = this.world.tarinai.find(o => o.id === this.birthPartnerId && !o.dead);
@ -1722,9 +1871,21 @@ class Tarinai {
const renderScale = typeof SPRITE_CACHE_SCALE === "number" ? SPRITE_CACHE_SCALE : 2.0;
const cacheW = Math.max(1, Math.round((dw * renderScale) / 8) * 8);
const cacheH = Math.max(1, Math.round((dh * renderScale) / 8) * 8);
const spriteCanvas = typeof getCachedSpriteCanvas === "function" ? getCachedSpriteCanvas(sprite, img, cacheW, cacheH) : img;
ctx.drawImage(spriteCanvas, -dw / 2, -dh / 2, dw, dh);
if ((this.zunchiStain || 0) > 3 && typeof getCachedStainOverlayCanvas === "function") {
if (img) {
const spriteCanvas = typeof getCachedSpriteCanvas === "function" ? getCachedSpriteCanvas(sprite, img, cacheW, cacheH) : img;
ctx.drawImage(spriteCanvas, -dw / 2, -dh / 2, dw, dh);
} else {
ctx.save();
ctx.fillStyle = this.stress > 62 ? "#f1c3a8" : "#f4ead6";
ctx.strokeStyle = "rgba(92,71,49,0.48)";
ctx.lineWidth = 2;
ctx.beginPath();
ctx.ellipse(0, 0, dw * 0.42, dh * 0.36, 0, 0, Math.PI * 2);
ctx.fill();
ctx.stroke();
ctx.restore();
}
if (img && (this.zunchiStain || 0) > 3 && typeof getCachedStainOverlayCanvas === "function") {
const stainCanvas = getCachedStainOverlayCanvas(sprite, img, cacheW, cacheH, clamp((this.zunchiStain || 0) / 100, 0, 1), this.zunchiStainSeed || 0.5);
if (stainCanvas) {
ctx.save();
@ -1733,15 +1894,6 @@ class Tarinai {
ctx.restore();
}
}
if (this.zunchiDisease) {
ctx.save();
ctx.globalAlpha = 0.12 + clamp(this.zunchiDiseaseSeverity || 0, 0, 1) * 0.10;
ctx.fillStyle = "rgba(9, 74, 23, 0.75)";
ctx.beginPath();
ctx.ellipse(0, drawH * 0.05, drawW * 0.56, drawH * 0.38, Math.sin(t + this.age) * 0.12, 0, Math.PI * 2);
ctx.fill();
ctx.restore();
}
drawDawnRimLight(ctx, dw, dh, lightState);
if (faceRight) ctx.scale(-1, 1);
@ -1758,24 +1910,35 @@ class Tarinai {
ctx.restore();
if ((this.hpBarTimer || 0) > 0) {
const hpActive = (this.hpBarTimer || 0) > 0;
const stressActive = (this.stressBarTimer || 0) > 0;
if (hpActive || stressActive) {
const bw = Math.max(28, this.radius * 2.35);
const bh = 5;
const x = this.x - bw / 2;
const y = this.y - drawH * 0.55 - 16;
const pct = clamp(this.energy / 100, 0, 1);
ctx.save();
ctx.globalAlpha = clamp((this.hpBarTimer || 0) / 0.7, 0.35, 1);
ctx.fillStyle = "rgba(255,252,242,0.86)";
roundedRect(ctx, x - 2, y - 2, bw + 4, bh + 4, 5);
ctx.fill();
ctx.fillStyle = "rgba(72,58,45,0.22)";
roundedRect(ctx, x, y, bw, bh, 4);
ctx.fill();
ctx.fillStyle = pct > 0.45 ? "rgba(118,190,80,0.88)" : (pct > 0.20 ? "rgba(232,172,68,0.90)" : "rgba(218,82,70,0.92)");
roundedRect(ctx, x, y, bw * pct, bh, 4);
ctx.fill();
ctx.restore();
const baseY = this.y - drawH * 0.55 - 16;
const drawMeter = (y, pct, fill, alpha) => {
ctx.save();
ctx.globalAlpha = alpha;
ctx.fillStyle = "rgba(255,252,242,0.86)";
roundedRect(ctx, x - 2, y - 2, bw + 4, bh + 4, 5);
ctx.fill();
ctx.fillStyle = "rgba(72,58,45,0.22)";
roundedRect(ctx, x, y, bw, bh, 4);
ctx.fill();
ctx.fillStyle = fill;
roundedRect(ctx, x, y, bw * pct, bh, 4);
ctx.fill();
ctx.restore();
};
if (stressActive) {
const pct = clamp((this.stress || 0) / 130, 0, 1);
drawMeter(baseY - (hpActive ? 11 : 0), pct, pct > 0.72 ? "rgba(178,74,110,0.92)" : "rgba(212,126,84,0.90)", clamp((this.stressBarTimer || 0) / 0.7, 0.35, 1));
}
if (hpActive) {
const pct = clamp(this.energy / 100, 0, 1);
drawMeter(baseY, pct, pct > 0.45 ? "rgba(118,190,80,0.88)" : (pct > 0.20 ? "rgba(232,172,68,0.90)" : "rgba(218,82,70,0.92)"), clamp((this.hpBarTimer || 0) / 0.7, 0.35, 1));
}
}
}

View file

@ -39,6 +39,17 @@ const uiCache = {
toolButtons: [],
archiveVersion: "",
archiveRows: [],
archiveFamilyVersion: null,
archiveRelationSignature: "",
archiveHtmlCache: new Map(),
archiveRenderTimer: 0,
archiveRenderForce: false,
archiveScheduled: false,
archivePendingOffscreen: false,
archivePendingWhileRunning: false,
archiveLastRenderedAt: 0,
archiveLastScheduleFamilyVersion: null,
archiveDiagnostics: { renders: 0, lastMs: 0, lastFamilies: 0, lastNodes: 0, skippedWhileRunning: 0 },
archiveScrollScheduled: false,
deferArchiveUntil: 0,
lastArchiveWindow: "",
@ -55,6 +66,15 @@ const uiCache = {
panLastX: 0,
panLastY: 0,
panMoved: false,
grabbing: false,
grabTarget: null,
grabKind: "",
grabMoved: false,
grabStartX: 0,
grabStartY: 0,
grabLastWorldX: 0,
grabLastWorldY: 0,
grabLastSpatialAt: 0,
};
function renderLog(logs) {
@ -137,10 +157,11 @@ function renderSelected() {
ui.selectedInfo.className = "selected-info";
const effectBadges = [];
if (t.isZunchiSlave) effectBadges.push(`<span class="badge">ずんちどれい</span>`);
if (t.zunchiDisease) effectBadges.push(`<span class="badge">ずんち病 ${fmt((t.zunchiDiseaseSeverity || 0) * 100)}</span>`);
if ((t.loveMochiTimer || 0) > 0.1) effectBadges.push(`<span class="badge">媚薬餅 ${fmt(t.loveMochiTimer)}</span>`);
if ((t.fightMochiTimer || 0) > 0.1) effectBadges.push(`<span class="badge">喧嘩餅 ${fmt(t.fightMochiTimer)}</span>`);
effectBadges.push(`<span class="badge">\u6027\u683c ${escapeHtml(t.personalityLabel ? t.personalityLabel() : t.personality || "\u4e0d\u660e")}</span>`);
if (t.isZunchiSlave) effectBadges.push(`<span class="badge">\u305a\u3093\u3061\u3069\u308c\u3044</span>`);
if (t.zunchiDisease) effectBadges.push(`<span class="badge">\u305a\u3093\u3061\u75c5 ${fmt((t.zunchiDiseaseSeverity || 0) * 100)}</span>`);
if ((t.loveMochiTimer || 0) > 0.1) effectBadges.push(`<span class="badge">\u3078\u3053\u9905 ${fmt(t.loveMochiTimer)}</span>`);
if ((t.fightMochiTimer || 0) > 0.1) effectBadges.push(`<span class="badge">\u3051\u3093\u304b\u9905 ${fmt(t.fightMochiTimer)}</span>`);
ui.selectedInfo.innerHTML = `
<div><span class="badge">${escapeHtml(t.label())}</span><span class="badge">${escapeHtml(t.name)}</span>${(t.displayGeneration ? t.displayGeneration() : ((t.hasPaired || t.parents?.length || t.children?.length) ? t.generation : null)) ? `<span class="badge">\u4e16\u4ee3 ${t.generation}</span>` : ""}${effectBadges.join("")}</div>
<div class="info-row"><span>\u6027\u683c</span><strong>${escapeHtml(t.personalityLabel ? t.personalityLabel() : t.personality || "\u4e0d\u660e")}</strong></div>
@ -152,7 +173,7 @@ function renderSelected() {
<div class="info-row"><span>\u5bc2\u3057\u3055</span><strong>${fmt(t.loneliness)}</strong></div>
<div class="info-row"><span>\u4f53\u529b</span><strong>${fmt(t.energy)}</strong></div>
<div class="info-row"><span>\u30b9\u30c8\u30ec\u30b9</span><strong>${fmt(t.stress)}</strong></div>
<div class="info-row"><span>ずんち汚れ</span><strong>${fmt(t.zunchiStain || 0)}</strong></div>
<div class="info-row"><span>\u305a\u3093\u3061\u6c5a\u308c</span><strong>${fmt(t.zunchiStain || 0)}</strong></div>
<div class="info-row"><span>\u6c17\u5206</span><strong>${fmt(t.mood)}</strong></div>
<div class="info-row relation-row"><span>\u4ef2\u826f\u3057</span><strong>${rel.friend ? `${relationIconHtml(rel.friend.id)}${escapeHtml(`${rel.friend.name} +${fmt(rel.friend.score)}`)}` : "\u306a\u3057"}</strong></div>
<div class="info-row relation-row"><span>\u907f\u3051\u308b\u76f8\u624b</span><strong>${rel.fear ? `${relationIconHtml(rel.fear.id)}${escapeHtml(`${rel.fear.name} ${fmt(rel.fear.score)}`)}` : "\u306a\u3057"}</strong></div>
@ -168,8 +189,11 @@ function stateLabel(s) {
return {
idle: "\u5f85\u6a5f",
seek_food: "\u98df\u3079\u7269\u3078\u5411\u304b\u3046",
seek_bed: "寝床へ向かう",
play_ball: "ボール遊び",
seek_bed: "\u5bdd\u5e8a\u3078\u5411\u304b\u3046",
play_ball: "\u30dc\u30fc\u30eb\u904a\u3073",
seek_water: "\u6c34\u3092\u63a2\u3059",
zunchi_sick: "\u305a\u3093\u3061\u75c5",
system: "\u305a\u3093\u3061\u75c5",
seek_friend: "\u4ef2\u9593\u3092\u63a2\u3059",
follow_parent: "\u89aa\u306b\u3064\u3044\u3066\u3044\u304f",
cursor_friend: "\u30ab\u30fc\u30bd\u30eb\u306b\u3064\u3044\u3066\u3044\u304f",
@ -192,13 +216,15 @@ function reasonLabel(t) {
if (t.state === "intimidate") return "\u76f8\u624b\u3092\u5a01\u5687\u3057\u3066\u3044\u308b";
if (t.state === "birth_ritual") return "\u5b50\u304c\u73fe\u308c\u308b\u524d\u306b\u4f53\u3092\u3086\u3059\u3063\u3066\u3044\u308b";
if (t.state === "seek_food") return "\u304a\u8179\u304c\u3059\u3044\u3066\u3044\u308b";
if (t.state === "seek_water") return "\u305a\u3093\u3061\u75c5\u3067\u6c34\u3092\u63a2\u3057\u3066\u3044\u308b";
if (t.state === "zunchi_sick" || t.state === "system") return "\u305a\u3093\u3061\u75c5";
return "\u5468\u56f2\u3092\u898b\u3066\u3044\u308b";
}
function targetLabel(target) {
if (!target) return "\u306a\u3057";
if (target.name) return target.name;
if (target.type) return { sweet: "\u305a\u3093\u3060\u9905", love_mochi: "\u5a9a\u85ac\u9905", fight_mochi: "\u55a7\u5629\u9905", food: "\u98df\u4e8b", grass: "\u8349", water: "\u6c34", bed: "\u5e72\u8349\u5bdd\u5e8a", ball: "\u30dc\u30fc\u30eb", stone: "\u77f3", zunchi: "\u305a\u3093\u3061", trace: "\u8db3\u8de1", splat: "\u3057\u3076\u304d" }[target.type] || target.type;
if (target.type) return { sweet: "\u305a\u3093\u3060\u9905", love_mochi: "\u3078\u3053\u9905", fight_mochi: "\u3051\u3093\u304b\u9905", food: "\u98df\u4e8b", grass: "\u8349", water: "\u6c34", bed: "\u5e72\u8349\u5bdd\u5e8a", ball: "\u30dc\u30fc\u30eb", stone: "\u77f3", zunchi: "\u305a\u3093\u3061", system: "\u305a\u3093\u3061\u75c5", zunchi_sick: "\u305a\u3093\u3061\u75c5", trace: "\u8db3\u8de1", splat: "\u3057\u3076\u304d" }[target.type] || target.type;
if (Number.isFinite(target.x) && Number.isFinite(target.y)) return "\u30ab\u30fc\u30bd\u30eb";
return "\u4e0d\u660e";
}
@ -249,8 +275,8 @@ function formatLogDisplayText(text) {
for (const n of Object.values(world?.family || {})) if (n?.name) names.add(n.name);
const sorted = [...names].filter(Boolean).sort((a, b) => b.length - a.length);
for (const name of sorted) {
const re = new RegExp(`(^|[^「])(${escapeRegExp(name)})(?=[とはがをにのもへからで、。]|$)`, "g");
out = out.replace(re, (m, prefix, found) => `${prefix}${found}`);
const re = new RegExp(`(^|[^\u300c])(${escapeRegExp(name)})(?=[\u3068\u306f\u304c\u3092\u306b\u306e\u3082\u3078\u304b\u3089\u3067\u3001\u3002]|$)`, "g");
out = out.replace(re, (m, prefix, found) => `${prefix}\u300c${found}\u300d`);
}
return out;
}
@ -294,7 +320,15 @@ function closeFieldDialog() {
ui.fieldDialog?.classList.add("hidden");
}
function hydrateLazyImages(root) {
const scope = root || document;
for (const img of scope.querySelectorAll("img[data-src]")) {
if (!img.getAttribute("src")) img.setAttribute("src", img.dataset.src || "");
}
}
function openEcologyDialog() {
hydrateLazyImages(ui.ecologyDialog);
ui.ecologyDialog?.classList.remove("hidden");
}
@ -434,6 +468,8 @@ function bindUI() {
});
syncToolSizeBadges();
ui.archiveContent?.addEventListener("scroll", scheduleArchiveWindowRender, { passive: true });
window.addEventListener("scroll", schedulePendingArchiveRender, { passive: true });
window.addEventListener("resize", schedulePendingArchiveRender, { passive: true });
const bindArchiveHorizontal = (root) => {
if (!root) return;
root.addEventListener("wheel", (e) => {
@ -460,11 +496,16 @@ function bindUI() {
showToast(`${t.name}\u3092\u9078\u629e\u3057\u307e\u3057\u305f\u3002`);
});
ui.pauseBtn.addEventListener("click", () => {
ui.pauseBtn?.addEventListener("click", () => {
world.paused = !world.paused;
const archiveStale = uiCache.archiveFamilyVersion !== (world.familyVersion || 0);
if (world.paused && (uiCache.archivePendingWhileRunning || archiveStale)) {
uiCache.archivePendingWhileRunning = false;
scheduleArchiveWindowRender();
}
syncTopButtons();
});
ui.speedBtn.addEventListener("click", () => {
ui.speedBtn?.addEventListener("click", () => {
const speeds = [1, 2, 4];
const i = speeds.indexOf(world.speed);
world.speed = speeds[(i + 1) % speeds.length];
@ -481,7 +522,7 @@ function bindUI() {
ui.creditsDialog?.addEventListener("click", (e) => {
if (e.target === ui.creditsDialog) closeCreditsDialog();
});
ui.resetBtn.addEventListener("click", () => {
ui.resetBtn?.addEventListener("click", () => {
openFieldDialog();
});
ui.fieldCancelBtn?.addEventListener("click", closeFieldDialog);
@ -506,10 +547,10 @@ function bindUI() {
closeArchiveResetDialog();
renderArchive();
renderSelected();
showToast("家系図をリセットしました。");
showToast("\u5bb6\u7cfb\u56f3\u3092\u30ea\u30bb\u30c3\u30c8\u3057\u307e\u3057\u305f\u3002");
});
ui.toolPalette.addEventListener("click", (e) => {
ui.toolPalette?.addEventListener("click", (e) => {
const toggle = e.target.closest(".tool-category-toggle");
if (toggle) {
const category = toggle.closest(".tool-category");
@ -556,14 +597,14 @@ function bindUI() {
chainScroll(ui.archiveContent);
containOwnVerticalScroll(ui.log);
canvas.addEventListener("contextmenu", (e) => e.preventDefault());
canvas.addEventListener("mousedown", (e) => {
canvas?.addEventListener("contextmenu", (e) => e.preventDefault());
canvas?.addEventListener("mousedown", (e) => {
if (e.button === 0 && world.tool === "pinch") {
const p = screenToWorld(e);
if (!p.inside) return;
const target = world.findGrabTargetAt ? world.findGrabTargetAt(p.x, p.y) : null;
if (!target) {
showToast("つまめる対象がありません。");
showToast("\u3064\u307e\u3081\u308b\u5bfe\u8c61\u304c\u3042\u308a\u307e\u305b\u3093\u3002");
return;
}
e.preventDefault();
@ -616,6 +657,7 @@ function bindUI() {
uiCache.grabTarget = null;
uiCache.grabKind = "";
world.rebuildSpatial?.();
uiCache.grabLastSpatialAt = 0;
canvas.style.cursor = world.tool === "pinch" ? "grab" : (world.tool === "observe" ? "default" : (world.tool === "poke" || world.tool === "delete" ? "pointer" : "crosshair"));
renderStats();
return;
@ -657,9 +699,12 @@ function bindUI() {
target.spinVelocity = clamp((target.spinVelocity || 0) + dx * 0.06, -38, 38);
}
world.drawListDirty = true;
world.rebuildSpatial?.();
const now = performance.now();
if (!uiCache.grabLastSpatialAt || now - uiCache.grabLastSpatialAt > 80) {
world.rebuildSpatial?.();
uiCache.grabLastSpatialAt = now;
}
canvas.style.cursor = "grabbing";
render();
return;
}
if (!uiCache.panning) return;
@ -676,7 +721,7 @@ function bindUI() {
}
});
canvas.addEventListener("click", (e) => {
canvas?.addEventListener("click", (e) => {
if (uiCache.grabMoved) {
uiCache.grabMoved = false;
return;
@ -691,7 +736,7 @@ function bindUI() {
renderStats();
});
canvas.addEventListener("mousemove", (e) => {
canvas?.addEventListener("mousemove", (e) => {
const p = screenToWorld(e);
const prevX = world.pointer.x;
const prevY = world.pointer.y;
@ -702,8 +747,8 @@ function bindUI() {
world.pointer.motion = clamp(delta / 18, 0, 2);
world.pointer.movedAt = performance.now();
});
canvas.addEventListener("wheel", resizeFieldFromWheel, { passive: false });
canvas.addEventListener("mouseleave", () => {
canvas?.addEventListener("wheel", resizeFieldFromWheel, { passive: false });
canvas?.addEventListener("mouseleave", () => {
world.pointer.inside = false;
world.pointer.motion = 0;
});

View file

@ -1,4 +1,4 @@
"use strict";
"use strict";
function renderStats() {
const alive = world.tarinai;
@ -18,7 +18,11 @@ function renderStats() {
updateColonyHistory(values);
drawColonyChart(values);
renderSelected();
renderArchive();
const familyVersion = world.familyVersion || 0;
if (uiCache.archiveLastScheduleFamilyVersion !== familyVersion) {
uiCache.archiveLastScheduleFamilyVersion = familyVersion;
scheduleArchiveWindowRender();
}
}
function updateColonyHistory(values) {

View file

@ -1,3 +1,3 @@
"use strict";
"use strict";
window.TarinaiUI = { canvas, ctx, ui, renderLog, renderSelected, stateLabel, renderStats, escapeHtml, renderArchive, validateFamilyTree, resizeCanvas, applyFieldLayout, screenToWorld, selectTool, showToast, saveGame, loadGame, syncTopButtons, bindUI };

View file

@ -78,7 +78,7 @@ function lineageRelatedIdSet(family) {
function liveFamilyComponents(family) {
// Childless pairs, including pairs currently performing the birth ritual, are
// intentionally excluded. A 家系図 node is created only after an actual parent/child
// intentionally excluded. A \u5bb6\u7cfb\u56f3 node is created only after an actual parent/child
// relation exists; otherwise ritual participants become isolated pseudo-families.
family = lineageEdgeFamily(family);
const relatedIds = lineageRelatedIdSet(family);
@ -124,9 +124,29 @@ function liveFamilyComponents(family) {
}
function familyStatusText(n) {
if (!n) return "不明";
return n.alive ? "生存" : "死亡";
if (!n) return "\u4e0d\u660e";
return n.alive ? "\u751f\u5b58" : "\u6b7b\u4ea1";
}
function familyDeathReasonLabel(rawReason, entity = null) {
const text = String(rawReason || "");
if (!text) return "";
if (entity?.briefDeathReason) return entity.briefDeathReason(text);
if (text.includes("\u3067\u8870\u5f31")) return text.length > 12 ? `${text.slice(0, 12)}\u2026` : text;
if (/\u55a7\u5629|fight/.test(text)) return "\u55a7\u5629";
if (/\u7206\u7af9|firecracker|explosion/.test(text)) return "\u7206\u7af9";
if (/\u3064\u3064\u304b\u308c|\u3064\u3064\u304d|poke/.test(text)) return "\u3064\u3064\u304b\u308c\u3059\u304e\u305f";
if (/\u305a\u3093\u3061\u75c5|zunchi_sick|zunchi.*\u75c5/.test(text)) return "\u305a\u3093\u3061\u75c5";
if (/\u75c5/.test(text)) {
const disease = text.match(/([^\u3001\u3002\s]+\u75c5)/);
return disease ? disease[1] : "\u305a\u3093\u3061\u75c5";
}
if (/\u98e2|\u7a7a\u8179|\u98df\u3079\u7269|hunger/.test(text)) return "\u98e2\u9913";
if (/\u30b9\u30c8\u30ec\u30b9|stress|\u6c17\u5206/.test(text)) return "\u30b9\u30c8\u30ec\u30b9\u904e\u591a";
if (/\u5bff\u547d/.test(text)) return "\u5bff\u547d";
if (/\u30dc\u30fc\u30eb|\u843d\u3061|\u843d\u4e0b|\u77f3|\u9053\u5177|\u4e8b\u6545|\u5f53\u305f|\u885d\u7a81|ball|drop|stone|accident/.test(text)) return "\u4e8b\u6545";
return "\u4e8b\u6545";
}
function lineageNodeSort(a, b) {
return (a.generation || 1) - (b.generation || 1) ||
@ -139,19 +159,21 @@ function lineageTreeNodeHtml(n, x, y) {
const entity = n?.id ? world.tarinai.find(t => t.id === n.id) : null;
const live = entity && !entity.dead ? entity : null;
const img = n ? tarinaiSpritePathForId(n.id) : SPRITES[0].path;
const name = escapeHtml(n?.name || "不明");
const name = escapeHtml(n?.name || "\u4e0d\u660e");
const status = familyStatusText(n);
const gen = n?.generation ? `G${n.generation}` : "G?";
const rawReason = !n?.alive && n?.deathReason ? String(n.deathReason) : "";
const briefReason = rawReason && entity?.briefDeathReason ? entity.briefDeathReason(rawReason) : (rawReason ? String(rawReason) : "");
const briefReason = familyDeathReasonLabel(rawReason, entity);
const reason = briefReason ? ` / ${briefReason}` : "";
const title = escapeHtml(`${n?.name || "不明"} / 世代 ${n?.generation || "?"} / ${status}${reason}`);
const personality = live?.personalityLabel ? live.personalityLabel() : ((PERSONALITIES[n?.personality] || {}).label || n?.personality || "");
const personalityPart = personality ? ` / \u6027\u683c ${personality}` : "";
const title = escapeHtml(`${n?.name || "\u4e0d\u660e"} / \u4e16\u4ee3 ${n?.generation || "?"} / ${status}${personalityPart}${reason}`);
const deathLine = briefReason ? `<span class="death-reason">${escapeHtml(briefReason)}</span>` : "";
const cls = n ? ((live || n.alive) ? "alive" : "dead") : "missing";
const childCls = (n?.parents || []).length ? " child" : "";
const data = n?.id ? ` data-family-tarinai-id="${escapeHtml(n.id)}"` : "";
return `<div class="family-node tree-node ${cls}${childCls}"${data} title="${title}" style="left:${Math.round(x)}px;top:${Math.round(y)}px">
<div class="family-portrait" aria-hidden="true"><img src="${img}" alt=""></div>
<div class="family-portrait" aria-hidden="true"><img src="${img}" loading="lazy" decoding="async" alt=""></div>
<div class="family-copy">
<strong>${name}</strong>
<span>${escapeHtml(gen)} / ${escapeHtml(status)}</span>
@ -162,7 +184,7 @@ function lineageTreeNodeHtml(n, x, y) {
/*
* Family archive rendering is intentionally a top-down tree diagram.
* Do not replace this section with list/cards/readable grids: the archive must remain a 家系図.
* Do not replace this section with list/cards/readable grids: the archive must remain a \u5bb6\u7cfb\u56f3.
* The layout below may reorder siblings/parents inside the same generation only to reduce crossings.
*/
function lineageParentIds(n, idSet, family = world.family || {}) {
@ -731,7 +753,7 @@ function lineageBuildChildPathGroup(group, nodeW, nodeH, bridgeHorizontals) {
const childPoints = children
.map(c => ({ x: c.x + nodeW / 2, y: c.y }))
.sort((a, b) => a.x - b.x || a.y - b.y);
if (childPoints.length === 1 && Math.abs(childPoints[0].x - joinX) <= 40) {
if (childPoints.length === 1 && Math.abs(childPoints[0].x - joinX) <= 0.5) {
const p = childPoints[0];
const bridges = lineageIntersectionYsForVertical(p.x, fromY, p.y, bridgeHorizontals);
return { d: lineageVerticalBridgePath(p.x, fromY, p.y, bridges) };
@ -748,6 +770,98 @@ function lineageBuildChildPathGroup(group, nodeW, nodeH, bridgeHorizontals) {
return { d };
}
function lineageComponentSignature(component, family) {
family = lineageEdgeFamily(family);
const idSet = new Set(component.map(x => x?.id).filter(Boolean));
return component
.filter(Boolean)
.map(n => {
const parents = lineageMutualParentIds(n, family, idSet).join(",");
const children = lineageMutualChildIds(n, family, idSet).join(",");
return [
n.id,
n.name || "",
n.type || "",
n.generation || 1,
n.birthTime || 0,
n.hasPaired ? 1 : 0,
n.alive === false ? 0 : 1,
n.deathReason || "",
parents,
children,
].join(":");
})
.sort()
.join("|");
}
function lineageExpectedChildEdgeCount(component, family) {
family = lineageEdgeFamily(family);
const idSet = new Set(component.map(x => x?.id).filter(Boolean));
let count = 0;
for (const n of component || []) count += lineageParentIds(n, idSet, family).length;
return count;
}
function lineageVisibleRelationSignature(family) {
family = lineageEdgeFamily(family);
const known = new Set(Object.keys(family));
const parentEdges = new Map();
const childEdges = new Map();
const relatedIds = new Set();
const addEdge = (parentId, childId) => {
if (!parentId || !childId || parentId === childId || !known.has(parentId) || !known.has(childId)) return;
if (!parentEdges.has(childId)) parentEdges.set(childId, new Set());
if (!childEdges.has(parentId)) childEdges.set(parentId, new Set());
parentEdges.get(childId).add(parentId);
childEdges.get(parentId).add(childId);
relatedIds.add(parentId);
relatedIds.add(childId);
};
for (const n of Object.values(family || {})) {
if (!n?.id) continue;
for (const parentId of n.parents || []) addEdge(parentId, n.id);
for (const childId of n.children || []) addEdge(n.id, childId);
}
return Array.from(relatedIds)
.sort()
.map(id => {
const n = family[id] || {};
const parents = Array.from(parentEdges.get(id) || []).sort().join(",");
const children = Array.from(childEdges.get(id) || []).sort().join(",");
return [
id,
n.name || "",
n.type || "",
n.generation || 1,
n.birthTime || 0,
n.alive === false ? 0 : 1,
n.deathReason || "",
parents,
children,
].join(":");
})
.join("|");
}
function lineageArchiveNearViewport() {
if (!ui.archiveContent?.getBoundingClientRect) return true;
const rect = ui.archiveContent.getBoundingClientRect();
const h = window.innerHeight || document.documentElement?.clientHeight || 0;
return rect.top < h + 260 && rect.bottom > -260;
}
function lineageSetArchiveStaleStatus(show) {
if (!ui.archiveContent) return;
const existing = ui.archiveContent.querySelector(".lineage-stale-status");
if (!show) {
existing?.remove();
return;
}
if (existing) return;
ui.archiveContent.insertAdjacentHTML("afterbegin", `<div class="lineage-stale-status">\u5bb6\u7cfb\u56f3\u306e\u66f4\u65b0\u306f\u4e00\u6642\u505c\u6b62\u4e2d\u3067\u3059\u3002\u4e00\u6642\u505c\u6b62\u3059\u308b\u3068\u53cd\u6620\u3055\u308c\u307e\u3059\u3002</div>`);
}
function lineageAssignPartnerAttachOffsets(linkGroups) {
const buckets = new Map();
const pushBucket = (nodeId, side, group) => {
@ -855,7 +969,7 @@ function lineageBuildLinks(nodes, idSet, layout) {
}
}
return { partnerLinks, childLinks };
return { partnerLinks, childLinks, childLinkGroups: linkGroups.length };
}
function lineageSplitByActualEdges(component) {
@ -935,36 +1049,81 @@ function buildLineageTreeLayout(component, family) {
const labels = generations.map((g, rowIndex) => ({ generation: g, y: layout.topPad + rowIndex * (layout.nodeH + layout.rowGap) + 18 }));
const renderedNodes = nodes.map(n => ({ node: n, ...(layout.positions.get(n.id) || {}) })).filter(n => Number.isFinite(n.x) && Number.isFinite(n.y));
return { ...layout, labels, nodes: renderedNodes, childLinks: links.childLinks, partnerLinks: links.partnerLinks };
return { ...layout, labels, nodes: renderedNodes, childLinks: links.childLinks, partnerLinks: links.partnerLinks, childLinkGroups: links.childLinkGroups };
}
function lineageFamilyHtml(component, index, family) {
function lineageFamilyHtml(component, index, family, signature = "") {
const uniqueComponent = Array.from(new Map(component.filter(Boolean).map(n => [n.id, n])).values()).sort(lineageNodeSort);
const cacheKey = `${index}:${signature || lineageComponentSignature(uniqueComponent, family)}`;
if (uiCache.archiveHtmlCache?.has(cacheKey)) return uiCache.archiveHtmlCache.get(cacheKey);
const layout = buildLineageTreeLayout(uniqueComponent, family);
const aliveCount = uniqueComponent.filter(n => n.alive).length;
const labels = layout.labels.map(label => `<div class="tree-generation-label" style="top:${Math.round(label.y)}px">世代 ${label.generation}</div>`).join("");
const childEdgeCount = lineageExpectedChildEdgeCount(uniqueComponent, family);
const maskId = `lineage-node-mask-${index}`;
const nodeMaskRects = layout.nodes
.map(p => `<rect x="${(p.x + 1).toFixed(1)}" y="${(p.y + 1).toFixed(1)}" width="${(layout.nodeW - 2).toFixed(1)}" height="${(layout.nodeH - 2).toFixed(1)}" rx="9" fill="black"></rect>`)
.join("");
const labels = layout.labels.map(label => `<div class="tree-generation-label" style="top:${Math.round(label.y)}px">\u4e16\u4ee3 ${label.generation}</div>`).join("");
const partnerPaths = layout.partnerLinks.map(d => `<path class="partner-link" d="${d}"></path>`).join("");
const childPaths = layout.childLinks.map(d => `<path class="child-link" d="${d}"></path>`).join("");
const nodeHtml = layout.nodes.map(p => lineageTreeNodeHtml(p.node, p.x, p.y)).join("");
const empty = !layout.childLinks.length ? `<div class="lineage-empty-family">親子関係の線はまだありません。</div>` : "";
const empty = !layout.childLinks.length ? `<div class="lineage-empty-family">\u89aa\u5b50\u95a2\u4fc2\u306e\u7dda\u306f\u307e\u3060\u3042\u308a\u307e\u305b\u3093\u3002</div>` : "";
return `<section class="lineage-family lineage-family-tree">
<h3>家系 ${index + 1} / ${uniqueComponent.length}/ 生存 ${aliveCount}</h3>
const html = `<section class="lineage-family lineage-family-tree" data-lineage-child-edges="${childEdgeCount}" data-lineage-child-groups="${layout.childLinkGroups || 0}" data-lineage-child-paths="${layout.childLinks.length}">
<h3>\u5bb6\u7cfb ${index + 1} / ${uniqueComponent.length}\u5339 / \u751f\u5b58 ${aliveCount}</h3>
<div class="lineage-tree-panel" style="width:${Math.ceil(layout.width)}px;height:${Math.ceil(layout.height)}px">
<svg class="lineage-links" viewBox="0 0 ${Math.ceil(layout.width)} ${Math.ceil(layout.height)}" aria-hidden="true">
${partnerPaths}${childPaths}
<defs><mask id="${maskId}" maskUnits="userSpaceOnUse"><rect x="0" y="0" width="${Math.ceil(layout.width)}" height="${Math.ceil(layout.height)}" fill="white"></rect>${nodeMaskRects}</mask></defs>
<g mask="url(#${maskId})">${partnerPaths}${childPaths}</g>
</svg>
${labels}${nodeHtml}${empty}
</div>
</section>`;
uiCache.archiveHtmlCache?.set(cacheKey, html);
return html;
}
function renderArchive() {
if (!ui.archiveContent) return;
if (uiCache.deferArchiveUntil && performance.now() < uiCache.deferArchiveUntil) return;
uiCache.deferArchiveUntil = 0;
if (world.normalizeFamily) world.normalizeFamily();
uiCache.archiveScheduled = false;
const familyVersion = world.familyVersion || 0;
if (uiCache.archiveVersion && uiCache.archiveFamilyVersion === familyVersion) return;
if (uiCache.archiveVersion && !lineageArchiveNearViewport()) {
uiCache.archivePendingOffscreen = true;
return;
}
const running = world && !world.paused;
if (uiCache.archiveVersion && running) {
uiCache.archivePendingWhileRunning = true;
if (uiCache.archiveDiagnostics) uiCache.archiveDiagnostics.skippedWhileRunning = (uiCache.archiveDiagnostics.skippedWhileRunning || 0) + 1;
lineageSetArchiveStaleStatus(true);
return;
}
const now = performance.now();
const minUpdateGap = 700;
if (uiCache.archiveVersion && !uiCache.archiveRenderForce && now - (uiCache.archiveLastRenderedAt || 0) < minUpdateGap) {
if (!uiCache.archiveRenderTimer) {
uiCache.archiveRenderTimer = setTimeout(() => {
uiCache.archiveRenderTimer = 0;
uiCache.archiveRenderForce = true;
renderArchive();
uiCache.archiveRenderForce = false;
}, Math.max(80, minUpdateGap - (now - (uiCache.archiveLastRenderedAt || 0))));
}
return;
}
if (world.familyPrunePending && world.pruneExtinctFamilies) {
world.familyPrunePending = false;
world.pruneExtinctFamilies();
}
const family = world.family || {};
const relationSignature = lineageVisibleRelationSignature(family);
if (uiCache.archiveVersion && uiCache.archiveRelationSignature === relationSignature) {
uiCache.archiveFamilyVersion = world.familyVersion || 0;
return;
}
const ids = Object.keys(family);
const edgeCount = ids.reduce((sum, id) => {
const n = family[id];
@ -972,41 +1131,67 @@ function renderArchive() {
}, 0);
const version = `${world.familyVersion || 0}:${ids.length}:${edgeCount}`;
if (uiCache.archiveVersion === version) return;
const renderStarted = performance.now();
lineageSetArchiveStaleStatus(false);
if (uiCache.archiveRenderTimer) {
clearTimeout(uiCache.archiveRenderTimer);
uiCache.archiveRenderTimer = 0;
}
uiCache.archiveVersion = version;
uiCache.archiveFamilyVersion = world.familyVersion || 0;
uiCache.archiveLastScheduleFamilyVersion = world.familyVersion || 0;
uiCache.archiveRelationSignature = relationSignature;
uiCache.archiveLastRenderedAt = performance.now();
uiCache.lastArchiveWindow = "";
const components = liveFamilyComponents(family).flatMap(lineageSplitByActualEdges).map(c => lineageCleanComponent(c, family)).filter(c => c.length);
uiCache.archiveRows = components;
const signatures = components.map(component => lineageComponentSignature(component, family));
if (!uiCache.archiveHtmlCache) uiCache.archiveHtmlCache = new Map();
const activeCacheKeys = new Set(signatures.map((signature, index) => `${index}:${signature}`));
for (const key of Array.from(uiCache.archiveHtmlCache.keys())) {
if (!activeCacheKeys.has(key)) uiCache.archiveHtmlCache.delete(key);
}
const token = `${version}:${Math.random().toString(36).slice(2)}`;
uiCache.archiveRenderToken = token;
if (!components.length) {
ui.archiveContent.innerHTML = `<div class="selected-info empty">生きている構成員を持つ家系はまだありません。</div>`;
ui.archiveContent.innerHTML = `<div class="selected-info empty">\u751f\u304d\u3066\u3044\u308b\u69cb\u6210\u54e1\u3092\u6301\u3064\u5bb6\u7cfb\u306f\u307e\u3060\u3042\u308a\u307e\u305b\u3093\u3002</div>`;
return;
}
ui.archiveContent.innerHTML = `<div class="lineage-render-status">家系図を描画中… 0 / ${components.length}</div><div class="lineage-forest"></div>`;
ui.archiveContent.innerHTML = `<div class="lineage-render-status">\u5bb6\u7cfb\u56f3\u3092\u63cf\u753b\u4e2d\u2026 0 / ${components.length}</div><div class="lineage-forest"></div>`;
const status = ui.archiveContent.querySelector(".lineage-render-status");
const forest = ui.archiveContent.querySelector(".lineage-forest");
let index = 0;
const pump = () => {
if (uiCache.archiveRenderToken !== token || !forest) return;
const started = performance.now();
let nodeBudget = 180;
let nodeBudget = 72;
let renderedThisSlice = 0;
while (index < components.length) {
const component = components[index];
forest.insertAdjacentHTML("beforeend", lineageFamilyHtml(component, index, family));
if (renderedThisSlice > 0 && component.length > nodeBudget) break;
forest.insertAdjacentHTML("beforeend", lineageFamilyHtml(component, index, family, signatures[index]));
nodeBudget -= Math.max(1, component.length);
index += 1;
renderedThisSlice += 1;
if (index < components.length && (nodeBudget <= 0 || performance.now() - started > 14)) break;
}
if (status) status.textContent = `家系図を描画中… ${index} / ${components.length}`;
if (status) status.textContent = `\u5bb6\u7cfb\u56f3\u3092\u63cf\u753b\u4e2d\u2026 ${index} / ${components.length}`;
if (index < components.length) {
const schedule = window.requestIdleCallback || ((fn) => setTimeout(fn, 0));
schedule(pump, { timeout: 120 });
} else if (status) {
status.remove();
if (uiCache.archiveDiagnostics) {
uiCache.archiveDiagnostics.renders = (uiCache.archiveDiagnostics.renders || 0) + 1;
uiCache.archiveDiagnostics.lastMs = Math.round((performance.now() - renderStarted) * 10) / 10;
uiCache.archiveDiagnostics.lastFamilies = components.length;
uiCache.archiveDiagnostics.lastNodes = components.reduce((sum, component) => sum + component.length, 0);
}
}
};
pump();
const schedule = window.requestIdleCallback || ((fn) => setTimeout(fn, 0));
schedule(pump, { timeout: 80 });
}
function validateFamilyTree() {
@ -1024,6 +1209,40 @@ function validateFamilyTree() {
if (n?.id && !rendered.has(n.id)) issues.push({ type: "missing-render-node", id: n.id });
}
}
document.querySelectorAll(".lineage-family-tree[data-lineage-child-edges]").forEach((section, index) => {
const expectedEdges = Number(section.getAttribute("data-lineage-child-edges") || 0);
const expectedGroups = Number(section.getAttribute("data-lineage-child-groups") || 0);
const pathCount = section.querySelectorAll(".lineage-links .child-link").length;
if (expectedEdges > 0 && pathCount < 1) {
issues.push({ type: "missing-render-child-link", familyIndex: index, expectedEdges, pathCount });
}
if (expectedGroups > 0 && pathCount < expectedGroups) {
issues.push({ type: "missing-render-child-link-group", familyIndex: index, expectedGroups, pathCount });
}
const panel = section.querySelector(".lineage-tree-panel");
const svg = section.querySelector(".lineage-links");
if (panel && svg) {
const panelRect = panel.getBoundingClientRect();
const nodes = Array.from(panel.querySelectorAll(".tree-node")).map(node => {
const r = node.getBoundingClientRect();
return {
id: node.getAttribute("data-family-tarinai-id") || "",
left: r.left - panelRect.left + 1,
top: r.top - panelRect.top + 1,
right: r.right - panelRect.left - 1,
bottom: r.bottom - panelRect.top - 1,
};
});
section.querySelectorAll(".lineage-links .child-link").forEach((path, pathIndex) => {
if (!path.getBBox) return;
const box = path.getBBox();
for (const node of nodes) {
const overlaps = box.x < node.right && box.x + box.width > node.left && box.y < node.bottom && box.y + box.height > node.top;
if (overlaps) issues.push({ type: "child-link-bbox-overlaps-node-body", familyIndex: index, pathIndex, node: node.id });
}
});
}
});
return issues;
}
@ -1032,7 +1251,22 @@ function renderArchiveWindow() {
}
function scheduleArchiveWindowRender() {
renderArchive();
if (uiCache.archiveVersion && uiCache.archiveFamilyVersion === (world.familyVersion || 0)) return;
if (uiCache.archiveRenderTimer) return;
if (uiCache.archiveScheduled) return;
uiCache.archiveScheduled = true;
const schedule = window.requestIdleCallback || ((fn) => setTimeout(fn, 0));
schedule(() => {
renderArchive();
}, { timeout: 700 });
}
function schedulePendingArchiveRender() {
if (!uiCache.archivePendingOffscreen) return;
if (!lineageArchiveNearViewport()) return;
uiCache.archivePendingOffscreen = false;
scheduleArchiveWindowRender();
}
window.validateFamilyTree = validateFamilyTree;
window.familyTreeDiagnostics = () => ({ ...(uiCache.archiveDiagnostics || {}) });

View file

@ -24,6 +24,7 @@ class World {
this.drawListDirty = true;
this.selected = null;
this.deadCount = 0;
this.lastBirthAt = -999;
this.maxGeneration = 1;
this.family = {};
this.familyVersion = 0;
@ -91,10 +92,27 @@ class World {
const base = CONFIG.grassLimit ?? 96;
const mediumScale = Math.max(0.22, FIELD_TYPES?.garden?.worldScale || 1);
const ratio = this.fieldWorldScale() / mediumScale;
// 中サイズを CONFIG.grassLimit の基準にし、フィールドの論理サイズに応じて増減する。
// \u4e2d\u30b5\u30a4\u30ba\u3092 CONFIG.grassLimit \u306e\u57fa\u6e96\u306b\u3057\u3001\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u8ad6\u7406\u30b5\u30a4\u30ba\u306b\u5fdc\u3058\u3066\u5897\u6e1b\u3059\u308b\u3002
return Math.max(12, Math.round(base * ratio));
}
fenceLimit() {
const base = CONFIG.fenceLimit ?? 72;
const mediumScale = Math.max(0.22, FIELD_TYPES?.garden?.worldScale || 1);
const ratio = Math.max(0.24, this.fieldWorldScale() / mediumScale);
return clamp(Math.round(base * Math.sqrt(ratio)), 28, 140);
}
isFenceType(type = "") {
return type === "fence_v" || type === "fence_h";
}
liveFenceCount() {
let count = 0;
for (const it of this.items || []) if (!it.dead && this.isFenceType(it.type)) count += 1;
return count;
}
baseZoomMin() {
return CONFIG.fieldZoomMin || 0.42;
}
@ -299,6 +317,7 @@ class World {
this.drawListDirty = true;
this.selected = null;
this.deadCount = 0;
this.lastBirthAt = -999;
this.maxGeneration = 1;
this.family = {};
this.familyVersion = 0;
@ -337,6 +356,7 @@ class World {
recordFamily(t) {
if (!this.family) this.family = {};
if (!t?.id) return;
const uniqueIds = (list) => Array.from(new Set((list || []).filter(Boolean)));
const sameList = (a, b) => {
const aa = uniqueIds(a);
@ -351,6 +371,7 @@ class World {
id: t.id,
name: t.name,
type: t.type,
personality: t.personality || "",
generation: t.generation,
hasPaired: !!t.hasPaired,
parents: nextParents,
@ -366,6 +387,7 @@ class World {
const nextAlive = !t.dead;
if (entry.name !== t.name) changed = true;
if (entry.type !== t.type) changed = true;
if ((entry.personality || "") !== (t.personality || "")) changed = true;
if (entry.hasPaired !== !!t.hasPaired) changed = true;
if (entry.generation !== t.generation) changed = true;
if ((entry.deathReason || "") !== (t.deathReason || entry.deathReason || "")) changed = true;
@ -374,6 +396,7 @@ class World {
if (!sameList(entry.children, nextChildren)) changed = true;
entry.name = t.name;
entry.type = t.type;
entry.personality = t.personality || entry.personality || "";
entry.alive = nextAlive;
entry.generation = t.generation;
entry.hasPaired = !!t.hasPaired;
@ -394,6 +417,7 @@ class World {
const uniqueIds = (list, allow) => Array.from(new Set((list || []).filter(id => id && (!allow || allow.has(id)))));
const sameList = (a, b) => a.length === b.length && a.every((id, i) => id === b[i]);
for (const t of this.tarinai || []) {
if (!this.family[t.id] && !(t.hasPaired || (t.parents || []).length || (t.children || []).length)) continue;
const before = this.familyVersion || 0;
this.recordFamily(t);
changed = changed || before !== (this.familyVersion || 0);
@ -414,6 +438,7 @@ class World {
id,
name: live?.name || n.name || id,
type: live?.type || n.type || "smile",
personality: live?.personality || n.personality || "",
generation: Math.max(1, live?.generation || n.generation || 1),
hasPaired: !!(live?.hasPaired || n.hasPaired),
parents,
@ -448,6 +473,13 @@ class World {
changed = true;
}
}
for (const id of Object.keys(family)) {
const n = family[id];
if (!n?.hasPaired && !(n?.parents || []).length && !(n?.children || []).length) {
delete family[id];
changed = true;
}
}
for (const [id, live] of liveById.entries()) {
const n = family[id];
if (!n) continue;
@ -513,15 +545,16 @@ class World {
markDead(t, reason) {
if (!this.family) this.family = {};
const finalReason = t?.normalizeDeathReason ? t.normalizeDeathReason(reason) : reason;
if (this.family[t.id]) {
if (this.family[t.id].alive !== false || this.family[t.id].deathReason !== reason) {
if (this.family[t.id].alive !== false || this.family[t.id].deathReason !== finalReason) {
this.family[t.id].alive = false;
this.family[t.id].deathReason = reason;
this.family[t.id].deathReason = finalReason;
this.family[t.id].personality = t.personality || this.family[t.id].personality || "";
this.familyVersion = (this.familyVersion || 0) + 1;
}
}
this.normalizeFamily();
this.pruneExtinctFamilies();
this.familyPrunePending = true;
}
pruneExtinctFamilies(opts = {}) {
@ -571,7 +604,7 @@ class World {
const t = new Tarinai(this, opts);
this.tarinai.push(t);
this.drawListDirty = true;
this.recordFamily(t);
if (t.hasPaired || (t.parents || []).length || (t.children || []).length) this.recordFamily(t);
this.maxGeneration = Math.max(this.maxGeneration, t.generation);
return t;
}
@ -626,7 +659,8 @@ class World {
const child = this.spawnChild(a, b, i, childCount);
if (child) { child.postBirthPeaceTimer = 18; children.push(child); }
}
if (children.length > 1) this.log(`${a.name}\u3068${b.name}\u306e\u8fd1\u304f\u306b${children.length}\u5339\u306e\u5b50\u304c\u73fe\u308c\u305f\u3002`, "birth");
if (children.length > 0) this.lastBirthAt = this.time;
if (children.length > 1) this.log(`${a.name}\u3068${b.name}\u306e\u5b50\u304c${children.length}\u5339\u751f\u307e\u308c\u305f\u3002`, "birth");
return children[0] || null;
}
@ -656,8 +690,10 @@ class World {
spawnChild(a, b, index = 0, total = 1) {
const inherited = Math.random() < 0.56 ? a.type : b.type;
const mutation = Math.random() < 0.18 ? baseSpriteId() : inherited;
const inheritedPersonality = a.personality === b.personality ? a.personality : (Math.random() < 0.5 ? a.personality : b.personality);
const child = this.addTarinai({
type: mutation,
personality: inheritedPersonality || personalityForSeed(`${a.id}:${b.id}:${this.time}:${index}`),
name: makeName(),
age: 0,
x: (a.x + b.x) / 2 + rand(-14, 14) + (index - (total - 1) / 2) * 18,
@ -690,14 +726,64 @@ class World {
this.recordFamily(child);
if (this.family[a.id] && !this.family[a.id].children.includes(child.id)) this.family[a.id].children.push(child.id);
if (this.family[b.id] && !this.family[b.id].children.includes(child.id)) this.family[b.id].children.push(child.id);
this.normalizeFamily();
this.familyCleanVersion = null;
audio.birth();
if (total <= 1) this.log(`${child.name}\u304c${a.name}\u3068${b.name}\u306e\u8fd1\u304f\u306b\u73fe\u308c\u305f\u3002`, "birth");
this.lastBirthAt = this.time;
if (total <= 1) this.log(`${child.name}\u304c${a.name}\u3068${b.name}\u306e\u5b50\u3068\u3057\u3066\u751f\u307e\u308c\u305f\u3002`, "birth");
return child;
}
startForcedFight(a, b) {
if (!a || !b || a === b || a.dead || b.dead) return false;
const alreadyFighting = a.fightTimer > 0.04 && b.fightTimer > 0.04 && ((a.fightTargetIds || []).includes(b.id) || a.fightTargetId === b.id);
if (alreadyFighting) return true;
for (const t of [a, b]) {
t.birthRitualTimer = 0;
t.birthRitualMax = 0;
t.birthPartnerId = null;
t.birthRitualLeader = false;
t.birthRitualRole = 0;
t.postBirthPeaceTimer = 0;
t.fightCooldown = 0;
t.intimidateTimer = 0;
t.intimidateTargetId = null;
t.intimidatedTimer = 0;
t.defeatedTimer = 0;
t.defeatedById = null;
t.fightWinnerId = null;
t.target = null;
t.state = "idle";
}
this.startFightMochiIntimidation(a, b);
this.startFight(a, b);
return true;
}
startFightMochiIntimidation(a, b) {
if (!a || !b || a.dead || b.dead) return false;
const aDrug = (a.fightMochiTimer || 0) > 0.04;
const bDrug = (b.fightMochiTimer || 0) > 0.04;
const actor = aDrug && !bDrug ? a : (!aDrug && bDrug ? b : (a.energy + a.stress * 0.36 >= b.energy + b.stress * 0.36 ? a : b));
const target = actor === a ? b : a;
actor.intimidateTimer = Math.max(actor.intimidateTimer || 0, rand(0.85, 1.35));
actor.intimidateTargetId = target.id;
actor.surpriseTimer = Math.max(actor.surpriseTimer || 0, 0.28);
target.intimidatedTimer = Math.max(target.intimidatedTimer || 0, rand(0.75, 1.25));
target.fearTimer = Math.max(target.fearTimer || 0, 0.72 * target.personalityProfile().fear);
actor.adjustRelation(target, -0.05, 0.06, "intimidate");
target.adjustRelation(actor, -0.12, 0.30 * target.personalityProfile().fear, "intimidate");
this.effects.push(new Effect("ring", actor.x, actor.y - actor.radius * 0.65, {
life: 0.34,
size: actor.radius * 0.62,
color: "rgba(154, 88, 42, 0.74)",
}));
this.spawnBubble(actor.x, actor.y - actor.radius * 1.30, "!", "rgba(120,62,38,0.82)");
return true;
}
startConflict(a, b) {
if (!a || !b || a.dead || b.dead) return;
if ((a.fightMochiTimer || 0) > 0.04 || (b.fightMochiTimer || 0) > 0.04) { this.startForcedFight(a, b); return; }
if (this.areParentChild(a, b) || this.areCoParents?.(a, b)) return;
if ((a.postBirthPeaceTimer || 0) > 0 || (b.postBirthPeaceTimer || 0) > 0) return;
if (a.fightTimer > 0.04 || b.fightTimer > 0.04 || a.intimidateTimer > 0.04 || b.intimidateTimer > 0.04) return;
@ -788,10 +874,10 @@ class World {
winner.fightWinnerId = winner.id;
winner.defeatedById = null;
winner.defeatedTimer = 0;
a.stress = clamp(a.stress + rand(8, 18), 0, 130);
b.stress = clamp(b.stress + rand(8, 18), 0, 130);
a.damage(rand(2, 7));
b.damage(rand(2, 7));
a.addStress ? a.addStress(rand(8, 18), { threshold: 8 }) : (a.stress = clamp(a.stress + rand(8, 18), 0, 130));
b.addStress ? b.addStress(rand(8, 18), { threshold: 8 }) : (b.stress = clamp(b.stress + rand(8, 18), 0, 130));
a.damage(rand(2, 7), "\u55a7\u5629");
b.damage(rand(2, 7), "\u55a7\u5629");
const dx = b.x - a.x, dy = b.y - a.y;
const d = Math.hypot(dx, dy) || 1;
a.vx -= dx / d * rand(32, 62); a.vy -= dy / d * rand(32, 62);
@ -839,17 +925,17 @@ class World {
t.target = { x, y, dead: false };
t.surpriseTimer = Math.max(t.surpriseTimer, 0.95);
t.fearTimer = Math.max(t.fearTimer, 1.2);
t.thought = "爆竹でたたき起こされた";
t.thought = "\u7206\u7af9\u3067\u305f\u305f\u304d\u8d77\u3053\u3055\u308c\u305f";
}
t.stress = clamp(t.stress + rand(8, 15), 0, 130);
t.addStress ? t.addStress(rand(8, 15), { threshold: 8 }) : (t.stress = clamp(t.stress + rand(8, 15), 0, 130));
t.fearTimer = Math.max(t.fearTimer, 0.58);
const dx = t.x - x;
const dy = t.y - y;
const d = Math.hypot(dx, dy) || 1;
if (d > blastRadius) continue;
const p = clamp(1 - d / blastRadius, 0, 1);
t.damage(5 + p * 18, "\u7206\u7af9\u306b\u9a5a\u3044\u305f");
t.stress = clamp(t.stress + 22 * p, 0, 130);
t.damage(5 + p * 18, "\u7206\u7af9");
t.addStress ? t.addStress(22 * p, { threshold: 8 }) : (t.stress = clamp(t.stress + 22 * p, 0, 130));
t.hurtTimer = Math.max(t.hurtTimer, 1.5 + p * 1.8);
t.surpriseTimer = Math.max(t.surpriseTimer, 0.85);
t.fearTimer = Math.max(t.fearTimer, 1.7 + p);
@ -894,7 +980,7 @@ class World {
blastedBalls += 1;
}
audio.explode();
this.log(blastedBalls ? "爆竹が派手にはじけ、ボールが急加速した。" : "爆竹が派手にはじけ、庭がざわついた。", "accident");
this.log(blastedBalls ? "\u7206\u7af9\u304c\u6d3e\u624b\u306b\u306f\u3058\u3051\u3001\u30dc\u30fc\u30eb\u304c\u6025\u52a0\u901f\u3057\u305f\u3002" : "\u7206\u7af9\u304c\u6d3e\u624b\u306b\u306f\u3058\u3051\u3001\u5ead\u304c\u3056\u308f\u3064\u3044\u305f\u3002", "accident");
}
spawnZunchi(x, y) {
@ -1038,8 +1124,8 @@ class World {
loser.totalFightLosses = (loser.totalFightLosses || 0) + 1;
if ((loser.totalFightLosses || 0) >= 5 && loser.becomeZunchiSlave?.(winner)) {
const oldName = loser.formerName || loser.name;
this.spawnBubble(loser.x, loser.y - loser.radius * 1.20, "ぶりゅ…", "rgba(74,91,50,0.78)");
this.log(`${oldName}は5回喧嘩に負け、ずんちどれいになった。`, "fight");
this.spawnBubble(loser.x, loser.y - loser.radius * 1.20, "\u3076\u308a\u3085\u2026", "rgba(74,91,50,0.78)");
this.log(`${oldName}\u306f5\u56de\u55a7\u5629\u306b\u8ca0\u3051\u3001\u305a\u3093\u3061\u3069\u308c\u3044\u306b\u306a\u3063\u305f\u3002`, "fight");
}
loser.fearTimer = Math.max(loser.fearTimer, 1.2 * loser.personalityProfile().fear);
this.spawnBubble(loser.x, loser.y - loser.radius * 1.28, "\u306f\u3041\u3041\u3041\uff01", "rgba(84,66,86,0.80)");
@ -1051,7 +1137,7 @@ class World {
}
itemDropImpact(it) {
if (!it || it.dead) return;
if (!it || it.dead || it.type === "water") return;
const isStone = it.type === "stone";
const radius = isStone ? 64 : Math.max(34, (it.r || 14) * 1.75);
const damage = isStone ? rand(20, 34) : rand(3, 7);
@ -1108,7 +1194,7 @@ class World {
for (const t of arr.slice(5)) {
t.state = "idle";
t.target = null;
t.thought = "ボールが混み合っているので眺めている";
t.thought = "\u30dc\u30fc\u30eb\u304c\u6df7\u307f\u5408\u3063\u3066\u3044\u308b\u306e\u3067\u773a\u3081\u3066\u3044\u308b";
t.wanderAngle = Math.atan2(t.y - ball.y, t.x - ball.x) + rand(-0.45, 0.45);
}
}
@ -1146,8 +1232,8 @@ class World {
ball.amount = Math.max(ball.amount || 999, 999);
audio.poke();
this.effects.push(new Effect("ring", ball.x, ball.y, { size: Math.max(16, ball.r * (0.95 + ball.pokeCombo * 0.05)), life: 0.22, color: "rgba(255,255,255,0.58)" }));
if (ball.pokeCombo >= 4 || speed > 430) this.log(`ボールを連続でつつき、勢いが増した。`, "observe");
else this.log(`ボールをつついて弾いた。`, "observe");
if (ball.pokeCombo >= 4 || speed > 430) this.log(`\u30dc\u30fc\u30eb\u3092\u9023\u7d9a\u3067\u3064\u3064\u304d\u3001\u52e2\u3044\u304c\u5897\u3057\u305f\u3002`, "observe");
else this.log(`\u30dc\u30fc\u30eb\u3092\u3064\u3064\u3044\u3066\u5f3e\u3044\u305f\u3002`, "observe");
return true;
}
@ -1199,9 +1285,10 @@ class World {
t.lastBallDamageAt = now;
t.vx += bvx * push;
t.vy += bvy * push;
t.damage(damage, "超高速のボールに当たった");
t.damage(damage, "\u8d85\u9ad8\u901f\u306e\u30dc\u30fc\u30eb\u306b\u5f53\u305f\u3063\u305f");
const timidStress = t.personality === "timid" ? 1.55 : 1.0;
t.stress = clamp(t.stress + clamp(damage * 0.55 * timidStress, 3, t.personality === "timid" ? 26 : 18), 0, 130);
const stressGain = clamp(damage * 0.55 * timidStress, 3, t.personality === "timid" ? 26 : 18);
t.addStress ? t.addStress(stressGain, { threshold: 8 }) : (t.stress = clamp(t.stress + stressGain, 0, 130));
t.hurtTimer = Math.max(t.hurtTimer, damage > 16 ? 2.4 : 1.35);
t.fallTimer = Math.max(t.fallTimer, damage > 14 ? 0.82 : 0.38);
t.fallMax = Math.max(t.fallMax || 0.82, t.fallTimer);
@ -1209,7 +1296,7 @@ class World {
t.fearTimer = Math.max(t.fearTimer, 0.8);
this.spawnFallEffect(t.x, t.y + t.radius * 0.55, clamp(damage / 18, 0.55, 1.6));
this.effects.push(new Effect("ring", hitX, hitY, { size: Math.max(20, ball.r * 1.25), life: 0.22, color: "rgba(210,75,65,0.50)" }));
if (this.relationNotice(t.id, ball.id || "ball", "fast-ball-hit", 2.8)) this.log(`${t.name}は超高速のボールに当たってダメージを受けた。`, "accident");
if (this.relationNotice(t.id, ball.id || "ball", "fast-ball-hit", 2.8)) this.log(`${t.name}\u306f\u8d85\u9ad8\u901f\u306e\u30dc\u30fc\u30eb\u306b\u5f53\u305f\u3063\u3066\u30c0\u30e1\u30fc\u30b8\u3092\u53d7\u3051\u305f\u3002`, "accident");
ball.vx = (ball.vx || 0) * 0.58 - nx * Math.min(110, ballSpeed * 0.10);
ball.vy = (ball.vy || 0) * 0.58 - ny * Math.min(110, ballSpeed * 0.10);
ball.spinVelocity = clamp((ball.spinVelocity || 0) + (nx >= 0 ? -1 : 1) * 8.5, -38, 38);
@ -1248,9 +1335,9 @@ class World {
t.goodMode = playIntent || playful ? "smile" : t.goodMode;
if (playIntent && now > (t.nextPlayBubbleAt || 0)) {
t.nextPlayBubbleAt = now + rand(2.0, 3.8);
this.spawnBubble(t.x, t.y - t.radius * 1.15, pick(["!", "はう", "?" ]), "rgba(70,96,50,0.76)");
this.spawnBubble(t.x, t.y - t.radius * 1.15, pick(["!", "\u306f\u3046", "?" ]), "rgba(70,96,50,0.76)");
}
if (playful && this.relationNotice(t.id, ball.id || "ball", "ball-kick", 16)) this.log(`${t.name}はボールを追いかけて弾いた。`, "observe");
if (playful && this.relationNotice(t.id, ball.id || "ball", "ball-kick", 16)) this.log(`${t.name}\u306f\u30dc\u30fc\u30eb\u3092\u8ffd\u3044\u304b\u3051\u3066\u5f3e\u3044\u305f\u3002`, "observe");
this.effects.push(new Effect("ring", ball.x, ball.y, { size: Math.max(12, ball.r * 0.80), life: 0.20, color: "rgba(170,210,95,0.50)" }));
}
}
@ -1306,8 +1393,13 @@ class World {
resolveFenceCollision(t) {
if (!t || t.dead) return;
const rr = Math.max(8, t.radius * 0.74);
for (const it of this.nearbyItems(t.x, t.y, rr + 92)) {
if (it.dead || (it.type !== "fence_v" && it.type !== "fence_h")) continue;
const maxChecks = CONFIG.maxFenceCollisionChecks ?? 18;
let checked = 0;
let pushed = false;
for (const it of this.nearbyItems(t.x, t.y, rr + 132)) {
if (checked >= maxChecks) break;
if (it.dead || !this.isFenceType(it.type)) continue;
checked += 1;
const r = this.fenceRect(it);
if (!r) continue;
const cx = clamp(t.x, r.left, r.right);
@ -1327,12 +1419,20 @@ class World {
else if (m === top) { dx = 0; dy = -1; d = 1; }
else { dx = 0; dy = 1; d = 1; }
}
const push = rr - d + 0.8;
const push = Math.min(rr - d + 0.8, Math.max(10, rr * 0.92));
t.x += dx / d * push;
t.y += dy / d * push;
pushed = true;
if (Math.abs(dx) > Math.abs(dy)) t.vx *= -0.18;
else t.vy *= -0.18;
}
if (pushed) {
const pad = CONFIG.worldPadding + Math.max(2, t.radius * 0.18);
t.x = clamp(t.x, pad, this.w - pad);
t.y = clamp(t.y, pad, this.h - pad);
t.vx = clamp(t.vx || 0, -130, 130);
t.vy = clamp(t.vy || 0, -130, 130);
}
}
@ -1354,9 +1454,9 @@ class World {
const cx = (x1 + x2) / 2;
const cy = (y1 + y2) / 2;
const maxD = Math.hypot(x2 - x1, y2 - y1) / 2 + 120;
for (const it of this.items) {
if (it.dead || (it.type !== "fence_v" && it.type !== "fence_h")) continue;
if (distXY(cx, cy, it.x, it.y) > maxD + 110) continue;
for (const it of this.nearbyItems(cx, cy, maxD + padding + 160)) {
if (it.dead || !this.isFenceType(it.type)) continue;
if (distXY(cx, cy, it.x, it.y) > maxD + padding + 130) continue;
const base = this.fenceRect(it);
if (!base) continue;
const r = { left: base.left - padding, right: base.right + padding, top: base.top - padding, bottom: base.bottom + padding };
@ -1523,10 +1623,19 @@ class World {
pruneOldest("trace", CONFIG.traceLimit ?? 64);
pruneOldest("splat", CONFIG.splatLimit ?? 48);
pruneOldest("grass", this.grassLimit ? this.grassLimit() : (CONFIG.grassLimit ?? 96));
const fenceLimit = this.fenceLimit ? this.fenceLimit() : (CONFIG.fenceLimit ?? 72);
const liveFences = this.liveFenceCount ? this.liveFenceCount() : 0;
if (liveFences > fenceLimit) {
const victims = this.items
.filter(it => this.isFenceType?.(it.type) && !it.dead)
.sort((a, b) => (b.age || 0) - (a.age || 0))
.slice(0, liveFences - fenceLimit);
for (const it of victims) it.amount = 0;
}
const limit = CONFIG.itemLimit ?? Infinity;
if (!Number.isFinite(limit) || this.items.length <= limit) return;
const priority = { trace: 1, splat: 2, zunchi: 3, water: 4, grass: 5, sweet: 6, firecracker: 7 };
const priority = { trace: 1, splat: 2, zunchi: 3, water: 4, grass: 5, sweet: 6, firecracker: 7, fence_v: 8, fence_h: 8 };
const removable = this.items
.filter(it => !it.dead && (priority[it.type] || 99) < 99)
.sort((a, b) => (priority[a.type] || 99) - (priority[b.type] || 99) || (b.age || 0) - (a.age || 0));
@ -1618,12 +1727,12 @@ class World {
audio.phase();
}
if (this.tarinai.length > 0 && this.tarinai.length <= 10 && Math.random() < dt * 0.022) {
if (this.tarinai.length > 0 && this.tarinai.length <= 10 && this.time - (this.lastBirthAt || -999) > 12 && Math.random() < dt * 0.022) {
const spot = this.edgeSpawnPoint(null, null, 42, true);
const t = this.addTarinai({ x: spot.x, y: spot.y, vx: spot.vx, vy: spot.vy, type: baseSpriteId(), entryTimer: 2.0 });
t.wanderAngle = spot.angle;
t.surpriseTimer = Math.max(t.surpriseTimer || 0, 0.35);
this.log(`${t.name}が画面外から迷い込んできた。`);
this.log(`${t.name}\u304c\u753b\u9762\u5916\u304b\u3089\u8ff7\u3044\u8fbc\u3093\u3067\u304d\u305f\u3002`);
}
@ -1677,6 +1786,23 @@ class World {
this.log(`\u5929\u6c17: ${weatherLabel(this.weather)}`);
}
fencePlacementBlocked(item) {
if (!item || !this.isFenceType(item.type)) return false;
const rect = this.fenceRect(item);
if (!rect) return false;
const margin = Math.max(6, (item.r || 42) * 0.24);
if (rect.left < CONFIG.worldPadding || rect.top < CONFIG.worldPadding || rect.right > this.w - CONFIG.worldPadding || rect.bottom > this.h - CONFIG.worldPadding) return true;
const searchRadius = Math.max(rect.right - rect.left, rect.bottom - rect.top) * 0.5 + 72;
for (const it of this.nearbyItems(item.x, item.y, searchRadius)) {
if (!it || it.dead || !this.isFenceType(it.type)) continue;
const r = this.fenceRect(it);
if (!r) continue;
const separated = rect.right + margin < r.left || rect.left - margin > r.right || rect.bottom + margin < r.top || rect.top - margin > r.bottom;
if (!separated) return true;
}
return false;
}
findGrabTargetAt(x, y) {
let foundT = null;
for (let i = this.tarinai.length - 1; i >= 0; i--) {
@ -1702,9 +1828,21 @@ class World {
placeItem(item, dropped = true) {
if (!item) return null;
if (item.type === "grass" && (this.itemCounts?.grass || 0) >= (this.grassLimit ? this.grassLimit() : (CONFIG.grassLimit ?? 96))) {
showToast("このフィールドの草の上限に達しています。");
showToast("\u3053\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u8349\u306e\u4e0a\u9650\u306b\u9054\u3057\u3066\u3044\u307e\u3059\u3002");
return null;
}
if (this.isFenceType(item.type)) {
this.compactItems();
this.updateItemCounts();
if (this.liveFenceCount() >= this.fenceLimit()) {
showToast("\u67f5\u304c\u591a\u3059\u304e\u307e\u3059\u3002\u5148\u306b\u4e00\u90e8\u3092\u524a\u9664\u3057\u3066\u304f\u3060\u3055\u3044\u3002");
return null;
}
if (this.fencePlacementBlocked(item)) {
showToast("\u305d\u3053\u306b\u306f\u67f5\u3092\u8ffd\u52a0\u3067\u304d\u307e\u305b\u3093\u3002");
return null;
}
}
if (dropped) {
item.dropMax = item.type === "stone" ? 0.72 : 0.58;
item.dropTimer = item.dropMax;
@ -1743,9 +1881,9 @@ class World {
const target = [...this.tarinai].reverse().find(t => t.contains(x, y));
if (target) {
target.poke();
if (!target.dead) this.log(`${target.name}はつつかれ、たりないことを覚えた。`);
if (!target.dead) this.log(`${target.name}\u306f\u3064\u3064\u304b\u308c\u3001\u305f\u308a\u306a\u3044\u3053\u3068\u3092\u899a\u3048\u305f\u3002`);
} else {
this.log("空気をつついた。そこには何もたりなかった。");
this.log("\u7a7a\u6c17\u3092\u3064\u3064\u3044\u305f\u3002\u305d\u3053\u306b\u306f\u4f55\u3082\u305f\u308a\u306a\u304b\u3063\u305f\u3002");
}
return;
}
@ -1774,7 +1912,7 @@ class World {
this.compactItems();
this.updateItemCounts();
this.rebuildSpatial();
const label = { zunchi: "\u305a\u3093\u3061", food: "\u98df\u3079\u7269", sweet: "\u305a\u3093\u3060\u9905", love_mochi: "\u5a9a\u85ac\u9905", fight_mochi: "\u55a7\u5629\u9905", water: "\u6c34", grass: "\u8349", stone: "\u77f3", bed: "\u5e72\u8349\u5bdd\u5e8a", ball: "\u30dc\u30fc\u30eb", firecracker: "\u7206\u7af9", fence_v: "\u7e26\u306e\u67f5", fence_h: "\u6a2a\u306e\u67f5", trace: "\u8db3\u8de1", splat: "\u3057\u3076\u304d" }[best.type] || best.type;
const label = { zunchi: "\u305a\u3093\u3061", food: "\u98df\u3079\u7269", sweet: "\u305a\u3093\u3060\u9905", love_mochi: "\u3078\u3053\u9905", fight_mochi: "\u3051\u3093\u304b\u9905", water: "\u6c34", grass: "\u8349", stone: "\u77f3", bed: "\u5e72\u8349\u5bdd\u5e8a", ball: "\u30dc\u30fc\u30eb", firecracker: "\u7206\u7af9", fence_v: "\u7e26\u306e\u67f5", fence_h: "\u6a2a\u306e\u67f5", trace: "\u8db3\u8de1", splat: "\u3057\u3076\u304d" }[best.type] || best.type;
this.log(`${label}\u3092\u524a\u9664\u3057\u305f\u3002`, "observe");
return;
}
@ -1795,10 +1933,20 @@ class World {
px = spot.x;
py = spot.y;
}
const placed = this.placeItem(this.applyToolSize(new Item(itemType, px, py)), true);
const rawItem = this.applyToolSize(new Item(itemType, px, py));
if (this.isFenceType(rawItem.type)) {
const rect = this.fenceRect(rawItem);
if (rect) {
const dx = Math.max(CONFIG.worldPadding - rect.left, 0) - Math.max(rect.right - (this.w - CONFIG.worldPadding), 0);
const dy = Math.max(CONFIG.worldPadding - rect.top, 0) - Math.max(rect.bottom - (this.h - CONFIG.worldPadding), 0);
rawItem.x += dx;
rawItem.y += dy;
}
}
const placed = this.placeItem(rawItem, true);
if (!placed) return;
const label = { zunchi: "ずんち", food: "食べ物", sweet: "ずんだ餅", love_mochi: "媚薬餅", fight_mochi: "喧嘩餅", water: "水", grass: "草", stone: "石", bed: "干草寝床", ball: "ボール", firecracker: "爆竹", fence_v: "縦の柵", fence_h: "横の柵" }[itemType];
this.log(`${label}を配置した。`);
const label = { zunchi: "\u305a\u3093\u3061", food: "\u98df\u3079\u7269", sweet: "\u305a\u3093\u3060\u9905", love_mochi: "\u3078\u3053\u9905", fight_mochi: "\u3051\u3093\u304b\u9905", water: "\u6c34", grass: "\u8349", stone: "\u77f3", bed: "\u5e72\u8349\u5bdd\u5e8a", ball: "\u30dc\u30fc\u30eb", firecracker: "\u7206\u7af9", fence_v: "\u7e26\u306e\u67f5", fence_h: "\u6a2a\u306e\u67f5" }[itemType];
this.log(`${label}\u3092\u914d\u7f6e\u3057\u305f\u3002`);
}
}
@ -1807,7 +1955,7 @@ class World {
if (s.includes("firecracker") || s.includes("accident") || s.includes("drop") || s.includes("\u7206\u7af9") || s.includes("\u843d\u3061") || s.includes("\u4e8b\u6545") || s.includes("\u5439\u304d\u98db")) return "accident";
if (s.includes("fight") || s.includes("lost to") || s.includes("poked") || s.includes("\u55a7\u5629") || s.includes("\u8ca0\u3051") || s.includes("\u3064\u3064\u304b")) return "fight";
if (s.includes("appeared") || s.includes("wandered in") || s.includes("birth") || s.includes("\u73fe\u308c") || s.includes("\u8ff7\u3044\u8fbc")) return "birth";
if (s.includes("dead") || s.includes("trace") || s.includes("reason:") || s.includes("\u6b7b\u4ea1") || s.includes("\u75d5\u8de1") || s.includes("\u7406\u7531:")) return "death";
if (s.includes("dead") || s.includes("trace") || s.includes("reason:") || s.includes("\u6b7b\u4ea1") || s.includes("\u75d5\u8de1") || s.includes("\u7406\u7531:") || s.includes("\u6b7b\u56e0:")) return "death";
if (s.includes("weather") || s.includes("day") || s.includes("night") || s.includes("morning") || s.includes("evening") || s.includes("\u5929\u6c17") || s.includes("\u65e5\u76ee") || s.includes("\u591c") || s.includes("\u671d") || s.includes("\u5915")) return "weather";
if (s.includes("zunda") || s.includes("food") || s.includes("eat") || s.includes("appreciated") || s.includes("\u305a\u3093\u3060") || s.includes("\u98df\u3079\u7269") || s.includes("\u5473\u308f")) return "food";
if (s.includes("grass") || s.includes("soil") || s.includes("\u8349") || s.includes("\u571f")) return "grass";
@ -1828,7 +1976,7 @@ class World {
serialize() {
return {
w: this.w, h: this.h, time: this.time, day: this.day, deadCount: this.deadCount,
maxGeneration: this.maxGeneration,
maxGeneration: this.maxGeneration, lastBirthAt: this.lastBirthAt || -999,
tarinai: this.tarinai.map(t => t.serialize()),
items: this.items.map(i => i.serialize()),
logs: this.logs.slice(0, 30),
@ -1853,6 +2001,7 @@ class World {
this.toolSize = data.toolSize || this.toolSize || "medium";
this.toolSizes = data.toolSizes || this.toolSizes || {};
this.maxGeneration = data.maxGeneration || 1;
this.lastBirthAt = Number.isFinite(data.lastBirthAt) ? data.lastBirthAt : -999;
this.fieldType = FIELD_TYPES?.[data.fieldType]?.id || "garden";
this.fieldZoom = Number(data.fieldZoom) || 1;
this.cameraX = Number(data.cameraX) || 0;