File size: 51,881 Bytes
80733a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
946e7bf
80733a2
 
 
946e7bf
80733a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
946e7bf
80733a2
 
 
 
 
 
 
 
 
946e7bf
80733a2
 
 
 
 
946e7bf
80733a2
 
 
 
 
 
 
 
 
946e7bf
80733a2
 
 
 
 
 
 
 
 
 
 
946e7bf
80733a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
946e7bf
80733a2
 
 
 
 
 
 
 
 
946e7bf
80733a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
946e7bf
80733a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
946e7bf
80733a2
 
 
 
 
 
 
 
946e7bf
80733a2
 
 
 
 
 
 
 
 
946e7bf
80733a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
946e7bf
80733a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
946e7bf
 
80733a2
 
 
946e7bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80733a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
946e7bf
 
 
80733a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
946e7bf
80733a2
 
946e7bf
 
80733a2
 
 
946e7bf
80733a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
# Pictuary Battle System Design Document

## Overview

This document defines a new programmatic battle system for Pictuary that replaces the current description-based approach with executable building blocks. The design is inspired by Pokemon Emerald's sophisticated battle mechanics while being simplified for our use case.

## Core Philosophy

The battle system is built on **composable building blocks** that can be combined to create unique and dynamic effects. Each action and ability is defined using simple, atomic operations that can be chained together to create complex behaviors.

## JSON Schema for `generateStats`

### Monster Definition

```json
{
  "name": "Zephyr Sprite",
  "description": "A mysterious floating creature that manipulates wind currents",
  "tier": "medium",
  "primaryType": "space",
  "secondaryType": null,
  "baseStats": {
    "hp": 65,
    "attack": 85,
    "defense": 40,
    "speed": 90
  },
  "nature": "hasty",
  "specialAbility": {
    "name": "Wind Currents",
    "description": "Gains +25% speed when opponent uses a contact move",
    "trigger": "onOpponentContactMove",
    "effects": [
      {
        "type": "modifyStats",
        "target": "self",
        "stats": { "speed": "increase" }
      }
    ]
  },
  "movepool": [
    {
      "name": "Gust Strike",
      "type": "space",
      "power": 65,
      "accuracy": 95,
      "pp": 20,
      "priority": 0,
      "flags": ["contact"],
      "effects": [
        {
          "type": "damage",
          "target": "opponent",
          "amount": "normal"
        }
      ]
    },
    {
      "name": "Piercing Gale",
      "type": "space", 
      "power": 80,
      "accuracy": 85,
      "pp": 15,
      "priority": 0,
      "flags": [],
      "effects": [
        {
          "type": "damage",
          "target": "opponent",
          "amount": "normal"
        },
        {
          "type": "modifyStats",
          "target": "self",
          "stats": { "accuracy": "decrease" },
          "condition": "afterUse"
        }
      ]
    },
    {
      "name": "Tailwind Boost",
      "type": "space",
      "power": 0,
      "accuracy": 100,
      "pp": 10,
      "priority": 1,
      "flags": [],
      "effects": [
        {
          "type": "modifyStats",
          "target": "self",
          "stats": { "speed": "greatly_increase" }
        }
      ]
    },
    {
      "name": "Reckless Dive",
      "type": "space", 
      "power": 120,
      "accuracy": 80,
      "pp": 5,
      "priority": 0,
      "flags": ["contact", "reckless"],
      "effects": [
        {
          "type": "damage",
          "target": "opponent",
          "amount": "normal"
        },
        {
          "type": "damage",
          "target": "self",
          "formula": "recoil",
          "value": 0.25
        }
      ]
    }
  ]
}
```

## Building Blocks System

### Effect Types

All battle effects are built from these atomic operations:

#### 1. **damage**
```json
{
  "type": "damage",
  "target": "opponent" | "self" | "all" | "allies",
  "amount": "weak" | "normal" | "strong" | "extreme"
}
```

#### 2. **modifyStats**
```json
{
  "type": "modifyStats",
  "target": "self" | "opponent" | "all",
  "stats": {
    "attack": "increase",      // "increase" | "decrease" | "greatly_increase" | "greatly_decrease"
    "defense": "decrease",
    "speed": "greatly_increase",
    "accuracy": "decrease"
  },
  "condition": "always" | "onHit" | "afterUse" | "ifCritical"
}
```

**Standard Stat Modification Levels:**
- **increase**: +25% (1.25x multiplier)
- **decrease**: -25% (0.75x multiplier)
- **greatly_increase**: +50% (1.5x multiplier)
- **greatly_decrease**: -50% (0.5x multiplier)

#### 3. **applyStatus**
```json
{
  "type": "applyStatus",
  "target": "opponent" | "self",
  "status": "burn" | "freeze" | "paralyze" | "poison" | "sleep" | "confuse"
}
```

#### 4. **heal**
```json
{
  "type": "heal",
  "target": "self" | "ally",
  "amount": "small" | "medium" | "large" | "full"
}
```

#### 5. **manipulatePP**
```json
{
  "type": "manipulatePP",
  "target": "opponent",
  "action": "drain" | "restore" | "disable",
  "amount": "small" | "medium" | "large"
}
```

#### 6. **fieldEffect**
```json
{
  "type": "fieldEffect",
  "effect": "reflect" | "lightScreen" | "spikes" | "healingMist" | "toxicSpikes",
  "target": "playerSide" | "opponentSide" | "field",
  "stackable": false
}
```

#### 7. **counter**
```json
{
  "type": "counter",
  "counterType": "physical" | "special" | "any",
  "strength": "weak" | "normal" | "strong"
}
```

#### 8. **priority**
```json
{
  "type": "priority",
  "target": "self",
  "value": 1,           // Priority bracket (-5 to +5)
  "condition": "ifLowHp" | "always"
}
```

#### 9. **removeStatus**
```json
{
  "type": "removeStatus",
  "target": "self" | "opponent" | "allies",
  "status": "burn" | "freeze" | "paralyze" | "poison" | "sleep" | "confuse"
}
```

### Move Flags

Moves can have flags that affect how they interact with abilities and other mechanics:

#### **Combat Flags**
- **contact**: Move makes physical contact (triggers contact abilities like Rough Skin)
- **bite**: Biting move (affected by Strong Jaw ability, blocked by certain defenses)  
- **punch**: Punching move (affected by Iron Fist ability)
- **sound**: Sound-based move (bypasses Substitute, blocked by Soundproof)
- **explosive**: Explosive move (affected by Damp ability)
- **draining**: Move that drains HP (affected by Liquid Ooze ability)
- **ground**: Ground-based attack (blocked by Sky Dancer, Levitate abilities)

#### **Priority Flags**
- **priority**: Move has natural priority (+1 to +5)
- **lowPriority**: Move has negative priority (-1 to -5)

#### **Special Mechanics**
- **charging**: Move requires charging turn (Sky Attack, Solar Beam)
- **recharge**: User must recharge next turn (Hyper Beam)
- **multiHit**: Hits multiple times (2-5 hits)
- **twoTurn**: Takes two turns to execute
- **sacrifice**: Move involves self-sacrifice or major cost
- **gambling**: Move has random outcomes
- **reckless**: Move gains power but has drawbacks (affected by Reckless ability)

#### **Interaction Flags**
- **reflectable**: Can be reflected by Magic Coat
- **snatchable**: Can be stolen by Snatch
- **copyable**: Can be copied by Mirror Move
- **protectable**: Blocked by Protect/Detect
- **bypassProtect**: Ignores Protect/Detect

### Triggers and Conditions

Effects can be triggered by various battle events:

- **always**: Effect always applies when move is used
- **onHit**: Effect applies only if the move hits
- **afterUse**: Effect applies after move execution regardless of hit/miss
- **onCritical**: Effect applies only on critical hits
- **ifLowHp**: Effect applies if user's HP < 25%
- **ifHighHp**: Effect applies if user's HP > 75%
- **onOpponentContactMove**: Trigger when opponent uses a contact move
- **endOfTurn**: Effect applies at the end of each turn
- **onSwitchIn**: Effect applies when Piclet enters battle
- **afterKO**: Effect applies after knocking out an opponent

### Target Specification

- **self**: The move user
- **opponent**: The target opponent
- **all**: All Piclets in battle
- **allies**: All allied Piclets (in team battles)
- **playerSide**: Player's side of the field
- **opponentSide**: Opponent's side of the field
- **field**: Entire battlefield

## Special Abilities

Special abilities are passive traits that can fundamentally alter battle mechanics. They can use standard effect building blocks OR modify core game mechanics directly.

### Mechanic Modifications

Special abilities can override or alter fundamental battle mechanics:

#### 9. **mechanicOverride**
```json
{
  "type": "mechanicOverride",
  "mechanic": "criticalHits" | "statusImmunity" | "damageReflection" | "healingInversion" | "priorityOverride" | "accuracyBypass" | "typeImmunity" | "contactDamage" | "drainInversion" | "weatherImmunity",
  "condition": "always" | "ifLowHp" | "whenStatusAfflicted" | "vsPhysical" | "vsSpecial",
  "value": true | false | "invert" | "double" | "absorb" | "reflect"
}
```

**Mechanic Types:**
- **criticalHits**: `false` = cannot be crit, `true` = always crit, `"double"` = 2x crit rate
- **statusImmunity**: Array of status types to be immune to
- **damageReflection**: Reflects % of damage back to attacker
- **healingInversion**: Healing effects cause damage instead
- **priorityOverride**: Always goes first/last regardless of speed
- **accuracyBypass**: Moves cannot miss this Piclet
- **typeImmunity**: Immune to specific damage types
- **contactDamage**: Attackers take damage when using contact moves
- **drainInversion**: HP draining moves heal the target instead
- **weatherImmunity**: Unaffected by weather damage/effects
- **flagImmunity**: Immune to moves with specific flags
- **flagWeakness**: Takes extra damage from moves with specific flags
- **flagResistance**: Takes reduced damage from moves with specific flags

### Advanced Ability Examples

#### 1. **Shell Armor** - Cannot be critically hit
```json
{
  "name": "Shell Armor",
  "description": "Hard shell prevents critical hits",
  "effects": [
    {
      "type": "mechanicOverride",
      "mechanic": "criticalHits",
      "condition": "always",
      "value": false
    }
  ]
}
```

#### 2. **Rough Skin** - Contact moves damage attacker
```json
{
  "name": "Rough Skin",
  "description": "Rough skin damages attackers on contact",
  "triggers": [
    {
      "event": "onContactDamage",
      "effects": [
        {
          "type": "damage",
          "target": "attacker",
          "formula": "fixed",
          "value": 12
        }
      ]
    }
  ]
}
```

#### 3. **Photosynthesis** - Healed by flora-type moves
```json
{
  "name": "Photosynthesis",
  "description": "Absorbs flora-type moves to restore HP",
  "triggers": [
    {
      "event": "onDamageTaken",
      "condition": "ifMoveType:flora",
      "effects": [
        {
          "type": "mechanicOverride",
          "mechanic": "damageAbsorption",
          "value": "absorb"
        },
        {
          "type": "heal",
          "target": "self",
          "amount": "percentage",
          "value": 25
        }
      ]
    }
  ]
}
```

#### 4. **Poison Heal** - Healed by poison instead of damaged
```json
{
  "name": "Poison Heal",
  "description": "Poison heals instead of damages",
  "effects": [
    {
      "type": "mechanicOverride",
      "mechanic": "statusEffect:poison",
      "value": "invert"
    }
  ]
}
```

#### 5. **Wonder Guard** - Only super-effective moves can hit
```json
{
  "name": "Wonder Guard",
  "description": "Only super-effective moves deal damage",
  "effects": [
    {
      "type": "mechanicOverride", 
      "mechanic": "damageCalculation",
      "condition": "ifNotSuperEffective",
      "value": false
    }
  ]
}
```

#### 6. **Levitate** - Immune to ground-type moves
```json
{
  "name": "Levitate",
  "description": "Floating ability makes ground moves miss",
  "effects": [
    {
      "type": "mechanicOverride",
      "mechanic": "typeImmunity",
      "value": ["ground"]
    }
  ]
}
```

#### 7. **Vampiric** - Drain moves damage the drainer
```json
{
  "name": "Vampiric",
  "description": "Cursed blood damages those who try to drain it",
  "triggers": [
    {
      "event": "onHPDrained",
      "effects": [
        {
          "type": "mechanicOverride",
          "mechanic": "drainInversion",
          "value": true
        },
        {
          "type": "damage",
          "target": "attacker",
          "formula": "fixed",
          "value": 20
        }
      ]
    }
  ]
}
```

#### 8. **Insomnia** - Cannot be put to sleep
```json
{
  "name": "Insomnia",
  "description": "Prevents sleep status",
  "effects": [
    {
      "type": "mechanicOverride",
      "mechanic": "statusImmunity",
      "value": ["sleep"]
    }
  ]
}
```

#### 9. **Prankster** - Status moves have +1 priority
```json
{
  "name": "Prankster",
  "description": "Status moves gain priority",
  "effects": [
    {
      "type": "mechanicOverride",
      "mechanic": "priorityOverride",
      "condition": "ifStatusMove",
      "value": 1
    }
  ]
}
```

#### 10. **Magic Bounce** - Reflects status moves
```json
{
  "name": "Magic Bounce",
  "description": "Reflects status moves back at the user",
  "triggers": [
    {
      "event": "onStatusMoveTargeted",
      "effects": [
        {
          "type": "mechanicOverride",
          "mechanic": "targetRedirection",
          "value": "reflect"
        }
      ]
    }
  ]
}
```

### Complex Multi-Mechanic Abilities

#### **Protean** - Changes type to match moves used
```json
{
  "name": "Protean",
  "description": "Changes type to match the move being used",
  "triggers": [
    {
      "event": "beforeMoveUse",
      "effects": [
        {
          "type": "mechanicOverride",
          "mechanic": "typeChange",
          "value": "matchMoveType"
        }
      ]
    }
  ]
}
```

#### **Contrary** - Stat changes are reversed
```json
{
  "name": "Contrary",
  "description": "Stat changes have the opposite effect",
  "effects": [
    {
      "type": "mechanicOverride",
      "mechanic": "statModification",
      "value": "invert"
    }
  ]
}
```

### Status-Specific Abilities

#### **Frost Walker** - Alternative effect when frozen
```json
{
  "name": "Frost Walker",
  "description": "Instead of being frozen, gains +50% attack",
  "effects": [
    {
      "type": "mechanicOverride",
      "mechanic": "statusReplacement:freeze",
      "value": {
        "type": "modifyStats",
        "target": "self",
        "stats": { "attack": "greatly_increase" }
      }
    }
  ]
}
```

#### **Glacial Birth** - Starts battle frozen
```json
{
  "name": "Glacial Birth",
  "description": "Enters battle in a frozen state but gains defensive bonuses",
  "triggers": [
    {
      "event": "onSwitchIn",
      "effects": [
        {
          "type": "applyStatus",
          "target": "self",
          "status": "freeze",
          "chance": 100
        },
        {
          "type": "modifyStats",
          "target": "self",
          "stats": { "defense": "greatly_increase" },
          "condition": "whileFrozen"
        }
      ]
    }
  ]
}
```

#### **Cryogenic Touch** - Freezes enemy on contact
```json
{
  "name": "Cryogenic Touch",
  "description": "Contact moves have a chance to freeze the attacker",
  "triggers": [
    {
      "event": "onContactDamage",
      "effects": [
        {
          "type": "applyStatus",
          "target": "attacker",
          "status": "freeze",
          "chance": 30
        }
      ]
    }
  ]
}
```

#### **Slumber Heal** - Heal when asleep
```json
{
  "name": "Slumber Heal",
  "description": "Restores HP while sleeping instead of being unable to act",
  "triggers": [
    {
      "event": "endOfTurn",
      "condition": "ifStatus:sleep",
      "effects": [
        {
          "type": "heal",
          "target": "self",
          "amount": "percentage",
          "value": 15
        }
      ]
    }
  ]
}
```

#### **Toxic Skin** - Poisons on contact
```json
{
  "name": "Toxic Skin",
  "description": "Physical contact poisons the attacker",
  "triggers": [
    {
      "event": "onContactDamage",
      "effects": [
        {
          "type": "applyStatus",
          "target": "attacker",
          "status": "poison",
          "chance": 50
        }
      ]
    }
  ]
}
```

#### **Paralytic Aura** - Starts battle with paralyzed enemy
```json
{
  "name": "Paralytic Aura",
  "description": "Intimidating presence paralyzes the opponent upon entry",
  "triggers": [
    {
      "event": "onSwitchIn",
      "effects": [
        {
          "type": "applyStatus",
          "target": "opponent",
          "status": "paralyze",
          "chance": 75
        }
      ]
    }
  ]
}
```

#### **Burn Boost** - Powered up when burned
```json
{
  "name": "Burn Boost",
  "description": "Fire damage energizes this Piclet, increasing attack power",
  "triggers": [
    {
      "event": "onStatusInflicted",
      "condition": "ifStatus:burn",
      "effects": [
        {
          "type": "modifyStats",
          "target": "self",
          "stats": { "attack": "greatly_increase" }
        }
      ]
    }
  ]
}
```

#### **Confusion Clarity** - Cannot be confused, clears team confusion
```json
{
  "name": "Confusion Clarity",
  "description": "Clear mind prevents confusion and helps allies focus",
  "effects": [
    {
      "type": "mechanicOverride",
      "mechanic": "statusImmunity",
      "value": ["confuse"]
    }
  ],
  "triggers": [
    {
      "event": "onSwitchIn",
      "effects": [
        {
          "type": "removeStatus",
          "target": "allies",
          "status": "confuse"
        }
      ]
    }
  ]
}
```

### Flag-Based Immunities and Weaknesses

#### **Sky Dancer** - Immune to ground-flagged attacks
```json
{
  "name": "Sky Dancer",
  "description": "Floating in air, immune to ground-based attacks",
  "effects": [
    {
      "type": "mechanicOverride", 
      "mechanic": "flagImmunity",
      "value": ["ground"]
    }
  ]
}
```

#### **Sound Barrier** - Immune to sound attacks
```json
{
  "name": "Sound Barrier",
  "description": "Natural sound dampening prevents sound-based moves",
  "effects": [
    {
      "type": "mechanicOverride",
      "mechanic": "flagImmunity", 
      "value": ["sound"]
    }
  ]
}
```

#### **Soft Body** - Weak to punch moves, immune to explosive
```json
{
  "name": "Soft Body",
  "description": "Gelatinous form absorbs explosions but vulnerable to direct hits",
  "effects": [
    {
      "type": "mechanicOverride",
      "mechanic": "flagImmunity",
      "value": ["explosive"]
    },
    {
      "type": "mechanicOverride", 
      "mechanic": "flagWeakness",
      "value": ["punch"]
    }
  ]
}
```

#### **Ethereal Form** - Immune to contact moves
```json
{
  "name": "Ethereal Form",
  "description": "Ghostly body cannot be touched by physical contact",
  "effects": [
    {
      "type": "mechanicOverride",
      "mechanic": "flagImmunity",
      "value": ["contact"]
    }
  ]
}
```

#### **Fragile Shell** - Takes double damage from explosive moves
```json
{
  "name": "Fragile Shell", 
  "description": "Hard shell provides defense but shatters from explosions",
  "effects": [
    {
      "type": "modifyStats",
      "target": "self", 
      "stats": { "defense": "increase" }
    },
    {
      "type": "mechanicOverride",
      "mechanic": "flagWeakness",
      "value": ["explosive"]
    }
  ]
}
```

#### **Liquid Body** - Immune to punch/bite, weak to sound
```json
{
  "name": "Liquid Body",
  "description": "Fluid form flows around physical attacks but resonates with sound",
  "effects": [
    {
      "type": "mechanicOverride",
      "mechanic": "flagImmunity",
      "value": ["punch", "bite"]
    },
    {
      "type": "mechanicOverride",
      "mechanic": "flagWeakness", 
      "value": ["sound"]
    }
  ]
}
```

#### **Thick Hide** - Reduced damage from contact moves
```json
{
  "name": "Thick Hide",
  "description": "Tough skin reduces impact from physical contact",
  "effects": [
    {
      "type": "mechanicOverride",
      "mechanic": "flagResistance",
      "value": ["contact"]
    }
  ]
}
```

### Event Triggers for Abilities

Extended list of trigger events:
- **onDamageTaken**: When this Piclet takes damage
- **onDamageDealt**: When this Piclet deals damage
- **onContactDamage**: When hit by a contact move
- **onStatusInflicted**: When a status is applied to this Piclet
- **onStatusMove**: When targeted by a status move
- **onCriticalHit**: When this Piclet lands/receives a critical hit
- **onHPDrained**: When HP is drained from this Piclet
- **onKO**: When this Piclet knocks out an opponent
- **onSwitchIn**: When this Piclet enters battle
- **onSwitchOut**: When this Piclet leaves battle
- **onWeatherChange**: When battlefield weather changes
- **beforeMoveUse**: Just before this Piclet uses a move
- **afterMoveUse**: Just after this Piclet uses a move
- **onLowHP**: When HP drops below 25%
- **onFullHP**: When HP is at 100%

## Move Categories and Interactions

### Physical vs Special Attacks

- **Physical**: Direct combat using attack vs defense stats, affected by contact abilities
- **Special**: Ranged/magical attacks using attack vs defense stats, no contact interactions
- **Status**: No damage, focus on effects and stat manipulation

### Move Flags

Moves can have flags that affect interactions:

- **contact**: Triggers contact-based abilities (like Rough Skin)
- **sound**: Affects sound-based interactions
- **bite**: Triggers bite-specific abilities
- **punch**: Triggers punch-specific abilities  
- **reckless**: Increased power but with drawbacks
- **priority**: Natural priority moves
- **multiHit**: Hits multiple times
- **charging**: Requires charging turn

## Dynamic Combinations

### Power vs Risk Tradeoffs

1. **High Power, Self-Debuff**
```json
{
  "name": "Berserker Strike",
  "power": 130,
  "effects": [
    {
      "type": "damage",
      "target": "opponent", 
      "formula": "standard"
    },
    {
      "type": "modifyStats",
      "target": "self",
      "stats": { "defense": "greatly_decrease" },
      "condition": "afterUse"
    }
  ]
}
```

2. **Accuracy Trade for Power**
```json
{
  "name": "Wild Swing",
  "power": 100,
  "accuracy": 70,
  "effects": [
    {
      "type": "damage",
      "target": "opponent",
      "formula": "standard"
    },
    {
      "type": "modifyStats", 
      "target": "self",
      "stats": { "accuracy": "decrease" },
      "condition": "afterUse"
    }
  ]
}
```

3. **Conditional Power Scaling**
```json
{
  "name": "Revenge Strike",
  "power": 60,
  "effects": [
    {
      "type": "damage",
      "target": "opponent",
      "amount": "normal"
    },
    {
      "type": "damage", 
      "target": "opponent",
      "amount": "strong",
      "condition": "ifDamagedThisTurn"
    }
  ]
}
```

### Extreme Risk-Reward Moves

Powerful moves with dramatic sacrifices create high-stakes decision making:

#### **Self Destruct** - Ultimate sacrifice for massive damage
```json
{
  "name": "Self Destruct",
  "power": 200,
  "accuracy": 100,
  "pp": 1,
  "priority": 0,
  "flags": ["explosive", "contact"],
  "effects": [
    {
      "type": "damage",
      "target": "all",
      "formula": "standard",
      "multiplier": 1.5
    },
    {
      "type": "damage",
      "target": "self",
      "formula": "fixed",
      "value": 9999,
      "condition": "afterUse"
    }
  ]
}
```

#### **Life Drain Overload** - Heal massively but lose stats permanently
```json
{
  "name": "Life Drain Overload",
  "power": 0,
  "accuracy": 100,
  "pp": 3,
  "priority": 0,
  "flags": ["draining"],
  "effects": [
    {
      "type": "heal",
      "target": "self",
      "amount": "percentage",
      "value": 75
    },
    {
      "type": "modifyStats",
      "target": "self",
      "stats": { "attack": "greatly_decrease" },
      "condition": "afterUse"
    }
  ]
}
```

#### **Berserker's End** - More damage as HP gets lower, but can't heal
```json
{
  "name": "Berserker's End", 
  "power": 80,
  "accuracy": 95,
  "pp": 10,
  "priority": 0,
  "flags": ["contact", "reckless"],
  "effects": [
    {
      "type": "damage",
      "target": "opponent",
      "amount": "normal"
    },
    {
      "type": "damage",
      "target": "opponent", 
      "amount": "strong",
      "condition": "ifLowHp"
    },
    {
      "type": "mechanicOverride",
      "target": "self",
      "mechanic": "healingBlocked",
      "value": true
    }
  ]
}
```

#### **Mirror Shatter** - Reflect all damage taken this turn back doubled
```json
{
  "name": "Mirror Shatter",
  "power": 0,
  "accuracy": 100,
  "pp": 5,
  "priority": 4,
  "flags": ["priority"],
  "effects": [
    {
      "type": "mechanicOverride",
      "target": "self",
      "mechanic": "damageReflection",
      "value": "double",
      "condition": "thisTurn"
    },
    {
      "type": "modifyStats",
      "target": "self",
      "stats": { "defense": "greatly_decrease", "fieldDefense": "greatly_decrease" },
      "condition": "afterUse"
    }
  ]
}
```

#### **Temporal Overload** - Act twice next turn, skip following turn
```json
{
  "name": "Temporal Overload",
  "power": 0,
  "accuracy": 100,
  "pp": 2,
  "priority": 0,
  "flags": ["temporal"],
  "effects": [
    {
      "type": "mechanicOverride",
      "target": "self",
      "mechanic": "extraTurn",
      "value": true,
      "condition": "nextTurn"
    },
    {
      "type": "applyStatus",
      "target": "self",
      "status": "paralyzed",
      "chance": 100,
      "condition": "turnAfterNext"
    }
  ]
}
```

#### **Blood Pact** - Sacrifice HP to double all damage dealt
```json
{
  "name": "Blood Pact",
  "power": 0,
  "accuracy": 100,
  "pp": 3,
  "priority": 0,
  "flags": ["sacrifice"],
  "effects": [
    {
      "type": "damage",
      "target": "self",
      "formula": "percentage",
      "value": 50
    },
    {
      "type": "mechanicOverride",
      "target": "self",
      "mechanic": "damageMultiplier",
      "value": 2.0,
      "condition": "restOfBattle"
    }
  ]
}
```

#### **Soul Burn** - Massive special attack that burns user's PP
```json
{
  "name": "Soul Burn",
  "power": 150,
  "accuracy": 90,
  "pp": 5,
  "priority": 0,
  "flags": ["burning"],
  "effects": [
    {
      "type": "damage",
      "target": "opponent",
      "formula": "standard"
    },
    {
      "type": "manipulatePP",
      "target": "self",
      "action": "drain",
      "amount": 3,
      "targetMove": "random",
      "condition": "afterUse"
    }
  ]
}
```

#### **Cursed Gambit** - Random effect: heal fully OR faint instantly
```json
{
  "name": "Cursed Gambit",
  "power": 0,
  "accuracy": 100,
  "pp": 1,
  "priority": 0,
  "flags": ["gambling", "cursed"],
  "effects": [
    {
      "type": "heal",
      "target": "self",
      "amount": "percentage", 
      "value": 100,
      "condition": "ifLucky50"
    },
    {
      "type": "damage",
      "target": "self",
      "formula": "fixed",
      "value": 9999,
      "condition": "ifUnlucky50"
    }
  ]
}
```

#### **Apocalypse Strike** - Massive damage to all, but user becomes vulnerable
```json
{
  "name": "Apocalypse Strike",
  "power": 120,
  "accuracy": 85,
  "pp": 1,
  "priority": 0,
  "flags": ["apocalyptic"],
  "effects": [
    {
      "type": "damage",
      "target": "all",
      "formula": "standard",
      "multiplier": 1.3
    },
    {
      "type": "mechanicOverride",
      "target": "self",
      "mechanic": "criticalHits",
      "value": "alwaysReceive",
      "condition": "restOfBattle"
    },
    {
      "type": "modifyStats",
      "target": "self",
      "stats": { "defense": "greatly_decrease", "fieldDefense": "greatly_decrease" }
    }
  ]
}
```

### Multi-Stage Effects

Complex moves can have multiple phases:

```json
{
  "name": "Charging Blast",
  "power": 120,
  "accuracy": 90,
  "pp": 5,
  "flags": ["charging"],
  "effects": [
    {
      "type": "modifyStats",
      "target": "self",
      "stats": { "defense": "increase" },
      "condition": "onCharging"
    },
    {
      "type": "damage",
      "target": "opponent", 
      "formula": "standard",
      "condition": "afterCharging"
    },
    {
      "type": "applyStatus",
      "target": "self",
      "status": "vulnerable",
      "condition": "afterCharging"
    }
  ]
}
```

## Implementation Benefits

### 1. **Programmatic Execution**
- All effects are defined as data structures
- Battle engine can execute any combination of effects
- No hardcoded move implementations needed

### 2. **Infinite Variety**
- Mix and match building blocks for unique moves
- Same building blocks create vastly different strategies
- Easy to balance by adjusting values

### 3. **Clear Tradeoffs** 
- Every powerful effect has a drawback
- Players must weigh risk vs reward
- Multiple viable strategies emerge

### 4. **Emergent Complexity**
- Simple rules create complex interactions
- Abilities interact with moves in unexpected ways
- Meta-game develops naturally

### 5. **Easy Extension**
- New effect types can be added seamlessly
- New conditions and triggers expand possibilities
- Backward compatible with existing definitions

## Battle Flow Integration

The battle system processes effects in this order:

1. **Pre-Move Phase**: Priority calculation, ability triggers
2. **Move Execution**: Damage calculation, hit/miss determination  
3. **Effect Application**: Apply all move effects based on conditions
4. **Post-Move Phase**: End-of-turn abilities, status effects
5. **Turn Cleanup**: Duration decrements, expired effect removal

This ensures predictable interaction resolution while allowing for complex chains of effects.

## Balancing Philosophy

The system encourages diverse strategies through:

- **No "strictly better" moves**: Every powerful move has meaningful drawbacks
- **Type diversity matters**: Different types offer different utility patterns
- **Timing is crucial**: When to use high-risk moves becomes strategic
- **Adaptation required**: Static strategies are punishable by counter-play

This creates a dynamic battle system where player skill and strategic thinking matter more than raw stat advantages.

## Complete System Reference

### Available Conditions
- **always**: Effect always applies when triggered
- **onHit**: Effect applies only if the move hits successfully
- **afterUse**: Effect applies after move execution regardless of hit/miss
- **onCritical**: Effect applies only on critical hits
- **ifLowHp**: Effect applies if user's HP < 25%
- **ifHighHp**: Effect applies if user's HP > 75%
- **thisTurn**: Effect lasts only for the current turn
- **nextTurn**: Effect applies on the next turn
- **turnAfterNext**: Effect applies two turns from now
- **restOfBattle**: Effect persists for the remainder of the battle
- **onCharging**: Effect applies during charging phase of two-turn moves
- **afterCharging**: Effect applies after charging phase completes
- **ifDamagedThisTurn**: Effect applies if user took damage this turn
- **ifNotSuperEffective**: Effect applies if move would not be super effective
- **ifMoveType:[type]**: Effect applies if move is of specified type
- **ifStatus:[status]**: Effect applies if user has specified status
- **whileFrozen**: Effect applies while user is frozen
- **ifWeather:[weather]**: Effect applies if weather condition is active
- **ifStatusMove**: Effect applies if move is a status move
- **ifLucky50**: Effect applies on 50% random chance (good outcome)
- **ifUnlucky50**: Effect applies on 50% random chance (bad outcome)

### Available Mechanic Overrides
- **criticalHits**: Modify critical hit behavior
- **statusImmunity**: Immunity to specific status effects
- **statusReplacement:[status]**: Replace status effect with different effect
- **damageReflection**: Reflect damage back to attacker
- **damageAbsorption**: Absorb damage of specific types
- **damageCalculation**: Modify damage calculation rules
- **damageMultiplier**: Multiply all damage dealt
- **healingInversion**: Healing effects cause damage instead
- **healingBlocked**: Prevent all healing
- **priorityOverride**: Override move priority
- **accuracyBypass**: Moves cannot miss
- **typeImmunity**: Immunity to specific damage types
- **typeChange**: Change Piclet's type
- **contactDamage**: Deal damage to contact move users
- **drainInversion**: HP drain heals target instead
- **weatherImmunity**: Immunity to weather effects
- **flagImmunity**: Immunity to moves with specific flags
- **flagWeakness**: Extra damage from moves with specific flags
- **flagResistance**: Reduced damage from moves with specific flags
- **statModification**: Modify how stat changes work
- **targetRedirection**: Change move targets
- **extraTurn**: Grant additional turns

### Available Event Triggers
- **onDamageTaken**: When this Piclet takes damage
- **onDamageDealt**: When this Piclet deals damage
- **onContactDamage**: When hit by a contact move
- **onStatusInflicted**: When a status is applied to this Piclet
- **onStatusMove**: When targeted by a status move
- **onStatusMoveTargeted**: When targeted by opponent's status move
- **onCriticalHit**: When this Piclet lands/receives a critical hit
- **onHPDrained**: When HP is drained from this Piclet
- **onKO**: When this Piclet knocks out an opponent
- **onSwitchIn**: When this Piclet enters battle
- **onSwitchOut**: When this Piclet leaves battle
- **onWeatherChange**: When battlefield weather changes
- **beforeMoveUse**: Just before this Piclet uses a move
- **afterMoveUse**: Just after this Piclet uses a move
- **onLowHP**: When HP drops below 25%
- **onFullHP**: When HP is at 100%
- **endOfTurn**: At the end of each turn
- **onOpponentContactMove**: When opponent uses contact move

### Available Status Effects
- **burn**: Ongoing fire damage
- **freeze**: Cannot act (unless replaced by ability)
- **paralyze**: Speed reduction and chance to be unable to move
- **poison**: Ongoing poison damage
- **sleep**: Cannot act for several turns
- **confuse**: Chance to hit self instead of target

### Available Move Flags
- **contact**: Makes physical contact
- **bite**: Biting attack
- **punch**: Punching attack
- **sound**: Sound-based attack
- **explosive**: Explosive attack
- **draining**: Drains HP from target
- **ground**: Ground-based attack
- **priority**: Has natural priority
- **lowPriority**: Has negative priority
- **charging**: Requires charging turn
- **recharge**: User must recharge after
- **multiHit**: Hits multiple times
- **twoTurn**: Takes two turns to execute
- **sacrifice**: Involves self-sacrifice
- **gambling**: Has random outcomes
- **reckless**: High power with drawbacks
- **reflectable**: Can be reflected
- **snatchable**: Can be stolen
- **copyable**: Can be copied
- **protectable**: Blocked by Protect
- **bypassProtect**: Ignores Protect

### Available Types

Types correspond to photographed objects in the real world:

- **beast** 🐾: Vertebrate wildlife — mammals, birds, reptiles. Raw physicality, instincts, and region-based variants
- **bug** 🐛: Arthropods great and small: butterflies, beetles, mantises. Agile swarms, precision strikes, metamorphosis
- **aquatic** 🌊: Life that swims, dives, sloshes: fish, octopus, ink-creatures, sentient puddles. Masters of tides and pressure
- **flora** 🌿: Plants and fungi captured in bloom or decay. Growth, spores, vines, seasonal shifts
- **mineral** 🪨: Stones, crystals, metals shaped by earth's depths. High durability, reflective armor, seismic shocks
- **space** ✨: Stars, moon, cosmic objects not of this world. Stellar energy, gravitational effects, void manipulation
- **machina** ⚙️: Engineered devices from gadgets to heavy machinery. Gears, circuits, drones, power surges
- **structure** 🏛️: Buildings, bridges, monuments, ruins as titans. Fortification, terrain shaping, zone denial
- **culture** 🎨: Art, fashion, toys, written symbols. Buffs, debuffs, illusion, story-driven interactions
- **cuisine** 🍣: Dishes, drinks, culinary artistry. Flavors, aromas, temperature shifts for support or offense
- **normal** 👤: Attack type only (no Piclets are Normal type). Represents mundane, non-specialized attacks

### Type Effectiveness Chart

| ATK \ DEF         | 🐾 Beast | 🐛 Bug  | 🌊 Aquatic | 🌿 Flora | 🪨 Mineral | ✨Space   | ⚙️ Machina | 🏛️ Structure   | 🎨 Culture | 🍣 Cuisine |
| ----------------- | :------: | :----: | :--------: | :------: | :--------: | :------: | :--------: | :-----------: | :--------: | :--------: |
| **🐾 Beast**      |     1    | **×2** |      1     |     1    |     ×½     |   **0**  |     ×½     |       ×½      |   **×2**   |   **×2**   |
| **🐛 Bug**        |  **×2**  |    1   |      1     |  **×2**  |     ×½     |    ×½    |      1     |     **0**     |     ×½     |     ×½     |
| **🌊 Aquatic**    |     1    |    1   |      1     |    ×½    |   **×2**   |  **×2**  |   **×2**   |       1       |     ×½     |     ×½     |
| **🌿 Flora**      |     1    | **×2** |   **×2**   |     1    |   **×2**   |    ×½    |    **0**   |     **×2**    |      1     |     ×½     |
| **🪨 Mineral**    |  **×2**  | **×2** |     ×½     |    ×½    |      1     |    ×½    |   **×2**   |       1       |      1     |    **0**   |
| **✨ Space**  |   **0**  | **×2** |     ×½     |  **×2**  |   **×2**   |     1    |     ×½     |     **×2**    |     ×½     |     ×½     |
| **⚙️ Machina**    |  **×2**  |   ×½   |     ×½     |  **×2**  |     ×½     |    ×½    |      1     |     **×2**    |      1     |      1     |
| **🏛️ Structure**  |    ×½    |   ×½   |      1     |     1    |      1     |    ×½    |   **×2**   |       1       |   **×2**   |   **×2**   |
| **🎨 Culture**    |    ×½    |   ×½   |      1     |     1    |    **0**   |  **×2**  |   **×2**   |     **×2**    |      1     |     ×½     |
| **🍣 Cuisine**    |  **×2**  |   ×½   |     ×½     |     1    |    **0**   |  **×2**  |      1     |       ×½      |   **×2**   |      1     |
| **👤 Normal**    |     1    |    1   |      1     |     1    |      1     |     0    |      1     |        1      |      1     |      1     |

**Legend:**
- **×2** = Super effective (2x damage)
- **×½** = Not very effective (0.5x damage)  
- **0** = No effect (0x damage)
- **1** = Normal effectiveness (1x damage)

## JSON Schema

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "title": "Piclet Definition",
  "required": ["name", "description", "tier", "primaryType", "baseStats", "nature", "specialAbility", "movepool"],
  "properties": {
    "name": {
      "type": "string",
      "description": "The name of the Piclet"
    },
    "description": {
      "type": "string", 
      "description": "Flavor text describing the Piclet"
    },
    "tier": {
      "type": "string",
      "enum": ["low", "medium", "high", "legendary"],
      "description": "Power tier of the Piclet"
    },
    "primaryType": {
      "type": "string",
      "enum": ["beast", "bug", "aquatic", "flora", "mineral", "space", "machina", "structure", "culture", "cuisine"],
      "description": "Primary type of the Piclet"
    },
    "secondaryType": {
      "type": ["string", "null"],
      "enum": ["beast", "bug", "aquatic", "flora", "mineral", "space", "machina", "structure", "culture", "cuisine", null],
      "description": "Optional secondary type"
    },
    "baseStats": {
      "type": "object",
      "required": ["hp", "attack", "defense", "speed"],
      "properties": {
        "hp": {"type": "integer", "minimum": 1, "maximum": 255},
        "attack": {"type": "integer", "minimum": 1, "maximum": 255},
        "defense": {"type": "integer", "minimum": 1, "maximum": 255},
        "speed": {"type": "integer", "minimum": 1, "maximum": 255}
      },
      "additionalProperties": false
    },
    "nature": {
      "type": "string",
      "description": "Personality trait affecting stats or behavior"
    },
    "specialAbility": {
      "$ref": "#/definitions/SpecialAbility"
    },
    "movepool": {
      "type": "array",
      "items": {"$ref": "#/definitions/Move"},
      "minItems": 1,
      "maxItems": 8
    }
  },
  "additionalProperties": false,
  "definitions": {
    "SpecialAbility": {
      "type": "object",
      "required": ["name", "description"],
      "properties": {
        "name": {"type": "string"},
        "description": {"type": "string"},
        "effects": {
          "type": "array",
          "items": {"$ref": "#/definitions/Effect"}
        },
        "triggers": {
          "type": "array", 
          "items": {"$ref": "#/definitions/Trigger"}
        }
      },
      "additionalProperties": false
    },
    "Move": {
      "type": "object",
      "required": ["name", "type", "power", "accuracy", "pp", "priority", "flags", "effects"],
      "properties": {
        "name": {"type": "string"},
        "type": {
          "type": "string",
          "enum": ["beast", "bug", "aquatic", "flora", "mineral", "space", "machina", "structure", "culture", "cuisine", "normal"]
        },
        "power": {"type": "integer", "minimum": 0, "maximum": 250},
        "accuracy": {"type": "integer", "minimum": 0, "maximum": 100},
        "pp": {"type": "integer", "minimum": 1, "maximum": 50},
        "priority": {"type": "integer", "minimum": -5, "maximum": 5},
        "flags": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": ["contact", "bite", "punch", "sound", "explosive", "draining", "ground", "priority", "lowPriority", "charging", "recharge", "multiHit", "twoTurn", "sacrifice", "gambling", "reckless", "reflectable", "snatchable", "copyable", "protectable", "bypassProtect"]
          },
          "uniqueItems": true
        },
        "effects": {
          "type": "array",
          "items": {"$ref": "#/definitions/Effect"},
          "minItems": 1
        }
      },
      "additionalProperties": false
    },
    "Effect": {
      "type": "object",
      "required": ["type"],
      "properties": {
        "type": {
          "type": "string",
          "enum": ["damage", "modifyStats", "applyStatus", "heal", "manipulatePP", "fieldEffect", "counter", "priority", "removeStatus", "mechanicOverride"]
        },
        "target": {
          "type": "string",
          "enum": ["self", "opponent", "allies", "all", "attacker", "field", "playerSide", "opponentSide"]
        },
        "condition": {
          "type": "string",
          "enum": ["always", "onHit", "afterUse", "onCritical", "ifLowHp", "ifHighHp", "thisTurn", "nextTurn", "turnAfterNext", "restOfBattle", "onCharging", "afterCharging", "ifDamagedThisTurn", "ifNotSuperEffective", "ifStatusMove", "ifLucky50", "ifUnlucky50", "whileFrozen"]
        }
      },
      "allOf": [
        {
          "if": {"properties": {"type": {"const": "damage"}}},
          "then": {
            "required": ["amount"],
            "properties": {
              "amount": {
                "type": "string",
                "enum": ["weak", "normal", "strong", "extreme"]
              }
            }
          }
        },
        {
          "if": {"properties": {"type": {"const": "modifyStats"}}},
          "then": {
            "required": ["stats"],
            "properties": {
              "stats": {
                "type": "object",
                "properties": {
                  "hp": {"type": "string", "enum": ["increase", "decrease", "greatly_increase", "greatly_decrease"]},
                  "attack": {"type": "string", "enum": ["increase", "decrease", "greatly_increase", "greatly_decrease"]},
                  "defense": {"type": "string", "enum": ["increase", "decrease", "greatly_increase", "greatly_decrease"]},
                  "speed": {"type": "string", "enum": ["increase", "decrease", "greatly_increase", "greatly_decrease"]},
                  "accuracy": {"type": "string", "enum": ["increase", "decrease", "greatly_increase", "greatly_decrease"]}
                },
                "additionalProperties": false,
                "minProperties": 1
              }
            }
          }
        },
        {
          "if": {"properties": {"type": {"const": "applyStatus"}}},
          "then": {
            "required": ["status"],
            "properties": {
              "status": {
                "type": "string",
                "enum": ["burn", "freeze", "paralyze", "poison", "sleep", "confuse"]
              }
            }
          }
        },
        {
          "if": {"properties": {"type": {"const": "heal"}}},
          "then": {
            "required": ["amount"],
            "properties": {
              "amount": {"type": "string", "enum": ["small", "medium", "large", "full"]}
            }
          }
        },
        {
          "if": {"properties": {"type": {"const": "manipulatePP"}}},
          "then": {
            "required": ["action", "amount"],
            "properties": {
              "action": {"type": "string", "enum": ["drain", "restore", "disable"]},
              "amount": {"type": "string", "enum": ["small", "medium", "large"]}
            }
          }
        },
        {
          "if": {"properties": {"type": {"const": "fieldEffect"}}},
          "then": {
            "required": ["effect"],
            "properties": {
              "effect": {"type": "string"},
              "stackable": {"type": "boolean"}
            }
          }
        },
        {
          "if": {"properties": {"type": {"const": "counter"}}},
          "then": {
            "required": ["counterType", "strength"],
            "properties": {
              "counterType": {"type": "string", "enum": ["physical", "special", "any"]},
              "strength": {"type": "string", "enum": ["weak", "normal", "strong"]}
            }
          }
        },
        {
          "if": {"properties": {"type": {"const": "priority"}}},
          "then": {
            "required": ["value"],
            "properties": {
              "value": {"type": "integer", "minimum": -5, "maximum": 5}
            }
          }
        },
        {
          "if": {"properties": {"type": {"const": "removeStatus"}}},
          "then": {
            "required": ["status"],
            "properties": {
              "status": {
                "type": "string",
                "enum": ["burn", "freeze", "paralyze", "poison", "sleep", "confuse"]
              }
            }
          }
        },
        {
          "if": {"properties": {"type": {"const": "mechanicOverride"}}},
          "then": {
            "required": ["mechanic", "value"],
            "properties": {
              "mechanic": {
                "type": "string",
                "enum": ["criticalHits", "statusImmunity", "damageReflection", "damageAbsorption", "damageCalculation", "damageMultiplier", "healingInversion", "healingBlocked", "priorityOverride", "accuracyBypass", "typeImmunity", "typeChange", "contactDamage", "drainInversion", "weatherImmunity", "flagImmunity", "flagWeakness", "flagResistance", "statModification", "targetRedirection", "extraTurn"]
              },
              "value": {}
            }
          }
        }
      ],
      "additionalProperties": false
    },
    "Trigger": {
      "type": "object",
      "required": ["event", "effects"],
      "properties": {
        "event": {
          "type": "string",
          "enum": ["onDamageTaken", "onDamageDealt", "onContactDamage", "onStatusInflicted", "onStatusMove", "onStatusMoveTargeted", "onCriticalHit", "onHPDrained", "onKO", "onSwitchIn", "onSwitchOut", "onWeatherChange", "beforeMoveUse", "afterMoveUse", "onLowHP", "onFullHP", "endOfTurn", "onOpponentContactMove"]
        },
        "condition": {
          "type": "string",
          "enum": ["always", "onHit", "afterUse", "onCritical", "ifLowHp", "ifHighHp", "thisTurn", "nextTurn", "turnAfterNext", "restOfBattle", "onCharging", "afterCharging", "ifDamagedThisTurn", "ifNotSuperEffective", "ifStatusMove", "ifLucky50", "ifUnlucky50", "whileFrozen"]
        },
        "effects": {
          "type": "array",
          "items": {"$ref": "#/definitions/Effect"},
          "minItems": 1
        }
      },
      "additionalProperties": false
    }
  }
}
```

## Complete Example: Tempest Wraith

Here's a full example of a Piclet using the complete schema with advanced abilities and dramatic moves:

```json
{
  "name": "Tempest Wraith",
  "description": "A ghostly creature born from violent storms, wielding cosmic energy and shadowy illusions",
  "tier": "high",
  "primaryType": "space",
  "secondaryType": "culture",
  "baseStats": {
    "hp": 75,
    "attack": 95,
    "defense": 45,
    "speed": 85
  },
  "nature": "timid",
  "specialAbility": {
    "name": "Storm Caller",
    "description": "When HP drops below 25%, gains immunity to status effects and +50% speed",
    "triggers": [
      {
        "event": "onLowHP",
        "effects": [
          {
            "type": "mechanicOverride",
            "mechanic": "statusImmunity",
            "value": ["burn", "freeze", "paralyze", "poison", "sleep", "confuse"]
          },
          {
            "type": "modifyStats",
            "target": "self",
            "stats": { "speed": "greatly_increase" }
          }
        ]
      },
      {
        "event": "onSwitchIn",
        "condition": "ifWeather:storm",
        "effects": [
          {
            "type": "modifyStats",
            "target": "self",
            "stats": { "attack": "increase" }
          }
        ]
      }
    ]
  },
  "movepool": [
    {
      "name": "Shadow Pulse",
      "type": "culture",
      "power": 70,
      "accuracy": 100,
      "pp": 15,
      "priority": 0,
      "flags": [],
      "effects": [
        {
          "type": "damage",
          "target": "opponent",
          "amount": "normal"
        },
        {
          "type": "applyStatus",
          "target": "opponent",
          "status": "confuse"
        }
      ]
    },
    {
      "name": "Cosmic Strike",
      "type": "space",
      "power": 85,
      "accuracy": 90,
      "pp": 10,
      "priority": 0,
      "flags": [],
      "effects": [
        {
          "type": "damage",
          "target": "opponent",
          "amount": "normal"
        },
        {
          "type": "applyStatus",
          "target": "opponent",
          "status": "paralyze"
        }
      ]
    },
    {
      "name": "Spectral Drain",
      "type": "culture",
      "power": 60,
      "accuracy": 95,
      "pp": 12,
      "priority": 0,
      "flags": ["draining"],
      "effects": [
        {
          "type": "damage",
          "target": "opponent",
          "formula": "drain",
          "value": 0.5
        },
        {
          "type": "heal",
          "target": "self",
          "amount": "medium"
        }
      ]
    },
    {
      "name": "Void Sacrifice",
      "type": "space",
      "power": 130,
      "accuracy": 85,
      "pp": 1,
      "priority": 0,
      "flags": ["sacrifice", "explosive"],
      "effects": [
        {
          "type": "damage",
          "target": "all",
          "formula": "standard",
          "multiplier": 1.2
        },
        {
          "type": "damage",
          "target": "self",
          "formula": "percentage",
          "value": 75
        },
        {
          "type": "fieldEffect",
          "effect": "voidStorm",
          "target": "field",
          "stackable": false
        }
      ]
    }
  ]
}
```

This example demonstrates:

### **Advanced Special Ability**
- **Conditional Triggers**: Different effects based on HP and weather
- **Multiple Mechanics**: Status immunity + stat boosts + weather interactions
- **Strategic Depth**: Becomes more dangerous when near defeat

### **Diverse Movepool**
- **Standard Attack**: Shadow Pulse with minor status chance
- **Type Coverage**: Storm and Shadow moves for different matchups  
- **Utility Move**: Spectral Drain for sustainability
- **Ultimate Move**: Storm's Sacrifice - massive AoE damage with severe self-harm

### **Meaningful Tradeoffs**
- **Spectral Drain**: Healing requires hitting the opponent
- **Storm's Sacrifice**: Incredible power (130 base + 20% bonus to all) but costs 75% of user's HP
- **Low defenses**: High speed/special attack but vulnerable to physical moves

### **Emergent Strategy**
- Use standard moves early while healthy
- Spectral Drain for sustain in mid-game
- When low on HP, ability kicks in for immunity and speed boost
- Storm's Sacrifice as desperate finisher or when opponent is also low

This creates a Piclet that plays differently throughout the battle, rewards risk-taking, and offers multiple viable strategies depending on the situation!