aboutsummaryrefslogtreecommitdiff
path: root/skill_plans/combat.md
blob: 67037d671c4d54622ee5483b5785ea8f477d5f32 (plain)
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
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
# Combat System Overhaul — OSRS-Style Attack Types & Per-Type Defense

## 1. Overview

The current combat system uses a single `attack_bonus` / `defense_bonus` per item, ignoring attack types entirely. OSRS uses per-type accuracy bonuses (stab/slash/crush/ranged/magic) and per-type defense bonuses. This overhaul brings the game's combat inline with OSRS mechanics while adapting the naming to the sci-fi theme (Science replaces Magic, Technology replaces Prayer).

**What changes:**
- `ItemStats` struct: 5 attack bonuses, 5 defense bonuses, 4 damage bonuses (14 fields total)
- Weapons get an `attack_type` field (stab/slash/crush/ranged/science)
- Mobs get per-type defense bonuses and attack bonuses
- Combat formulas use the true OSRS accuracy formula (not the current binary hit/miss)
- `formulas.go` rewritten with proper OSRS accuracy curve
- `cmd_attack.go` updated to use per-type bonuses for both player and mob attacks
- Mobs get an `attack_type` field (default "crush")
- New `stats` command shows total equipment bonuses
- `look <item>` shows per-type combat stats
- All ~66 combat item YAMLs updated with per-type stats
- All 5 mob YAMLs updated with per-type defense/attack bonuses
- 8 new example mob YAMLs for varied combat encounters

**What stays the same:**
- 4 attack styles (accurate/aggressive/defensive/balanced) — style determines level bonus
- XP distribution formula (dmg * 4, split by style)
- Death mechanics, flee mechanics, combat timing/tick system
- WeaponType enum (melee/ranged/science) — still used for equip text + XP routing
- Player combat level formula

---

## 2. ItemStats Struct

**File:** `internal/object/item.go:67-73`

**Current:**
```go
type ItemStats struct {
    AttackBonus    int `yaml:"attack_bonus"`
    StrengthBonus  int `yaml:"strength_bonus"`
    DefenseBonus   int `yaml:"defense_bonus"`
    ScienceBonus   int `yaml:"science_bonus"`
    TechnologyBonus int `yaml:"technology_bonus"`
}
```

**New:**
```go
type ItemStats struct {
    // Offensive accuracy bonuses
    StabAttack    int `yaml:"stab_attack"`
    SlashAttack   int `yaml:"slash_attack"`
    CrushAttack   int `yaml:"crush_attack"`
    ScienceAttack int `yaml:"science_attack"`
    RangedAttack  int `yaml:"ranged_attack"`

    // Defensive bonuses
    StabDefense    int `yaml:"stab_defense"`
    SlashDefense   int `yaml:"slash_defense"`
    CrushDefense   int `yaml:"crush_defense"`
    ScienceDefense int `yaml:"science_defense"`
    RangedDefense  int `yaml:"ranged_defense"`

    // Damage bonuses
    StrengthBonus   int `yaml:"strength_bonus"`
    RangedStrength  int `yaml:"ranged_strength"`
    ScienceDamage   int `yaml:"science_damage"`
    TechnologyBonus int `yaml:"technology_bonus"`
}
```

**Notes:**
- `AttackBonus` and `DefenseBonus` YAML tags are removed entirely. All item YAMLs will be updated to use the new per-type fields.
- `ScienceBonus` is removed. It was never used in combat. The new `ScienceDamage` field replaces it for future science combat.
- `TechnologyBonus` stays — it will be used in the Technology skill (Prayer equivalent) in the future.
- The old `attack` YAML tag (used by bows/arrows/bolts, silently ignored because the Go struct had `attack_bonus`) is also removed. Those items move to `ranged_attack` and `ranged_strength`.

**Backward Compatibility:** None needed. All YAML files will be rewritten. The old YAML tags (`attack_bonus`, `defense_bonus`, `attack`) will no longer be recognized and will be silently ignored by `gopkg.in/yaml.v3` (which is the current behavior for unknown fields). No `UnmarshalYAML` shim needed.

---

## 3. Weapon Attack Types

**File:** `internal/object/item.go:33-59` — add field to `ItemDef`

**Add this field to `ItemDef`:**
```go
AttackType  string `yaml:"attack_type"` // "stab", "slash", "crush", "ranged", "science"
```

Insert it after `WeaponType` (line 41), before `Stats`:
```go
type ItemDef struct {
    ID          string         `yaml:"id"`
    Name        string         `yaml:"name"`
    Color       string         `yaml:"color"`
    Description string         `yaml:"description"`
    Value       int            `yaml:"value"`
    Stackable   bool           `yaml:"stackable"`
    EquipSlot   EquipSlot      `yaml:"equip_slot"`
    WeaponType  WeaponType     `yaml:"weapon_type"`
    AttackType  string         `yaml:"attack_type"` // NEW
    Stats       ItemStats      `yaml:"stats"`
    Speed       float64        `yaml:"speed"`
    // ... rest unchanged
}
```

**Default attack type mapping** (used when `attack_type` is empty):
- If `WeaponType == "ranged"` → `"ranged"`
- If `WeaponType == "science"` → `"science"`
- Unarmed (no weapon) → `"crush"`
- Otherwise → `"crush"` (safest default for melee)

Weapons should always have `attack_type` set explicitly in YAML. The default is only a fallback.

**Attack type assignments for existing weapons:**

| Weapon Category | attack_type | Reasoning |
|-----------------|-------------|-----------|
| Swords (all tiers) | slash | Swords are slashing weapons |
| Daggers (all tiers) | stab | Daggers are stabbing weapons |
| Axes (all tiers) | slash | Axes are slashing weapons (also tools) |
| Pickaxes (all tiers) | stab | Pickaxes stab/pierce (also tools) |
| Bows (all types) | ranged | Ranged weapons |
| Unarmed | crush | Fists = crush |

---

## 4. Combat Style Mapping

The 4 existing styles remain. The style determines:
1. **Level bonus** (which combat level gets +3 or +1)
2. **XP distribution** (unchanged from current)

The **weapon's `attack_type`** determines:
1. Which of the player's 5 attack bonus totals is used for the accuracy roll
2. Which of the mob's 5 defense bonus values is used for the defense roll

**Style → Level Bonus (unchanged from current):**

| Style | Attack Level | Strength Level | Defense Level |
|-------|-------------|----------------|---------------|
| Accurate | +3 | +0 | +0 |
| Aggressive | +0 | +3 | +0 |
| Defensive | +0 | +0 | +3 |
| Balanced | +1 | +1 | +1 |

**Style → XP Distribution (unchanged from current):**

| Style | Distribution |
|-------|-------------|
| Accurate | 75% Attack, 25% Hitpoints |
| Aggressive | 75% Strength, 25% Hitpoints |
| Defensive | 75% Defense, 25% Hitpoints |
| Balanced | 25% each Attack/Strength/Defense/Hitpoints |

**Ranged style bonuses** (when weapon_type is "ranged"):

| Style | Ranged Level | Defense Level | XP Distribution |
|-------|-------------|---------------|-----------------|
| Accurate | +3 | +0 | 75% Ranged, 25% Hitpoints |
| Aggressive | +3 | +0 | 75% Ranged, 25% Hitpoints |
| Defensive | +0 | +3 | 75% Ranged, 25% Hitpoints |
| Balanced | +1 | +1 | 75% Ranged, 25% Hitpoints |

Note: For ranged, accurate and aggressive both give +3 Ranged (matching OSRS "accurate" and "rapid" which both boost ranged). The attack/strength bonuses from `AttackStyleBonus()` are NOT used — Ranged level is used instead.

---

## 5. Updated Combat Formulas

**File:** `internal/combat/formulas.go` — complete rewrite

```go
package combat

import "math/rand"

// AttackRoll computes the maximum attack roll for accuracy.
// effectiveLevel = level + styleBonus + 8
// equipBonus = total equipment bonus for the relevant attack type
func AttackRoll(level int, styleBonus int, equipBonus int) int {
    effective := level + styleBonus + 8
    return effective * (equipBonus + 64)
}

// DefenseRoll computes the maximum defense roll.
// effectiveLevel = level + styleBonus + 8
// equipBonus = total equipment bonus for the relevant defense type
func DefenseRoll(level int, styleBonus int, equipBonus int) int {
    effective := level + styleBonus + 8
    return effective * (equipBonus + 64)
}

// HitChance returns the probability of hitting (0.0 to 1.0) using the
// true OSRS accuracy formula.
func HitChance(attackRoll, defenseRoll int) float64 {
    a := float64(attackRoll)
    d := float64(defenseRoll)
    if a > d {
        return 1.0 - (d+2.0)/(2.0*(a+1.0))
    }
    return a / (2.0*(d+1.0))
}

// HitCheck uses the OSRS accuracy formula to determine if an attack hits.
// Returns true if the attack lands.
func HitCheck(attackRoll, defenseRoll int) bool {
    chance := HitChance(attackRoll, defenseRoll)
    return rand.Float64() < chance
}

// MaxHit computes the maximum melee hit.
// level = Strength level (or Ranged level for ranged)
// styleBonus = strength style bonus (+3 aggressive, +1 balanced, 0 otherwise)
// equipBonus = total equipment strength bonus (or ranged_strength for ranged)
func MaxHit(level int, styleBonus int, equipBonus int) int {
    effective := level + styleBonus + 8
    hit := (effective * (equipBonus + 64)) / 512
    if hit < 1 {
        hit = 1
    }
    return hit
}

// RollDamage returns a random damage value from 0 to maxHit inclusive.
// In OSRS, 0 is a valid damage (a "hit 0" or splash). We keep the
// current behavior of 1..maxHit to match existing game feel, but this
// can be changed to 0..maxHit for true OSRS.
func RollDamage(maxHit int) int {
    if maxHit <= 0 {
        return 0
    }
    return 1 + rand.Intn(maxHit)
}

// AttackStyleBonus returns the level bonuses for melee combat styles.
// For ranged weapons, the caller should use RangedStyleBonus instead.
func AttackStyleBonus(style string) (attack, strength, defense int) {
    switch style {
    case "accurate":
        return 3, 0, 0
    case "aggressive":
        return 0, 3, 0
    case "defensive":
        return 0, 0, 3
    case "balanced":
        return 1, 1, 1
    default:
        return 0, 0, 0
    }
}

// RangedStyleBonus returns the level bonuses for ranged combat styles.
func RangedStyleBonus(style string) (ranged, defense int) {
    switch style {
    case "accurate":
        return 3, 0
    case "aggressive":
        return 3, 0
    case "defensive":
        return 0, 3
    case "balanced":
        return 1, 1
    default:
        return 0, 0
    }
}

// MobCombatLevel computes a mob's combat level.
// Uses the standard OSRS NPC formula:
//   floor((attack + strength + defense + hp) / 4)
func MobCombatLevel(attack, strength, defense, hp int) int {
    return (attack + strength + defense + hp) / 4
}

// EquipBonusForAttackType selects the correct attack bonus from a
// pre-summed equipment stats struct based on the weapon's attack type.
// attackType is one of: "stab", "slash", "crush", "ranged", "science"
//
// This function lives here to avoid circular imports. The caller passes
// the individual bonus values.
func SelectAttackBonus(attackType string, stab, slash, crush, science, ranged int) int {
    switch attackType {
    case "stab":
        return stab
    case "slash":
        return slash
    case "crush":
        return crush
    case "science":
        return science
    case "ranged":
        return ranged
    default:
        return crush
    }
}

// SelectDefenseBonus picks the correct defense bonus to oppose a given
// attack type.
func SelectDefenseBonus(attackType string, stab, slash, crush, science, ranged int) int {
    switch attackType {
    case "stab":
        return stab
    case "slash":
        return slash
    case "crush":
        return crush
    case "science":
        return science
    case "ranged":
        return ranged
    default:
        return crush
    }
}
```

**Key differences from current formulas.go:**
1. `HitCheck` now uses the continuous OSRS accuracy formula instead of a binary comparison. Previously, if `attackRoll > defenseRoll` it was always a hit; if less, always a miss. Now it uses the proper probability curve.
2. `HitChance` is exposed as a separate function (useful for debugging/display).
3. `RangedStyleBonus` added for ranged weapons.
4. `MobCombatLevel` moved here from `utils.go` (optional, can stay in utils.go).
5. `SelectAttackBonus` and `SelectDefenseBonus` helper functions added.
6. `AttackRoll`, `DefenseRoll`, `MaxHit` formulas are actually unchanged in structure — they were already OSRS-correct. The change is in what values are passed to them.

---

## 6. Code Changes to cmd_attack.go

**File:** `internal/game/cmd_attack.go`

### 6.1 playerAttack (lines 174-236)

**Current flow:**
1. Gets style bonuses from `AttackStyleBonus`
2. Reads main hand weapon's `AttackBonus` and `StrengthBonus`
3. `attRoll = AttackRoll(Attack level, attBonus, equipAtt)`
4. `defRoll = DefenseRoll(mob.Defense, 0, 0)` — mob has NO equipment defense
5. Binary `HitCheck(attRoll, defRoll)`
6. `MaxHit(Strength level, strBonus, equipStr)`

**New flow:**
```go
func (g *Game) playerAttack(sess *net.Session, p *player.Player, mob *world.MobInstance) {
    if g.processConsumeQueue(p, sess) {
        p.ActionState = &ActionState{Type: ActionEating, TargetName: "food"}
        return
    }

    // Determine weapon and attack type
    attackType := "crush" // unarmed default
    var weaponType object.WeaponType
    if itemID, ok := p.Equipment[object.SlotMainHand]; ok {
        if def, err := g.ItemStore.Load(itemID); err == nil {
            if def.AttackType != "" {
                attackType = def.AttackType
            } else if def.WeaponType == object.WeaponRanged {
                attackType = "ranged"
            } else if def.WeaponType == object.WeaponScience {
                attackType = "science"
            }
            weaponType = def.WeaponType
        }
    }

    // Sum all equipment bonuses
    totals := g.playerEquipBonuses(p)

    if weaponType == object.WeaponRanged {
        // --- RANGED ATTACK ---
        rangedBonus, defBonus := combat.RangedStyleBonus(string(p.AttackStyle))

        equipAttack := totals.RangedAttack
        attRoll := combat.AttackRoll(p.Level(player.Ranged), rangedBonus, equipAttack)

        mobDefBonus := combat.SelectDefenseBonus(attackType,
            mob.StabDefense, mob.SlashDefense, mob.CrushDefense,
            mob.ScienceDefense, mob.RangedDefense)
        defRoll := combat.DefenseRoll(mob.Defense, 0, mobDefBonus)

        if combat.HitCheck(attRoll, defRoll) {
            maxHit := combat.MaxHit(p.Level(player.Ranged), rangedBonus, totals.RangedStrength)
            dmg := combat.RollDamage(maxHit)
            // ... apply damage, award XP (ranged style), consume ammo ...
            _ = defBonus // used if needed for defense-related ranged style
        }
    } else {
        // --- MELEE ATTACK ---
        attBonus, strBonus, _ := combat.AttackStyleBonus(string(p.AttackStyle))

        equipAttack := combat.SelectAttackBonus(attackType,
            totals.StabAttack, totals.SlashAttack, totals.CrushAttack,
            totals.ScienceAttack, totals.RangedAttack)
        attRoll := combat.AttackRoll(p.Level(player.Attack), attBonus, equipAttack)

        mobDefBonus := combat.SelectDefenseBonus(attackType,
            mob.StabDefense, mob.SlashDefense, mob.CrushDefense,
            mob.ScienceDefense, mob.RangedDefense)
        defRoll := combat.DefenseRoll(mob.Defense, 0, mobDefBonus)

        if combat.HitCheck(attRoll, defRoll) {
            maxHit := combat.MaxHit(p.Level(player.Strength), strBonus, totals.StrengthBonus)
            dmg := combat.RollDamage(maxHit)
            // ... apply damage, award XP (current style) ...
        }
    }
}
```

**Detailed changes (line-by-line for melee path):**

Replace lines 180-193:
```go
// OLD:
attBonus, strBonus, _ := combat.AttackStyleBonus(string(p.AttackStyle))
equipAtt := 0
equipStr := 0
if itemID, ok := p.Equipment[object.SlotMainHand]; ok {
    def, err := g.ItemStore.Load(itemID)
    if err == nil {
        equipAtt = def.Stats.AttackBonus
        equipStr = def.Stats.StrengthBonus
    }
}
attRoll := combat.AttackRoll(p.Level(player.Attack), attBonus, equipAtt)
defRoll := combat.DefenseRoll(mob.Defense, 0, 0)

// NEW:
attBonus, strBonus, _ := combat.AttackStyleBonus(string(p.AttackStyle))

attackType := "crush"
if itemID, ok := p.Equipment[object.SlotMainHand]; ok {
    if def, err := g.ItemStore.Load(itemID); err == nil {
        if def.AttackType != "" {
            attackType = def.AttackType
        }
    }
}

totals := g.playerEquipBonuses(p)
equipAttack := combat.SelectAttackBonus(attackType,
    totals.StabAttack, totals.SlashAttack, totals.CrushAttack,
    totals.ScienceAttack, totals.RangedAttack)
attRoll := combat.AttackRoll(p.Level(player.Attack), attBonus, equipAttack)

mobDefBonus := combat.SelectDefenseBonus(attackType,
    mob.StabDefense, mob.SlashDefense, mob.CrushDefense,
    mob.ScienceDefense, mob.RangedDefense)
defRoll := combat.DefenseRoll(mob.Defense, 0, mobDefBonus)
```

Replace line 196 (`MaxHit` call):
```go
// OLD:
maxHit := combat.MaxHit(p.Level(player.Strength), strBonus, equipStr)

// NEW:
maxHit := combat.MaxHit(p.Level(player.Strength), strBonus, totals.StrengthBonus)
```

### 6.2 mobAttack (lines 238-289)

**Current flow:**
1. Gets defense style bonus
2. Sums `DefenseBonus` from ALL equipped items
3. `attRoll = AttackRoll(mob.Attack, 0, 0)` — mob has NO attack bonus
4. `defRoll = DefenseRoll(Defense level, defBonus, equipDef)`

**New flow:**
```go
func (g *Game) mobAttack(sess *net.Session, p *player.Player, mob *world.MobInstance) {
    _, _, defStyleBonus := combat.AttackStyleBonus(string(p.AttackStyle))

    // Determine mob's attack type
    mobAttackType := mob.AttackType
    if mobAttackType == "" {
        mobAttackType = "crush"
    }

    // Mob attack roll: uses mob's attack level + mob's attack bonus
    attRoll := combat.AttackRoll(mob.Attack, 0, mob.AttackBonus)

    // Player defense roll: uses player's defense level + style bonus +
    // equipment defense matching the mob's attack type
    totals := g.playerEquipBonuses(p)
    equipDef := combat.SelectDefenseBonus(mobAttackType,
        totals.StabDefense, totals.SlashDefense, totals.CrushDefense,
        totals.ScienceDefense, totals.RangedDefense)
    defRoll := combat.DefenseRoll(p.Level(player.Defense), defStyleBonus, equipDef)

    if combat.HitCheck(attRoll, defRoll) {
        maxHit := combat.MaxHit(mob.Strength, 0, mob.StrengthBonus)
        dmg := combat.RollDamage(maxHit)
        // ... rest unchanged (apply damage, save, flee check, etc.)
    }
}
```

**Detailed changes (line-by-line):**

Replace lines 239-250:
```go
// OLD:
_, _, defBonus := combat.AttackStyleBonus(string(p.AttackStyle))
equipDef := 0
for _, itemID := range p.Equipment {
    def, err := g.ItemStore.Load(itemID)
    if err == nil {
        equipDef += def.Stats.DefenseBonus
    }
}
attRoll := combat.AttackRoll(mob.Attack, 0, 0)
defRoll := combat.DefenseRoll(p.Level(player.Defense), defBonus, equipDef)

// NEW:
_, _, defStyleBonus := combat.AttackStyleBonus(string(p.AttackStyle))

mobAttackType := mob.AttackType
if mobAttackType == "" {
    mobAttackType = "crush"
}

attRoll := combat.AttackRoll(mob.Attack, 0, mob.AttackBonus)

totals := g.playerEquipBonuses(p)
equipDef := combat.SelectDefenseBonus(mobAttackType,
    totals.StabDefense, totals.SlashDefense, totals.CrushDefense,
    totals.ScienceDefense, totals.RangedDefense)
defRoll := combat.DefenseRoll(p.Level(player.Defense), defStyleBonus, equipDef)
```

Replace line 253 (`MaxHit` call):
```go
// OLD:
maxHit := combat.MaxHit(mob.Strength, 0, 0)

// NEW:
maxHit := combat.MaxHit(mob.Strength, 0, mob.StrengthBonus)
```

### 6.3 awardCombatXP changes for Ranged

**Current** (lines 378-406): Only awards to Attack/Strength/Defense/Hitpoints based on style.

**New:** If the player's weapon_type is "ranged", XP goes to Ranged instead of melee skills.

Add a new parameter to `awardCombatXP`:
```go
func (g *Game) awardCombatXP(p *player.Player, dmg int, isRanged bool) ([]xpGain, []player.SkillName) {
    baseXP := dmg * 4
    var gains []xpGain
    var leveledUp []player.SkillName

    if isRanged {
        // All ranged styles: 75% ranged, 25% hitpoints
        gains = []xpGain{
            {string(player.Ranged), baseXP * 3 / 4},
            {string(player.Hitpoints), baseXP / 4},
        }
    } else {
        switch p.AttackStyle {
        case player.Accurate:
            gains = []xpGain{{string(player.Attack), baseXP * 3 / 4}, {string(player.Hitpoints), baseXP / 4}}
        case player.Aggressive:
            gains = []xpGain{{string(player.Strength), baseXP * 3 / 4}, {string(player.Hitpoints), baseXP / 4}}
        case player.Defensive:
            gains = []xpGain{{string(player.Defense), baseXP * 3 / 4}, {string(player.Hitpoints), baseXP / 4}}
        case player.Balanced:
            quarter := baseXP / 4
            gains = []xpGain{
                {string(player.Attack), quarter},
                {string(player.Strength), quarter},
                {string(player.Defense), quarter},
                {string(player.Hitpoints), quarter},
            }
        }
    }

    for _, gain := range gains {
        if newLevel := p.AddSkillXP(player.SkillName(gain.Skill), gain.XP); newLevel > 0 {
            leveledUp = append(leveledUp, player.SkillName(gain.Skill))
        }
    }
    g.AccountStore.SaveCharacter(p)
    return gains, leveledUp
}
```

Update call sites:
- `playerAttack` melee path: `g.awardCombatXP(p, dmg, false)`
- `playerAttack` ranged path: `g.awardCombatXP(p, dmg, true)`

### 6.4 Ammo Consumption (Ranged)

In `playerAttack`, after a successful ranged attack:
```go
if weaponType == object.WeaponRanged {
    p.AmmoQty--
    if p.AmmoQty <= 0 {
        delete(p.Equipment, object.SlotAmmo)
        p.AmmoQty = 0
        sess.WriteLine("You've run out of ammo!")
        combat.LeaveCombat(p.Name)
        // End combat
    }
    g.AccountStore.SaveCharacter(p)
}
```

Before combat starts (in `startCombat` or `doAttack`), check for ammo:
```go
if weaponDef.WeaponType == object.WeaponRanged {
    if _, hasAmmo := p.Equipment[object.SlotAmmo]; !hasAmmo || p.AmmoQty <= 0 {
        sess.WriteLine("You don't have any ammo equipped.")
        return
    }
}
```

### 6.5 startCombat Style Display

In `startCombat` (line 120), the style display should also show the attack type:
```go
attackType := "crush"
if itemID, ok := p.Equipment[object.SlotMainHand]; ok {
    if def, err := g.ItemStore.Load(itemID); err == nil && def.AttackType != "" {
        attackType = def.AttackType
    }
}
styleStr := fmt.Sprintf(" Style: %s (%s, %s)", p.AttackStyle, strings.Join(styleParts, ", "), attackType)
```

---

## 7. Code Changes to MobDef and MobInstance

**File:** `internal/world/mob.go`

### 7.1 MobDef (lines 20-37)

**Add these fields:**
```go
type MobDef struct {
    ID                 string    `yaml:"id"`
    Name               string    `yaml:"name"`
    Description        string    `yaml:"description"`
    BehaviorID         string    `yaml:"behavior"`
    IdleDescriptions   []string  `yaml:"idle_descriptions"`
    CombatDescriptions []string  `yaml:"combat_descriptions"`
    Attack             int       `yaml:"attack"`
    Strength           int       `yaml:"strength"`
    Defense            int       `yaml:"defense"`
    HP                 int       `yaml:"hp"`
    Ranged             int       `yaml:"ranged"`       // NEW
    Science            int       `yaml:"science"`      // NEW
    Speed              float64   `yaml:"speed"`
    Aggressive         bool      `yaml:"aggressive"`
    Protected          bool      `yaml:"protected"`
    Unique             bool      `yaml:"unique"`
    RespawnTicks       float64   `yaml:"respawn_ticks"`
    Drops              DropTable `yaml:"drops"`

    // NEW: Attack bonuses
    AttackBonus    int    `yaml:"attack_bonus"`    // equipment-equivalent attack bonus
    StrengthBonus  int    `yaml:"strength_bonus"`  // equipment-equivalent strength bonus
    RangedBonus    int    `yaml:"ranged_bonus"`    // ranged attack bonus
    ScienceBonus   int    `yaml:"science_bonus"`   // science attack bonus
    AttackType     string `yaml:"attack_type"`     // "stab"/"slash"/"crush"/"ranged"/"science" (default "crush")

    // NEW: Defense bonuses
    StabDefense    int `yaml:"stab_defense"`
    SlashDefense   int `yaml:"slash_defense"`
    CrushDefense   int `yaml:"crush_defense"`
    ScienceDefense int `yaml:"science_defense"`
    RangedDefense  int `yaml:"ranged_defense"`

    // NEW: Elemental weakness
    Weakness string `yaml:"weakness"` // "solar"/"hydro"/"eco"/"bio"/""
}
```

### 7.2 MobInstance (lines 39-62)

**Add matching fields:**
```go
type MobInstance struct {
    InstanceID        string
    DefID             string
    Name              string
    BehaviorID        string
    HP                int
    MaxHP             int
    Attack            int
    Strength          int
    Defense           int
    Ranged            int    // NEW
    Science           int    // NEW
    Speed             float64
    Aggressive        bool
    Protected         bool
    Unique            bool
    RespawnTicks      float64
    RoomID            int
    HomeRoomID        int
    Drops             DropTable
    IdleDescription   string
    WanderRooms       []int
    WanderInterval    float64
    WanderTickCounter int
    regenerateTick    int

    // NEW: Attack bonuses
    AttackBonus    int
    StrengthBonus  int
    RangedBonus    int
    ScienceBonus   int
    AttackType     string

    // NEW: Defense bonuses
    StabDefense    int
    SlashDefense   int
    CrushDefense   int
    ScienceDefense int
    RangedDefense  int

    // NEW: Elemental weakness
    Weakness string
}
```

### 7.3 SeedMobs (lines 213-259)

**Add field propagation** in the `inst := &MobInstance{...}` block (lines 236-258):

After line 245 (`Defense: dw.def.Defense,`), add:
```go
Ranged:         dw.def.Ranged,
Science:        dw.def.Science,
```

After line 255 (`Drops: dw.def.Drops,`), add:
```go
AttackBonus:    dw.def.AttackBonus,
StrengthBonus:  dw.def.StrengthBonus,
RangedBonus:    dw.def.RangedBonus,
ScienceBonus:   dw.def.ScienceBonus,
AttackType:     dw.def.AttackType,
StabDefense:    dw.def.StabDefense,
SlashDefense:   dw.def.SlashDefense,
CrushDefense:   dw.def.CrushDefense,
ScienceDefense: dw.def.ScienceDefense,
RangedDefense:  dw.def.RangedDefense,
Weakness:       dw.def.Weakness,
```

### 7.4 mobCombatLevel Update

**File:** `internal/game/utils.go:47-49`

**Current:**
```go
func mobCombatLevel(m *world.MobInstance) int {
    return int(0.25*float64(m.Attack+m.Strength+m.Defense+m.MaxHP) + 0.5)
}
```

**New** (unchanged — this formula is already correct for melee-only mobs):
```go
func mobCombatLevel(m *world.MobInstance) int {
    base := float64(m.Defense+m.MaxHP) / 4.0
    melee := float64(m.Attack+m.Strength) / 4.0
    ranged := float64(m.Ranged) * 3.0 / 8.0
    science := float64(m.Science) * 3.0 / 8.0
    best := melee
    if ranged > best {
        best = ranged
    }
    if science > best {
        best = science
    }
    return int(base + best + 0.5)
}
```

This uses the OSRS NPC combat level formula:
- `base = (def + hp) / 4`
- `offensive = max(melee=(atk+str)/4, ranged=rng*3/8, magic=sci*3/8)`
- `level = floor(base + offensive)`

For existing mobs with no Ranged/Science, this produces the same results as the old formula.

---

## 8. Equipment Bonus Aggregation

**File:** `internal/game/cmd_attack.go` (or a new `internal/game/equip_stats.go`)

Add a helper function that sums all equipped items' stats:

```go
func (g *Game) playerEquipBonuses(p *player.Player) object.ItemStats {
    var totals object.ItemStats
    for _, itemID := range p.Equipment {
        def, err := g.ItemStore.Load(itemID)
        if err != nil {
            continue
        }
        totals.StabAttack += def.Stats.StabAttack
        totals.SlashAttack += def.Stats.SlashAttack
        totals.CrushAttack += def.Stats.CrushAttack
        totals.ScienceAttack += def.Stats.ScienceAttack
        totals.RangedAttack += def.Stats.RangedAttack
        totals.StabDefense += def.Stats.StabDefense
        totals.SlashDefense += def.Stats.SlashDefense
        totals.CrushDefense += def.Stats.CrushDefense
        totals.ScienceDefense += def.Stats.ScienceDefense
        totals.RangedDefense += def.Stats.RangedDefense
        totals.StrengthBonus += def.Stats.StrengthBonus
        totals.RangedStrength += def.Stats.RangedStrength
        totals.ScienceDamage += def.Stats.ScienceDamage
        totals.TechnologyBonus += def.Stats.TechnologyBonus
    }
    return totals
}
```

This function is called by `playerAttack`, `mobAttack`, the new `stats` command, and `doLookTarget` for comparing equipment.

---

## 9. Equipment Stats Display

**File:** `internal/game/cmd_look.go`

### 9.1 Item Examination (doLookTarget)

When looking at an item (inventory or ground), if the item has any non-zero combat stats, display them in a formatted block.

**Location:** After displaying item name/description/value (lines 508-514 for ground items, lines 526-536 for inventory items).

**Add this helper function:**
```go
func (g *Game) showItemStats(sess *net.Session, def *object.ItemDef) {
    s := def.Stats
    hasAttack := s.StabAttack != 0 || s.SlashAttack != 0 || s.CrushAttack != 0 ||
        s.ScienceAttack != 0 || s.RangedAttack != 0
    hasDefense := s.StabDefense != 0 || s.SlashDefense != 0 || s.CrushDefense != 0 ||
        s.ScienceDefense != 0 || s.RangedDefense != 0
    hasOther := s.StrengthBonus != 0 || s.RangedStrength != 0 ||
        s.ScienceDamage != 0 || s.TechnologyBonus != 0

    if !hasAttack && !hasDefense && !hasOther {
        return
    }

    sess.WriteLine("")
    if hasAttack || hasDefense {
        sess.WriteLine("  Attack bonuses:       Defense bonuses:")
        sess.WriteLine(fmt.Sprintf("    Stab:   %+4d          Stab:   %+4d", s.StabAttack, s.StabDefense))
        sess.WriteLine(fmt.Sprintf("    Slash:  %+4d          Slash:  %+4d", s.SlashAttack, s.SlashDefense))
        sess.WriteLine(fmt.Sprintf("    Crush:  %+4d          Crush:  %+4d", s.CrushAttack, s.CrushDefense))
        sess.WriteLine(fmt.Sprintf("    Science:%+4d          Science:%+4d", s.ScienceAttack, s.ScienceDefense))
        sess.WriteLine(fmt.Sprintf("    Ranged: %+4d          Ranged: %+4d", s.RangedAttack, s.RangedDefense))
    }
    if hasOther {
        sess.WriteLine("")
        sess.WriteLine("  Other bonuses:")
        if s.StrengthBonus != 0 {
            sess.WriteLine(fmt.Sprintf("    Melee strength: %+d", s.StrengthBonus))
        }
        if s.RangedStrength != 0 {
            sess.WriteLine(fmt.Sprintf("    Ranged strength: %+d", s.RangedStrength))
        }
        if s.ScienceDamage != 0 {
            sess.WriteLine(fmt.Sprintf("    Science damage: %+d", s.ScienceDamage))
        }
        if s.TechnologyBonus != 0 {
            sess.WriteLine(fmt.Sprintf("    Technology: %+d", s.TechnologyBonus))
        }
    }
    if def.AttackType != "" {
        sess.WriteLine(fmt.Sprintf("  Attack type: %s", def.AttackType))
    }
    if def.Speed > 0 {
        sess.WriteLine(fmt.Sprintf("  Speed: %.0f", def.Speed))
    }
}
```

**Call it** in the ground item branch (after line 513):
```go
g.showItemStats(sess, def)
```

**Call it** in the inventory item branch (after line 531):
```go
g.showItemStats(sess, def)
```

### 9.2 Mob Examination

Update the mob examination section in `doLookTarget` (lines 451-457) to show per-type bonuses:

```go
// Replace lines 451-457:
sess.WriteLines(
    "",
    fmt.Sprintf("  Attack: %d  Strength: %d  Defense: %d", best.Attack, best.Strength, best.Defense),
    fmt.Sprintf("  HP: %d/%d", best.HP, best.MaxHP),
)
if best.StabDefense != 0 || best.SlashDefense != 0 || best.CrushDefense != 0 ||
    best.ScienceDefense != 0 || best.RangedDefense != 0 {
    sess.WriteLines(
        "",
        "  Defense bonuses:",
        fmt.Sprintf("    Stab: %+d  Slash: %+d  Crush: %+d", best.StabDefense, best.SlashDefense, best.CrushDefense),
        fmt.Sprintf("    Science: %+d  Ranged: %+d", best.ScienceDefense, best.RangedDefense),
    )
}
if best.Weakness != "" {
    sess.WriteLine(fmt.Sprintf("  Weakness: %s", best.Weakness))
}
```

---

## 10. Equipment Totals Command — `stats`

**New file:** `internal/game/cmd_stats.go`

```go
package game

import (
    "fmt"
    "strings"

    "thehouseoficarus/internal/combat"
    "thehouseoficarus/internal/net"
    "thehouseoficarus/internal/object"
    "thehouseoficarus/internal/player"
)

func (g *Game) doStats(sess *net.Session) {
    p := sess.Player.(*player.Player)
    totals := g.playerEquipBonuses(p)

    attackType := "crush"
    weaponName := "unarmed"
    if itemID, ok := p.Equipment[object.SlotMainHand]; ok {
        if def, err := g.ItemStore.Load(itemID); err == nil {
            weaponName = def.Name
            if def.AttackType != "" {
                attackType = def.AttackType
            }
        }
    }

    sess.WriteLines(
        "",
        fmt.Sprintf("Weapon: %s (attack type: %s)", weaponName, attackType),
        "",
        "Attack bonuses:       Defense bonuses:",
        fmt.Sprintf("  Stab:   %+4d          Stab:   %+4d", totals.StabAttack, totals.StabDefense),
        fmt.Sprintf("  Slash:  %+4d          Slash:  %+4d", totals.SlashAttack, totals.SlashDefense),
        fmt.Sprintf("  Crush:  %+4d          Crush:  %+4d", totals.CrushAttack, totals.CrushDefense),
        fmt.Sprintf("  Science:%+4d          Science:%+4d", totals.ScienceAttack, totals.ScienceDefense),
        fmt.Sprintf("  Ranged: %+4d          Ranged: %+4d", totals.RangedAttack, totals.RangedDefense),
        "",
        "Other bonuses:",
        fmt.Sprintf("  Melee strength:  %+d", totals.StrengthBonus),
        fmt.Sprintf("  Ranged strength: %+d", totals.RangedStrength),
        fmt.Sprintf("  Science damage:  %+d", totals.ScienceDamage),
        fmt.Sprintf("  Technology:      %+d", totals.TechnologyBonus),
    )

    // Show effective accuracy and max hit for current setup
    attBonus, strBonus, _ := combat.AttackStyleBonus(string(p.AttackStyle))
    equipAtt := combat.SelectAttackBonus(attackType,
        totals.StabAttack, totals.SlashAttack, totals.CrushAttack,
        totals.ScienceAttack, totals.RangedAttack)
    attRoll := combat.AttackRoll(p.Level(player.Attack), attBonus, equipAtt)
    maxHit := combat.MaxHit(p.Level(player.Strength), strBonus, totals.StrengthBonus)

    sess.WriteLines(
        "",
        fmt.Sprintf("Style: %s  Attack roll: %d  Max hit: %d",
            p.AttackStyle, attRoll, maxHit),
    )

    _ = strings.Join // avoid unused import (the real code won't need this)
}
```

**Register the command:**

**File:** `internal/game/game.go`

In `classifyCommand` (line 138), add `"stats"` to the `ClassInstant` case:
```go
case "say", "score", "sc", "inventory", "i", "inv",
    "look", "l", "exits", "help",
    "map", "option", "options", "alias", "unalias",
    "description", "desc", "queued", "color", "colors",
    "colortable", "prompt", "style", "stats":   // ADD "stats"
    return ClassInstant
```

In `executeCommand` (find the switch statement for instant commands), add:
```go
case "stats":
    g.doStats(sess)
```

---

## 11. Item YAML Migration

Every item with combat stats needs updated YAML. Below is the complete set.

### 11.1 Melee Weapons — Swords (attack_type: slash)

Stats are OSRS-proportional. Swords have high slash, moderate stab, no crush.

**Bronze Sword** (`data/items/bronze_sword.yaml`):
```yaml
id: bronze_sword
name: bronze sword
color: "178"
description: "A basic bronze sword."
value: 12
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: slash
stats:
  stab_attack: 4
  slash_attack: 10
  crush_attack: -2
  strength_bonus: 7
speed: 4
```

**Iron Sword** (`data/items/iron_sword.yaml`):
```yaml
id: iron_sword
name: iron sword
color: "250"
description: "An iron sword."
value: 30
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: slash
stats:
  stab_attack: 7
  slash_attack: 15
  crush_attack: -2
  strength_bonus: 10
speed: 4
```

**Steel Sword** (`data/items/steel_sword.yaml`):
```yaml
id: steel_sword
name: steel sword
color: "253"
description: "A steel sword."
value: 100
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: slash
stats:
  stab_attack: 10
  slash_attack: 22
  crush_attack: -2
  strength_bonus: 14
speed: 4
```

**Mithril Sword** (`data/items/mithril_sword.yaml`):
```yaml
id: mithril_sword
name: mithril sword
color: "75"
description: "A mithril sword."
value: 250
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: slash
stats:
  stab_attack: 14
  slash_attack: 30
  crush_attack: -2
  strength_bonus: 20
speed: 4
```

**Adamant Sword** (`data/items/adamant_sword.yaml`):
```yaml
id: adamant_sword
name: adamant sword
color: "120"
description: "An adamant sword."
value: 700
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: slash
stats:
  stab_attack: 20
  slash_attack: 40
  crush_attack: -2
  strength_bonus: 27
speed: 4
```

**Rune Sword** (`data/items/rune_sword.yaml`):
```yaml
id: rune_sword
name: rune sword
color: "87"
description: "A rune sword."
value: 10000
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: slash
stats:
  stab_attack: 27
  slash_attack: 52
  crush_attack: -2
  strength_bonus: 36
speed: 4
```

### 11.2 Melee Weapons — Daggers (attack_type: stab)

Daggers have high stab, moderate slash, negative crush. Fast speed.

**Bronze Dagger** (`data/items/bronze_dagger.yaml`):
```yaml
id: bronze_dagger
name: bronze dagger
color: "178"
description: "A small bronze dagger."
value: 8
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: stab
stats:
  stab_attack: 5
  slash_attack: 3
  crush_attack: -1
  strength_bonus: 4
speed: 3
```

**Iron Dagger** (`data/items/iron_dagger.yaml`):
```yaml
id: iron_dagger
name: iron dagger
color: "250"
description: "A small iron dagger."
value: 20
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: stab
stats:
  stab_attack: 8
  slash_attack: 5
  crush_attack: -1
  strength_bonus: 7
speed: 3
```

**Steel Dagger** (`data/items/steel_dagger.yaml`):
```yaml
id: steel_dagger
name: steel dagger
color: "253"
description: "A small steel dagger."
value: 60
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: stab
stats:
  stab_attack: 12
  slash_attack: 7
  crush_attack: -1
  strength_bonus: 10
speed: 3
```

**Mithril Dagger** (`data/items/mithril_dagger.yaml`):
```yaml
id: mithril_dagger
name: mithril dagger
color: "75"
description: "A small mithril dagger."
value: 150
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: stab
stats:
  stab_attack: 17
  slash_attack: 10
  crush_attack: -1
  strength_bonus: 14
speed: 3
```

**Adamant Dagger** (`data/items/adamant_dagger.yaml`):
```yaml
id: adamant_dagger
name: adamant dagger
color: "120"
description: "A small adamant dagger."
value: 400
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: stab
stats:
  stab_attack: 23
  slash_attack: 14
  crush_attack: -1
  strength_bonus: 19
speed: 3
```

**Rune Dagger** (`data/items/rune_dagger.yaml`):
```yaml
id: rune_dagger
name: rune dagger
color: "87"
description: "A small rune dagger."
value: 5000
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: stab
stats:
  stab_attack: 30
  slash_attack: 18
  crush_attack: -1
  strength_bonus: 24
speed: 3
```

### 11.3 Melee Weapons — Axes (attack_type: slash)

Axes are also tools. They have moderate slash, some crush, weak stab. Slower than swords.

**Bronze Axe** (`data/items/bronze_axe.yaml`):
```yaml
id: bronze_axe
name: bronze axe
color: "178"
description: "A sturdy bronze axe, good for woodcutting."
value: 10
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: slash
stats:
  stab_attack: -2
  slash_attack: 7
  crush_attack: 5
  strength_bonus: 5
speed: 5
tool_type: axe
tool_speed: 4
```

**Iron Axe** (`data/items/iron_axe.yaml`):
```yaml
id: iron_axe
name: iron axe
color: "250"
description: "A sturdy iron axe, good for woodcutting."
value: 25
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: slash
stats:
  stab_attack: -2
  slash_attack: 10
  crush_attack: 7
  strength_bonus: 8
speed: 5
tool_type: axe
tool_speed: 3.5
```

**Steel Axe** (`data/items/steel_axe.yaml`):
```yaml
id: steel_axe
name: steel axe
color: "253"
description: "A sturdy steel axe, good for woodcutting."
value: 75
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: slash
stats:
  stab_attack: -2
  slash_attack: 15
  crush_attack: 11
  strength_bonus: 12
speed: 5
tool_type: axe
tool_speed: 3
```

**Black Axe** (`data/items/black_axe.yaml`):
```yaml
id: black_axe
name: black axe
color: "240"
description: "A black axe, good for woodcutting."
value: 150
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: slash
stats:
  stab_attack: -2
  slash_attack: 18
  crush_attack: 14
  strength_bonus: 14
speed: 5
tool_type: axe
tool_speed: 2.5
```

**Mithril Axe** (`data/items/mithril_axe.yaml`):
```yaml
id: mithril_axe
name: mithril axe
color: "75"
description: "A sturdy mithril axe, good for woodcutting."
value: 200
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: slash
stats:
  stab_attack: -2
  slash_attack: 21
  crush_attack: 16
  strength_bonus: 17
speed: 5
tool_type: axe
tool_speed: 2.5
```

**Adamant Axe** (`data/items/adamant_axe.yaml`):
```yaml
id: adamant_axe
name: adamant axe
color: "120"
description: "A sturdy adamant axe, good for woodcutting."
value: 500
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: slash
stats:
  stab_attack: -2
  slash_attack: 29
  crush_attack: 22
  strength_bonus: 24
speed: 5
tool_type: axe
tool_speed: 2
```

**Rune Axe** (`data/items/rune_axe.yaml`):
```yaml
id: rune_axe
name: rune axe
color: "87"
description: "A sturdy rune axe, good for woodcutting."
value: 5000
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: slash
stats:
  stab_attack: -2
  slash_attack: 38
  crush_attack: 29
  strength_bonus: 32
speed: 5
tool_type: axe
tool_speed: 1.5
```

**Dragon Axe** (`data/items/dragon_axe.yaml`):
```yaml
id: dragon_axe
name: dragon axe
color: "196"
description: "A powerful dragon axe."
value: 50000
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: slash
stats:
  stab_attack: -2
  slash_attack: 43
  crush_attack: 32
  strength_bonus: 36
speed: 5
tool_type: axe
tool_speed: 1
```

### 11.4 Melee Weapons — Pickaxes (attack_type: stab)

Pickaxes stab/pierce. Tool items with moderate combat stats.

**Bronze Pickaxe** (`data/items/bronze_pickaxe.yaml`):
```yaml
id: bronze_pickaxe
name: bronze pickaxe
color: "178"
description: "A sturdy bronze pickaxe, good for mining."
value: 10
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: stab
stats:
  stab_attack: 4
  slash_attack: -2
  crush_attack: 2
  strength_bonus: 3
speed: 5
tool_type: pickaxe
tool_speed: 2
```

**Iron Pickaxe** (`data/items/iron_pickaxe.yaml`):
```yaml
id: iron_pickaxe
name: iron pickaxe
color: "250"
description: "A sturdy iron pickaxe, good for mining."
value: 25
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: stab
stats:
  stab_attack: 7
  slash_attack: -2
  crush_attack: 3
  strength_bonus: 5
speed: 5
tool_type: pickaxe
tool_speed: 1.5
```

**Steel Pickaxe** (`data/items/steel_pickaxe.yaml`):
```yaml
id: steel_pickaxe
name: steel pickaxe
color: "253"
description: "A sturdy steel pickaxe, good for mining."
value: 75
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: stab
stats:
  stab_attack: 10
  slash_attack: -2
  crush_attack: 4
  strength_bonus: 7
speed: 5
tool_type: pickaxe
tool_speed: 1.25
```

**Black Pickaxe** (`data/items/black_pickaxe.yaml`):
```yaml
id: black_pickaxe
name: black pickaxe
color: "240"
description: "A black pickaxe, good for mining."
value: 150
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: stab
stats:
  stab_attack: 14
  slash_attack: -2
  crush_attack: 6
  strength_bonus: 9
speed: 5
tool_type: pickaxe
tool_speed: 1
```

**Mithril Pickaxe** (`data/items/mithril_pickaxe.yaml`):
```yaml
id: mithril_pickaxe
name: mithril pickaxe
color: "75"
description: "A sturdy mithril pickaxe, good for mining."
value: 200
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: stab
stats:
  stab_attack: 17
  slash_attack: -2
  crush_attack: 8
  strength_bonus: 12
speed: 5
tool_type: pickaxe
tool_speed: 1
```

**Adamant Pickaxe** (`data/items/adamant_pickaxe.yaml`):
```yaml
id: adamant_pickaxe
name: adamant pickaxe
color: "120"
description: "A sturdy adamant pickaxe, good for mining."
value: 500
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: stab
stats:
  stab_attack: 23
  slash_attack: -2
  crush_attack: 10
  strength_bonus: 16
speed: 5
tool_type: pickaxe
tool_speed: 0.75
```

**Rune Pickaxe** (`data/items/rune_pickaxe.yaml`):
```yaml
id: rune_pickaxe
name: rune pickaxe
color: "87"
description: "A sturdy rune pickaxe, good for mining."
value: 5000
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: stab
stats:
  stab_attack: 30
  slash_attack: -2
  crush_attack: 14
  strength_bonus: 22
speed: 5
tool_type: pickaxe
tool_speed: 0.5
```

**Dragon Pickaxe** (`data/items/dragon_pickaxe.yaml`):
```yaml
id: dragon_pickaxe
name: dragon pickaxe
color: "196"
description: "A powerful dragon pickaxe."
value: 50000
stackable: false
equip_slot: main_hand
weapon_type: melee
attack_type: stab
stats:
  stab_attack: 34
  slash_attack: -2
  crush_attack: 16
  strength_bonus: 26
speed: 5
tool_type: pickaxe
tool_speed: 0.25
```

### 11.5 Armor — Med Helms

Med helms have moderate defense, balanced across melee types. Slightly negative science defense (metal conducts energy), neutral ranged.

**Bronze Med Helm** (`data/items/bronze_med_helm.yaml`):
```yaml
id: bronze_med_helm
name: bronze med helm
color: "178"
description: "A bronze medium helmet."
value: 8
stackable: false
equip_slot: head
stats:
  stab_defense: 3
  slash_defense: 4
  crush_defense: 2
  science_defense: -1
  ranged_defense: 3
```

**Iron Med Helm** (`data/items/iron_med_helm.yaml`):
```yaml
id: iron_med_helm
name: iron med helm
color: "250"
description: "An iron medium helmet."
value: 20
stackable: false
equip_slot: head
stats:
  stab_defense: 5
  slash_defense: 6
  crush_defense: 3
  science_defense: -1
  ranged_defense: 5
```

**Steel Med Helm** (`data/items/steel_med_helm.yaml`):
```yaml
id: steel_med_helm
name: steel med helm
color: "253"
description: "A steel medium helmet."
value: 60
stackable: false
equip_slot: head
stats:
  stab_defense: 7
  slash_defense: 9
  crush_defense: 5
  science_defense: -2
  ranged_defense: 7
```

**Mithril Med Helm** (`data/items/mithril_med_helm.yaml`):
```yaml
id: mithril_med_helm
name: mithril med helm
color: "75"
description: "A mithril medium helmet."
value: 150
stackable: false
equip_slot: head
stats:
  stab_defense: 10
  slash_defense: 12
  crush_defense: 7
  science_defense: -3
  ranged_defense: 10
```

**Adamant Med Helm** (`data/items/adamant_med_helm.yaml`):
```yaml
id: adamant_med_helm
name: adamant med helm
color: "120"
description: "An adamant medium helmet."
value: 400
stackable: false
equip_slot: head
stats:
  stab_defense: 14
  slash_defense: 16
  crush_defense: 10
  science_defense: -3
  ranged_defense: 14
```

**Rune Med Helm** (`data/items/rune_med_helm.yaml`):
```yaml
id: rune_med_helm
name: rune med helm
color: "87"
description: "A rune medium helmet."
value: 5000
stackable: false
equip_slot: head
stats:
  stab_defense: 19
  slash_defense: 22
  crush_defense: 13
  science_defense: -4
  ranged_defense: 19
```

### 11.6 Armor — Full Helms

Full helms have higher defense than med helms. Larger science penalty.

**Bronze Full Helm** (`data/items/bronze_full_helm.yaml`):
```yaml
id: bronze_full_helm
name: bronze full helm
color: "178"
description: "A bronze full helmet."
value: 20
stackable: false
equip_slot: head
stats:
  stab_defense: 5
  slash_defense: 6
  crush_defense: 4
  science_defense: -3
  ranged_defense: 5
```

**Iron Full Helm** (`data/items/iron_full_helm.yaml`):
```yaml
id: iron_full_helm
name: iron full helm
color: "250"
description: "An iron full helmet."
value: 50
stackable: false
equip_slot: head
stats:
  stab_defense: 8
  slash_defense: 9
  crush_defense: 6
  science_defense: -3
  ranged_defense: 8
```

**Steel Full Helm** (`data/items/steel_full_helm.yaml`):
```yaml
id: steel_full_helm
name: steel full helm
color: "253"
description: "A steel full helmet."
value: 150
stackable: false
equip_slot: head
stats:
  stab_defense: 12
  slash_defense: 13
  crush_defense: 9
  science_defense: -5
  ranged_defense: 12
```

**Mithril Full Helm** (`data/items/mithril_full_helm.yaml`):
```yaml
id: mithril_full_helm
name: mithril full helm
color: "75"
description: "A mithril full helmet."
value: 400
stackable: false
equip_slot: head
stats:
  stab_defense: 16
  slash_defense: 18
  crush_defense: 12
  science_defense: -6
  ranged_defense: 16
```

**Adamant Full Helm** (`data/items/adamant_full_helm.yaml`):
```yaml
id: adamant_full_helm
name: adamant full helm
color: "120"
description: "An adamant full helmet."
value: 1000
stackable: false
equip_slot: head
stats:
  stab_defense: 22
  slash_defense: 24
  crush_defense: 16
  science_defense: -8
  ranged_defense: 22
```

**Rune Full Helm** (`data/items/rune_full_helm.yaml`):
```yaml
id: rune_full_helm
name: rune full helm
color: "87"
description: "A rune full helmet."
value: 12000
stackable: false
equip_slot: head
stats:
  stab_defense: 30
  slash_defense: 33
  crush_defense: 22
  science_defense: -11
  ranged_defense: 30
```

### 11.7 Armor — Platebodies

Platebodies are the highest-defense torso armor. Heavy science penalty, strong melee defense.

**Bronze Platebody** (`data/items/bronze_platebody.yaml`):
```yaml
id: bronze_platebody
name: bronze platebody
color: "178"
description: "A bronze platebody."
value: 60
stackable: false
equip_slot: torso
stats:
  stab_defense: 12
  slash_defense: 15
  crush_defense: 10
  science_defense: -10
  ranged_defense: 12
```

**Iron Platebody** (`data/items/iron_platebody.yaml`):
```yaml
id: iron_platebody
name: iron platebody
color: "250"
description: "An iron platebody."
value: 150
stackable: false
equip_slot: torso
stats:
  stab_defense: 18
  slash_defense: 22
  crush_defense: 14
  science_defense: -10
  ranged_defense: 18
```

**Steel Platebody** (`data/items/steel_platebody.yaml`):
```yaml
id: steel_platebody
name: steel platebody
color: "253"
description: "A steel platebody."
value: 500
stackable: false
equip_slot: torso
stats:
  stab_defense: 27
  slash_defense: 32
  crush_defense: 22
  science_defense: -15
  ranged_defense: 27
```

**Mithril Platebody** (`data/items/mithril_platebody.yaml`):
```yaml
id: mithril_platebody
name: mithril platebody
color: "75"
description: "A mithril platebody."
value: 1500
stackable: false
equip_slot: torso
stats:
  stab_defense: 36
  slash_defense: 42
  crush_defense: 30
  science_defense: -20
  ranged_defense: 36
```

**Adamant Platebody** (`data/items/adamant_platebody.yaml`):
```yaml
id: adamant_platebody
name: adamant platebody
color: "120"
description: "An adamant platebody."
value: 5000
stackable: false
equip_slot: torso
stats:
  stab_defense: 49
  slash_defense: 55
  crush_defense: 40
  science_defense: -25
  ranged_defense: 49
```

**Rune Platebody** (`data/items/rune_platebody.yaml`):
```yaml
id: rune_platebody
name: rune platebody
color: "87"
description: "A rune platebody."
value: 40000
stackable: false
equip_slot: torso
stats:
  stab_defense: 65
  slash_defense: 72
  crush_defense: 52
  science_defense: -30
  ranged_defense: 65
```

### 11.8 Ranged Weapons — Bows

Bows use the `ranged_attack` field. The bug where they used `attack:` (which was silently ignored since ItemStats has no `attack` YAML tag) is fixed. Longbows have higher accuracy than shortbows but are slower.

**Shortbow** (`data/items/shortbow.yaml`):
```yaml
id: shortbow
name: shortbow
color: "137"
description: "A shortbow."
value: 10
equip_slot: main_hand
weapon_type: ranged
attack_type: ranged
speed: 4
stats:
  ranged_attack: 8
```

**Oak Shortbow** (`data/items/oak_shortbow.yaml`):
```yaml
id: oak_shortbow
name: oak shortbow
color: "136"
description: "An oak shortbow."
value: 40
equip_slot: main_hand
weapon_type: ranged
attack_type: ranged
speed: 4
stats:
  ranged_attack: 14
```

**Willow Shortbow** (`data/items/willow_shortbow.yaml`):
```yaml
id: willow_shortbow
name: willow shortbow
color: "107"
description: "A willow shortbow."
value: 160
equip_slot: main_hand
weapon_type: ranged
attack_type: ranged
speed: 4
stats:
  ranged_attack: 20
```

**Maple Shortbow** (`data/items/maple_shortbow.yaml`):
```yaml
id: maple_shortbow
name: maple shortbow
color: "172"
description: "A maple shortbow."
value: 640
equip_slot: main_hand
weapon_type: ranged
attack_type: ranged
speed: 4
stats:
  ranged_attack: 29
```

**Yew Shortbow** (`data/items/yew_shortbow.yaml`):
```yaml
id: yew_shortbow
name: yew shortbow
color: "94"
description: "A yew shortbow."
value: 1600
equip_slot: main_hand
weapon_type: ranged
attack_type: ranged
speed: 4
stats:
  ranged_attack: 47
```

**Magic Shortbow** (`data/items/magic_shortbow.yaml`):
```yaml
id: magic_shortbow
name: magic shortbow
color: "63"
description: "A magic shortbow."
value: 4000
equip_slot: main_hand
weapon_type: ranged
attack_type: ranged
speed: 4
stats:
  ranged_attack: 69
```

**Longbow** (`data/items/longbow.yaml`):
```yaml
id: longbow
name: longbow
color: "137"
description: "A longbow."
value: 20
equip_slot: main_hand
weapon_type: ranged
attack_type: ranged
speed: 6
stats:
  ranged_attack: 8
```

**Oak Longbow** (`data/items/oak_longbow.yaml`):
```yaml
id: oak_longbow
name: oak longbow
color: "136"
description: "An oak longbow."
value: 80
equip_slot: main_hand
weapon_type: ranged
attack_type: ranged
speed: 6
stats:
  ranged_attack: 14
```

**Willow Longbow** (`data/items/willow_longbow.yaml`):
```yaml
id: willow_longbow
name: willow longbow
color: "107"
description: "A willow longbow."
value: 320
equip_slot: main_hand
weapon_type: ranged
attack_type: ranged
speed: 6
stats:
  ranged_attack: 20
```

**Maple Longbow** (`data/items/maple_longbow.yaml`):
```yaml
id: maple_longbow
name: maple longbow
color: "172"
description: "A maple longbow."
value: 1280
equip_slot: main_hand
weapon_type: ranged
attack_type: ranged
speed: 6
stats:
  ranged_attack: 29
```

**Yew Longbow** (`data/items/yew_longbow.yaml`):
```yaml
id: yew_longbow
name: yew longbow
color: "94"
description: "A yew longbow."
value: 2000
equip_slot: main_hand
weapon_type: ranged
attack_type: ranged
speed: 6
stats:
  ranged_attack: 47
```

**Magic Longbow** (`data/items/magic_longbow.yaml`):
```yaml
id: magic_longbow
name: magic longbow
color: "63"
description: "A magic longbow."
value: 6000
equip_slot: main_hand
weapon_type: ranged
attack_type: ranged
speed: 6
stats:
  ranged_attack: 69
```

### 11.9 Ranged Ammo — Arrows

Arrows now use `ranged_strength` instead of the broken `attack:` field. Arrow accuracy (ranged_attack) is 0 — all accuracy comes from the bow. Damage comes from the arrow's `ranged_strength`.

**Bronze Arrow** (`data/items/bronze_arrow.yaml`):
```yaml
id: bronze_arrow
name: bronze arrow
color: "178"
description: "A bronze-tipped arrow."
value: 1
stackable: true
equip_slot: ammo
stats:
  ranged_strength: 7
```

**Iron Arrow** (`data/items/iron_arrow.yaml`):
```yaml
id: iron_arrow
name: iron arrow
color: "250"
description: "An iron-tipped arrow."
value: 2
stackable: true
equip_slot: ammo
stats:
  ranged_strength: 10
```

**Steel Arrow** (`data/items/steel_arrow.yaml`):
```yaml
id: steel_arrow
name: steel arrow
color: "253"
description: "A steel-tipped arrow."
value: 5
stackable: true
equip_slot: ammo
stats:
  ranged_strength: 16
```

**Mithril Arrow** (`data/items/mithril_arrow.yaml`):
```yaml
id: mithril_arrow
name: mithril arrow
color: "75"
description: "A mithril-tipped arrow."
value: 10
stackable: true
equip_slot: ammo
stats:
  ranged_strength: 22
```

**Adamant Arrow** (`data/items/adamant_arrow.yaml`):
```yaml
id: adamant_arrow
name: adamant arrow
color: "120"
description: "An adamant-tipped arrow."
value: 20
stackable: true
equip_slot: ammo
stats:
  ranged_strength: 31
```

**Rune Arrow** (`data/items/rune_arrow.yaml`):
```yaml
id: rune_arrow
name: rune arrow
color: "87"
description: "A rune-tipped arrow."
value: 40
stackable: true
equip_slot: ammo
stats:
  ranged_strength: 49
```

### 11.10 Ranged Ammo — Bolts

Same pattern as arrows. `ranged_strength` for damage.

**Bronze Bolts** (`data/items/bronze_bolts.yaml`):
```yaml
id: bronze_bolts
name: bronze bolts
color: "178"
description: "Bronze crossbow bolts."
value: 1
stackable: true
equip_slot: ammo
stats:
  ranged_strength: 10
```

**Iron Bolts** (`data/items/iron_bolts.yaml`):
```yaml
id: iron_bolts
name: iron bolts
color: "250"
description: "Iron crossbow bolts."
value: 3
stackable: true
equip_slot: ammo
stats:
  ranged_strength: 17
```

**Steel Bolts** (`data/items/steel_bolts.yaml`):
```yaml
id: steel_bolts
name: steel bolts
color: "253"
description: "Steel crossbow bolts."
value: 6
stackable: true
equip_slot: ammo
stats:
  ranged_strength: 25
```

**Mithril Bolts** (`data/items/mithril_bolts.yaml`):
```yaml
id: mithril_bolts
name: mithril bolts
color: "75"
description: "Mithril crossbow bolts."
value: 12
stackable: true
equip_slot: ammo
stats:
  ranged_strength: 32
```

**Adamant Bolts** (`data/items/adamant_bolts.yaml`):
```yaml
id: adamant_bolts
name: adamant bolts
color: "120"
description: "Adamant crossbow bolts."
value: 24
stackable: true
equip_slot: ammo
stats:
  ranged_strength: 43
```

**Rune Bolts** (`data/items/rune_bolts.yaml`):
```yaml
id: rune_bolts
name: rune bolts
color: "87"
description: "Rune crossbow bolts."
value: 48
stackable: true
equip_slot: ammo
stats:
  ranged_strength: 55
```

**Sapphire Bolts** (`data/items/sapphire_bolts.yaml`):
```yaml
id: sapphire_bolts
name: sapphire bolts
color: "69"
description: "Mithril bolts tipped with sapphire."
value: 40
stackable: true
equip_slot: ammo
stats:
  ranged_strength: 36
```

**Emerald Bolts** (`data/items/emerald_bolts.yaml`):
```yaml
id: emerald_bolts
name: emerald bolts
color: "83"
description: "Mithril bolts tipped with emerald."
value: 65
stackable: true
equip_slot: ammo
stats:
  ranged_strength: 39
```

**Ruby Bolts** (`data/items/ruby_bolts.yaml`):
```yaml
id: ruby_bolts
name: ruby bolts
color: "196"
description: "Adamant bolts tipped with ruby."
value: 130
stackable: true
equip_slot: ammo
stats:
  ranged_strength: 49
```

**Diamond Bolts** (`data/items/diamond_bolts.yaml`):
```yaml
id: diamond_bolts
name: diamond bolts
color: "255"
description: "Adamant bolts tipped with diamond."
value: 230
stackable: true
equip_slot: ammo
stats:
  ranged_strength: 52
```

### 11.11 Ranged Armor — Leather

Leather armor provides ranged defense and slight melee defense. Positive ranged defense, negative science defense.

**Leather Cowl** (`data/items/leather_cowl.yaml`):
```yaml
id: leather_cowl
name: leather cowl
color: "130"
description: "A leather cowl."
value: 15
equip_slot: head
stats:
  stab_defense: 1
  slash_defense: 2
  crush_defense: 1
  science_defense: 2
  ranged_defense: 4
```

**Leather Body** (`data/items/leather_body.yaml`):
```yaml
id: leather_body
name: leather body
color: "130"
description: "A leather body armour."
value: 25
equip_slot: torso
stats:
  stab_defense: 4
  slash_defense: 7
  crush_defense: 5
  science_defense: 4
  ranged_defense: 10
```

**Leather Chaps** (`data/items/leather_chaps.yaml`):
```yaml
id: leather_chaps
name: leather chaps
color: "130"
description: "A pair of leather chaps."
value: 20
equip_slot: legs
stats:
  stab_defense: 2
  slash_defense: 4
  crush_defense: 3
  science_defense: 3
  ranged_defense: 6
```

**Leather Gloves** (`data/items/leather_gloves.yaml`):
```yaml
id: leather_gloves
name: leather gloves
color: "130"
description: "A pair of leather gloves."
value: 10
equip_slot: hands
stats:
  stab_defense: 1
  slash_defense: 1
  crush_defense: 1
  science_defense: 1
  ranged_defense: 2
```

**Leather Vambraces** (`data/items/leather_vambraces.yaml`):
```yaml
id: leather_vambraces
name: leather vambraces
color: "130"
description: "A pair of leather vambraces."
value: 18
equip_slot: hands
stats:
  stab_defense: 2
  slash_defense: 2
  crush_defense: 2
  science_defense: 2
  ranged_defense: 4
  ranged_attack: 4
```

**Leather Boots** (`data/items/leather_boots.yaml`):
```yaml
id: leather_boots
name: leather boots
color: "130"
description: "A pair of leather boots."
value: 12
equip_slot: feet
stats:
  stab_defense: 1
  slash_defense: 1
  crush_defense: 1
  science_defense: 1
  ranged_defense: 2
```

**Coif** (`data/items/coif.yaml`):
```yaml
id: coif
name: coif
color: "94"
description: "A hard leather coif."
value: 45
equip_slot: head
stats:
  stab_defense: 2
  slash_defense: 4
  crush_defense: 2
  science_defense: 4
  ranged_defense: 6
  ranged_attack: 2
```

**Hard Leather Body** (`data/items/hard_leather_body.yaml`):
```yaml
id: hard_leather_body
name: hard leather body
color: "94"
description: "A hardened leather body armour."
value: 60
equip_slot: torso
stats:
  stab_defense: 8
  slash_defense: 12
  crush_defense: 8
  science_defense: 6
  ranged_defense: 14
```

**Hard Leather Shield** (`data/items/hard_leather_shield.yaml`):
```yaml
id: hard_leather_shield
name: hard leather shield
color: "94"
description: "A shield made of hardened leather."
value: 55
equip_slot: off_hand
stats:
  stab_defense: 5
  slash_defense: 7
  crush_defense: 5
  science_defense: 4
  ranged_defense: 8
```

### 11.12 Non-Combat Equipment (no changes needed)

These items have no combat stats and need no changes:
- Graceful set (hat, torso, legs, gloves, boots, cape) — movement only
- Cape of Agility — movement only
- Jewelry (rings, necklaces, amulets, bracelets) — currently no stats
- Tools without equip (needle, chisel, etc.)

### 11.13 Unfinished Bow Items (no combat stats)

These are fletching intermediates with no combat purpose:
- `shortbow_u`, `longbow_u`, `oak_shortbow_u`, `oak_longbow_u`, `willow_shortbow_u`, `willow_longbow_u`, `maple_shortbow_u`, `maple_longbow_u`, `yew_shortbow_u`, `yew_longbow_u`, `magic_shortbow_u`, `magic_longbow_u`
- `arrow_shaft`, `headless_arrow`, all `*_arrowtips`, all `*_bolts_unf`, all `*_bolt_tips`

These have no equip slot or stats and need no changes.

---

## 12. Mob YAML Updates

### 12.1 Cow (`data/mobs/cow.yaml`)

```yaml
id: cow
name: cow
description: "A placid dairy cow, chewing cud."
attack: 1
strength: 1
defense: 1
hp: 8
speed: 5
aggressive: false
respawn_ticks: 30
attack_type: crush
stab_defense: 1
slash_defense: 1
crush_defense: 1
science_defense: 0
ranged_defense: 0
idle_descriptions:
  - "moos softly"
  - "chews on some grass"
  - "swishes its tail lazily"
  - "stares at you with big brown eyes"
drops:
  remains: bones
  loot:
    - item_id: cowhide
      weight: 100
    - item_id: raw_beef
      weight: 100
```

### 12.2 Man (`data/mobs/man.yaml`)

```yaml
id: man
name: man
description: "A shabby-looking man loitering in the town square."
combat_descriptions:
  - "is engaged in a fight to the death with %s"
  - "is getting pummelled by %s"
  - "is locked in combat with %s"
  - "trades blows with %s"
  - "circles warily around %s"
idle_descriptions:
  - "scribbles something in a small notebook"
  - "gazes skyward at the clouds"
  - "leans against a wall, looking bored"
  - "scratches his head thoughtfully"
  - "stares off into the distance"
  - "adjusts his tunic and stretches"
attack: 1
strength: 1
defense: 1
hp: 7
speed: 5
aggressive: false
respawn_ticks: 30
attack_type: crush
stab_defense: 0
slash_defense: 0
crush_defense: 0
science_defense: 0
ranged_defense: 0
drops:
  remains: "bones"
  loot:
    - item_id: "credits"
      weight: 98
      quantity: 10
    - item_id: "credits"
      weight: 2
      quantity: 150
```

### 12.3 Guard (`data/mobs/guard.yaml`)

```yaml
id: guard
name: Guard
description: "A stern-looking guard in weathered armor."
behavior: guard_talk
unique: true
protected: true
attack: 5
strength: 5
defense: 5
hp: 30
speed: 5
aggressive: false
respawn_ticks: 60
attack_type: slash
attack_bonus: 8
strength_bonus: 6
stab_defense: 12
slash_defense: 15
crush_defense: 10
science_defense: -5
ranged_defense: 12
idle_descriptions:
  - "scans the area with a watchful eye"
  - "adjusts the grip on his weapon"
  - "nods curtly at passersby"
  - "leans against the gate, arms folded"
```

### 12.4 Newbie Trainer (`data/mobs/newbie_trainer.yaml`)

```yaml
id: newbie_trainer
name: Newbie Trainer
description: "A friendly-looking instructor ready to help new adventurers."
unique: true
protected: true
attack: 1
strength: 1
defense: 1
hp: 50
speed: 5
aggressive: false
respawn_ticks: 30
attack_type: crush
stab_defense: 0
slash_defense: 0
crush_defense: 0
science_defense: 0
ranged_defense: 0
idle_descriptions:
  - "reviews a training manual"
  - "adjusts a practice dummy"
  - "demonstrates a sword stance to no one in particular"
  - "offers a friendly nod to passersby"
  - "polishes a wooden shield"
  - "checks a stopwatch and jots something down"
```

### 12.5 Tanner (`data/mobs/tanner.yaml`)

```yaml
id: tanner
name: Tanner
description: "A weathered craftsman with stained hands and a leather apron."
behavior: tanner_talk
unique: true
protected: true
hp: 50
attack: 1
strength: 1
defense: 1
speed: 5
aggressive: false
respawn_ticks: 30
attack_type: crush
stab_defense: 0
slash_defense: 0
crush_defense: 0
science_defense: 0
ranged_defense: 0
idle_descriptions:
  - "scrapes at a piece of hide"
  - "examines a stack of leathers"
  - "sharpens a tanning knife"
  - "wipes sweat from his brow"
```

---

## 13. Example New Mobs

These new mob YAMLs demonstrate the full stat spectrum. Place in `data/mobs/`.

### 13.1 Rat (Level 1)

```yaml
id: rat
name: rat
description: "A large, mangy rat with beady red eyes."
attack: 1
strength: 1
defense: 1
hp: 2
speed: 4
aggressive: false
respawn_ticks: 20
attack_type: crush
stab_defense: 0
slash_defense: 0
crush_defense: 0
science_defense: 0
ranged_defense: 0
idle_descriptions:
  - "sniffs around the ground"
  - "nibbles on something"
  - "scurries in circles"
drops:
  remains: bones
```

### 13.2 Goblin (Level 5)

Weak to crush — goblins wear thin leather that resists slashing poorly and does nothing against blunt force.

```yaml
id: goblin
name: goblin
description: "A small green-skinned goblin with a rusty blade."
attack: 1
strength: 3
defense: 3
hp: 12
speed: 5
aggressive: true
respawn_ticks: 25
attack_type: slash
attack_bonus: 3
strength_bonus: 2
stab_defense: 4
slash_defense: 3
crush_defense: -2
science_defense: 0
ranged_defense: 3
idle_descriptions:
  - "mutters something unintelligible"
  - "waves a rusty blade around"
  - "picks its nose"
  - "kicks a pebble"
drops:
  remains: bones
  loot:
    - item_id: credits
      weight: 80
      quantity: 5
    - item_id: credits
      weight: 20
      quantity: 25
```

### 13.3 Skeleton (Level 22)

Skeletons have high slash defense (blade passes through gaps in bones), weak to crush (bones shatter).

```yaml
id: skeleton
name: skeleton
description: "An animated pile of bones, held together by dark energy."
attack: 8
strength: 6
defense: 8
hp: 22
speed: 5
aggressive: true
respawn_ticks: 30
attack_type: stab
attack_bonus: 6
strength_bonus: 4
stab_defense: 10
slash_defense: 18
crush_defense: -5
science_defense: -8
ranged_defense: 10
idle_descriptions:
  - "rattles ominously"
  - "clicks its jaw open and shut"
  - "stares with empty eye sockets"
drops:
  remains: bones
  loot:
    - item_id: credits
      weight: 70
      quantity: 30
    - item_id: credits
      weight: 30
      quantity: 100
```

### 13.4 Zombie (Level 28)

High slash defense (rotting flesh gives way), weak to crush and solar (sci-fi fire equivalent).

```yaml
id: zombie
name: zombie
description: "A shambling corpse reanimated by residual asteroid radiation."
attack: 10
strength: 8
defense: 8
hp: 30
speed: 6
aggressive: true
respawn_ticks: 35
attack_type: crush
attack_bonus: 4
strength_bonus: 6
stab_defense: 8
slash_defense: 20
crush_defense: -8
science_defense: -15
ranged_defense: 8
weakness: solar
idle_descriptions:
  - "groans and shuffles forward"
  - "reaches out with decaying arms"
  - "stumbles and catches itself"
  - "stares blankly ahead"
drops:
  remains: bones
  loot:
    - item_id: credits
      weight: 60
      quantity: 50
    - item_id: credits
      weight: 40
      quantity: 200
```

### 13.5 Moss Giant (Level 42)

High HP, moderate defense across the board. Big and slow.

```yaml
id: moss_giant
name: moss giant
description: "A towering creature covered in moss and vines, its rocky skin dripping with moisture."
attack: 12
strength: 14
defense: 10
hp: 60
speed: 7
aggressive: true
respawn_ticks: 45
attack_type: crush
attack_bonus: 10
strength_bonus: 12
stab_defense: 15
slash_defense: 12
crush_defense: 18
science_defense: -5
ranged_defense: 15
idle_descriptions:
  - "surveys its territory with dull eyes"
  - "pulls a vine from its shoulder"
  - "stamps the ground, sending tremors"
  - "scratches its mossy hide"
drops:
  remains: bones
  loot:
    - item_id: credits
      weight: 50
      quantity: 120
    - item_id: credits
      weight: 50
      quantity: 500
```

### 13.6 Lesser Drone (Level 53)

A science-based mob. High melee defense, weak to ranged. Uses science attacks.

```yaml
id: lesser_drone
name: lesser drone
description: "A floating metallic drone with a pulsing energy core. Its surface crackles with electric discharge."
attack: 1
strength: 1
defense: 18
hp: 55
ranged: 0
science: 20
speed: 4
aggressive: true
respawn_ticks: 50
attack_type: science
attack_bonus: 0
science_bonus: 22
strength_bonus: 0
stab_defense: 35
slash_defense: 35
crush_defense: 30
science_defense: 20
ranged_defense: -10
idle_descriptions:
  - "hovers silently, scanning the area"
  - "emits a low electronic hum"
  - "projects a thin beam of light across the floor"
  - "rotates slowly in place"
drops:
  loot:
    - item_id: scrap_metal
      weight: 60
    - item_id: credits
      weight: 40
      quantity: 300
```

### 13.7 Greater Drone (Level 83)

Stronger version of the lesser drone.

```yaml
id: greater_drone
name: greater drone
description: "A large, heavily armored drone with multiple energy emitters. Red warning lights pulse along its hull."
attack: 1
strength: 1
defense: 30
hp: 120
ranged: 0
science: 40
speed: 4
aggressive: true
respawn_ticks: 80
attack_type: science
attack_bonus: 0
science_bonus: 45
strength_bonus: 0
stab_defense: 55
slash_defense: 55
crush_defense: 50
science_defense: 40
ranged_defense: -20
idle_descriptions:
  - "projects a defensive energy shield"
  - "recalibrates its targeting array"
  - "emits a warning klaxon"
  - "deploys sensor probes"
drops:
  loot:
    - item_id: scrap_metal
      weight: 40
      quantity: 3
    - item_id: credits
      weight: 60
      quantity: 1500
```

### 13.8 Iron Sentinel (Level 92)

A heavily armored mechanical guardian. Very high melee defense, weak to science attacks.

```yaml
id: iron_sentinel
name: iron sentinel
description: "A massive bipedal automaton forged from pre-regression alloys. Its joints grind with each deliberate step."
attack: 25
strength: 30
defense: 45
hp: 180
speed: 6
aggressive: true
respawn_ticks: 100
attack_type: crush
attack_bonus: 40
strength_bonus: 35
stab_defense: 80
slash_defense: 80
crush_defense: 70
science_defense: -30
ranged_defense: 50
idle_descriptions:
  - "stands motionless, servos whining softly"
  - "turns its armored head with a mechanical grind"
  - "vents steam from exhaust ports"
  - "scans the area with a red optical sensor"
drops:
  loot:
    - item_id: scrap_metal
      weight: 30
      quantity: 5
    - item_id: runite_bar
      weight: 10
    - item_id: credits
      weight: 60
      quantity: 5000
```

---

## 14. Ranged Combat Integration

### 14.1 Attack Flow

When `weapon_type == "ranged"`:

1. **Ammo check** (in `doAttack`, before `startCombat`):
   ```go
   if weaponDef.WeaponType == object.WeaponRanged {
       if _, hasAmmo := p.Equipment[object.SlotAmmo]; !hasAmmo || p.AmmoQty <= 0 {
           sess.WriteLine("You don't have any ammo equipped.")
           return
       }
   }
   ```

2. **Attack roll**: Uses `Ranged` level + `RangedStyleBonus` + total `ranged_attack` from all equipment (bow + ammo + any ranged-boosting armor).

3. **Max hit**: Uses `Ranged` level + `RangedStyleBonus` (strength portion) + total `ranged_strength` from equipment (primarily the ammo).

4. **Mob defense**: Uses mob's `ranged_defense` value.

5. **Ammo consumption**: After each attack (hit or miss), decrement `p.AmmoQty` by 1. If ammo reaches 0, unequip it and end combat.

6. **XP**: 75% Ranged, 25% Hitpoints (all ranged styles).

### 14.2 RangedStyleBonus

| Style | Ranged Level Bonus | Defense Level Bonus | XP |
|-------|-------------------|--------------------|----|
| Accurate | +3 | +0 | 75% rng, 25% hp |
| Aggressive | +3 | +0 | 75% rng, 25% hp |
| Defensive | +0 | +3 | 75% rng, 25% hp |
| Balanced | +1 | +1 | 75% rng, 25% hp |

### 14.3 Ranged Max Hit Formula

```
effective_ranged = Ranged_level + style_bonus + 8
max_hit = (effective_ranged * (total_ranged_strength + 64)) / 512
```

The `ranged_strength` comes primarily from ammo (arrows/bolts). Some equipment might also add ranged_strength in the future.

---

## 15. Science Combat Integration

Science (magic) combat is covered in a separate plan (`science.md`). Key integration points:

- `attack_type: "science"` — uses Science level + `science_attack` bonus for accuracy
- Max hit is determined by the equipped "mod" (spell/ability), NOT by equipment
- Mob defense against science uses `science_defense`
- XP: 75% Science, 25% Hitpoints
- Science-based mobs (like drones) use `science` level + `science_bonus` for their attacks

For this combat overhaul, the struct fields (`ScienceAttack`, `ScienceDefense`, `ScienceDamage`) are added but the science combat flow implementation is deferred.

---

## 16. Backward Compatibility

### Approach: Full YAML rewrite (recommended)

All item YAML files are updated to use the new field names. The old `attack_bonus`, `defense_bonus`, and `attack` YAML tags are simply removed from the Go struct. Since `gopkg.in/yaml.v3` silently ignores unknown fields during unmarshalling, any YAML files accidentally left with old tags will simply have those values ignored (zeroed).

**No custom `UnmarshalYAML`** is needed because:
1. We control all the YAML files — they're in the repo under `data/`
2. Player data (accounts/characters) doesn't store `ItemStats` — equipment is stored as item IDs
3. There's no external API consuming these fields

**Migration checklist:**
- [x] All `attack_bonus: N` → replaced by `stab_attack`/`slash_attack`/`crush_attack` per weapon type
- [x] All `defense_bonus: N` → replaced by per-type defense fields
- [x] All `attack: N` (bows/arrows/bolts) → replaced by `ranged_attack` or `ranged_strength`
- [x] All `strength_bonus: N` → kept as-is (same YAML tag)

### What if old-format items are loaded?

If someone has a custom item YAML with the old format, all combat stats will be 0. The item will have no combat effectiveness. This is acceptable — the items were already broken (bows used `attack:` which was silently ignored).

---

## 17. Help Files

### 17.1 Combat Help (`data/help/combat.yaml`)

```yaml
id: combat
name: Combat
aliases:
  - fighting
  - fight
content: |
  COMBAT

  Attack a mob with: attack <mob>

  Your accuracy depends on your attack type (stab, slash, crush, ranged,
  or science) and your total equipment bonus for that type. Your weapon
  determines the attack type.

  Mobs have per-type defense bonuses. A skeleton with high slash defense
  but weak crush defense takes more hits from a mace than a sword.

  Use the 'style' command to change your combat style:
    accurate    - +3 attack level, XP to attack
    aggressive  - +3 strength level, XP to strength
    defensive   - +3 defense level, XP to defense
    balanced    - +1 to all, XP split evenly

  Use 'stats' to see your total equipment bonuses and current attack roll.
  Use 'look <item>' to see an item's combat stats.
```

### 17.2 Stats Help (`data/help/stats.yaml`)

```yaml
id: stats
name: Stats
aliases:
  - bonuses
  - equipment stats
content: |
  STATS

  The 'stats' command shows your total equipment bonuses from all worn
  items, your current weapon and attack type, and your effective attack
  roll and max hit.

  Attack bonuses affect accuracy. The relevant bonus is determined by
  your weapon's attack type (stab, slash, crush, ranged, or science).

  Defense bonuses reduce incoming damage. When a mob attacks you, the
  game uses your defense bonus matching the mob's attack type.

  Strength bonus increases your max melee hit.
  Ranged strength increases your max ranged hit.
  Science damage increases your max science hit.
  Technology bonus will affect technology abilities (future).
```

### 17.3 Style Help (`data/help/style.yaml`)

If this file already exists, update it. If not, create it:

```yaml
id: style
name: Style
aliases:
  - combat style
  - attack style
content: |
  STYLE

  Usage: style <name>

  Changes your combat style. Prefix matching is supported.

  Styles:
    accurate    - +3 to attack level, XP goes to Attack
    aggressive  - +3 to strength level, XP goes to Strength
    defensive   - +3 to defense level, XP goes to Defense
    balanced    - +1 to all three, XP split evenly

  For ranged weapons:
    accurate    - +3 to ranged level
    aggressive  - +3 to ranged level (same as accurate for ranged)
    defensive   - +3 to defense level
    balanced    - +1 to ranged and defense

  Your style does NOT change your attack type. The attack type is
  determined by your weapon (e.g., swords use slash, daggers use stab).

  Use 'stats' to see how your current style affects your attack roll.
```

---

## 18. Implementation Order

Step-by-step checklist. Each step should compile and pass `make vet` before moving to the next.

### Phase 1: Struct Changes (no behavior change yet)

- [ ] **Step 1:** Update `ItemStats` struct in `internal/object/item.go:67-73`
  - Replace the 5 fields with the 14 new fields
  - Add `AttackType string` field to `ItemDef` after line 41

- [ ] **Step 2:** Update `MobDef` struct in `internal/world/mob.go:20-37`
  - Add: `Ranged`, `Science`, `AttackBonus`, `StrengthBonus`, `RangedBonus`, `ScienceBonus`, `AttackType`
  - Add: `StabDefense`, `SlashDefense`, `CrushDefense`, `ScienceDefense`, `RangedDefense`
  - Add: `Weakness`

- [ ] **Step 3:** Update `MobInstance` struct in `internal/world/mob.go:39-62`
  - Mirror all new fields from MobDef

- [ ] **Step 4:** Update `SeedMobs` in `internal/world/mob.go:213-259`
  - Copy all new fields from def to instance

- [ ] **Step 5:** Fix all compilation errors from removed `AttackBonus`/`DefenseBonus`/`ScienceBonus` fields
  - `cmd_attack.go:187` — references `def.Stats.AttackBonus` → temporarily use `def.Stats.SlashAttack`
  - `cmd_attack.go:188` — references `def.Stats.StrengthBonus` → OK, field still exists
  - `cmd_attack.go:245` — references `def.Stats.DefenseBonus` → temporarily use sum of all defense types
  - Any other references to removed fields

- [ ] **Step 6:** Run `make vet` — should pass with no errors

### Phase 2: Item YAML Updates

- [ ] **Step 7:** Update all 6 sword YAMLs (Section 11.1)
- [ ] **Step 8:** Update all 6 dagger YAMLs (Section 11.2)
- [ ] **Step 9:** Update all 8 axe YAMLs (Section 11.3)
- [ ] **Step 10:** Update all 8 pickaxe YAMLs (Section 11.4)
- [ ] **Step 11:** Update all 6 med helm YAMLs (Section 11.5)
- [ ] **Step 12:** Update all 6 full helm YAMLs (Section 11.6)
- [ ] **Step 13:** Update all 6 platebody YAMLs (Section 11.7)
- [ ] **Step 14:** Update all 12 bow YAMLs (Section 11.8)
- [ ] **Step 15:** Update all 6 arrow YAMLs (Section 11.9)
- [ ] **Step 16:** Update all 10 bolt YAMLs (Section 11.10)
- [ ] **Step 17:** Update all 9 leather/ranged armor YAMLs (Section 11.11)

### Phase 3: Mob YAML Updates

- [ ] **Step 18:** Update all 5 existing mob YAMLs (Section 12)
- [ ] **Step 19:** Create 8 new mob YAMLs (Section 13)

### Phase 4: Formula & Combat Logic

- [ ] **Step 20:** Rewrite `internal/combat/formulas.go` (Section 5)
  - New `HitChance` function
  - Updated `HitCheck` to use probability curve
  - Add `RangedStyleBonus`
  - Add `SelectAttackBonus` and `SelectDefenseBonus`

- [ ] **Step 21:** Add `playerEquipBonuses` helper (Section 8)
  - New file `internal/game/equip_stats.go` or add to `cmd_attack.go`

- [ ] **Step 22:** Update `playerAttack` in `cmd_attack.go` (Section 6.1)
  - Determine attack type from weapon
  - Use `playerEquipBonuses` for totals
  - Use `SelectAttackBonus` for the right attack bonus
  - Use `SelectDefenseBonus` for mob's matching defense
  - Melee path: use Attack level + melee style bonus
  - Ranged path: use Ranged level + ranged style bonus + ammo consumption

- [ ] **Step 23:** Update `mobAttack` in `cmd_attack.go` (Section 6.2)
  - Use mob's `AttackType` (default "crush")
  - Use mob's `AttackBonus` in attack roll
  - Use mob's `StrengthBonus` in max hit
  - Use player's matching defense bonus for the mob's attack type

- [ ] **Step 24:** Update `awardCombatXP` (Section 6.3)
  - Add `isRanged` parameter
  - Ranged path: 75% Ranged, 25% Hitpoints

- [ ] **Step 25:** Update `mobCombatLevel` in `utils.go` (Section 7.4)
  - New formula accounting for Ranged/Science levels

- [ ] **Step 26:** Add ammo check in `doAttack` (Section 6.4)

- [ ] **Step 27:** Run `make vet` and `make test`

### Phase 5: Display Changes

- [ ] **Step 28:** Add `showItemStats` helper to `cmd_look.go` (Section 9.1)
- [ ] **Step 29:** Call `showItemStats` in item examination paths in `doLookTarget`
- [ ] **Step 30:** Update mob examination in `doLookTarget` (Section 9.2)
- [ ] **Step 31:** Create `cmd_stats.go` with `doStats` command (Section 10)
- [ ] **Step 32:** Register `stats` command in `classifyCommand` and `executeCommand` in `game.go`
- [ ] **Step 33:** Create help YAML files (Section 17)

### Phase 6: Final Verification

- [ ] **Step 34:** Run `make build`
- [ ] **Step 35:** Run `make test`
- [ ] **Step 36:** Run `make vet`
- [ ] **Step 37:** Manual testing: equip weapons, check `stats`, `look <item>`, attack mobs, verify damage/accuracy feel reasonable
- [ ] **Step 38:** Verify ranged combat works with ammo consumption
- [ ] **Step 39:** Verify `look <mob>` shows defense bonuses

---

## Appendix A: Complete Item Stats Reference Table

### Melee Weapons

| Item | Type | Stab | Slash | Crush | Str | Speed |
|------|------|------|-------|-------|-----|-------|
| bronze_dagger | stab | +5 | +3 | -1 | +4 | 3 |
| iron_dagger | stab | +8 | +5 | -1 | +7 | 3 |
| steel_dagger | stab | +12 | +7 | -1 | +10 | 3 |
| mithril_dagger | stab | +17 | +10 | -1 | +14 | 3 |
| adamant_dagger | stab | +23 | +14 | -1 | +19 | 3 |
| rune_dagger | stab | +30 | +18 | -1 | +24 | 3 |
| bronze_sword | slash | +4 | +10 | -2 | +7 | 4 |
| iron_sword | slash | +7 | +15 | -2 | +10 | 4 |
| steel_sword | slash | +10 | +22 | -2 | +14 | 4 |
| mithril_sword | slash | +14 | +30 | -2 | +20 | 4 |
| adamant_sword | slash | +20 | +40 | -2 | +27 | 4 |
| rune_sword | slash | +27 | +52 | -2 | +36 | 4 |
| bronze_axe | slash | -2 | +7 | +5 | +5 | 5 |
| iron_axe | slash | -2 | +10 | +7 | +8 | 5 |
| steel_axe | slash | -2 | +15 | +11 | +12 | 5 |
| black_axe | slash | -2 | +18 | +14 | +14 | 5 |
| mithril_axe | slash | -2 | +21 | +16 | +17 | 5 |
| adamant_axe | slash | -2 | +29 | +22 | +24 | 5 |
| rune_axe | slash | -2 | +38 | +29 | +32 | 5 |
| dragon_axe | slash | -2 | +43 | +32 | +36 | 5 |
| bronze_pickaxe | stab | +4 | -2 | +2 | +3 | 5 |
| iron_pickaxe | stab | +7 | -2 | +3 | +5 | 5 |
| steel_pickaxe | stab | +10 | -2 | +4 | +7 | 5 |
| black_pickaxe | stab | +14 | -2 | +6 | +9 | 5 |
| mithril_pickaxe | stab | +17 | -2 | +8 | +12 | 5 |
| adamant_pickaxe | stab | +23 | -2 | +10 | +16 | 5 |
| rune_pickaxe | stab | +30 | -2 | +14 | +22 | 5 |
| dragon_pickaxe | stab | +34 | -2 | +16 | +26 | 5 |

### Metal Armor (Defense Bonuses)

| Item | Slot | Stab | Slash | Crush | Science | Ranged |
|------|------|------|-------|-------|---------|--------|
| bronze_med_helm | head | +3 | +4 | +2 | -1 | +3 |
| iron_med_helm | head | +5 | +6 | +3 | -1 | +5 |
| steel_med_helm | head | +7 | +9 | +5 | -2 | +7 |
| mithril_med_helm | head | +10 | +12 | +7 | -3 | +10 |
| adamant_med_helm | head | +14 | +16 | +10 | -3 | +14 |
| rune_med_helm | head | +19 | +22 | +13 | -4 | +19 |
| bronze_full_helm | head | +5 | +6 | +4 | -3 | +5 |
| iron_full_helm | head | +8 | +9 | +6 | -3 | +8 |
| steel_full_helm | head | +12 | +13 | +9 | -5 | +12 |
| mithril_full_helm | head | +16 | +18 | +12 | -6 | +16 |
| adamant_full_helm | head | +22 | +24 | +16 | -8 | +22 |
| rune_full_helm | head | +30 | +33 | +22 | -11 | +30 |
| bronze_platebody | torso | +12 | +15 | +10 | -10 | +12 |
| iron_platebody | torso | +18 | +22 | +14 | -10 | +18 |
| steel_platebody | torso | +27 | +32 | +22 | -15 | +27 |
| mithril_platebody | torso | +36 | +42 | +30 | -20 | +36 |
| adamant_platebody | torso | +49 | +55 | +40 | -25 | +49 |
| rune_platebody | torso | +65 | +72 | +52 | -30 | +65 |

### Leather/Ranged Armor (Defense Bonuses)

| Item | Slot | Stab | Slash | Crush | Science | Ranged | Other |
|------|------|------|-------|-------|---------|--------|-------|
| leather_cowl | head | +1 | +2 | +1 | +2 | +4 | |
| leather_body | torso | +4 | +7 | +5 | +4 | +10 | |
| leather_chaps | legs | +2 | +4 | +3 | +3 | +6 | |
| leather_gloves | hands | +1 | +1 | +1 | +1 | +2 | |
| leather_vambraces | hands | +2 | +2 | +2 | +2 | +4 | ranged_attack: +4 |
| leather_boots | feet | +1 | +1 | +1 | +1 | +2 | |
| coif | head | +2 | +4 | +2 | +4 | +6 | ranged_attack: +2 |
| hard_leather_body | torso | +8 | +12 | +8 | +6 | +14 | |
| hard_leather_shield | off_hand | +5 | +7 | +5 | +4 | +8 | |

### Ranged Weapons (Attack Bonuses)

| Item | Ranged Attack | Ranged Str | Speed |
|------|--------------|------------|-------|
| shortbow | +8 | 0 | 4 |
| oak_shortbow | +14 | 0 | 4 |
| willow_shortbow | +20 | 0 | 4 |
| maple_shortbow | +29 | 0 | 4 |
| yew_shortbow | +47 | 0 | 4 |
| magic_shortbow | +69 | 0 | 4 |
| longbow | +8 | 0 | 6 |
| oak_longbow | +14 | 0 | 6 |
| willow_longbow | +20 | 0 | 6 |
| maple_longbow | +29 | 0 | 6 |
| yew_longbow | +47 | 0 | 6 |
| magic_longbow | +69 | 0 | 6 |

### Ranged Ammo (Ranged Strength)

| Item | Ranged Str |
|------|-----------|
| bronze_arrow | +7 |
| iron_arrow | +10 |
| steel_arrow | +16 |
| mithril_arrow | +22 |
| adamant_arrow | +31 |
| rune_arrow | +49 |
| bronze_bolts | +10 |
| iron_bolts | +17 |
| steel_bolts | +25 |
| mithril_bolts | +32 |
| adamant_bolts | +43 |
| rune_bolts | +55 |
| sapphire_bolts | +36 |
| emerald_bolts | +39 |
| ruby_bolts | +49 |
| diamond_bolts | +52 |

---

## Appendix B: OSRS Accuracy Formula Explanation

The true OSRS accuracy formula is:

```
if attack_roll > defense_roll:
    hit_chance = 1 - (defense_roll + 2) / (2 * (attack_roll + 1))
else:
    hit_chance = attack_roll / (2 * (defense_roll + 1))
```

This produces a smooth curve rather than the current binary hit/miss:
- Equal rolls → ~50% hit chance
- 2x attack vs defense → ~75% hit chance
- 0.5x attack vs defense → ~25% hit chance
- Very high attack → approaches ~100% but never reaches it
- Very low attack → approaches ~0% but never reaches it

This is more balanced than the current system where `attackRoll > defenseRoll` is always a hit and `<` is always a miss.

---

## Appendix C: Files Modified (Summary)

| File | Changes |
|------|---------|
| `internal/object/item.go` | `ItemStats` struct rewrite (14 fields), `AttackType` field on `ItemDef` |
| `internal/world/mob.go` | New fields on `MobDef`, `MobInstance`, `SeedMobs` propagation |
| `internal/combat/formulas.go` | Full rewrite: `HitChance`, `HitCheck`, `RangedStyleBonus`, `SelectAttackBonus`, `SelectDefenseBonus` |
| `internal/game/cmd_attack.go` | `playerAttack` rewrite, `mobAttack` rewrite, `awardCombatXP` ranged support, ammo consumption |
| `internal/game/equip_stats.go` | New file: `playerEquipBonuses` helper |
| `internal/game/cmd_stats.go` | New file: `doStats` command |
| `internal/game/cmd_look.go` | `showItemStats` helper, item/mob examination updates |
| `internal/game/game.go` | Register `stats` in `classifyCommand` and `executeCommand` |
| `internal/game/utils.go` | Updated `mobCombatLevel` formula |
| `data/items/*.yaml` | ~66 item files updated with per-type stats |
| `data/mobs/*.yaml` | 5 existing mobs updated, 8 new mobs added |
| `data/help/combat.yaml` | New help file |
| `data/help/stats.yaml` | New help file |
| `data/help/style.yaml` | New/updated help file |