From 24ca5c5f6bb23fc0313c50308a75b27be961efe4 Mon Sep 17 00:00:00 2001 From: hant Date: Tue, 9 Dec 2025 22:56:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Data/item_new.php | 1 + src/Data/items.php | 3 - src/Data/map_new.php | 884 +++++++++++++++++++++++++++++++++++++++ src/Entities/Item.php | 234 +++++------ src/Entities/Monster.php | 6 +- test/Test.php | 2 +- 6 files changed, 998 insertions(+), 132 deletions(-) create mode 100644 src/Data/map_new.php diff --git a/src/Data/item_new.php b/src/Data/item_new.php index f1f417a..9cc2716 100644 --- a/src/Data/item_new.php +++ b/src/Data/item_new.php @@ -36,6 +36,7 @@ return [ 'desc' => '门派内甲,提供均衡的双防和可靠的生命值。', // 固定的基础属性:均衡的双防 'fixed_primary' => [ + 'hp' => ['base' => [35, 60, 95, 130], 'growth' => 1.7], 'pdef' => ['base' => [35, 60, 95, 130], 'growth' => 1.7], 'mdef' => ['base' => [30, 50, 80, 110], 'growth' => 1.5], ], diff --git a/src/Data/items.php b/src/Data/items.php index 6eff9d5..2db712c 100644 --- a/src/Data/items.php +++ b/src/Data/items.php @@ -16,7 +16,4 @@ return [ 'crit' => '暴击率', 'critdmg' => '暴击伤害', ], - - // 物品类型配置 - ]; diff --git a/src/Data/map_new.php b/src/Data/map_new.php new file mode 100644 index 0000000..a2e84b0 --- /dev/null +++ b/src/Data/map_new.php @@ -0,0 +1,884 @@ + [ + 'name' => '七玄门', + 'min_level' => 1, + 'key_item' => null, // 初始区域,无需钥匙 + 'desc' => '镜州边境的江湖门派,韩立在此获得神秘小瓶,开启修仙之路。', + 'monsters' => [ + [ + 'name' => '野狼帮马贼', // 更名为原著中的敌对势力 + 'level' => 1, + 'hp' => 30, + 'patk' => 6, + 'matk' => 0, // 凡人无魔攻 + 'pdef' => 1, + 'mdef' => 0, + 'exp' => 10, + 'spirit_stones' => 0, // 凡人没有灵石,改为银两(逻辑上) + 'drops' => [], + 'spells' => [ + ['id' => 11, 'name' => '罗烟步(伪)', 'rate' => 20], + ], + 'weight' => 50, + ], + [ + 'name' => '铁奴(张铁)', // 增加原著重要角色 + 'level' => 4, + 'hp' => 120, // 炼尸防御高血厚 + 'patk' => 15, + 'matk' => 0, + 'pdef' => 10, // 铜皮铁骨 + 'mdef' => 5, + 'exp' => 40, + 'spirit_stones' => 2, + 'drops' => [], + 'spells' => [ + ['id' => 5, 'name' => '象甲功', 'rate' => 30], + ], + 'weight' => 30, + ], + [ + 'name' => '墨居仁', // 墨大夫全名 + 'level' => 6, + 'hp' => 200, + 'patk' => 25, + 'matk' => 15, // 虽是凡人但有法力道具 + 'pdef' => 8, + 'mdef' => 5, + 'exp' => 150, + 'spirit_stones' => 10, + 'drops' => [ + ['type' => 'consume', 'name' => '掌天瓶(伪)', 'rate' => 5, 'heal' => 500], // 彩蛋物品 + ['type' => 'quest_item', 'name' => '长春功', 'rate' => 10], // 必掉任务道具 + ['type' => 'consume', 'name' => '抽魂丹', 'rate' => 10, 'heal' => -50], // 毒药 + ], + 'spells' => [ + ['id' => 10, 'name' => '火球术', 'rate' => 30], + ], + 'weight' => 20, + ], + ], + ], + // ============================================================ + // 第二章:初入仙途 (Lv.5-15) + // ============================================================ + 2 => [ + 'name' => '太南谷外', + 'min_level' => 8, + 'key_item' => '长春功', // 从金光上人掉落 + 'desc' => '太南小会结束后,韩立在遭遇了修仙路上的第一场生死搏杀。', + 'monsters' => [ + [ + 'name' => '太南谷外-散修', + 'level' => 8, + 'hp' => 100, + 'patk' => 12, + 'matk' => 18, + 'pdef' => 4, + 'mdef' => 4, + 'exp' => 45, + 'spirit_stones' => 15, + 'drops' => [ + ['type' => 'consume', 'name' => '辟谷丹', 'rate' => 30, 'heal' => 50], + ['type' => 'consume', 'name' => '灵石碎片', 'rate' => 40, 'heal' => 10], + ], + 'spells' => [ + ['id' => 10, 'name' => '火球术', 'rate' => 30], + ['id' => 20, 'name' => '冰雹术', 'rate' => 30], + ], + 'weight' => 60, + ], + [ + 'name' => '秦家护卫', + 'level' => 10, + 'hp' => 150, + 'patk' => 30, + 'matk' => 5, + 'pdef' => 12, + 'mdef' => 5, + 'exp' => 60, + 'spirit_stones' => 20, + 'drops' => [ + ], + 'weight' => 25, + ], + [ + 'name' => '金光上人', // 替换吴丑,符合前期剧情 + 'level' => 13, // 炼气中后期 + 'hp' => 350, + 'patk' => 15, + 'matk' => 40, + 'pdef' => 15, + 'mdef' => 20, // 金光罩防御高 + 'exp' => 250, + 'spirit_stones' => 80, + 'drops' => [ + ['type' => 'quest_item', 'name' => '升仙令', 'rate' => 10], // 必掉任务道具 + ['type' => 'quest_item', 'name' => '故人信笺·小老头', 'rate' => 10], // NPC解锁道具 + ['type' => 'consume', 'name' => '烈火符', 'rate' => 30, 'heal' => 60], // 攻击道具 + ], + 'spells' => [ + ['id' => 30, 'name' => '金光罩', 'rate' => 40], + ['id' => 11, 'name' => '飞剑斩击', 'rate' => 30], + ], + 'weight' => 5, + ], + ], + ], + // ============================================================ + // 第三章:血色禁地 (Lv.15-25) + // ============================================================ + 3 => [ + 'name' => '血色禁地', + 'min_level' => 15, + 'key_item' => '升仙令', + 'desc' => '七派弟子为了筑基丹原料进行的生死试炼,中心区危机四伏。', + 'monsters' => [ + [ + 'name' => '灵兽山弟子', // 原著中主要的竞争对手 + 'level' => 16, + 'hp' => 250, + 'patk' => 35, + 'matk' => 20, + 'pdef' => 10, + 'mdef' => 10, + 'exp' => 90, + 'spirit_stones' => 40, + 'drops' => [ + ['type' => 'consume', 'name' => '紫猴花', 'rate' => 20, 'heal' => 120], + ], + 'spells' => [ + ['id' => 10, 'name' => '火球术', 'rate' => 25], + ], + 'weight' => 45, + ], + [ + 'name' => '掩月宗多宝女', // 原著中拥有透明丝线和水晶球的女弟子 + 'level' => 18, // 炼气大圆满 + 'hp' => 400, + 'patk' => 20, + 'matk' => 60, + 'pdef' => 20, + 'mdef' => 30, + 'exp' => 180, + 'spirit_stones' => 100, + 'drops' => [ + ['type' => 'consume', 'name' => '天灵果', 'rate' => 30, 'heal' => 200], + ], + 'spells' => [ + ['id' => 13, 'name' => '冰锥术', 'rate' => 30], + ['id' => 30, 'name' => '月华护盾', 'rate' => 20], + ], + 'weight' => 35, + ], + [ + 'name' => '墨蛟', // 经典BOSS + 'level' => 25, // 相当于筑基初期妖兽,极难打 + 'hp' => 1200, + 'patk' => 100, + 'matk' => 50, + 'pdef' => 60, // 鳞片坚硬 + 'mdef' => 40, + 'exp' => 800, + 'spirit_stones' => 300, + 'drops' => [ + ['type' => 'quest_item', 'name' => '墨蛟元神', 'rate' => 10], // 任务道具 + ['type' => 'quest_item', 'name' => '故人信笺·南宫婉', 'rate' => 10], // 任务道具 + ['type' => 'consume', 'name' => '伴妖草', 'rate' => 20, 'heal' => 500], // 导致韩立南宫婉剧情的道具 + ], + 'spells' => [ + ['id' => 10, 'name' => '紫液毒火', 'rate' => 25], + ['id' => 15, 'name' => '巨尾横扫', 'rate' => 30], + ['id' => 20, 'name' => '蛟龙离水', 'rate' => 15], + ], + 'weight' => 5, + ], + ], + ], + // ============================================================ + // 第二章:筑基期 (Lv.15-40) + // ============================================================ + 4 => [ + 'name' => '黄枫谷·后山密地', + 'min_level' => 15, + 'key_item' => '墨蛟元神', // 从陆师兄掉落 + 'desc' => '看似平静的宗门后山,实则暗流涌动。韩立在此遭遇了同门相残。', + 'monsters' => [ + [ + 'name' => '嫉妒的同门', + 'level' => 16, + 'hp' => 350, + 'patk' => 45, + 'matk' => 25, + 'pdef' => 15, + 'mdef' => 10, + 'exp' => 110, + 'spirit_stones' => 20, + 'drops' => [ + ['type' => 'consume', 'name' => '黄龙丹', 'rate' => 30, 'heal' => 100], + ], + 'weight' => 50, + ], + [ + 'name' => '陈巧倩(受困)', + 'level' => 18, + 'hp' => 800, + 'patk' => 50, + 'matk' => 60, + 'pdef' => 20, + 'mdef' => 20, + 'desc' => '正被不知名恶徒围攻的陈师姐。', + 'drops' => [ + ], + 'weight' => 30, + ], + [ + 'name' => '陆师兄(蒙面人)', // 原著中韩立反杀的第一个筑基期高手 + 'level' => 20, + 'hp' => 1500, + 'patk' => 80, + 'matk' => 100, // 风属性法术高 + 'pdef' => 30, + 'mdef' => 25, + 'exp' => 500, + 'spirit_stones' => 200, + 'desc' => '手持青蛟旗,脚踏神风舟,为了筑基丹不择手段的伪君子。', + 'drops' => [ + ['type' => 'weapon', 'name' => '青蛟旗', 'quality' => 'rare', 'matk' => 80, 'rate' => 25], // 风属性极品法器 + ['type' => 'quest_item', 'name' => '筑基丹', 'rate' => 10], // 任务道具 + ['type' => 'quest_item', 'name' => '故人信笺·陈巧倩', 'rate' => 10], // NPC解锁道具 + ], + 'spells' => [ + ['id' => 11, 'name' => '风刃壁', 'rate' => 40], + ['id' => 21, 'name' => '青风剑诀', 'rate' => 20], + ], + 'weight' => 20, + ], + ], + ], + + 5 => [ + 'name' => '燕家堡·魔道入侵', + 'min_level' => 25, + 'key_item' => '筑基丹', + 'desc' => '燕家老祖投靠鬼灵门,夺宝大会变成了屠杀场。', + 'monsters' => [ + [ + 'name' => '鬼灵门血卫', + 'level' => 26, + 'hp' => 600, + 'patk' => 90, + 'matk' => 40, + 'pdef' => 35, + 'mdef' => 20, + 'exp' => 200, + 'spirit_stones' => 50, + 'drops' => [ + ['type' => 'consume', 'name' => '血珠丸', 'rate' => 25, 'heal' => 100], + ], + 'weight' => 50, + ], + [ + 'name' => '双首鹜(鬼灵门灵兽)', + 'level' => 28, + 'hp' => 1200, + 'patk' => 120, + 'matk' => 60, + 'pdef' => 40, + 'mdef' => 40, + 'desc' => '王蝉饲养的凶禽,不仅攻击力强,还能破除隐匿。', + 'drops' => [ + ], + 'spells' => [ + ['id' => 11, 'name' => '双首啄击', 'rate' => 30], + ], + 'weight' => 30, + ], + [ + 'name' => '王蝉(鬼灵门少主)', + 'level' => 30, // 筑基中期顶峰 + 'hp' => 2500, + 'patk' => 150, + 'matk' => 150, // 魔武双修 + 'pdef' => 60, + 'mdef' => 80, // 有法宝护身 + 'exp' => 1000, + 'spirit_stones' => 500, + 'desc' => '修炼血灵大法,性格残忍,也是韩立前期的宿敌。', + 'drops' => [ + ['type' => 'consume', 'name' => '血珠丸', 'rate' => 25, 'heal' => 100], + ['type' => 'quest_item', 'name' => '远古传送阵', 'rate' => 10], // 任务道具 + ['type' => 'quest_item', 'name' => '故人信笺·辛如音', 'rate' => 10], // NPC解锁道具 + ], + 'spells' => [ + ['id' => 10, 'name' => '血雾腐蚀', 'rate' => 30], + ['id' => 14, 'name' => '绿煌剑', 'rate' => 30], + ['id' => 30, 'name' => '血影身法', 'rate' => 25], + ['id' => 10, 'name' => '血狱冲击', 'rate' => 20], + ], + 'weight' => 5, + ], + ], + ], + + 6 => [ + 'name' => '越京皇宫·黑煞教', + 'min_level' => 35, + 'key_item' => '远古传送阵', // 从黑煞教主掉落 + 'desc' => '越国皇宫冷宫之下,黑煞教主闭关之地,四大血侍护法在侧。', + 'monsters' => [ + [ + 'name' => '铁/铜血侍', + 'level' => 36, + 'hp' => 1500, + 'patk' => 180, // 炼体修士攻击高 + 'matk' => 20, + 'pdef' => 100, // 刀枪不入 + 'mdef' => 30, + 'desc' => '修炼煞妖决的死士,防御力惊人。', + 'drops' => [ + ], + 'weight' => 40, + ], + [ + 'name' => '冰妖/叶蛇(血侍首领)', + 'level' => 38, + 'hp' => 2000, + 'patk' => 200, + 'matk' => 100, + 'pdef' => 80, + 'mdef' => 60, + 'desc' => '可以进行妖化变身的血侍高手。', + 'drops' => [], + 'spells' => [ + ['id' => 10, 'name' => '妖化变身', 'rate' => 100], // Buff类技能 + ], + 'weight' => 30, + ], + [ + 'name' => '黑煞教主', + 'level' => 40, // 假丹/真丹境界 + 'hp' => 4000, + 'patk' => 250, + 'matk' => 200, + 'pdef' => 120, + 'mdef' => 120, + 'exp' => 2000, + 'spirit_stones' => 800, + 'desc' => '原是越皇,修习魔功试图结丹,筑基期最强BOSS之一。', + 'drops' => [ + ['type' => 'consume', 'name' => '血凝五行丹', 'quality' => 'legendary', 'rate' => 50, 'heal' => 5000], // 结丹辅助神药 + ['type' => 'quest_item', 'name' => '玄阴经(残)', 'rate' => 100], // 任务道具 + ], + 'spells' => [ + ['id' => 30, 'name' => '血光罡气', 'rate' => 30], + ['id' => 14, 'name' => '修罗血刃', 'rate' => 30], + ['id' => 24, 'name' => '暗黑冲击', 'rate' => 25], + ['id' => 30, 'name' => '黑暗护盾', 'rate' => 20], + ], + 'weight' => 5, + ], + ], + ], + + 7 => [ + 'name' => '灵石矿脉·地下溶洞', + 'min_level' => 38, + 'key_item' => '玄阴经(残)', // 从血玉蜘蛛掉落 + 'desc' => '荒废的灵石矿脉深处,藏着古传送阵和凶猛的守护古兽。', + 'monsters' => [ + [ + 'name' => '地底僵尸', + 'level' => 38, + 'hp' => 1000, + 'patk' => 150, + 'pdef' => 50, + 'weight' => 60, + 'drops' => [ + ['type' => 'consume', 'name' => '尸毒珠', 'rate' => 30], + ], + ], + [ + 'name' => '血玉蜘蛛', + 'level' => 42, // 四级妖兽,非常棘手 + 'hp' => 5000, + 'patk' => 300, + 'matk' => 50, + 'pdef' => 200, // 外壳极其坚硬 + 'mdef' => 100, + 'desc' => '浑身晶莹如玉的巨型蜘蛛,蛛丝坚韧无比,是修复古传送阵的关键。', + 'exp' => 1500, + 'drops' => [ + ['type' => 'consume', 'name' => '四级妖丹', 'rate' => 30], + ['type' => 'quest_item', 'name' => '大挪移令', 'rate' => 10], // 任务道具 + ], + 'spells' => [ + ['id' => 13, 'name' => '蛛网束缚', 'rate' => 40], + ], + 'weight' => 40, + ], + ] + ], + // ============================================================ + // 第三章:结丹期 (Lv.40-70) + // ============================================================ + 8 => [ + 'name' => '乱星海·珊瑚海域', + 'min_level' => 45, + 'key_item' => '大挪移令', // 从温天仁掉落 + 'desc' => '韩立初入乱星海,一边捕杀婴鲤兽,一边躲避六道传人的追杀。', + 'monsters' => [ + [ + 'name' => '婴鲤兽', // 原著韩立击杀的第一只高阶妖兽 + 'level' => 48, + 'hp' => 3000, + 'patk' => 200, + 'matk' => 150, + 'pdef' => 80, + 'mdef' => 80, + 'exp' => 800, + 'spirit_stones' => 300, + 'desc' => '似鱼非鱼,口中发出婴儿啼哭之声,不仅善使水攻,还能施展幻术。', + 'drops' => [ + ['type' => 'consume', 'name' => '五级妖丹', 'rate' => 100], + ], + 'spells' => [ + ['id' => 20, 'name' => '啼魂音波', 'rate' => 30], + ['id' => 10, 'name' => '水箭连射', 'rate' => 40], + ], + 'weight' => 50, + ], + [ + 'name' => '温天仁(六道传人)', // 乱星海篇主要反派之一 + 'level' => 52, // 结丹后期 + 'hp' => 4500, + 'patk' => 350, + 'matk' => 300, + 'pdef' => 120, + 'mdef' => 150, + 'exp' => 1500, + 'spirit_stones' => 800, + 'desc' => '六道极圣的传人,修炼六极真魔功,手段阴狠毒辣。', + 'drops' => [ + ['type' => 'quest_item', 'name' => '六极真魔功(残)', 'rate' => 100], // 任务道具 + ['type' => 'quest_item', 'name' => '故人信笺·紫灵', 'rate' => 100], // NPC解锁道具 + ['type' => 'consume', 'name' => '抽魂瓶', 'rate' => 400], + ], + 'spells' => [ + ['id' => 13, 'name' => '真魔虚影', 'rate' => 40], + ['id' => 35, 'name' => '神识尖刺', 'rate' => 20], // 无视防御 + ['id' => 36, 'name' => '六道轮回', 'rate' => 30], + ['id' => 37, 'name' => '魔界之门', 'rate' => 25], + ], + 'weight' => 20, + ], + ], + ], + + 9 => [ + 'name' => '虚天殿·内殿', + 'min_level' => 55, + 'key_item' => '六极真魔功(残)', + 'desc' => '三百年一开的乱星海第一秘境,正魔两道元婴老怪齐聚,只为争夺通天灵宝。', + 'monsters' => [ + [ + 'name' => '狼首傀儡', + 'level' => 58, + 'hp' => 6000, + 'patk' => 400, + 'matk' => 200, + 'pdef' => 300, // 傀儡防御高 + 'mdef' => 100, + 'exp' => 1200, + 'desc' => '上古修士留下的守卫,不知疼痛,身躯坚硬如铁。', + 'drops' => [ + ['type' => 'consume', 'name' => '灵石乳', 'rate' => 30, 'heal' => 2000], // 恢复法力的神物 + ['type' => 'weapon', 'name' => '傀儡残片', 'rate' => 50], + ], + 'weight' => 40, + ], + [ + 'name' => '极阴祖师', + 'level' => 65, // 元婴初期(压制修为) + 'hp' => 12000, + 'patk' => 300, + 'matk' => 600, // 法伤极高 + 'pdef' => 200, + 'mdef' => 300, + 'exp' => 3000, + 'spirit_stones' => 1500, + 'desc' => '韩立名义上的师父,修炼天都尸火,阴险狡诈。', + 'drops' => [ + ['type' => 'consume', 'name' => '补天丹', 'rate' => 50, 'heal' => 5000], // 增加灵根资质 + ], + 'spells' => [ + ['id' => 11, 'name' => '天都尸火', 'rate' => 60], + ['id' => 20, 'name' => '玄阴鬼气', 'rate' => 30], + ], + 'weight' => 20, + ], + [ + 'name' => '蛮胡子', + 'level' => 68, // 元婴中期 + 'hp' => 20000, // 血量极厚 + 'patk' => 800, + 'matk' => 100, + 'pdef' => 800, // 托天魔功,物理防御极高 + 'mdef' => 400, + 'exp' => 5000, + 'desc' => '乱星海第一体修,托天魔功金身不坏,力大无穷。', + 'drops' => [ + ], + 'spells' => [ + ['id' => 30, 'name' => '托天魔功', 'rate' => 20], // 给自己加巨额防御Buff + ['id' => 10, 'name' => '蛮力一击', 'rate' => 20], + ], + 'weight' => 10, + ], + // 隐藏BOSS/核心道具守护者 + [ + 'name' => '乾蓝冰焰(鼎魂)', + 'level' => 70, + 'hp' => 5000, + 'patk' => 0, + 'matk' => 1000, // 触之即死 + 'pdef' => 9999, // 无法物理击破 + 'mdef' => 9999, + 'desc' => '虚天鼎周围的寒焰,非元婴修士不可靠近。', + 'drops' => [ + ['type' => 'quest_item', 'name' => '虚天鼎', 'rate' => 10], // 任务道具 + ['type' => 'quest_item', 'name' => '故人信笺·银月', 'rate' => 10], // NPC解锁道具 + ['type' => 'consume', 'name' => '九曲灵参', 'rate' => 10 ,'heal' => 2000], // 结婴丹药引 + ['type' => 'consume', 'name' => '万年灵乳', 'rate' => 20,'heal' => 2000], + ], + 'weight' => 5, + ] + ], + ], + + 10 => [ + 'name' => '外星海·深渊', + 'min_level' => 65, + 'key_item' => '虚天鼎', // 从风希掉落 + 'desc' => '韩立获得虚天鼎后逃至外星海,在此猎杀妖兽数十年,直至遭遇裂风兽。', + 'monsters' => [ + [ + 'name' => '毒蛟', + 'level' => 65, + 'hp' => 8000, + 'patk' => 500, + 'matk' => 400, + 'pdef' => 200, + 'mdef' => 150, + 'desc' => '剧毒无比的八级妖兽。', + 'drops' => [ + ], + 'weight' => 40, + ], + [ + 'name' => '雷鲸', + 'level' => 68, + 'hp' => 10000, + 'patk' => 600, + 'matk' => 500, + 'desc' => '掌控雷电之力的深海巨兽。', + 'drops' => [ + ], + 'spells' => [ + ['id' => 12, 'name' => '狂雷天降', 'rate' => 40], + ], + 'weight' => 30, + ], + [ + 'name' => '风希(裂风兽)', + 'level' => 70, // 九级妖兽(相当于元婴中期) + 'hp' => 25000, + 'patk' => 1000, + 'matk' => 800, + 'pdef' => 400, + 'mdef' => 400, + 'exp' => 10000, + 'desc' => '风属性化形妖修,速度极快,试图炼制风雷翅,后被韩立暗算。', + 'drops' => [ + ['type' => 'quest_item', 'name' => '风雷翅', 'rate' => 10], // 任务道具 + + ['type' => 'consume', 'name' => '九级妖丹', 'rate' => 10], + ['type' => 'consume', 'name' => '万年灵乳', 'rate' => 10], + ], + 'spells' => [ + ['id' => 15, 'name' => '裂风爪', 'rate' => 50], // 高伤害 + ['id' => 32, 'name' => '风遁术', 'rate' => 30], // 极高闪避 + ['id' => 25, 'name' => '雷风交击', 'rate' => 25], + ], + 'weight' => 10, + ], + ], + ], + // ============================================================ + // 第四章:元婴期 (Lv.70-90) + // ============================================================ + + // 10. 鬼灵门·幽冥之地 (Lv.70-80) + // ------------------------------------------------------------ + 11 => [ + 'name' => '鬼灵门·幽冥之地', + 'min_level' => 70, + 'key_item' => '青竹剑诀(残页)', // 从鬼灵门大长老掉落 + 'desc' => '越国鬼灵门的总坛,常年被浓郁的阴气笼罩。韩立在此地寻获钟卫娘,并击杀强敌,为日后炼制青竹蜂云剑获得线索。', + 'monsters' => [ + [ + 'name' => '鬼灵门血煞卫', + 'level' => 72, + 'hp' => 6000, 'patk' => 500, 'matk' => 300, 'pdef' => 200, 'mdef' => 150, + 'exp' => 2500, 'spirit_stones' => 800, + 'drops' => [ + ['type' => 'consume', 'name' => '聚阴丹', 'rate' => 30, 'heal' => 1500], + ], + 'spells' => [ + ['id' => 11, 'name' => '阴风刀', 'rate' => 40], + ], + 'weight' => 50, + ], + [ + 'name' => '千年阴魂兽', + 'level' => 75, + 'hp' => 8000, 'patk' => 100, 'matk' => 600, 'pdef' => 50, 'mdef' => 300, + 'exp' => 4000, 'spirit_stones' => 1200, + 'drops' => [ + ['type' => 'consume', 'name' => '阴魂石', 'rate' => 40, 'heal' => 0], + ], + 'spells' => [ + ['id' => 23, 'name' => '灵魂尖啸', 'rate' => 50], + ], + 'weight' => 35, + ], + [ + 'name' => '鬼灵门大长老', + 'level' => 80, // 元婴中期 + 'hp' => 15000, 'patk' => 400, 'matk' => 800, 'pdef' => 400, 'mdef' => 500, + 'exp' => 10000, 'spirit_stones' => 3000, + 'drops' => [ + ['type' => 'quest_item', 'name' => '青竹剑诀(残页)', 'rate' => 10], // 任务道具 + ['type' => 'quest_item', 'name' => '故人信笺·大衍神君', 'rate' => 10], // NPC解锁道具 + ['type' => 'consume', 'name' => '化形草', 'rate' => 30, 'heal' => 2000], + ], + 'spells' => [ + ['id' => 15, 'name' => '修罗鬼王', 'rate' => 25], + ['id' => 20, 'name' => '幽冥之力', 'rate' => 25], + ['id' => 25, 'name' => '阴灵束缚', 'rate' => 25], + ], + 'weight' => 15, + ], + ], + ], + + // ------------------------------------------------------------ + // 11. 落云宗 (Lv.80-88) + // ------------------------------------------------------------ + 12 => [ + 'name' => '落云宗', + 'min_level' => 80, + 'key_item' => '青竹剑诀(残页)', // 从宗门执法长老掉落 + 'desc' => '越过天南边界,进入大晋的地域。韩立在此地加入落云宗,接触到更高级的功法和炼器术。', + 'monsters' => [ + [ + 'name' => '落云宗内门弟子', + 'level' => 82, + 'hp' => 10000, 'patk' => 700, 'matk' => 500, 'pdef' => 300, 'mdef' => 250, + 'exp' => 5000, 'spirit_stones' => 1500, + 'drops' => [ + ['type' => 'consume', 'name' => '落云丹', 'rate' => 30, 'heal' => 2000], + ], + 'spells' => [ + ['id' => 10, 'name' => '五行灵术', 'rate' => 40], + ], + 'weight' => 40, + ], + [ + 'name' => '银翅夜枭(傀儡)', // 韩立常用的炼制傀儡素材,此地是其聚集地 + 'level' => 85, + 'hp' => 12000, 'patk' => 1000, 'matk' => 600, 'pdef' => 400, 'mdef' => 350, + 'exp' => 7000, 'spirit_stones' => 2500, + 'drops' => [ + ['type' => 'consume', 'name' => '九曲灵参', 'rate' => 25, 'heal' => 5000], + ], + 'spells' => [ + ['id' => 15, 'name' => '音速突袭', 'rate' => 40], + ], + 'weight' => 30, + ], + [ + 'name' => '宗门执法长老', + 'level' => 88, // 元婴后期 + 'hp' => 18000, 'patk' => 900, 'matk' => 1200, 'pdef' => 500, 'mdef' => 600, + 'exp' => 12000, 'spirit_stones' => 4000, + 'desc' => '落云宗元婴后期高手,通常不会出手,但一旦出手实力惊人。', + 'drops' => [ + ['type' => 'quest_item', 'name' => '青雷竹', 'rate' => 10], // 任务道具 + ['type' => 'consume', 'name' => '炼虚丹', 'rate' => 30, 'heal' => 8000], + ], + 'spells' => [ + ['id' => 12, 'name' => '天雷罚', 'rate' => 40], + ['id' => 30, 'name' => '五行护盾', 'rate' => 30], + ['id' => 40, 'name' => '天地雷鸣', 'rate' => 35], + ['id' => 41, 'name' => '五行剑阵', 'rate' => 25], + ], + 'weight' => 20, + ], + ], + ], + + // ------------------------------------------------------------ + // 12. 天星城 (Lv.88-95) - 元婴期终章 + // ------------------------------------------------------------ + 13 => [ + 'name' => '天星城', + 'min_level' => 88, + 'key_item' => '玄天灵宝(仿)', // 从天魔宗太上长老掉落 + 'desc' => '大晋修仙界的中心城池,聚集了大量高阶修士。韩立在此地因身份暴露而卷入正魔两道的纷争。', + 'monsters' => [ + [ + 'name' => '天魔宗弟子', + 'level' => 90, + 'hp' => 15000, 'patk' => 800, 'matk' => 1000, 'pdef' => 400, 'mdef' => 500, + 'exp' => 8000, 'spirit_stones' => 3000, + 'drops' => [ + ['type' => 'consume', 'name' => '魔灵液', 'rate' => 25, 'heal' => 3000], + ], + 'spells' => [ + ['id' => 15, 'name' => '天魔解体', 'rate' => 40], + ], + 'weight' => 50, + ], + [ + 'name' => '星宫双圣分身', // 天星城主要统治者 + 'level' => 93, + 'hp' => 20000, 'patk' => 1000, 'matk' => 1500, 'pdef' => 500, 'mdef' => 800, + 'exp' => 15000, 'spirit_stones' => 5000, + 'desc' => '星宫元婴后期修士的分身,实力强大,是城内秩序的维护者。', + 'drops' => [ + ], + 'spells' => [ + ['id' => 12, 'name' => '七星落', 'rate' => 40], + ['id' => 30, 'name' => '星辰护盾', 'rate' => 30], + ], + 'weight' => 30, + ], + [ + 'name' => '天魔宗太上长老', + 'level' => 95, // 接近化神期 + 'hp' => 30000, + 'patk' => 1500, + 'matk' => 2000, + 'pdef' => 800, + 'mdef' => 1000, + 'exp' => 30000, + 'spirit_stones' => 10000, + 'desc' => '元婴大圆满境界,为了争夺至宝不惜与星宫开战的魔道巨擘。', + 'drops' => [ + ['type' => 'consume', 'name' => '通玄丹', 'quality' => 'legendary', 'rate' => 25, 'heal' => 10000], // 辅助化神 + ['type' => 'quest_item', 'name' => '玄天灵宝(仿)', 'rate' => 100], // 任务道具 + ], + 'spells' => [ + ['id' => 15, 'name' => '逆天魔功', 'rate' => 35], + ['id' => 25, 'name' => '灭世魔云', 'rate' => 35], + ['id' => 28, 'name' => '天魔护盾', 'rate' => 30], + ['id' => 45, 'name' => '魔界降临', 'rate' => 25], + ], + 'weight' => 20, + ], + ], + ], + // ============================================================ + // 第五章:化神期 (Lv.90-100) + // ============================================================ + 14 => [ + 'name' => '昆吾山·玄天殿', + 'min_level' => 95, + 'key_item' => '真魔之气', // 从古魔分身掉落 + 'desc' => '大晋第一险地,上古封印之地。藏有玄天灵宝和真魔之气,是韩立在人界篇的最终战场。', + 'monsters' => [ + [ + 'name' => '古魔分身', + 'level' => 98, + 'hp' => 30000, + 'patk' => 2000, + 'matk' => 2500, + 'pdef' => 1200, + 'mdef' => 1500, + 'exp' => 40000, + 'spirit_stones' => 15000, + 'desc' => '被封印在上古法阵中的魔界分身,身携真魔之气,极难对付。', + 'drops' => [ + ['type' => 'quest_item', 'name' => '真魔之气', 'rate' => 100], // 任务道具 + ['type' => 'consume', 'name' => '玄天残片', 'rate' => 50, 'heal' => 0], // 炼制玄天灵宝的关键 + ], + 'spells' => [ + ['id' => 15, 'name' => '魔祖之手', 'rate' => 40], + ['id' => 35, 'name' => '真魔领域', 'rate' => 30], // 减益光环 + ], + 'weight' => 50, + ], + [ + 'name' => '冰凤残魂', + 'level' => 100, + 'hp' => 40000, + 'patk' => 1800, + 'matk' => 3000, + 'pdef' => 1500, + 'mdef' => 2000, + 'exp' => 60000, + 'spirit_stones' => 25000, + 'desc' => '上古神兽冰凤的残魂,实力在古魔分身之上,掌握冰系法则之力。', + 'drops' => [ + ['type' => 'weapon', 'name' => '冰魄神光', 'quality' => 'legendary', 'matk' => 600, 'rate' => 25], + ['type' => 'consume', 'name' => '涅槃果', 'rate' => 30, 'heal' => 15000], + ], + 'spells' => [ + ['id' => 25, 'name' => '冰凤风暴', 'rate' => 50], + ['id' => 33, 'name' => '极寒禁锢', 'rate' => 30], + ], + 'weight' => 35, + ], + [ + 'name' => '玄天魔祖(主意识)', // 人界篇最终BOSS + 'level' => 105, // 接近飞升 + 'hp' => 80000, + 'patk' => 3500, + 'matk' => 4500, + 'pdef' => 2500, + 'mdef' => 3000, + 'exp' => 100000, + 'spirit_stones' => 50000, + 'desc' => '自上古时期被封印的魔界至尊,是韩立在人界遇到的最强大敌人。', + 'drops' => [ + ['type' => 'consume', 'name' => '九转还魂丹', 'quality' => 'legendary', 'rate' => 20, 'heal' => 50000], + ['type' => 'consume', 'name' => '飞升灵符', 'quality' => 'legendary', 'rate' => 100], // 飞升上界的必要道具 + ], + 'spells' => [ + ['id' => 15, 'name' => '裂空爪', 'rate' => 40], + ['id' => 25, 'name' => '寂灭神雷', 'rate' => 30], + ['id' => 35, 'name' => '魔魂附体', 'rate' => 20], // 永久属性提升 + ['id' => 12, 'name' => '绝世斩杀', 'rate' => 25], + ], + 'weight' => 15, + ], + ], + ], +]; + diff --git a/src/Entities/Item.php b/src/Entities/Item.php index 5ad0e0c..d206806 100644 --- a/src/Entities/Item.php +++ b/src/Entities/Item.php @@ -1,4 +1,5 @@ '物攻', + 'matk' => '魔攻', + 'pdef' => '物防', + 'mdef' => '魔防', + 'hp' => '生命值', + 'crit' => '暴击率', + 'critdmg' => '暴击伤害', + ]; /** * Generate a random item of the given type and level. */ - public static function randomItem(string $type, int $level = 1, ?string $specificName = null): array + public static function randomItem(array $data, int $level = 1): array { - // Load data - static $data = null; - if ($data === null) { - $data = require __DIR__ . '/../../src/Data/items.php'; - } // 品质对照表 $qualityConfig = [ - 'common' => ['affixes' => 0, 'index' => 0], - 'rare' => ['affixes' => 1, 'index' => 1], - 'epic' => ['affixes' => 2, 'index' => 2], + 'common' => ['affixes' => 0, 'index' => 0], + 'rare' => ['affixes' => 1, 'index' => 1], + 'epic' => ['affixes' => 2, 'index' => 2], 'legendary' => ['affixes' => 3, 'index' => 3], ]; // 随机品质 $roll = rand(1, 100); // $roll = 100; - if ($roll <= 70) $quality = 'common'; - elseif ($roll <= 90) $quality = 'rare'; - elseif ($roll <= 98) $quality = 'epic'; - else $quality = 'legendary'; + if ($roll <= 70) $quality = 'common'; + elseif ($roll <= 90) $quality = 'rare'; + elseif ($roll <= 98) $quality = 'epic'; + else $quality = 'legendary'; $item = new self(); - $item->type = $type; + $item->type = $data['type']; $item->quality = $quality; $item->level = $level; $affixCount = $qualityConfig[$quality]['affixes']; $qualityIndex = $qualityConfig[$quality]['index']; - $typeConfig = $data['types'][$type] ?? null; - if (!$typeConfig) { - $item->name = '未知物品'; - $item->desc = '未知'; - return $item->toArray(); - } - - $names = $typeConfig['names'] ?? ['未知物品']; - - if ($specificName !== null && in_array($specificName, $names)) { - $item->name = $specificName; - } else { - $item->name = $names[array_rand($names)]; - } + $item->name = $data['names'] ?? $data['name']; // 初始化属性 $item->patk = 0; @@ -83,79 +74,64 @@ class Item $item->crit = 0; $item->critdmg = 0; - if ($type === 'consume') { - $baseStats = $typeConfig['base_stats'] ?? [0,0,0,0]; - $growth = $typeConfig['growth'] ?? 0; - $item->heal = $baseStats[$qualityIndex] + ($level * $growth) + rand(0, 10); - $item->desc = "Lv.{$level} {$quality}品质的药剂"; - } else { - // 检查是否有特定物品配置 + + // 检查是否有特定物品配置 // dd($typeConfig); - $specificConfig = $typeConfig['specific_config'][$item->name] ?? []; - - // 合并配置:优先使用特定配置,否则使用默认配置 - $fixedPrimaries = $specificConfig['fixed_primary'] ?? $typeConfig['fixed_primary'] ?? []; - $randomPool = $specificConfig['random_primary_pool'] ?? $typeConfig['random_primary_pool'] ?? []; - $randomCountConfig = $typeConfig['random_primary_count'][$quality] ?? [0, 0]; + $specificConfig = $data; - // 1. 固定主属性 - foreach ($fixedPrimaries as $statKey => $statConfig) { - $baseValue = $statConfig['base'][$qualityIndex]; - $growth = $statConfig['growth']; - $randomBonus = rand(0, max(1, (int)($baseValue * 0.15))); - $finalValue = (int)($baseValue + ($level * $growth) + $randomBonus); - $item->$statKey = $finalValue; - } + // 合并配置:优先使用特定配置,否则使用默认配置 + $fixedPrimaries = $specificConfig['fixed_primary'] ?? $typeConfig['fixed_primary'] ?? []; + $randomPool = $specificConfig['random_primary_pool'] ?? $typeConfig['random_primary_pool'] ?? []; + $randomCountConfig = $typeConfig['random_primary_count'][$quality] ?? [0, 0]; - // 2. 随机主属性 - if (!empty($randomPool)) { - [$minCount, $maxCount] = $randomCountConfig; - $randomCount = rand($minCount, $maxCount); - - if ($randomCount > 0) { - $selectedRandoms = []; - $availableStats = $randomPool; - - for ($i = 0; $i < $randomCount && !empty($availableStats); $i++) { - $weights = []; - foreach ($availableStats as $statKey => $statConfig) { - $weights[$statKey] = $statConfig['weight']; - } - $selectedStat = self::weightedRandom($weights); - $selectedRandoms[] = $selectedStat; - unset($availableStats[$selectedStat]); - } - - foreach ($selectedRandoms as $statKey) { - $statConfig = $randomPool[$statKey]; - $baseValue = $statConfig['base'][$qualityIndex]; - $growth = $statConfig['growth']; - $randomBonus = rand(0, max(1, (int)($baseValue * 0.15))); - $finalValue = (int)($baseValue + ($level * $growth) + $randomBonus); - $item->$statKey += $finalValue; - } - } - } - - $item->desc = "Lv.{$level} {$quality}品质的" . match($type) { - 'weapon' => '武器', - 'armor' => '防具', - 'boots' => '鞋子', - 'ring' => '戒指', - 'necklace' => '项链', - default => '装备' - }; + // 1. 固定主属性 + foreach ($fixedPrimaries as $statKey => $statConfig) { + $baseValue = $statConfig['base'][$qualityIndex]; + $growth = $statConfig['growth']; + $randomBonus = rand(0, max(1, (int)($baseValue * 0.15))); + $finalValue = (int)($baseValue + ($level * $growth) + $randomBonus); + $item->$statKey = $finalValue; } + // 2. 随机主属性 + if (!empty($randomPool)) { + [$minCount, $maxCount] = $randomCountConfig; + $randomCount = rand($minCount, $maxCount); + + if ($randomCount > 0) { + $selectedRandoms = []; + $availableStats = $randomPool; + + for ($i = 0; $i < $randomCount && !empty($availableStats); $i++) { + $weights = []; + foreach ($availableStats as $statKey => $statConfig) { + $weights[$statKey] = $statConfig['weight']; + } + $selectedStat = self::weightedRandom($weights); + $selectedRandoms[] = $selectedStat; + unset($availableStats[$selectedStat]); + } + + foreach ($selectedRandoms as $statKey) { + $statConfig = $randomPool[$statKey]; + $baseValue = $statConfig['base'][$qualityIndex]; + $growth = $statConfig['growth']; + $randomBonus = rand(0, max(1, (int)($baseValue * 0.15))); + $finalValue = (int)($baseValue + ($level * $growth) + $randomBonus); + $item->$statKey += $finalValue; + } + } + } + + $item->desc = $data['desc'] ?? ''; + // 3. 词条 - $affixNames = $data['affix_definitions']; - $affixWeights = $typeConfig['affix_weights'] ?? []; + $affixNames = self::affix_definitions; + $affixWeights = $data['affix_weights'] ?? []; $item->affixes = []; $selectedAffixes = []; for ($i = 0; $i < $affixCount; $i++) { - if ($type == 'consume') break; - if (empty($affixWeights)) break; $availableWeights = array_diff_key($affixWeights, array_flip($selectedAffixes)); if (empty($availableWeights)) break; @@ -170,7 +146,7 @@ class Item $v = $base + floor($level / 3); $item->affixes[] = "{$affixNames[$key]} +{$v}%"; } else { - $qualityMultiplier = match($quality) { + $qualityMultiplier = match ($quality) { 'legendary' => 2.0, 'epic' => 1.5, 'rare' => 1.2, @@ -178,7 +154,7 @@ class Item }; $base = rand(2, 8); - $multiplier = match($key) { + $multiplier = match ($key) { 'patk' => 1.5, 'matk' => 1.5, 'pdef' => 1.0, @@ -209,22 +185,8 @@ class Item public static function createFromSpec(array $spec, int $baseLevel): array { - $type = $spec['type'] ?? 'weapon'; $itemLevel = $spec['level'] ?? $baseLevel; - $specificName = $spec['name'] ?? null; - - $item = self::randomItem($type, $itemLevel, $specificName); - - - - // Allow overriding specific stats if provided in spec (e.g. from maps.php drops) - foreach (['patk', 'matk', 'pdef', 'mdef', 'hp', 'crit', 'critdmg'] as $stat) { - if (isset($spec[$stat])) { - $item[$stat] = $spec[$stat]; - } - } - - return $item; + return self::randomItem($spec, $itemLevel); } public static function createFromSpecWithConfig(array $spec, int $baseLevel): array @@ -293,7 +255,7 @@ class Item } // 品质映射到数组索引 (common=0, rare=1, epic=2, legendary=3) - $qualityIndex = match($quality) { + $qualityIndex = match ($quality) { 'common' => 0, 'rare' => 1, 'epic' => 2, @@ -368,34 +330,42 @@ class Item public function toArray(): array { return [ - 'name' => $this->name, - 'type' => $this->type, + 'name' => $this->name, + 'type' => $this->type, 'quality' => $this->quality, - 'level' => $this->level, - 'patk' => $this->patk, - 'matk' => $this->matk, - 'pdef' => $this->pdef, - 'mdef' => $this->mdef, - 'hp' => $this->hp, - 'crit' => $this->crit, + 'level' => $this->level, + 'patk' => $this->patk, + 'matk' => $this->matk, + 'pdef' => $this->pdef, + 'mdef' => $this->mdef, + 'hp' => $this->hp, + 'crit' => $this->crit, 'critdmg' => $this->critdmg, - 'heal' => $this->heal, + 'heal' => $this->heal, 'affixes' => $this->affixes ?? [], - 'desc' => $this->desc, + 'desc' => $this->desc, ]; } public static function calculateSellPrice(array $item): int { if (($item['type'] ?? '') === 'consume') { - $basePrice = match($item['quality'] ?? 'common') { - 'common' => 1, 'rare' => 3, 'epic' => 8, 'legendary' => 20, default => 1 + $basePrice = match ($item['quality'] ?? 'common') { + 'common' => 1, + 'rare' => 3, + 'epic' => 8, + 'legendary' => 20, + default => 1 }; return (int)($basePrice + ($item['level'] ?? 1) * 0.5); } - $basePrice = match($item['quality'] ?? 'common') { - 'common' => 5, 'rare' => 15, 'epic' => 40, 'legendary' => 100, default => 5 + $basePrice = match ($item['quality'] ?? 'common') { + 'common' => 5, + 'rare' => 15, + 'epic' => 40, + 'legendary' => 100, + default => 5 }; $levelBonus = $basePrice * ($item['level'] ?? 1) * 0.1; @@ -414,4 +384,18 @@ class Item return max(1, (int)($basePrice + $levelBonus + $statBonus + $affixBonus)); } + + public static function createConsume(mixed $spec, mixed $level) + { + return [ + 'id' => uniqid('consume_'), + 'type' => 'quest_item', + 'name' => $spec['name'], + 'quality' => $spec['quality'] ?? 'common', + 'heal' => $spec['heal'] ?? 100, + 'level' => $level, + 'quantity' => 1, + 'desc' => $spec['desc'] ?? '', + ]; + } } diff --git a/src/Entities/Monster.php b/src/Entities/Monster.php index 9ee6c06..1d41737 100644 --- a/src/Entities/Monster.php +++ b/src/Entities/Monster.php @@ -22,7 +22,7 @@ class Monster extends Actor // Load data static $maps = null; if ($maps === null) { - $maps = require __DIR__ . '/../../src/Data/maps.php'; + $maps = require __DIR__ . '/../../src/Data/map_new.php'; } $monster = new self(); @@ -151,7 +151,7 @@ class Monster extends Actor } // Drops & Equipment & Spells $drops = $config['drops'] ?? []; - $index = $dungeonId * 5 -1; + $index = ($dungeonId - 1) * 5; $drops_eq = array_slice($allItems,$index,5); $drops = array_merge($drops,$drops_eq); foreach ($drops as $drop) { @@ -171,7 +171,7 @@ class Monster extends Actor if ($type === 'consume') { $spec = $drop; unset($spec['rate']); - $item = Item::createFromSpec($spec, $this->level); + $item = Item::createConsume($spec, $this->level); $this->dropTable[] = [ 'item' => $item, 'rate' => $rate, diff --git a/test/Test.php b/test/Test.php index 1f560dd..3ee5f86 100644 --- a/test/Test.php +++ b/test/Test.php @@ -4,7 +4,7 @@ use Game\Entities\Item; require __DIR__ . '/../vendor/autoload.php'; -$monster = \Game\Entities\Monster::create(1); +$monster = \Game\Entities\Monster::create(10); dd($monster->equip);