rpg-event-generator 1.2.6 ā 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +548 -4
- package/demo.js +705 -460
- package/dist/index.js +504 -7
- package/package.json +17 -3
- package/scripts/event-economy.js +388 -0
- package/scripts/export-templates.js +289 -0
- package/scripts/generate-templates.js +407 -0
- package/templates/cyberpunk/event_100.json +43 -0
- package/templates/cyberpunk/event_11.json +42 -0
- package/templates/cyberpunk/event_14.json +42 -0
- package/templates/cyberpunk/event_15.json +43 -0
- package/templates/cyberpunk/event_16.json +43 -0
- package/templates/cyberpunk/event_18.json +44 -0
- package/templates/cyberpunk/event_2.json +42 -0
- package/templates/cyberpunk/event_26.json +42 -0
- package/templates/cyberpunk/event_27.json +43 -0
- package/templates/cyberpunk/event_3.json +43 -0
- package/templates/cyberpunk/event_30.json +42 -0
- package/templates/cyberpunk/event_32.json +42 -0
- package/templates/cyberpunk/event_36.json +43 -0
- package/templates/cyberpunk/event_37.json +42 -0
- package/templates/cyberpunk/event_39.json +42 -0
- package/templates/cyberpunk/event_4.json +42 -0
- package/templates/cyberpunk/event_40.json +42 -0
- package/templates/cyberpunk/event_42.json +43 -0
- package/templates/cyberpunk/event_46.json +43 -0
- package/templates/cyberpunk/event_49.json +44 -0
- package/templates/cyberpunk/event_5.json +44 -0
- package/templates/cyberpunk/event_50.json +42 -0
- package/templates/cyberpunk/event_51.json +42 -0
- package/templates/cyberpunk/event_54.json +43 -0
- package/templates/cyberpunk/event_55.json +44 -0
- package/templates/cyberpunk/event_57.json +42 -0
- package/templates/cyberpunk/event_58.json +42 -0
- package/templates/cyberpunk/event_61.json +43 -0
- package/templates/cyberpunk/event_62.json +43 -0
- package/templates/cyberpunk/event_64.json +42 -0
- package/templates/cyberpunk/event_65.json +42 -0
- package/templates/cyberpunk/event_66.json +42 -0
- package/templates/cyberpunk/event_68.json +43 -0
- package/templates/cyberpunk/event_69.json +43 -0
- package/templates/cyberpunk/event_71.json +42 -0
- package/templates/cyberpunk/event_72.json +42 -0
- package/templates/cyberpunk/event_73.json +42 -0
- package/templates/cyberpunk/event_74.json +42 -0
- package/templates/cyberpunk/event_75.json +44 -0
- package/templates/cyberpunk/event_76.json +43 -0
- package/templates/cyberpunk/event_78.json +43 -0
- package/templates/cyberpunk/event_79.json +42 -0
- package/templates/cyberpunk/event_8.json +42 -0
- package/templates/cyberpunk/event_80.json +43 -0
- package/templates/cyberpunk/event_81.json +43 -0
- package/templates/cyberpunk/event_83.json +44 -0
- package/templates/cyberpunk/event_84.json +43 -0
- package/templates/cyberpunk/event_86.json +44 -0
- package/templates/cyberpunk/event_88.json +43 -0
- package/templates/cyberpunk/event_9.json +42 -0
- package/templates/cyberpunk/event_91.json +42 -0
- package/templates/cyberpunk/event_92.json +43 -0
- package/templates/cyberpunk/event_93.json +42 -0
- package/templates/cyberpunk/event_95.json +42 -0
- package/templates/cyberpunk/event_96.json +43 -0
- package/templates/cyberpunk/event_97.json +43 -0
- package/templates/cyberpunk/event_98.json +42 -0
- package/templates/cyberpunk/event_99.json +42 -0
- package/templates/fantasy/dragon_lair.json +28 -0
- package/templates/fantasy/event_1.json +44 -0
- package/templates/fantasy/event_10.json +43 -0
- package/templates/fantasy/event_11.json +43 -0
- package/templates/fantasy/event_12.json +42 -0
- package/templates/fantasy/event_13.json +43 -0
- package/templates/fantasy/event_16.json +44 -0
- package/templates/fantasy/event_20.json +42 -0
- package/templates/fantasy/event_21.json +42 -0
- package/templates/fantasy/event_22.json +42 -0
- package/templates/fantasy/event_23.json +42 -0
- package/templates/fantasy/event_24.json +43 -0
- package/templates/fantasy/event_27.json +43 -0
- package/templates/fantasy/event_29.json +43 -0
- package/templates/fantasy/event_3.json +42 -0
- package/templates/fantasy/event_30.json +43 -0
- package/templates/fantasy/event_31.json +42 -0
- package/templates/fantasy/event_33.json +42 -0
- package/templates/fantasy/event_34.json +43 -0
- package/templates/fantasy/event_36.json +43 -0
- package/templates/fantasy/event_38.json +43 -0
- package/templates/fantasy/event_39.json +42 -0
- package/templates/fantasy/event_4.json +44 -0
- package/templates/fantasy/event_41.json +43 -0
- package/templates/fantasy/event_44.json +42 -0
- package/templates/fantasy/event_45.json +42 -0
- package/templates/fantasy/event_46.json +42 -0
- package/templates/fantasy/event_47.json +42 -0
- package/templates/fantasy/event_48.json +42 -0
- package/templates/fantasy/event_5.json +42 -0
- package/templates/fantasy/event_50.json +44 -0
- package/templates/fantasy/event_51.json +43 -0
- package/templates/fantasy/event_54.json +43 -0
- package/templates/fantasy/event_55.json +43 -0
- package/templates/fantasy/event_57.json +44 -0
- package/templates/fantasy/event_58.json +44 -0
- package/templates/fantasy/event_6.json +42 -0
- package/templates/fantasy/event_64.json +42 -0
- package/templates/fantasy/event_68.json +42 -0
- package/templates/fantasy/event_69.json +43 -0
- package/templates/fantasy/event_70.json +42 -0
- package/templates/fantasy/event_71.json +42 -0
- package/templates/fantasy/event_72.json +43 -0
- package/templates/fantasy/event_73.json +42 -0
- package/templates/fantasy/event_76.json +43 -0
- package/templates/fantasy/event_77.json +43 -0
- package/templates/fantasy/event_79.json +42 -0
- package/templates/fantasy/event_88.json +42 -0
- package/templates/fantasy/event_9.json +44 -0
- package/templates/fantasy/event_90.json +43 -0
- package/templates/fantasy/event_91.json +42 -0
- package/templates/fantasy/event_92.json +42 -0
- package/templates/fantasy/event_94.json +43 -0
- package/templates/fantasy/event_96.json +42 -0
- package/templates/fantasy/event_97.json +42 -0
- package/templates/fantasy/event_98.json +42 -0
- package/templates/fantasy/event_99.json +42 -0
- package/templates/fantasy/magic_shop.json +28 -0
- package/templates/historical/court_intrigue.json +28 -0
- package/templates/historical/event_1.json +44 -0
- package/templates/historical/event_10.json +42 -0
- package/templates/historical/event_11.json +44 -0
- package/templates/historical/event_14.json +44 -0
- package/templates/historical/event_17.json +44 -0
- package/templates/historical/event_2.json +43 -0
- package/templates/historical/event_20.json +43 -0
- package/templates/historical/event_21.json +44 -0
- package/templates/historical/event_22.json +43 -0
- package/templates/historical/event_25.json +43 -0
- package/templates/historical/event_26.json +42 -0
- package/templates/historical/event_3.json +43 -0
- package/templates/historical/event_30.json +42 -0
- package/templates/historical/event_33.json +44 -0
- package/templates/historical/event_34.json +42 -0
- package/templates/historical/event_39.json +42 -0
- package/templates/historical/event_4.json +44 -0
- package/templates/historical/event_40.json +42 -0
- package/templates/historical/event_42.json +42 -0
- package/templates/historical/event_44.json +43 -0
- package/templates/historical/event_45.json +43 -0
- package/templates/historical/event_48.json +42 -0
- package/templates/historical/event_50.json +42 -0
- package/templates/historical/event_52.json +42 -0
- package/templates/historical/event_53.json +44 -0
- package/templates/historical/event_54.json +44 -0
- package/templates/historical/event_56.json +42 -0
- package/templates/historical/event_57.json +42 -0
- package/templates/historical/event_59.json +42 -0
- package/templates/historical/event_60.json +43 -0
- package/templates/historical/event_61.json +42 -0
- package/templates/historical/event_62.json +44 -0
- package/templates/historical/event_63.json +42 -0
- package/templates/historical/event_64.json +43 -0
- package/templates/historical/event_65.json +44 -0
- package/templates/historical/event_66.json +42 -0
- package/templates/historical/event_67.json +43 -0
- package/templates/historical/event_69.json +43 -0
- package/templates/historical/event_7.json +42 -0
- package/templates/historical/event_70.json +42 -0
- package/templates/historical/event_71.json +43 -0
- package/templates/historical/event_74.json +42 -0
- package/templates/historical/event_75.json +43 -0
- package/templates/historical/event_79.json +42 -0
- package/templates/historical/event_8.json +44 -0
- package/templates/historical/event_80.json +43 -0
- package/templates/historical/event_82.json +42 -0
- package/templates/historical/event_87.json +43 -0
- package/templates/historical/event_89.json +43 -0
- package/templates/historical/event_9.json +43 -0
- package/templates/historical/event_90.json +44 -0
- package/templates/historical/event_91.json +42 -0
- package/templates/historical/event_92.json +43 -0
- package/templates/historical/event_94.json +42 -0
- package/templates/historical/event_97.json +42 -0
- package/templates/horror/event_1.json +42 -0
- package/templates/horror/event_100.json +42 -0
- package/templates/horror/event_12.json +42 -0
- package/templates/horror/event_13.json +43 -0
- package/templates/horror/event_14.json +44 -0
- package/templates/horror/event_15.json +42 -0
- package/templates/horror/event_16.json +43 -0
- package/templates/horror/event_17.json +43 -0
- package/templates/horror/event_18.json +42 -0
- package/templates/horror/event_2.json +44 -0
- package/templates/horror/event_20.json +43 -0
- package/templates/horror/event_23.json +42 -0
- package/templates/horror/event_27.json +43 -0
- package/templates/horror/event_28.json +42 -0
- package/templates/horror/event_29.json +42 -0
- package/templates/horror/event_3.json +42 -0
- package/templates/horror/event_30.json +42 -0
- package/templates/horror/event_32.json +42 -0
- package/templates/horror/event_34.json +42 -0
- package/templates/horror/event_35.json +43 -0
- package/templates/horror/event_36.json +43 -0
- package/templates/horror/event_37.json +43 -0
- package/templates/horror/event_38.json +44 -0
- package/templates/horror/event_39.json +42 -0
- package/templates/horror/event_40.json +42 -0
- package/templates/horror/event_41.json +42 -0
- package/templates/horror/event_42.json +43 -0
- package/templates/horror/event_43.json +43 -0
- package/templates/horror/event_45.json +42 -0
- package/templates/horror/event_46.json +44 -0
- package/templates/horror/event_47.json +42 -0
- package/templates/horror/event_50.json +43 -0
- package/templates/horror/event_52.json +44 -0
- package/templates/horror/event_53.json +43 -0
- package/templates/horror/event_55.json +43 -0
- package/templates/horror/event_56.json +44 -0
- package/templates/horror/event_58.json +42 -0
- package/templates/horror/event_59.json +42 -0
- package/templates/horror/event_60.json +43 -0
- package/templates/horror/event_61.json +44 -0
- package/templates/horror/event_62.json +42 -0
- package/templates/horror/event_63.json +43 -0
- package/templates/horror/event_65.json +42 -0
- package/templates/horror/event_67.json +43 -0
- package/templates/horror/event_68.json +44 -0
- package/templates/horror/event_72.json +42 -0
- package/templates/horror/event_73.json +44 -0
- package/templates/horror/event_74.json +43 -0
- package/templates/horror/event_77.json +42 -0
- package/templates/horror/event_79.json +43 -0
- package/templates/horror/event_8.json +42 -0
- package/templates/horror/event_82.json +43 -0
- package/templates/horror/event_83.json +42 -0
- package/templates/horror/event_84.json +42 -0
- package/templates/horror/event_86.json +43 -0
- package/templates/horror/event_88.json +42 -0
- package/templates/horror/event_89.json +43 -0
- package/templates/horror/event_9.json +43 -0
- package/templates/horror/event_90.json +44 -0
- package/templates/horror/event_91.json +43 -0
- package/templates/horror/event_93.json +42 -0
- package/templates/horror/event_95.json +42 -0
- package/templates/horror/event_96.json +43 -0
- package/templates/horror/event_99.json +42 -0
- package/templates/horror/haunted_mansion.json +28 -0
- package/templates/index.json +475 -0
- package/templates/modern/event_10.json +42 -0
- package/templates/modern/event_100.json +43 -0
- package/templates/modern/event_11.json +44 -0
- package/templates/modern/event_13.json +42 -0
- package/templates/modern/event_15.json +43 -0
- package/templates/modern/event_16.json +42 -0
- package/templates/modern/event_17.json +42 -0
- package/templates/modern/event_19.json +43 -0
- package/templates/modern/event_2.json +42 -0
- package/templates/modern/event_20.json +42 -0
- package/templates/modern/event_21.json +43 -0
- package/templates/modern/event_22.json +43 -0
- package/templates/modern/event_23.json +43 -0
- package/templates/modern/event_25.json +43 -0
- package/templates/modern/event_27.json +42 -0
- package/templates/modern/event_28.json +42 -0
- package/templates/modern/event_31.json +42 -0
- package/templates/modern/event_32.json +43 -0
- package/templates/modern/event_34.json +44 -0
- package/templates/modern/event_35.json +42 -0
- package/templates/modern/event_36.json +44 -0
- package/templates/modern/event_37.json +42 -0
- package/templates/modern/event_39.json +42 -0
- package/templates/modern/event_4.json +42 -0
- package/templates/modern/event_41.json +42 -0
- package/templates/modern/event_42.json +44 -0
- package/templates/modern/event_43.json +42 -0
- package/templates/modern/event_44.json +44 -0
- package/templates/modern/event_45.json +44 -0
- package/templates/modern/event_46.json +44 -0
- package/templates/modern/event_47.json +43 -0
- package/templates/modern/event_48.json +42 -0
- package/templates/modern/event_49.json +43 -0
- package/templates/modern/event_5.json +43 -0
- package/templates/modern/event_51.json +42 -0
- package/templates/modern/event_52.json +42 -0
- package/templates/modern/event_55.json +43 -0
- package/templates/modern/event_56.json +42 -0
- package/templates/modern/event_57.json +42 -0
- package/templates/modern/event_59.json +42 -0
- package/templates/modern/event_6.json +43 -0
- package/templates/modern/event_60.json +43 -0
- package/templates/modern/event_61.json +42 -0
- package/templates/modern/event_63.json +42 -0
- package/templates/modern/event_64.json +42 -0
- package/templates/modern/event_66.json +42 -0
- package/templates/modern/event_67.json +42 -0
- package/templates/modern/event_69.json +42 -0
- package/templates/modern/event_7.json +43 -0
- package/templates/modern/event_70.json +42 -0
- package/templates/modern/event_72.json +43 -0
- package/templates/modern/event_74.json +43 -0
- package/templates/modern/event_78.json +42 -0
- package/templates/modern/event_8.json +42 -0
- package/templates/modern/event_80.json +44 -0
- package/templates/modern/event_81.json +43 -0
- package/templates/modern/event_82.json +42 -0
- package/templates/modern/event_83.json +42 -0
- package/templates/modern/event_84.json +44 -0
- package/templates/modern/event_85.json +42 -0
- package/templates/modern/event_86.json +42 -0
- package/templates/modern/event_87.json +44 -0
- package/templates/modern/event_89.json +42 -0
- package/templates/modern/event_94.json +42 -0
- package/templates/modern/event_97.json +43 -0
- package/templates/modern/event_98.json +42 -0
- package/templates/modern/event_99.json +44 -0
- package/templates/schema.json +87 -0
- package/templates/sci-fi/alien_encounter.json +28 -0
- package/templates/sci-fi/event_1.json +42 -0
- package/templates/sci-fi/event_11.json +43 -0
- package/templates/sci-fi/event_13.json +43 -0
- package/templates/sci-fi/event_15.json +43 -0
- package/templates/sci-fi/event_18.json +42 -0
- package/templates/sci-fi/event_19.json +43 -0
- package/templates/sci-fi/event_2.json +44 -0
- package/templates/sci-fi/event_22.json +42 -0
- package/templates/sci-fi/event_23.json +42 -0
- package/templates/sci-fi/event_24.json +43 -0
- package/templates/sci-fi/event_25.json +42 -0
- package/templates/sci-fi/event_27.json +43 -0
- package/templates/sci-fi/event_28.json +43 -0
- package/templates/sci-fi/event_30.json +43 -0
- package/templates/sci-fi/event_31.json +42 -0
- package/templates/sci-fi/event_32.json +42 -0
- package/templates/sci-fi/event_33.json +44 -0
- package/templates/sci-fi/event_34.json +42 -0
- package/templates/sci-fi/event_35.json +42 -0
- package/templates/sci-fi/event_36.json +42 -0
- package/templates/sci-fi/event_37.json +44 -0
- package/templates/sci-fi/event_39.json +43 -0
- package/templates/sci-fi/event_4.json +43 -0
- package/templates/sci-fi/event_41.json +42 -0
- package/templates/sci-fi/event_45.json +42 -0
- package/templates/sci-fi/event_47.json +43 -0
- package/templates/sci-fi/event_48.json +42 -0
- package/templates/sci-fi/event_50.json +43 -0
- package/templates/sci-fi/event_51.json +42 -0
- package/templates/sci-fi/event_53.json +42 -0
- package/templates/sci-fi/event_54.json +43 -0
- package/templates/sci-fi/event_55.json +42 -0
- package/templates/sci-fi/event_56.json +43 -0
- package/templates/sci-fi/event_59.json +42 -0
- package/templates/sci-fi/event_6.json +42 -0
- package/templates/sci-fi/event_60.json +43 -0
- package/templates/sci-fi/event_64.json +44 -0
- package/templates/sci-fi/event_65.json +43 -0
- package/templates/sci-fi/event_67.json +42 -0
- package/templates/sci-fi/event_7.json +42 -0
- package/templates/sci-fi/event_72.json +42 -0
- package/templates/sci-fi/event_73.json +43 -0
- package/templates/sci-fi/event_74.json +44 -0
- package/templates/sci-fi/event_75.json +43 -0
- package/templates/sci-fi/event_78.json +42 -0
- package/templates/sci-fi/event_80.json +42 -0
- package/templates/sci-fi/event_82.json +43 -0
- package/templates/sci-fi/event_83.json +44 -0
- package/templates/sci-fi/event_85.json +42 -0
- package/templates/sci-fi/event_87.json +42 -0
- package/templates/sci-fi/event_89.json +42 -0
- package/templates/sci-fi/event_9.json +42 -0
- package/templates/sci-fi/event_90.json +43 -0
- package/templates/sci-fi/event_92.json +44 -0
- package/templates/sci-fi/event_93.json +42 -0
- package/templates/sci-fi/event_94.json +42 -0
- package/templates/sci-fi/event_95.json +43 -0
- package/templates/sci-fi/event_96.json +43 -0
- package/templates/sci-fi/event_97.json +42 -0
- package/templates/space-opera/event_1.json +44 -0
- package/templates/space-opera/event_10.json +42 -0
- package/templates/space-opera/event_100.json +42 -0
- package/templates/space-opera/event_12.json +42 -0
- package/templates/space-opera/event_13.json +44 -0
- package/templates/space-opera/event_14.json +43 -0
- package/templates/space-opera/event_15.json +43 -0
- package/templates/space-opera/event_17.json +42 -0
- package/templates/space-opera/event_18.json +43 -0
- package/templates/space-opera/event_19.json +42 -0
- package/templates/space-opera/event_20.json +43 -0
- package/templates/space-opera/event_21.json +42 -0
- package/templates/space-opera/event_24.json +44 -0
- package/templates/space-opera/event_25.json +42 -0
- package/templates/space-opera/event_26.json +43 -0
- package/templates/space-opera/event_27.json +43 -0
- package/templates/space-opera/event_28.json +43 -0
- package/templates/space-opera/event_29.json +44 -0
- package/templates/space-opera/event_31.json +42 -0
- package/templates/space-opera/event_32.json +42 -0
- package/templates/space-opera/event_33.json +42 -0
- package/templates/space-opera/event_35.json +42 -0
- package/templates/space-opera/event_36.json +44 -0
- package/templates/space-opera/event_38.json +43 -0
- package/templates/space-opera/event_40.json +42 -0
- package/templates/space-opera/event_41.json +42 -0
- package/templates/space-opera/event_43.json +43 -0
- package/templates/space-opera/event_44.json +42 -0
- package/templates/space-opera/event_47.json +42 -0
- package/templates/space-opera/event_48.json +43 -0
- package/templates/space-opera/event_49.json +44 -0
- package/templates/space-opera/event_5.json +44 -0
- package/templates/space-opera/event_50.json +42 -0
- package/templates/space-opera/event_51.json +42 -0
- package/templates/space-opera/event_52.json +42 -0
- package/templates/space-opera/event_53.json +43 -0
- package/templates/space-opera/event_55.json +42 -0
- package/templates/space-opera/event_58.json +43 -0
- package/templates/space-opera/event_6.json +43 -0
- package/templates/space-opera/event_60.json +44 -0
- package/templates/space-opera/event_61.json +42 -0
- package/templates/space-opera/event_62.json +43 -0
- package/templates/space-opera/event_65.json +42 -0
- package/templates/space-opera/event_67.json +42 -0
- package/templates/space-opera/event_68.json +43 -0
- package/templates/space-opera/event_69.json +42 -0
- package/templates/space-opera/event_7.json +44 -0
- package/templates/space-opera/event_71.json +44 -0
- package/templates/space-opera/event_73.json +42 -0
- package/templates/space-opera/event_74.json +42 -0
- package/templates/space-opera/event_77.json +43 -0
- package/templates/space-opera/event_78.json +43 -0
- package/templates/space-opera/event_8.json +43 -0
- package/templates/space-opera/event_81.json +42 -0
- package/templates/space-opera/event_82.json +42 -0
- package/templates/space-opera/event_83.json +43 -0
- package/templates/space-opera/event_85.json +42 -0
- package/templates/space-opera/event_87.json +42 -0
- package/templates/space-opera/event_88.json +42 -0
- package/templates/space-opera/event_90.json +42 -0
- package/templates/space-opera/event_93.json +43 -0
- package/templates/space-opera/event_97.json +42 -0
- package/templates/space-opera/event_98.json +43 -0
package/demo.js
CHANGED
|
@@ -1,491 +1,736 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* RPG Event Generator v1.2.0 - Complete Feature Showcase
|
|
5
|
-
* Run with: node demo.js
|
|
6
|
-
*
|
|
7
|
-
* This demo showcases ALL features from v1.0.0 AND v1.2.0:
|
|
8
|
-
*
|
|
9
|
-
* š ORIGINAL v1.0.0 FEATURES:
|
|
10
|
-
* ā” Basic Event Generation
|
|
11
|
-
* šÆ Context-Aware Events
|
|
12
|
-
* š Custom Training Data
|
|
13
|
-
* š§© Modular Event System
|
|
14
|
-
* š Dynamic Difficulty Scaling
|
|
15
|
-
* āļø Event Chains
|
|
16
|
-
* ā° Time-Based Events
|
|
17
|
-
* š¾ Game State Management
|
|
18
|
-
*
|
|
19
|
-
* š ENHANCED v1.2.0 FEATURES:
|
|
20
|
-
* š Multi-Language Support
|
|
21
|
-
* š¤ļø Environmental Modifiers
|
|
22
|
-
* š Event Dependencies
|
|
23
|
-
* š„ NPC Relationships
|
|
24
|
-
* š Combined Feature Usage
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
3
|
const { RPGEventGenerator } = require('./dist/index.js');
|
|
28
4
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// ================================
|
|
34
|
-
console.log('ā” Demo 1: Basic Event Generation (v1.0.0)');
|
|
35
|
-
|
|
36
|
-
const basicGenerator = new RPGEventGenerator();
|
|
37
|
-
const basicEvent = basicGenerator.generateEvent();
|
|
38
|
-
console.log(`Basic Event: ${basicEvent.title}`);
|
|
39
|
-
console.log(`Type: ${basicEvent.type}, Difficulty: ${basicEvent.difficulty}`);
|
|
40
|
-
console.log(`Choices: ${basicEvent.choices.length} options`);
|
|
41
|
-
console.log(`Sample choice: "${basicEvent.choices[0].text}"`);
|
|
42
|
-
console.log();
|
|
43
|
-
|
|
44
|
-
// ================================
|
|
45
|
-
// š ORIGINAL v1.0.0: DYNAMIC DIFFICULTY SCALING
|
|
46
|
-
// ================================
|
|
47
|
-
console.log('š Demo 2: Dynamic Difficulty Scaling (v1.0.0)');
|
|
48
|
-
|
|
49
|
-
// Weak character
|
|
50
|
-
const weakling = {
|
|
51
|
-
gold: 50,
|
|
52
|
-
influence: 10,
|
|
53
|
-
skills: { combat: 20 }
|
|
54
|
-
};
|
|
55
|
-
const easyEvent = basicGenerator.generateEvent(weakling);
|
|
56
|
-
console.log(`Weak character event: ${easyEvent.title} (${easyEvent.difficulty})`);
|
|
57
|
-
|
|
58
|
-
// Powerful character
|
|
59
|
-
const hero = {
|
|
60
|
-
gold: 50000,
|
|
61
|
-
influence: 500,
|
|
62
|
-
skills: { combat: 100, diplomacy: 80 },
|
|
63
|
-
relationships: [{ name: 'King', type: 'ally', relationship: 80 }]
|
|
64
|
-
};
|
|
65
|
-
const hardEvent = basicGenerator.generateEvent(hero);
|
|
66
|
-
console.log(`Powerful character event: ${hardEvent.title} (${hardEvent.difficulty})`);
|
|
67
|
-
console.log();
|
|
68
|
-
|
|
69
|
-
// ================================
|
|
70
|
-
// šÆ ORIGINAL v1.0.0: CONTEXT-AWARE EVENTS
|
|
71
|
-
// ================================
|
|
72
|
-
console.log('šÆ Demo 3: Context-Aware Events (v1.0.0)');
|
|
73
|
-
|
|
74
|
-
const playerContext = {
|
|
75
|
-
age: 35,
|
|
76
|
-
gold: 2500,
|
|
77
|
-
influence: 40,
|
|
78
|
-
reputation: 25,
|
|
79
|
-
career: 'noble',
|
|
80
|
-
skills: { diplomacy: 70, combat: 45, intrigue: 30 },
|
|
81
|
-
relationships: [
|
|
82
|
-
{ name: 'Lord Harrington', type: 'ally', relationship: 60 }
|
|
83
|
-
],
|
|
84
|
-
location: 'capital',
|
|
85
|
-
season: 'winter'
|
|
5
|
+
const DEMO_CONFIG = {
|
|
6
|
+
version: '2.0.0',
|
|
7
|
+
showErrors: true,
|
|
8
|
+
pauseBetweenDemos: false
|
|
86
9
|
};
|
|
10
|
+
function printHeader(title, version = '') {
|
|
11
|
+
console.log('\n' + '='.repeat(50));
|
|
12
|
+
console.log(`${title}${version ? ` (${version})` : ''}`);
|
|
13
|
+
console.log('='.repeat(50));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function printSection(title) {
|
|
17
|
+
console.log(`\n${title}`);
|
|
18
|
+
console.log('-'.repeat(title.length));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function printResult(label, value) {
|
|
22
|
+
console.log(`${label}: ${value}`);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function safeExecute(fn, description) {
|
|
26
|
+
try {
|
|
27
|
+
return fn();
|
|
28
|
+
} catch (error) {
|
|
29
|
+
if (DEMO_CONFIG.showErrors) {
|
|
30
|
+
console.error(`ā Error in ${description}:`, error.message);
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
console.log(`š® RPG Event Generator ${DEMO_CONFIG.version} - Complete Feature Showcase`);
|
|
37
|
+
console.log('=' .repeat(60));
|
|
38
|
+
|
|
39
|
+
// Basic Event Generation
|
|
40
|
+
function demoBasicEventGeneration() {
|
|
41
|
+
printSection('ā” Demo 1: Basic Event Generation');
|
|
42
|
+
|
|
43
|
+
const generator = new RPGEventGenerator();
|
|
44
|
+
const event = safeExecute(() => generator.generateEvent(), 'basic event generation');
|
|
45
|
+
|
|
46
|
+
if (event) {
|
|
47
|
+
printResult('Basic Event', event.title);
|
|
48
|
+
printResult('Type', `${event.type}, Difficulty: ${event.difficulty}`);
|
|
49
|
+
printResult('Choices', `${event.choices.length} options`);
|
|
50
|
+
printResult('Sample choice', `"${event.choices[0].text}"`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Dynamic Difficulty Scaling
|
|
55
|
+
function demoDynamicDifficultyScaling() {
|
|
56
|
+
printSection('š Demo 2: Dynamic Difficulty Scaling');
|
|
57
|
+
|
|
58
|
+
const generator = new RPGEventGenerator();
|
|
59
|
+
|
|
60
|
+
const weakling = {
|
|
61
|
+
gold: 50,
|
|
62
|
+
influence: 10,
|
|
63
|
+
skills: { combat: 20 }
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const hero = {
|
|
67
|
+
gold: 50000,
|
|
68
|
+
influence: 500,
|
|
69
|
+
skills: { combat: 100, diplomacy: 80 },
|
|
70
|
+
relationships: [{ name: 'King', type: 'ally', relationship: 80 }]
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const easyEvent = safeExecute(() => generator.generateEvent(weakling), 'weak character event');
|
|
74
|
+
const hardEvent = safeExecute(() => generator.generateEvent(hero), 'powerful character event');
|
|
75
|
+
|
|
76
|
+
if (easyEvent) printResult('Weak character event', `${easyEvent.title} (${easyEvent.difficulty})`);
|
|
77
|
+
if (hardEvent) printResult('Powerful character event', `${hardEvent.title} (${hardEvent.difficulty})`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Context-Aware Events
|
|
81
|
+
function demoContextAwareEvents() {
|
|
82
|
+
printSection('šÆ Demo 3: Context-Aware Events');
|
|
83
|
+
|
|
84
|
+
const generator = new RPGEventGenerator();
|
|
85
|
+
|
|
86
|
+
const playerContext = {
|
|
87
|
+
age: 35,
|
|
88
|
+
gold: 2500,
|
|
89
|
+
influence: 40,
|
|
90
|
+
reputation: 25,
|
|
91
|
+
career: 'noble',
|
|
92
|
+
skills: { diplomacy: 70, combat: 45, intrigue: 30 },
|
|
93
|
+
relationships: [
|
|
94
|
+
{ name: 'Lord Harrington', type: 'ally', relationship: 60 }
|
|
95
|
+
],
|
|
96
|
+
location: 'capital',
|
|
97
|
+
season: 'winter'
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const event = safeExecute(() => generator.generateEvent(playerContext), 'context-aware event');
|
|
101
|
+
|
|
102
|
+
if (event) {
|
|
103
|
+
printResult('Context-aware event', event.title);
|
|
104
|
+
printResult('Generated for', `${playerContext.career} in ${playerContext.location} during ${playerContext.season}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Custom Training Data
|
|
109
|
+
function demoCustomTrainingData() {
|
|
110
|
+
printSection('š Demo 4: Custom Training Data');
|
|
111
|
+
|
|
112
|
+
const generator = new RPGEventGenerator();
|
|
113
|
+
|
|
114
|
+
const trainingData = [
|
|
115
|
+
'The ancient dragon hoards glittering treasures in its mountain lair',
|
|
116
|
+
'Mystical runes glow with ethereal blue light in the dark chamber',
|
|
117
|
+
'The enchanted forest whispers secrets to those who listen carefully',
|
|
118
|
+
'Crystal caverns sparkle with magical energy and hidden dangers'
|
|
119
|
+
];
|
|
120
|
+
|
|
121
|
+
safeExecute(() => generator.addTrainingData(trainingData), 'adding training data');
|
|
122
|
+
|
|
123
|
+
const event = safeExecute(() => generator.generateEvent(), 'custom training event');
|
|
124
|
+
|
|
125
|
+
if (event) {
|
|
126
|
+
printResult('Custom training event', event.title);
|
|
127
|
+
printResult('Description', `${event.description.substring(0, 100)}...`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Modular Event System
|
|
132
|
+
function demoModularEventSystem() {
|
|
133
|
+
printSection('š§© Demo 5: Modular Event System');
|
|
134
|
+
|
|
135
|
+
const generator = new RPGEventGenerator();
|
|
136
|
+
|
|
137
|
+
const customTemplate = {
|
|
138
|
+
title: 'Mystic Vision',
|
|
139
|
+
narrative: 'You experience a vivid prophetic dream showing future events.',
|
|
140
|
+
choices: [
|
|
141
|
+
{
|
|
142
|
+
text: 'Seek out the prophecy',
|
|
143
|
+
effect: { wisdom: 15, risk: 20 },
|
|
144
|
+
consequence: 'visionary'
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
text: 'Dismiss it as a dream',
|
|
148
|
+
effect: { stress: -10 },
|
|
149
|
+
consequence: 'skeptical'
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const mysticalTraining = [
|
|
155
|
+
'The ancient prophecy foretells of great change',
|
|
156
|
+
'Mystic visions reveal hidden truths to the worthy',
|
|
157
|
+
'Dreams of the future guide the destinies of heroes'
|
|
158
|
+
];
|
|
159
|
+
|
|
160
|
+
safeExecute(() => generator.registerEventTemplate('MYSTIC_VISION', customTemplate), 'registering template');
|
|
161
|
+
safeExecute(() => generator.addCustomTrainingData(mysticalTraining, 'mystical'), 'adding mystical training');
|
|
162
|
+
|
|
163
|
+
const event = safeExecute(() => generator.generateEvent(), 'modular event generation');
|
|
164
|
+
if (event) {
|
|
165
|
+
printResult('Modular system event', event.title);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const exportedContent = safeExecute(() => generator.exportCustomContent(), 'exporting content');
|
|
169
|
+
if (exportedContent) {
|
|
170
|
+
printResult('Exported templates', Object.keys(exportedContent.templates).length);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const newGenerator = new RPGEventGenerator();
|
|
174
|
+
const importResult = safeExecute(() => newGenerator.importCustomContent(exportedContent), 'importing content');
|
|
175
|
+
if (importResult) {
|
|
176
|
+
printResult('Imported templates', importResult.templates.success);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function demoEventChains() {
|
|
181
|
+
printSection('āļø Demo 6: Event Chains');
|
|
182
|
+
|
|
183
|
+
const generator = new RPGEventGenerator();
|
|
184
|
+
|
|
185
|
+
const chainResult = safeExecute(() => generator.startChain('BANDIT_RISING'), 'starting event chain');
|
|
186
|
+
|
|
187
|
+
if (chainResult) {
|
|
188
|
+
printResult('Started chain', chainResult.title);
|
|
189
|
+
console.log('Available choices in this event lead to different consequences...');
|
|
190
|
+
|
|
191
|
+
const nextEvent = safeExecute(() => generator.advanceChain(chainResult.chainId, 'bandit'), 'advancing chain');
|
|
192
|
+
|
|
193
|
+
if (nextEvent) {
|
|
194
|
+
printResult('Chain advanced', nextEvent.title);
|
|
195
|
+
} else {
|
|
196
|
+
console.log('Chain could not advance - need to choose \'bandit\' consequence first');
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const activeChains = safeExecute(() => generator.getActiveChains(), 'getting active chains');
|
|
200
|
+
if (activeChains) {
|
|
201
|
+
printResult('Active chains', activeChains.length);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Template Library
|
|
207
|
+
function demoTemplateLibrary() {
|
|
208
|
+
printSection('š Demo 7: Template Library');
|
|
209
|
+
|
|
210
|
+
const generator = new RPGEventGenerator({
|
|
211
|
+
enableTemplates: true,
|
|
212
|
+
templateLibrary: 'fantasy'
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
const availableTemplates = safeExecute(() => generator.getAvailableTemplates(), 'getting available templates');
|
|
216
|
+
if (availableTemplates) {
|
|
217
|
+
printResult('Loaded template genres', Object.keys(availableTemplates).join(', '));
|
|
218
|
+
const fantasyCount = availableTemplates.fantasy ? availableTemplates.fantasy.length : 0;
|
|
219
|
+
printResult('Fantasy templates available', fantasyCount);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const templateEvent = safeExecute(() => generator.generateFromTemplate('dragon_lair'), 'generating from template');
|
|
223
|
+
if (templateEvent) {
|
|
224
|
+
printResult('Template-generated event', templateEvent.title);
|
|
225
|
+
printResult('Event type', templateEvent.type);
|
|
226
|
+
printResult('Difficulty', templateEvent.difficulty);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const randomFantasyEvent = safeExecute(() => generator.generateFromGenre('fantasy'), 'generating from genre');
|
|
230
|
+
if (randomFantasyEvent) {
|
|
231
|
+
printResult('Random fantasy event', randomFantasyEvent.title);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function demoTimeBasedEvents() {
|
|
236
|
+
printSection('ā° Demo 8: Time-Based Events');
|
|
237
|
+
|
|
238
|
+
const generator = new RPGEventGenerator();
|
|
239
|
+
|
|
240
|
+
const dueEvents = safeExecute(() => generator.advanceGameDay(), 'advancing game day');
|
|
241
|
+
const currentTime = safeExecute(() => generator.getCurrentTime(), 'getting current time');
|
|
242
|
+
|
|
243
|
+
if (currentTime) {
|
|
244
|
+
printResult('Advanced to', `day ${currentTime.day}, season: ${currentTime.season}`);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
safeExecute(() => generator.startTimeBasedChain('POLITICAL_UPRISING'), 'starting time-based chain');
|
|
248
|
+
|
|
249
|
+
const activeTimeChains = safeExecute(() => generator.getActiveTimeChains(), 'getting active time chains');
|
|
250
|
+
if (activeTimeChains) {
|
|
251
|
+
printResult('Active time-based chains', activeTimeChains.length);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const timeEvent = safeExecute(() => generator.generateTimeAwareEvent({ season: 'spring' }), 'generating time-aware event');
|
|
255
|
+
if (timeEvent) {
|
|
256
|
+
printResult('Season-aware event', timeEvent.title);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function demoGameStateManagement() {
|
|
261
|
+
printSection('š¾ Demo 9: Game State Management');
|
|
262
|
+
|
|
263
|
+
const generator = new RPGEventGenerator();
|
|
264
|
+
|
|
265
|
+
const gameState = {
|
|
266
|
+
player: { level: 5, gold: 1000 },
|
|
267
|
+
completedEvents: new Set(['tutorial']),
|
|
268
|
+
currentDay: 10
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
safeExecute(() => generator.loadGameState(gameState), 'loading game state');
|
|
272
|
+
|
|
273
|
+
const savedState = safeExecute(() => generator.getGameState(), 'getting game state');
|
|
274
|
+
|
|
275
|
+
if (savedState) {
|
|
276
|
+
console.log('Game state loaded and saved successfully');
|
|
277
|
+
printResult('Current day', `${savedState.timeSystem.currentDay}, Season: ${savedState.timeSystem.currentSeason}`);
|
|
278
|
+
printResult('Active chains', savedState.activeChains.length);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Multi-Language Support
|
|
283
|
+
function demoMultiLanguageSupport() {
|
|
284
|
+
|
|
285
|
+
const generator = new RPGEventGenerator({
|
|
286
|
+
enableModifiers: true,
|
|
287
|
+
enableRelationships: true,
|
|
288
|
+
enableDependencies: true,
|
|
289
|
+
language: 'en'
|
|
290
|
+
});
|
|
87
291
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
console.log('š Demo 4: Custom Training Data (v1.0.0)');
|
|
97
|
-
|
|
98
|
-
const customTrainingGenerator = new RPGEventGenerator();
|
|
99
|
-
customTrainingGenerator.addTrainingData([
|
|
100
|
-
'The ancient dragon hoards glittering treasures in its mountain lair',
|
|
101
|
-
'Mystical runes glow with ethereal blue light in the dark chamber',
|
|
102
|
-
'The enchanted forest whispers secrets to those who listen carefully',
|
|
103
|
-
'Crystal caverns sparkle with magical energy and hidden dangers'
|
|
104
|
-
]);
|
|
105
|
-
|
|
106
|
-
const customEvent = customTrainingGenerator.generateEvent();
|
|
107
|
-
console.log(`Custom training event: ${customEvent.title}`);
|
|
108
|
-
console.log(`Description: ${customEvent.description.substring(0, 100)}...`);
|
|
109
|
-
console.log();
|
|
110
|
-
|
|
111
|
-
// ================================
|
|
112
|
-
// š§© ORIGINAL v1.0.0: MODULAR EVENT SYSTEM
|
|
113
|
-
// ================================
|
|
114
|
-
console.log('š§© Demo 5: Modular Event System (v1.0.0)');
|
|
115
|
-
|
|
116
|
-
const modularGenerator = new RPGEventGenerator();
|
|
117
|
-
|
|
118
|
-
const customTemplate = {
|
|
119
|
-
title: 'Mystic Vision',
|
|
120
|
-
narrative: 'You experience a vivid prophetic dream showing future events.',
|
|
121
|
-
choices: [
|
|
122
|
-
{
|
|
123
|
-
text: 'Seek out the prophecy',
|
|
124
|
-
effect: { wisdom: 15, risk: 20 },
|
|
125
|
-
consequence: 'visionary'
|
|
292
|
+
printSection('š Demo 10: Multi-Language Support');
|
|
293
|
+
|
|
294
|
+
const spanishPack = {
|
|
295
|
+
ui: {
|
|
296
|
+
'event.title.default': 'Evento Inesperado',
|
|
297
|
+
'choice.fight': 'Luchar',
|
|
298
|
+
'choice.flee': 'Huir',
|
|
299
|
+
'choice.negotiate': 'Negociar'
|
|
126
300
|
},
|
|
127
|
-
{
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
consequence: 'skeptical'
|
|
301
|
+
culture: {
|
|
302
|
+
nameFormats: ['western'],
|
|
303
|
+
currencySymbols: ['oro']
|
|
131
304
|
}
|
|
132
|
-
|
|
133
|
-
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
const frenchPack = {
|
|
308
|
+
ui: {
|
|
309
|
+
'event.title.default': 'ĆvĆ©nement Inattendu',
|
|
310
|
+
'choice.fight': 'Combattre',
|
|
311
|
+
'choice.flee': 'Fuire',
|
|
312
|
+
'choice.negotiate': 'NƩgocier'
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
safeExecute(() => generator.loadLanguagePack('es', spanishPack), 'loading Spanish pack');
|
|
317
|
+
safeExecute(() => generator.loadLanguagePack('fr', frenchPack), 'loading French pack');
|
|
318
|
+
|
|
319
|
+
printResult('English', generator.translate('choice.fight'));
|
|
320
|
+
|
|
321
|
+
safeExecute(() => generator.setLanguage('es'), 'switching to Spanish');
|
|
322
|
+
printResult('Spanish', generator.translate('choice.fight'));
|
|
134
323
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const modularEvent = modularGenerator.generateEvent();
|
|
143
|
-
console.log(`Modular system event: ${modularEvent.title}`);
|
|
144
|
-
|
|
145
|
-
// Test export/import
|
|
146
|
-
const exportedContent = modularGenerator.exportCustomContent();
|
|
147
|
-
console.log(`Exported ${Object.keys(exportedContent.templates).length} templates`);
|
|
148
|
-
|
|
149
|
-
const newGenerator = new RPGEventGenerator();
|
|
150
|
-
const importResult = newGenerator.importCustomContent(exportedContent);
|
|
151
|
-
console.log(`Imported ${importResult.templates.success} templates`);
|
|
152
|
-
console.log();
|
|
153
|
-
|
|
154
|
-
// ================================
|
|
155
|
-
// āļø ORIGINAL v1.0.0: EVENT CHAINS
|
|
156
|
-
// ================================
|
|
157
|
-
console.log('āļø Demo 6: Event Chains (v1.0.0)');
|
|
158
|
-
|
|
159
|
-
const chainGenerator = new RPGEventGenerator();
|
|
160
|
-
|
|
161
|
-
const chainResult = chainGenerator.startChain('BANDIT_RISING');
|
|
162
|
-
console.log(`Started chain: ${chainResult.title}`);
|
|
163
|
-
console.log(`Available choices in this event lead to different consequences...`);
|
|
164
|
-
|
|
165
|
-
// To advance the chain, we need to choose the option that leads to the 'bandit' consequence
|
|
166
|
-
const nextEvent = chainGenerator.advanceChain(chainResult.chainId, 'bandit');
|
|
167
|
-
if (nextEvent) {
|
|
168
|
-
console.log(`Chain advanced: ${nextEvent.title}`);
|
|
169
|
-
} else {
|
|
170
|
-
console.log(`Chain could not advance - need to choose 'bandit' consequence first`);
|
|
324
|
+
safeExecute(() => generator.setLanguage('fr'), 'switching to French');
|
|
325
|
+
printResult('French', generator.translate('choice.fight'));
|
|
326
|
+
|
|
327
|
+
safeExecute(() => generator.setLanguage('en'), 'switching back to English');
|
|
328
|
+
|
|
329
|
+
return generator;
|
|
171
330
|
}
|
|
172
331
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
332
|
+
// Environmental Modifiers
|
|
333
|
+
function demoEnvironmentalModifiers(generator) {
|
|
334
|
+
printSection('š¤ļø Demo 11: Environmental Modifiers');
|
|
176
335
|
|
|
177
|
-
|
|
178
|
-
// ā° ORIGINAL v1.0.0: TIME-BASED EVENTS
|
|
179
|
-
// ================================
|
|
180
|
-
console.log('ā° Demo 7: Time-Based Events (v1.0.0)');
|
|
336
|
+
console.log('Individual Modifiers:');
|
|
181
337
|
|
|
182
|
-
|
|
338
|
+
safeExecute(() => generator.setEnvironmentalContext({ weather: 'rain' }), 'setting rain context');
|
|
339
|
+
const rainEvent = safeExecute(() => generator.generateEnhancedEvent(), 'generating rain event');
|
|
340
|
+
if (rainEvent) {
|
|
341
|
+
printResult('Rain Event', rainEvent.title);
|
|
342
|
+
printResult('Description contains atmospheric text', rainEvent.description.includes('gloomy'));
|
|
343
|
+
}
|
|
183
344
|
|
|
184
|
-
|
|
185
|
-
|
|
345
|
+
safeExecute(() => generator.setEnvironmentalContext({ season: 'winter' }), 'setting winter context');
|
|
346
|
+
const winterEvent = safeExecute(() => generator.generateEnhancedEvent(), 'generating winter event');
|
|
347
|
+
if (winterEvent) {
|
|
348
|
+
printResult('Winter Event', winterEvent.title);
|
|
349
|
+
printResult('Description contains seasonal text', winterEvent.description.includes('bleak'));
|
|
350
|
+
}
|
|
186
351
|
|
|
187
|
-
|
|
188
|
-
const
|
|
189
|
-
|
|
352
|
+
console.log('\nCombined Modifiers:');
|
|
353
|
+
const testEvent = {
|
|
354
|
+
title: 'Test Event',
|
|
355
|
+
description: 'Testing modifier effects.',
|
|
356
|
+
choices: [{
|
|
357
|
+
text: 'Continue',
|
|
358
|
+
effect: { health: 10, gold: 50 }
|
|
359
|
+
}]
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
safeExecute(() => generator.setEnvironmentalContext({ weather: 'storm', season: 'winter' }), 'setting storm+winter context');
|
|
363
|
+
const modifiedEvent = safeExecute(() => generator.applyModifiers(testEvent), 'applying modifiers');
|
|
364
|
+
|
|
365
|
+
if (modifiedEvent) {
|
|
366
|
+
printResult('Original health', testEvent.choices[0].effect.health);
|
|
367
|
+
printResult('Modified health', `${modifiedEvent.choices[0].effect.health} (storm: -5, winter: *1.5 = 7)`);
|
|
368
|
+
printResult('Modified gold', `${modifiedEvent.choices[0].effect.gold} (unchanged)`);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
function demoEventDependencies(generator) {
|
|
373
|
+
printSection('š Demo 12: Event Dependencies');
|
|
374
|
+
|
|
375
|
+
safeExecute(() => generator.registerEventDependency('ROYAL_BALL', {
|
|
376
|
+
type: 'event_completed',
|
|
377
|
+
eventId: 'COURT_INTRODUCTION'
|
|
378
|
+
}), 'registering simple dependency');
|
|
379
|
+
|
|
380
|
+
safeExecute(() => generator.registerEventDependency('ELITE_MISSION', {
|
|
381
|
+
operator: 'AND',
|
|
382
|
+
conditions: [
|
|
383
|
+
{ type: 'stat_requirement', stat: 'level', min: 10 },
|
|
384
|
+
{ type: 'event_completed', eventId: 'BASIC_TRAINING' },
|
|
385
|
+
{ type: 'stat_requirement', stat: 'reputation', min: 50 }
|
|
386
|
+
]
|
|
387
|
+
}), 'registering AND dependency');
|
|
388
|
+
|
|
389
|
+
safeExecute(() => generator.registerEventDependency('SOCIAL_EVENT', {
|
|
390
|
+
operator: 'OR',
|
|
391
|
+
conditions: [
|
|
392
|
+
{ type: 'stat_requirement', stat: 'reputation', min: 75 },
|
|
393
|
+
{ type: 'stat_requirement', stat: 'gold', min: 1000 },
|
|
394
|
+
{ type: 'relationship_requirement', npc: 'nobleman', min: 60 }
|
|
395
|
+
]
|
|
396
|
+
}), 'registering OR dependency');
|
|
397
|
+
const dependencyGameState = {
|
|
398
|
+
completedEvents: new Set(['COURT_INTRODUCTION', 'BASIC_TRAINING']),
|
|
399
|
+
player: { level: 12, reputation: 80, gold: 500 }
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
console.log('Dependency Checks:');
|
|
403
|
+
const royalBall = safeExecute(() => generator.checkEventDependencies('ROYAL_BALL', dependencyGameState), 'checking royal ball');
|
|
404
|
+
const eliteMission = safeExecute(() => generator.checkEventDependencies('ELITE_MISSION', dependencyGameState), 'checking elite mission');
|
|
405
|
+
const socialEvent = safeExecute(() => generator.checkEventDependencies('SOCIAL_EVENT', dependencyGameState), 'checking social event');
|
|
406
|
+
|
|
407
|
+
printResult('Can access Royal Ball', royalBall);
|
|
408
|
+
printResult('Can access Elite Mission', eliteMission);
|
|
409
|
+
printResult('Can access Social Event', socialEvent);
|
|
410
|
+
}
|
|
190
411
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
console.log();
|
|
412
|
+
function demoNPCRelationships(generator) {
|
|
413
|
+
printSection('š„ Demo 13: NPC Relationships');
|
|
194
414
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
415
|
+
safeExecute(() => generator.addNPC({
|
|
416
|
+
id: 'merchant_sam',
|
|
417
|
+
name: 'Merchant Sam',
|
|
418
|
+
type: 'merchant'
|
|
419
|
+
}), 'adding merchant NPC');
|
|
199
420
|
|
|
200
|
-
|
|
421
|
+
safeExecute(() => generator.addNPC({
|
|
422
|
+
id: 'guard_captain',
|
|
423
|
+
name: 'Captain Valeria',
|
|
424
|
+
type: 'guard'
|
|
425
|
+
}), 'adding guard NPC');
|
|
201
426
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
427
|
+
safeExecute(() => generator.addNPC({
|
|
428
|
+
id: 'nobleman',
|
|
429
|
+
name: 'Lord Harrington',
|
|
430
|
+
type: 'noble'
|
|
431
|
+
}), 'adding noble NPC');
|
|
432
|
+
|
|
433
|
+
console.log('Relationship Interactions:');
|
|
434
|
+
|
|
435
|
+
const initialSamRel = safeExecute(() => generator.getRelationship('merchant_sam', 'player'), 'getting initial relationship');
|
|
436
|
+
printResult('Initial relationship with Merchant Sam', initialSamRel?.strength || 0);
|
|
437
|
+
|
|
438
|
+
safeExecute(() => generator.applyRelationshipRule('merchant_sam', 'player', 'save_life'), 'applying save_life rule');
|
|
439
|
+
const samRelAfter = safeExecute(() => generator.getRelationship('merchant_sam', 'player'), 'getting relationship after save');
|
|
440
|
+
printResult('After saving life', samRelAfter?.strength || 0);
|
|
441
|
+
|
|
442
|
+
safeExecute(() => generator.updateRelationship('guard_captain', 'player', -15, 'minor dispute'), 'updating guard relationship');
|
|
443
|
+
const guardRel = safeExecute(() => generator.getRelationship('guard_captain', 'player'), 'getting guard relationship');
|
|
444
|
+
printResult('Guard Captain relationship', guardRel?.strength || 0);
|
|
445
|
+
|
|
446
|
+
safeExecute(() => generator.applyRelationshipRule('nobleman', 'player', 'help_combat'), 'applying help_combat rule');
|
|
447
|
+
const nobleRel = safeExecute(() => generator.getRelationship('nobleman', 'player'), 'getting noble relationship');
|
|
448
|
+
printResult('Nobleman relationship', nobleRel?.strength || 0);
|
|
449
|
+
|
|
450
|
+
const samSummary = safeExecute(() => generator.getRelationshipSummary('merchant_sam'), 'getting relationship summary');
|
|
451
|
+
if (samSummary) {
|
|
452
|
+
console.log(`\nMerchant Sam has ${samSummary.totalRelationships} relationships`);
|
|
453
|
+
printResult('Average relationship strength', samSummary.averageStrength.toFixed(1));
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
function demoCombinedFeatures(generator) {
|
|
458
|
+
printSection('š Demo 14: Combined Feature Usage');
|
|
208
459
|
|
|
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
|
-
'event.title.default': 'Evento Inesperado',
|
|
237
|
-
'choice.fight': 'Luchar',
|
|
238
|
-
'choice.flee': 'Huir',
|
|
239
|
-
'choice.negotiate': 'Negociar'
|
|
240
|
-
},
|
|
241
|
-
culture: {
|
|
242
|
-
nameFormats: ['western'],
|
|
243
|
-
currencySymbols: ['oro']
|
|
460
|
+
const comprehensiveContext = {
|
|
461
|
+
player: {
|
|
462
|
+
id: 'player',
|
|
463
|
+
level: 15,
|
|
464
|
+
reputation: 70,
|
|
465
|
+
gold: 2000
|
|
466
|
+
},
|
|
467
|
+
environment: {
|
|
468
|
+
weather: 'rain',
|
|
469
|
+
season: 'spring',
|
|
470
|
+
timeOfDay: 'dawn'
|
|
471
|
+
},
|
|
472
|
+
gameState: {
|
|
473
|
+
completedEvents: new Set(['TUTORIAL', 'FIRST_QUEST']),
|
|
474
|
+
relationships: {
|
|
475
|
+
merchant_sam: { strength: 45, type: 'friend' }
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
console.log('Generating event with ALL features combined:');
|
|
481
|
+
const comprehensiveEvent = safeExecute(() => generator.generateEnhancedEvent(comprehensiveContext), 'generating comprehensive event');
|
|
482
|
+
|
|
483
|
+
if (comprehensiveEvent) {
|
|
484
|
+
printResult('Title', comprehensiveEvent.title);
|
|
485
|
+
printResult('Has environmental modifications', comprehensiveEvent.appliedModifiers?.length > 0);
|
|
486
|
+
printResult('Choices', comprehensiveEvent.choices.length);
|
|
244
487
|
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
// Backward Compatibility
|
|
491
|
+
function demoBackwardCompatibility() {
|
|
492
|
+
printSection('š Demo 15: Backward Compatibility');
|
|
493
|
+
|
|
494
|
+
const legacyGenerator = new RPGEventGenerator();
|
|
495
|
+
const legacyEvent = safeExecute(() => legacyGenerator.generateEvent(), 'legacy generator test');
|
|
496
|
+
if (legacyEvent) {
|
|
497
|
+
printResult('Basic generator works', legacyEvent.title);
|
|
253
498
|
}
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
// Test language switching
|
|
257
|
-
console.log('English:', generator.translate('choice.fight'));
|
|
258
|
-
generator.setLanguage('es');
|
|
259
|
-
console.log('Spanish:', generator.translate('choice.fight'));
|
|
260
|
-
generator.setLanguage('fr');
|
|
261
|
-
console.log('French:', generator.translate('choice.fight'));
|
|
262
|
-
generator.setLanguage('en'); // Back to English
|
|
263
|
-
console.log();
|
|
264
|
-
|
|
265
|
-
// ================================
|
|
266
|
-
// š¤ļø ENVIRONMENTAL MODIFIERS
|
|
267
|
-
// ================================
|
|
268
|
-
console.log('š¤ļø Demo 2: Environmental Modifiers');
|
|
269
|
-
|
|
270
|
-
// Test individual modifiers
|
|
271
|
-
console.log('Individual Modifiers:');
|
|
272
|
-
generator.setEnvironmentalContext({ weather: 'rain' });
|
|
273
|
-
const rainEvent = generator.generateEnhancedEvent();
|
|
274
|
-
console.log(`Rain Event: ${rainEvent.title}`);
|
|
275
|
-
console.log(`Description contains atmospheric text: ${rainEvent.description.includes('gloomy')}`);
|
|
276
|
-
|
|
277
|
-
generator.setEnvironmentalContext({ season: 'winter' });
|
|
278
|
-
const winterEvent = generator.generateEnhancedEvent();
|
|
279
|
-
console.log(`Winter Event: ${winterEvent.title}`);
|
|
280
|
-
console.log(`Description contains seasonal text: ${winterEvent.description.includes('bleak')}`);
|
|
281
|
-
|
|
282
|
-
// Test combined modifiers
|
|
283
|
-
console.log('\nCombined Modifiers:');
|
|
284
|
-
const testEvent = {
|
|
285
|
-
title: 'Test Event',
|
|
286
|
-
description: 'Testing modifier effects.',
|
|
287
|
-
choices: [{
|
|
288
|
-
text: 'Continue',
|
|
289
|
-
effect: { health: 10, gold: 50 }
|
|
290
|
-
}]
|
|
291
|
-
};
|
|
292
499
|
|
|
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
|
-
// Test dependencies
|
|
332
|
-
const dependencyGameState = {
|
|
333
|
-
completedEvents: new Set(['COURT_INTRODUCTION', 'BASIC_TRAINING']),
|
|
334
|
-
player: { level: 12, reputation: 80, gold: 500 }
|
|
335
|
-
};
|
|
500
|
+
const partialGenerator = new RPGEventGenerator({
|
|
501
|
+
enableModifiers: false,
|
|
502
|
+
enableRelationships: true,
|
|
503
|
+
enableDependencies: false
|
|
504
|
+
});
|
|
505
|
+
const partialEvent = safeExecute(() => partialGenerator.generateEvent(), 'partial features test');
|
|
506
|
+
if (partialEvent) {
|
|
507
|
+
printResult('Partial features work', partialEvent.title);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
const oldApiGenerator = new RPGEventGenerator({
|
|
511
|
+
theme: 'fantasy',
|
|
512
|
+
culture: 'norse'
|
|
513
|
+
});
|
|
514
|
+
const oldApiEvent = safeExecute(() => oldApiGenerator.generateEvent(), 'old API test');
|
|
515
|
+
if (oldApiEvent) {
|
|
516
|
+
printResult('Legacy API works', oldApiEvent.title);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
function demoSystemStatus(generator) {
|
|
521
|
+
printSection('š Demo 16: System Status');
|
|
522
|
+
|
|
523
|
+
const status = safeExecute(() => generator.getSystemStatus(), 'getting system status');
|
|
524
|
+
|
|
525
|
+
if (status) {
|
|
526
|
+
printResult('Current language', status.language);
|
|
527
|
+
printResult('Available languages', status.availableLanguages.join(', '));
|
|
528
|
+
printResult('Modifiers enabled', status.modifiersEnabled);
|
|
529
|
+
printResult('Relationships enabled', status.relationshipsEnabled);
|
|
530
|
+
printResult('Dependencies enabled', status.dependenciesEnabled);
|
|
531
|
+
printResult('Total NPCs', status.totalNPCs);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
// Advanced Usage Examples
|
|
536
|
+
function demoAdvancedUsage(generator) {
|
|
537
|
+
printSection('šÆ Demo 17: Advanced Usage Examples');
|
|
336
538
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
// ================================
|
|
344
|
-
// š„ NPC RELATIONSHIPS
|
|
345
|
-
// ================================
|
|
346
|
-
console.log('š„ Demo 4: NPC Relationships');
|
|
347
|
-
|
|
348
|
-
// Add multiple NPCs
|
|
349
|
-
generator.addNPC({
|
|
350
|
-
id: 'merchant_sam',
|
|
351
|
-
name: 'Merchant Sam',
|
|
352
|
-
type: 'merchant'
|
|
353
|
-
});
|
|
354
|
-
|
|
355
|
-
generator.addNPC({
|
|
356
|
-
id: 'guard_captain',
|
|
357
|
-
name: 'Captain Valeria',
|
|
358
|
-
type: 'guard'
|
|
359
|
-
});
|
|
360
|
-
|
|
361
|
-
generator.addNPC({
|
|
362
|
-
id: 'nobleman',
|
|
363
|
-
name: 'Lord Harrington',
|
|
364
|
-
type: 'noble'
|
|
365
|
-
});
|
|
366
|
-
|
|
367
|
-
// Test relationship interactions
|
|
368
|
-
console.log('Relationship Interactions:');
|
|
369
|
-
|
|
370
|
-
let samRel = generator.getRelationship('merchant_sam', 'player');
|
|
371
|
-
console.log(`Initial relationship with Merchant Sam: ${samRel?.strength || 0}`);
|
|
372
|
-
|
|
373
|
-
generator.applyRelationshipRule('merchant_sam', 'player', 'save_life');
|
|
374
|
-
samRel = generator.getRelationship('merchant_sam', 'player');
|
|
375
|
-
console.log(`After saving life: ${samRel?.strength || 0}`);
|
|
376
|
-
|
|
377
|
-
generator.updateRelationship('guard_captain', 'player', -15, 'minor dispute');
|
|
378
|
-
let guardRel = generator.getRelationship('guard_captain', 'player');
|
|
379
|
-
console.log(`Guard Captain relationship: ${guardRel?.strength || 0}`);
|
|
380
|
-
|
|
381
|
-
generator.applyRelationshipRule('nobleman', 'player', 'help_combat');
|
|
382
|
-
let nobleRel = generator.getRelationship('nobleman', 'player');
|
|
383
|
-
console.log(`Nobleman relationship: ${nobleRel?.strength || 0}`);
|
|
384
|
-
|
|
385
|
-
// Test relationship summary
|
|
386
|
-
const samSummary = generator.getRelationshipSummary('merchant_sam');
|
|
387
|
-
console.log(`\nMerchant Sam has ${samSummary.totalRelationships} relationships`);
|
|
388
|
-
console.log(`Average relationship strength: ${samSummary.averageStrength.toFixed(1)}`);
|
|
389
|
-
console.log();
|
|
390
|
-
|
|
391
|
-
// ================================
|
|
392
|
-
// š COMBINED FEATURE USAGE
|
|
393
|
-
// ================================
|
|
394
|
-
console.log('š Demo 5: Combined Feature Usage');
|
|
395
|
-
|
|
396
|
-
const comprehensiveContext = {
|
|
397
|
-
player: {
|
|
398
|
-
id: 'player',
|
|
399
|
-
level: 15,
|
|
400
|
-
reputation: 70,
|
|
401
|
-
gold: 2000
|
|
402
|
-
},
|
|
403
|
-
environment: {
|
|
404
|
-
weather: 'rain',
|
|
405
|
-
season: 'spring',
|
|
406
|
-
timeOfDay: 'dawn'
|
|
407
|
-
},
|
|
408
|
-
gameState: {
|
|
409
|
-
completedEvents: new Set(['TUTORIAL', 'FIRST_QUEST']),
|
|
410
|
-
relationships: {
|
|
411
|
-
merchant_sam: { strength: 45, type: 'friend' }
|
|
539
|
+
safeExecute(() => generator.registerModifier('festival', {
|
|
540
|
+
type: 'event',
|
|
541
|
+
effects: { mood_bonus: 20 },
|
|
542
|
+
text_modifiers: {
|
|
543
|
+
atmosphere: 'festive',
|
|
544
|
+
add_descriptors: ['celebratory', 'joyful']
|
|
412
545
|
}
|
|
546
|
+
}), 'registering custom modifier');
|
|
547
|
+
|
|
548
|
+
console.log('Time progression:');
|
|
549
|
+
safeExecute(() => generator.advanceTime(30), 'advancing time 30 days');
|
|
550
|
+
const currentSeason = safeExecute(() => generator.timeSystem?.currentSeason, 'getting current season');
|
|
551
|
+
if (currentSeason) {
|
|
552
|
+
printResult('New season', currentSeason);
|
|
413
553
|
}
|
|
414
|
-
};
|
|
415
554
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
console.log(`Has environmental modifications: ${comprehensiveEvent.appliedModifiers?.length > 0}`);
|
|
420
|
-
console.log(`Choices: ${comprehensiveEvent.choices.length}`);
|
|
421
|
-
console.log();
|
|
422
|
-
|
|
423
|
-
// ================================
|
|
424
|
-
// š BACKWARD COMPATIBILITY
|
|
425
|
-
// ================================
|
|
426
|
-
console.log('š Demo 6: Backward Compatibility');
|
|
427
|
-
|
|
428
|
-
// Test with no enhanced features
|
|
429
|
-
const legacyGenerator = new RPGEventGenerator();
|
|
430
|
-
const legacyEvent = legacyGenerator.generateEvent();
|
|
431
|
-
console.log(`Basic generator works: ${legacyEvent.title}`);
|
|
432
|
-
|
|
433
|
-
// Test with some features disabled
|
|
434
|
-
const partialGenerator = new RPGEventGenerator({
|
|
435
|
-
enableModifiers: false,
|
|
436
|
-
enableRelationships: true,
|
|
437
|
-
enableDependencies: false
|
|
438
|
-
});
|
|
439
|
-
const partialEvent = partialGenerator.generateEvent();
|
|
440
|
-
console.log(`Partial features work: ${partialEvent.title}`);
|
|
441
|
-
|
|
442
|
-
// Test old API still works
|
|
443
|
-
const oldApiGenerator = new RPGEventGenerator({
|
|
444
|
-
theme: 'fantasy',
|
|
445
|
-
culture: 'norse'
|
|
446
|
-
});
|
|
447
|
-
const oldApiEvent = oldApiGenerator.generateEvent();
|
|
448
|
-
console.log(`Legacy API works: ${oldApiEvent.title}`);
|
|
449
|
-
console.log();
|
|
450
|
-
|
|
451
|
-
// ================================
|
|
452
|
-
// š SYSTEM STATUS
|
|
453
|
-
// ================================
|
|
454
|
-
console.log('š Demo 7: System Status');
|
|
455
|
-
const status = generator.getSystemStatus();
|
|
456
|
-
console.log(`Current language: ${status.language}`);
|
|
457
|
-
console.log(`Available languages: ${status.availableLanguages.join(', ')}`);
|
|
458
|
-
console.log(`Modifiers enabled: ${status.modifiersEnabled}`);
|
|
459
|
-
console.log(`Relationships enabled: ${status.relationshipsEnabled}`);
|
|
460
|
-
console.log(`Dependencies enabled: ${status.dependenciesEnabled}`);
|
|
461
|
-
console.log(`Total NPCs: ${status.totalNPCs}`);
|
|
462
|
-
console.log();
|
|
463
|
-
|
|
464
|
-
// ================================
|
|
465
|
-
// šÆ ADVANCED USAGE EXAMPLES
|
|
466
|
-
// ================================
|
|
467
|
-
console.log('šÆ Demo 8: Advanced Usage Examples');
|
|
468
|
-
|
|
469
|
-
// Custom modifier
|
|
470
|
-
generator.registerModifier('festival', {
|
|
471
|
-
type: 'event',
|
|
472
|
-
effects: { mood_bonus: 20 },
|
|
473
|
-
text_modifiers: {
|
|
474
|
-
atmosphere: 'festive',
|
|
475
|
-
add_descriptors: ['celebratory', 'joyful']
|
|
555
|
+
const network = safeExecute(() => generator.getRelationshipNetwork('merchant_sam', 2), 'getting relationship network');
|
|
556
|
+
if (network) {
|
|
557
|
+
printResult('Merchant Sam\'s relationship network', `${network.nodes.size} nodes, ${network.edges.length} connections`);
|
|
476
558
|
}
|
|
477
|
-
}
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
function runDemo() {
|
|
562
|
+
|
|
563
|
+
demoBasicEventGeneration();
|
|
564
|
+
demoDynamicDifficultyScaling();
|
|
565
|
+
demoContextAwareEvents();
|
|
566
|
+
demoCustomTrainingData();
|
|
567
|
+
demoModularEventSystem();
|
|
568
|
+
demoEventChains();
|
|
569
|
+
demoTemplateLibrary();
|
|
570
|
+
demoTimeBasedEvents();
|
|
571
|
+
demoGameStateManagement();
|
|
572
|
+
|
|
573
|
+
const enhancedGenerator = demoMultiLanguageSupport();
|
|
574
|
+
demoEnvironmentalModifiers(enhancedGenerator);
|
|
575
|
+
demoEventDependencies(enhancedGenerator);
|
|
576
|
+
demoNPCRelationships(enhancedGenerator);
|
|
577
|
+
demoCombinedFeatures(enhancedGenerator);
|
|
578
|
+
demoBackwardCompatibility();
|
|
579
|
+
demoSystemStatus(enhancedGenerator);
|
|
580
|
+
demoAdvancedUsage(enhancedGenerator);
|
|
581
|
+
|
|
582
|
+
printHeader('š v2.0.0 FEATURE DEMOS');
|
|
583
|
+
|
|
584
|
+
// v2.0.0 Feature Demos
|
|
585
|
+
demoCustomRuleEngine();
|
|
586
|
+
demoThemeCreator();
|
|
587
|
+
demoPureMarkovMode();
|
|
588
|
+
demoEventEconomy();
|
|
589
|
+
|
|
590
|
+
printHeader('ā
DEMO COMPLETE');
|
|
591
|
+
console.log('š All v2.0.0 features demonstrated successfully!');
|
|
592
|
+
console.log('š¦ Version 2.0.0 delivers revolutionary new capabilities with full backward compatibility.');
|
|
593
|
+
console.log('š Production-ready for game development!');
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
// v2.0.0 Feature Demos
|
|
597
|
+
function demoCustomRuleEngine() {
|
|
598
|
+
printSection('š§ Demo 18: Custom Rule Engine (v2.0.0)');
|
|
599
|
+
|
|
600
|
+
const generator = new RPGEventGenerator({ enableRuleEngine: true });
|
|
601
|
+
|
|
602
|
+
// Create a custom rule for wealthy players
|
|
603
|
+
const wealthyRule = {
|
|
604
|
+
conditions: [
|
|
605
|
+
{ type: 'stat_greater_than', params: { stat: 'gold', value: 1000 } }
|
|
606
|
+
],
|
|
607
|
+
effects: {
|
|
608
|
+
modifyChoices: {
|
|
609
|
+
multiply: { gold: 1.3 },
|
|
610
|
+
add: { reputation: 5 }
|
|
611
|
+
},
|
|
612
|
+
addTags: ['wealthy_player_bonus']
|
|
613
|
+
}
|
|
614
|
+
};
|
|
478
615
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
console.log(`New season: ${generator.timeSystem.currentSeason}`);
|
|
616
|
+
safeExecute(() => {
|
|
617
|
+
generator.addCustomRule('wealthy_bonus', wealthyRule);
|
|
618
|
+
printResult('Rule added', 'wealthy_bonus');
|
|
483
619
|
|
|
484
|
-
//
|
|
485
|
-
const
|
|
486
|
-
|
|
620
|
+
// Test with wealthy player
|
|
621
|
+
const wealthyEvent = generator.generateEvent({ gold: 2000 });
|
|
622
|
+
printResult('Wealthy player event', wealthyEvent.title);
|
|
623
|
+
printResult('Tags applied', wealthyEvent.tags?.join(', ') || 'none');
|
|
624
|
+
|
|
625
|
+
// Test with poor player
|
|
626
|
+
const poorEvent = generator.generateEvent({ gold: 100 });
|
|
627
|
+
printResult('Poor player event', poorEvent.title);
|
|
628
|
+
printResult('Tags applied', poorEvent.tags?.join(', ') || 'none');
|
|
629
|
+
|
|
630
|
+
printResult('Active rules', Object.keys(generator.getCustomRules()).length);
|
|
631
|
+
}, 'custom rule engine');
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
function demoThemeCreator() {
|
|
635
|
+
printSection('šØ Demo 19: Theme Creator (v2.0.0)');
|
|
636
|
+
|
|
637
|
+
const customTrainingData = [
|
|
638
|
+
'Neon-lit cantinas pulse with quantum energy',
|
|
639
|
+
'Robotic bartenders serve drinks that change your memories',
|
|
640
|
+
'Space cowboys duel with laser revolvers under three moons',
|
|
641
|
+
'Alien merchants haggle over crystalline data cores',
|
|
642
|
+
'Floating colonies drift through asteroid fields'
|
|
643
|
+
];
|
|
644
|
+
|
|
645
|
+
safeExecute(() => {
|
|
646
|
+
const generator = new RPGEventGenerator({
|
|
647
|
+
trainingData: customTrainingData,
|
|
648
|
+
theme: 'space-opera',
|
|
649
|
+
culture: 'cyberpunk'
|
|
650
|
+
});
|
|
651
|
+
|
|
652
|
+
const event = generator.generateEvent();
|
|
653
|
+
printResult('Custom theme event', event.title);
|
|
654
|
+
printResult('Description preview', event.description.substring(0, 80) + '...');
|
|
655
|
+
printResult('Training sentences used', customTrainingData.length);
|
|
656
|
+
}, 'theme creator');
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
function demoPureMarkovMode() {
|
|
660
|
+
printSection('š² Demo 20: Pure Markov Mode (v2.0.0)');
|
|
661
|
+
|
|
662
|
+
const pureTrainingData = [
|
|
663
|
+
'Crystal caves echo with ancient magical resonances',
|
|
664
|
+
'Shadowy figures emerge from fog-shrouded forests',
|
|
665
|
+
'Forgotten ruins hide treasures and eldritch horrors',
|
|
666
|
+
'Mysterious merchants offer artifacts of power',
|
|
667
|
+
'Wandering bards sing tales of lost civilizations'
|
|
668
|
+
];
|
|
669
|
+
|
|
670
|
+
safeExecute(() => {
|
|
671
|
+
const pureGenerator = new RPGEventGenerator({
|
|
672
|
+
trainingData: pureTrainingData,
|
|
673
|
+
pureMarkovMode: true,
|
|
674
|
+
enableTemplates: false
|
|
675
|
+
});
|
|
676
|
+
|
|
677
|
+
const event = pureGenerator.generateEvent();
|
|
678
|
+
printResult('Pure Markov event', event.title);
|
|
679
|
+
printResult('Type', event.type);
|
|
680
|
+
printResult('Generated purely from', `${pureTrainingData.length} custom sentences`);
|
|
681
|
+
printResult('Templates disabled', 'true (Pure Markov only)');
|
|
682
|
+
}, 'pure Markov mode');
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
function demoEventEconomy() {
|
|
686
|
+
printSection('š° Demo 21: Event Economy (v2.0.0)');
|
|
687
|
+
|
|
688
|
+
safeExecute(() => {
|
|
689
|
+
// Import the EventEconomy class
|
|
690
|
+
const EventEconomy = require('./scripts/event-economy');
|
|
691
|
+
|
|
692
|
+
// Create economy instance
|
|
693
|
+
const economy = new EventEconomy('./user-content');
|
|
694
|
+
|
|
695
|
+
// Create a sample theme
|
|
696
|
+
const sampleTheme = {
|
|
697
|
+
name: 'CyberWestern',
|
|
698
|
+
author: 'DemoCreator',
|
|
699
|
+
description: 'Cyberpunk western theme',
|
|
700
|
+
tags: ['cyberpunk', 'western', 'scifi'],
|
|
701
|
+
settings: {
|
|
702
|
+
theme: 'cyberpunk',
|
|
703
|
+
culture: 'western',
|
|
704
|
+
enableRuleEngine: true
|
|
705
|
+
},
|
|
706
|
+
trainingData: [
|
|
707
|
+
'neon signs flicker in the dusty saloon',
|
|
708
|
+
'robotic sheriffs maintain order',
|
|
709
|
+
'cyborg outlaws ride mechanical horses'
|
|
710
|
+
],
|
|
711
|
+
customRules: [],
|
|
712
|
+
statistics: {
|
|
713
|
+
trainingSentences: 3,
|
|
714
|
+
estimatedQuality: 75
|
|
715
|
+
}
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
// Save the theme
|
|
719
|
+
const themePath = economy.saveTheme('CyberWestern', sampleTheme);
|
|
720
|
+
printResult('Theme saved to', themePath);
|
|
721
|
+
|
|
722
|
+
// Load the theme
|
|
723
|
+
const loadedTheme = economy.loadTheme('CyberWestern');
|
|
724
|
+
printResult('Theme loaded', loadedTheme.name);
|
|
725
|
+
printResult('Author', loadedTheme.author);
|
|
726
|
+
printResult('Training sentences', loadedTheme.trainingData.length);
|
|
727
|
+
|
|
728
|
+
// Show statistics
|
|
729
|
+
const stats = economy.getStatistics();
|
|
730
|
+
printResult('Total themes saved', stats.totalThemes);
|
|
731
|
+
printResult('Total quality score', Math.round(stats.averageThemeQuality) + '/100');
|
|
732
|
+
|
|
733
|
+
}, 'event economy');
|
|
734
|
+
}
|
|
487
735
|
|
|
488
|
-
|
|
489
|
-
console.log('š All enhanced features demonstrated successfully!');
|
|
490
|
-
console.log('š¦ Version 1.2.0 delivers powerful new capabilities while maintaining full backward compatibility.');
|
|
491
|
-
console.log('š Ready for future enhancements and releases!');
|
|
736
|
+
runDemo();
|