diff --git a/save.json b/save.json index 76f85e1..a9f972f 100644 --- a/save.json +++ b/save.json @@ -1 +1 @@ -{"player":{"hp":100,"maxHp":100,"patk":10,"matk":10,"pdef":10,"mdef":10,"crit":0,"critdmg":110,"level":1,"exp":0,"potionPool":900,"maxExp":100,"inventory":[],"equip":[],"spiritStones":0,"npcFlags":[],"talentPoints":0,"talents":{"hp":0,"patk":0,"matk":0,"pdef":0,"mdef":0,"crit":0,"critdmg":0},"mana":60,"maxMana":60,"skillSlots":{"skill1":null,"skill2":null,"skill3":null,"skill4":null},"partners":[{"id":"li_feiyu","name":"厉飞雨","level":1,"exp":0,"maxExp":201,"equip":[],"talents":{"hp":0,"patk":0,"matk":0,"pdef":0,"mdef":0,"crit":0,"critdmg":0},"talentWeights":{"hp":1,"patk":3,"matk":1,"pdef":1,"mdef":1,"crit":3,"critdmg":2},"mana":60,"maxMana":100,"skillSlots":{"skill1":null,"skill2":null,"skill3":null,"skill4":null},"hp":100,"maxHp":100,"patk":15,"matk":5,"pdef":5,"mdef":3,"crit":10,"critdmg":130}]},"dungeonId":1,"state":4} \ No newline at end of file +{"player":{"hp":121,"maxHp":100,"patk":10,"matk":10,"pdef":10,"mdef":10,"crit":0,"critdmg":110,"level":4,"exp":335,"potionPool":0,"maxExp":564,"inventory":[{"id":"69398040b7884","type":"spell","name":"罗烟步(伪)","quality":"common","level":1,"spellId":11,"enhanceLevel":0,"calc_type":"patk","cost":20,"spellType":"damage_single","desc":"旋转剑刃造成锋利的伤害","heal_ratio":0,"damage_ratio":1.1,"heal_base":0,"crit_bonus":0,"crit_dmg_bonus":0,"enemy_count_bonus":0,"dispersion":1,"team_bonus":0,"priority_bonus":0,"base":23,"growth":0.7,"quantity":1},{"name":"聚元坠","type":"necklace","enhanceLevel":0,"quality":"common","level":1,"patk":0,"matk":0,"pdef":0,"mdef":0,"hp":25,"crit":0,"critdmg":0,"affixes":[],"desc":"小幅度增加真元(Matk\/HP替代),侧重魔攻和暴伤。","id":"69398056b5317","quantity":1},{"name":"聚元坠","type":"necklace","enhanceLevel":0,"quality":"common","level":1,"patk":0,"matk":0,"pdef":0,"mdef":0,"hp":22,"crit":0,"critdmg":0,"affixes":[],"desc":"小幅度增加真元(Matk\/HP替代),侧重魔攻和暴伤。","id":"693980efb7fad","quantity":1},{"name":"汇灵戒","type":"ring","enhanceLevel":0,"quality":"common","level":1,"patk":0,"matk":0,"pdef":0,"mdef":0,"hp":0,"crit":7,"critdmg":0,"affixes":[],"desc":"用于聚集灵气,均衡提升双攻和暴击。","id":"693980f3d3d23","quantity":1},{"id":"693980fe0335f","type":"spell","name":"罗烟步(伪)","quality":"common","level":1,"spellId":11,"enhanceLevel":0,"calc_type":"patk","cost":20,"spellType":"damage_single","desc":"旋转剑刃造成锋利的伤害","heal_ratio":0,"damage_ratio":1.1,"heal_base":0,"crit_bonus":0,"crit_dmg_bonus":0,"enemy_count_bonus":0,"dispersion":1,"team_bonus":0,"priority_bonus":0,"base":27,"growth":0.7,"quantity":1},{"name":"七玄剑","type":"weapon","enhanceLevel":0,"quality":"rare","level":1,"patk":4,"matk":9,"pdef":0,"mdef":0,"hp":0,"crit":0,"critdmg":6,"affixes":["暴击率 +4"],"desc":"七玄门制式飞剑\/武器,双攻均衡,成长性优于凡人武者。","id":"69398116aef29","quantity":1},{"name":"七玄剑","type":"weapon","enhanceLevel":0,"quality":"common","level":1,"patk":5,"matk":3,"pdef":0,"mdef":0,"hp":0,"crit":0,"critdmg":0,"affixes":[],"desc":"七玄门制式飞剑\/武器,双攻均衡,成长性优于凡人武者。","id":"69398120d2121","quantity":1},{"name":"七玄剑","type":"weapon","enhanceLevel":0,"quality":"common","level":1,"patk":5,"matk":7,"pdef":0,"mdef":0,"hp":0,"crit":0,"critdmg":0,"affixes":[],"desc":"七玄门制式飞剑\/武器,双攻均衡,成长性优于凡人武者。","id":"6939813eef4ef","quantity":1},{"id":"693988189595a","type":"spell","name":"罗烟步(伪)","quality":"common","level":1,"spellId":11,"enhanceLevel":0,"calc_type":"patk","cost":20,"spellType":"damage_single","desc":"旋转剑刃造成锋利的伤害","heal_ratio":0,"damage_ratio":1.1,"heal_base":0,"crit_bonus":0,"crit_dmg_bonus":0,"enemy_count_bonus":0,"dispersion":1,"team_bonus":0,"priority_bonus":0,"base":23,"growth":0.7,"quantity":1},{"id":"69398821e7570","type":"spell","name":"罗烟步(伪)","quality":"common","level":1,"spellId":11,"enhanceLevel":0,"calc_type":"patk","cost":20,"spellType":"damage_single","desc":"旋转剑刃造成锋利的伤害","heal_ratio":0,"damage_ratio":1.1,"heal_base":0,"crit_bonus":0,"crit_dmg_bonus":0,"enemy_count_bonus":0,"dispersion":1,"team_bonus":0,"priority_bonus":0,"base":22,"growth":0.7,"quantity":1},{"id":"6939885f1787b","type":"spell","name":"罗烟步(伪)","quality":"common","level":1,"spellId":11,"enhanceLevel":0,"calc_type":"patk","cost":20,"spellType":"damage_single","desc":"旋转剑刃造成锋利的伤害","heal_ratio":0,"damage_ratio":1.1,"heal_base":0,"crit_bonus":0,"crit_dmg_bonus":0,"enemy_count_bonus":0,"dispersion":1,"team_bonus":0,"priority_bonus":0,"base":29,"growth":0.7,"quantity":1},{"id":"6939886332777","type":"spell","name":"罗烟步(伪)","quality":"rare","level":1,"spellId":11,"enhanceLevel":0,"calc_type":"patk","cost":20,"spellType":"damage_single","desc":"旋转剑刃造成锋利的伤害","heal_ratio":0,"damage_ratio":1.5,"heal_base":0,"crit_bonus":0,"crit_dmg_bonus":0,"enemy_count_bonus":0,"dispersion":1,"team_bonus":0,"priority_bonus":0,"base":44,"growth":0.9,"quantity":1},{"id":"6939887b19573","type":"spell","name":"罗烟步(伪)","quality":"common","level":1,"spellId":11,"enhanceLevel":0,"calc_type":"patk","cost":20,"spellType":"damage_single","desc":"旋转剑刃造成锋利的伤害","heal_ratio":0,"damage_ratio":1.1,"heal_base":0,"crit_bonus":0,"crit_dmg_bonus":0,"enemy_count_bonus":0,"dispersion":1,"team_bonus":0,"priority_bonus":0,"base":24,"growth":0.7,"quantity":1},{"name":"七玄剑","type":"weapon","enhanceLevel":0,"quality":"rare","level":1,"patk":4,"matk":6,"pdef":0,"mdef":0,"hp":0,"crit":3,"critdmg":0,"affixes":["暴击率 +4"],"desc":"七玄门制式飞剑\/武器,双攻均衡,成长性优于凡人武者。","id":"69398a4eea338","quantity":1},{"id":"69398b458c275","type":"spell","name":"罗烟步(伪)","quality":"common","level":1,"spellId":11,"enhanceLevel":0,"calc_type":"patk","cost":20,"spellType":"damage_single","desc":"旋转剑刃造成锋利的伤害","heal_ratio":0,"damage_ratio":1.1,"heal_base":0,"crit_bonus":0,"crit_dmg_bonus":0,"enemy_count_bonus":0,"dispersion":1,"team_bonus":0,"priority_bonus":0,"base":19,"growth":0.7,"quantity":1},{"id":"69398b6f5ee30","type":"spell","name":"罗烟步(伪)","quality":"common","level":1,"spellId":11,"enhanceLevel":0,"calc_type":"patk","cost":20,"spellType":"damage_single","desc":"旋转剑刃造成锋利的伤害","heal_ratio":0,"damage_ratio":1.1,"heal_base":0,"crit_bonus":0,"crit_dmg_bonus":0,"enemy_count_bonus":0,"dispersion":1,"team_bonus":0,"priority_bonus":0,"base":21,"growth":0.7,"quantity":1}],"equip":{"ring":{"name":"汇灵戒","type":"ring","enhanceLevel":0,"quality":"epic","level":1,"patk":0,"matk":0,"pdef":0,"mdef":0,"hp":0,"crit":4,"critdmg":3,"affixes":["物攻 +4%","暴击伤害 +3"],"desc":"用于聚集灵气,均衡提升双攻和暴击。","id":"69398116aef24","quantity":1},"weapon":{"name":"七玄剑","type":"weapon","enhanceLevel":0,"quality":"epic","level":1,"patk":6,"matk":14,"pdef":0,"mdef":0,"hp":0,"crit":0,"critdmg":7,"affixes":["暴击伤害 +3%","暴击率 +5%"],"desc":"七玄门制式飞剑\/武器,双攻均衡,成长性优于凡人武者。","id":"69398109d3feb","quantity":1},"armor":{"name":"七玄内甲","type":"armor","enhanceLevel":0,"quality":"common","level":1,"patk":0,"matk":0,"pdef":0,"mdef":0,"hp":12,"crit":0,"critdmg":0,"affixes":[],"desc":"门派内甲,提供均衡的双防和可靠的生命值。","id":"693980103591a","quantity":1},"necklace":{"name":"聚元坠","type":"necklace","enhanceLevel":0,"quality":"common","level":1,"patk":0,"matk":0,"pdef":0,"mdef":0,"hp":11,"crit":0,"critdmg":0,"affixes":[],"desc":"小幅度增加真元(Matk\/HP替代),侧重魔攻和暴伤。","id":"6939805181036","quantity":1},"boots":{"name":"云纹靴","type":"boots","enhanceLevel":0,"quality":"common","level":1,"patk":0,"matk":0,"pdef":0,"mdef":0,"hp":23,"crit":0,"critdmg":0,"affixes":[],"desc":"带有轻身符文的靴子,提供基础双防和一定暴击(代表身法)。","id":"693980518103b","quantity":1}},"spiritStones":8,"npcFlags":[],"talentPoints":0,"talents":{"hp":9,"patk":0,"matk":0,"pdef":0,"mdef":0,"crit":0,"critdmg":0},"mana":60,"maxMana":60,"skillSlots":{"skill1":null,"skill2":null,"skill3":null,"skill4":null},"partners":[{"id":"li_feiyu","name":"厉飞雨","level":3,"exp":347,"maxExp":427,"equip":{"weapon":{"name":"七玄剑","type":"weapon","enhanceLevel":0,"quality":"common","level":1,"patk":8,"matk":5,"pdef":0,"mdef":0,"hp":0,"crit":0,"critdmg":0,"affixes":[],"desc":"七玄门制式飞剑\/武器,双攻均衡,成长性优于凡人武者。","id":"693980f3d3d1f","quantity":1},"armor":{"name":"七玄内甲","type":"armor","enhanceLevel":0,"quality":"common","level":1,"patk":0,"matk":0,"pdef":0,"mdef":0,"hp":26,"crit":0,"critdmg":0,"affixes":[],"desc":"门派内甲,提供均衡的双防和可靠的生命值。","id":"6939815025037","quantity":1},"boots":{"name":"云纹靴","type":"boots","enhanceLevel":0,"quality":"common","level":1,"patk":0,"matk":0,"pdef":0,"mdef":0,"hp":15,"crit":0,"critdmg":0,"affixes":[],"desc":"带有轻身符文的靴子,提供基础双防和一定暴击(代表身法)。","id":"69398120d2124","quantity":1},"ring":{"name":"汇灵戒","type":"ring","enhanceLevel":0,"quality":"common","level":1,"patk":0,"matk":0,"pdef":0,"mdef":0,"hp":0,"crit":3,"critdmg":0,"affixes":[],"desc":"用于聚集灵气,均衡提升双攻和暴击。","id":"6939802ac971a","quantity":1},"necklace":{"name":"聚元坠","type":"necklace","enhanceLevel":0,"quality":"rare","level":1,"patk":0,"matk":0,"pdef":0,"mdef":0,"hp":33,"crit":0,"critdmg":0,"affixes":["生命值 +3%"],"desc":"小幅度增加真元(Matk\/HP替代),侧重魔攻和暴伤。","id":"6939812b012a4","quantity":1}},"talents":{"hp":2,"patk":2,"matk":0,"pdef":0,"mdef":0,"crit":2,"critdmg":0},"talentWeights":{"hp":1,"patk":3,"matk":1,"pdef":1,"mdef":1,"crit":3,"critdmg":2},"mana":100,"maxMana":100,"skillSlots":{"skill1":null,"skill2":null,"skill3":null,"skill4":null},"hp":-1,"maxHp":100,"patk":15,"matk":5,"pdef":5,"mdef":3,"crit":10,"critdmg":130}]},"dungeonId":1,"state":0} \ No newline at end of file diff --git a/src/Core/SpellCalculator.php b/src/Core/SpellCalculator.php new file mode 100644 index 0000000..c721744 --- /dev/null +++ b/src/Core/SpellCalculator.php @@ -0,0 +1,183 @@ + int, 'isCrit' => bool, 'baseDamage' => int, 'multiplier' => float] + */ + public static function calculateDamage(array $spellInfo, array $attackerStats, array $defenderStats, int $bonus = 0, bool $isAoe = false): array + { + + + // 基础倍率 + $baseMultiplier = $spellInfo['damage_ratio'] ?? ($spellInfo['damage'] ?? 1.0); + + // 实际倍率 (含强化加成) + $actualMultiplier = $baseMultiplier * (1 + $bonus / 100); + + // 计算方式 + $calcType = $spellInfo['calc_type'] ?? 'matk'; + + // 基础伤害 (根据 calc_type) + switch ($calcType) { + case 'patk': + $baseDamage = (int)($attackerStats['patk'] * $actualMultiplier); + break; + case 'hybrid': + // 取魔攻与物攻的平均值 + $combined = ($attackerStats['matk'] + $attackerStats['patk']) / 2; + $baseDamage = (int)($combined * $actualMultiplier); + break; + case 'low_def_bonus': + // 对低防御目标额外加成 20% + $baseDamage = (int)($attackerStats['matk'] * $actualMultiplier); + $def = $defenderStats['pdef'] ?? 0; + if ($def < 5) { + $baseDamage = (int)($baseDamage * 1.2); + } + break; + case 'matk_scaled': + // 根据敌人数加成,假设 spellInfo 包含 enemy_count_bonus (每个敌人加成比例) 和 enemy_count + $baseDamage = (int)($attackerStats['matk'] * $actualMultiplier); + if (isset($spellInfo['enemy_count_bonus'])) { + $bonusPct = $spellInfo['enemy_count_bonus']; + $enemyCount = $spellInfo['enemy_count'] ?? 1; + $baseDamage = (int)($baseDamage * (1 + $bonusPct * $enemyCount)); + } + break; + case 'hp_percent': + // 基于目标最大生命值的百分比 + $baseDamage = (int)(($defenderStats['maxHp'] ?? 0) * $actualMultiplier); + break; + case 'defense': + // 基于目标防御属性 (物防+魔防) + $defSum = ($defenderStats['pdef'] ?? 0) + ($defenderStats['mdef'] ?? 0); + $baseDamage = (int)($defSum * $actualMultiplier); + break; + case 'crit_damage': + // 使用物攻作为基础,后续在暴击阶段乘以暴击系数 + $baseDamage = (int)($attackerStats['patk'] * $actualMultiplier); + break; + case 'crit_aoe': + // 同 crit_damage,AOE 暴击率已在上层处理 + $baseDamage = (int)($attackerStats['patk'] * $actualMultiplier); + break; + case 'dispersed_damage': + // 基于魔攻,乘以分散系数 (spellInfo['dispersion']) + $baseDamage = (int)($attackerStats['matk'] * $actualMultiplier); + if (isset($spellInfo['dispersion'])) { + $baseDamage = (int)($baseDamage * $spellInfo['dispersion']); + } + break; + default: + // 默认使用魔攻 + $baseDamage = (int)($attackerStats['matk'] * $actualMultiplier); + } + + $baseDamage += ($spellInfo['base'] ?? 0) * $spellInfo['enhanceLevel']; + + // 计算防御减免 + $resistance = $defenderStats['mdef'] ?? 0; + $damage = max(1, $baseDamage - $resistance); + + // 暴击计算 + $critRate = $attackerStats['crit'] ?? 0; + if ($isAoe) { + $critRate /= 2; // AOE 暴击率减半 + } + + $isCrit = rand(1, 100) <= $critRate; + if ($isCrit) { + $critDmg = $attackerStats['critdmg'] ?? 150; + $damage = (int)($damage * ($critDmg / 100)); + } + + return [ + 'damage' => $damage, + 'isCrit' => $isCrit, + 'baseDamage' => $baseDamage, + 'multiplier' => $baseMultiplier // 返回基础倍率用于显示 + ]; + } + + /** + * 计算治疗量 + */ + public static function calculateHeal(array $spellInfo, array $casterStats, int $bonus = 0): int + { + // 计算方式 + $calcType = $spellInfo['calc_type'] ?? 'matk'; + $healRatio = $spellInfo['heal'] ?? 0.5; + $healBase = $spellInfo['base'] ?? 0; + + // 基础治疗量 (根据 calc_type) + switch ($calcType) { + case 'patk': + $healAmount = (int)($casterStats['patk'] * $healRatio + $healBase); + break; + case 'hybrid': + $combined = ($casterStats['matk'] + $casterStats['patk']) / 2; + $healAmount = (int)($combined * $healRatio + $healBase); + break; + case 'defense': + $defSum = ($casterStats['pdef'] ?? 0) + ($casterStats['mdef'] ?? 0); + $healAmount = (int)($defSum * $healRatio + $healBase); + break; + case 'hp_percent': + $healAmount = (int)($casterStats['maxHp'] * $healRatio + $healBase); + break; + case 'team_sync': + $teamSize = $spellInfo['team_size'] ?? 1; + $teamBonus = $spellInfo['team_bonus'] ?? 0; + $healAmount = (int)($casterStats['matk'] * $healRatio + $healBase); + $healAmount = (int)($healAmount * (1 + $teamBonus * $teamSize)); + break; + case 'smart_heal': + // 智能治疗,先按魔攻计算,后续在 Battle 中会选择低血量目标 + $healAmount = (int)($casterStats['matk'] * $healRatio + $healBase); + break; + case 'crit_heal': + $healAmount = (int)($casterStats['matk'] * $healRatio + $healBase); + $critRate = $casterStats['crit'] ?? 0; + $isCrit = rand(1, 100) <= $critRate; + if ($isCrit) { + $critDmg = $casterStats['critdmg'] ?? 150; + $healAmount = (int)($healAmount * ($critDmg / 100)); + } + break; + default: + $healAmount = (int)($casterStats['matk'] * $healRatio + $healBase); + break; + } + + // 应用强化加成 + return (int)($healAmount * (1 + $bonus / 100)); + } + + /** + * 根据品质获取数组索引 + */ + public static function getQualityIndex(string $quality): int + { + return match($quality) { + 'common' => 0, + 'rare' => 1, + 'epic' => 2, + 'legendary' => 3, + default => 0, + }; + } +} diff --git a/src/Data/items_new.json b/src/Data/items_new.json index b2e8b51..77ea2ce 100644 --- a/src/Data/items_new.json +++ b/src/Data/items_new.json @@ -1,352 +1,380 @@ [ - { - "name": "七玄剑", - "desc": "七玄门制式飞剑\/武器,双攻均衡,成长性优于凡人武者。", - "type": "weapon" - }, - { - "name": "七玄内甲", - "desc": "门派内甲,提供均衡的双防和可靠的生命值。", - "type": "armor" - }, - { - "name": "云纹靴", - "desc": "带有轻身符文的靴子,提供基础双防和一定暴击(代表身法)。", - "type": "boots" - }, - { - "name": "汇灵戒", - "desc": "用于聚集灵气,均衡提升双攻和暴击。", - "type": "ring" - }, - { - "name": "聚元坠", - "desc": "小幅度增加真元(Matk\/HP替代),侧重魔攻和暴伤。", - "type": "necklace" - }, - { - "name": "杂法剑", - "desc": "品质不高的混合型法剑,双攻都有但都不突出,体现了低阶修仙者装备的杂乱。", - "type": "weapon" - }, - { - "name": "粗布防护衣", - "desc": "基础防御服饰,略微提升双防和生命值,但防御数值较低。", - "type": "armor" - }, - { - "name": "简陋皮靴", - "desc": "普通的皮靴,属性极其基础,无明显偏向。", - "type": "boots" - }, - { - "name": "铁制储物戒 (弱)", - "desc": "低阶修仙者拥有的最低级的储物法器,属性附加聊胜于无。", - "type": "ring" - }, - { - "name": "劣质符箓坠", - "desc": "以失败符箓外壳制作,提供微弱的防御和生命。", - "type": "necklace" - }, - { - "name": "嗜血镰刀", - "desc": "禁地内常用的法器,魔攻高,暴击属性极强,利于收割。", - "type": "weapon" - }, - { - "name": "血影法袍", - "desc": "禁地内修士常用的法袍,提供高魔防和生命值。", - "type": "armor" - }, - { - "name": "疾遁靴", - "desc": "用于逃跑和追击,侧重暴击率(身法)和防御。", - "type": "boots" - }, - { - "name": "杀戮指环", - "desc": "将禁地内杀戮之气转化为自身暴击和魔攻。", - "type": "ring" - }, - { - "name": "血晶坠", - "desc": "以妖兽精血结晶炼制,大幅提升暴击伤害。", - "type": "necklace" - }, - { - "name": "嗜血镰刀", - "desc": "禁地内常用的法器,魔攻高,暴击属性极强,利于收割。", - "type": "weapon" - }, - { - "name": "血影法袍", - "desc": "禁地内修士常用的法袍,提供高魔防和生命值。", - "type": "armor" - }, - { - "name": "疾遁靴", - "desc": "用于逃跑和追击,侧重暴击率(身法)和防御。", - "type": "boots" - }, - { - "name": "杀戮指环", - "desc": "将禁地内杀戮之气转化为自身暴击和魔攻。", - "type": "ring" - }, - { - "name": "血晶坠", - "desc": "以妖兽精血结晶炼制,大幅提升暴击伤害。", - "type": "necklace" - }, - { - "name": "重铸铁棍", - "desc": "体修惯用的重型武器,追求极致的物理攻击面板和力量。", - "type": "weapon" - }, - { - "name": "体修软甲", - "desc": "燕家堡制式护甲,高生命值和物防,但魔防薄弱。", - "type": "armor" - }, - { - "name": "踏地靴", - "desc": "笨重但提供可靠的物防和生命值。", - "type": "boots" - }, - { - "name": "硬化铁环", - "desc": "体修用来增加拳劲的铁环,提升物攻和生存。", - "type": "ring" - }, - { - "name": "血气坠", - "desc": "体修用于凝聚血气,增加生命值和物理攻击。", - "type": "necklace" - }, - { - "name": "玉骨扇 (伪装)", - "desc": "外表儒雅,实则暗藏邪气。魔攻和暴击极高,兼有暗藏的物理攻击(暗器)。", - "type": "weapon" - }, - { - "name": "黑丝软甲 (伪装)", - "desc": "隐藏在常服下的软甲,提供均衡且较高的双防和生命,不易被察觉。", - "type": "armor" - }, - { - "name": "匿行靴", - "desc": "擅长潜行和躲避,侧重暴击率(身法)和防御。", - "type": "boots" - }, - { - "name": "邪煞环", - "desc": "用于聚集邪煞之气,极度强化法术爆发力。", - "type": "ring" - }, - { - "name": "惑心坠 (邪)", - "desc": "专门强化神识和法术伤害,辅助潜伏时的惑心之术。", - "type": "necklace" - }, - { - "name": "灵光镐", - "desc": "既是开采工具,也是自卫法器。魔攻稳定,不追求暴发。", - "type": "weapon" - }, - { - "name": "重型矿袍", - "desc": "为抵御矿道内塌方和邪气设计的重型法袍,提供极高生命值和双防。", - "type": "armor" - }, - { - "name": "防滑靴", - "desc": "矿道内复杂地形的防护靴,侧重防御和生命值。", - "type": "boots" - }, - { - "name": "储灵戒", - "desc": "用于临时储存灵力,主要提升魔攻和生命值。", - "type": "ring" - }, - { - "name": "矿脉石坠", - "desc": "以矿脉伴生矿石炼制,提升生命上限和防御。", - "type": "necklace" - }, - { - "name": "碧涛叉", - "desc": "水属性法器,魔攻稳定,且有较高的生命值加成以应对妖兽围攻。", - "type": "weapon" - }, - { - "name": "水纹软甲", - "desc": "专为水下活动和抵御水系法术设计的软甲,提供极高的魔防。", - "type": "armor" - }, - { - "name": "踏浪履", - "desc": "能在水面或水下快速移动,侧重防御和机动性(暴击\/回避)。", - "type": "boots" - }, - { - "name": "珊瑚戒", - "desc": "以珊瑚精华为基底,提升魔攻和魔防。", - "type": "ring" - }, - { - "name": "海魂坠", - "desc": "凝聚海洋灵气,大幅增加生命值和魔防,增强持久作战能力。", - "type": "necklace" - }, - { - "name": "破禁灵剑", - "desc": "专为破除禁制和应对高阶战斗设计,双攻属性强劲,且有高暴发。", - "type": "weapon" - }, - { - "name": "虚天甲", - "desc": "上古法宝,提供均衡的极高双防,特别是针对阵法和禁制的魔防。", - "type": "armor" - }, - { - "name": "踏虚靴", - "desc": "无视部分重力禁制,提供高机动性(暴击)和防御。", - "type": "boots" - }, - { - "name": "灵禁环", - "desc": "蕴含灵力禁制,均衡提升所有输出属性,同时提供高防御。", - "type": "ring" - }, - { - "name": "定神坠", - "desc": "辅助神识,抵抗心魔和幻术。大幅提升魔攻和暴伤。", - "type": "necklace" - }, - { - "name": "玄水重剑", - "desc": "以深海玄晶炼制,魔攻极高,且提供基础的防御加成。", - "type": "weapon" - }, - { - "name": "深海玄晶甲", - "desc": "专为对抗深海高压和黑暗侵蚀设计。提供极致的物理和魔法防御。", - "type": "armor" - }, - { - "name": "潜渊履", - "desc": "用于深渊活动,提供高双防和魔攻。", - "type": "boots" - }, - { - "name": "镇海环", - "desc": "用于稳定深海环境下的法力输出,提升魔攻和防御。", - "type": "ring" - }, - { - "name": "深渊之核", - "desc": "深渊高阶妖兽核心炼制,提供巨额生命值和魔防,增强续航。", - "type": "necklace" - }, - { - "name": "噬魂幡", - "desc": "鬼灵门核心法器,魔攻高且带有极强的暴击\/暴伤属性,用于收割灵魂。", - "type": "weapon" - }, - { - "name": "幽影黑袍", - "desc": "以阴魂炼制,魔防极高以抵御阴气侵蚀,但物理防护薄弱。", - "type": "armor" - }, - { - "name": "鬼步履", - "desc": "擅长潜行和快速移动,侧重暴击率(身法)和魔防。", - "type": "boots" - }, - { - "name": "阴魂戒", - "desc": "储存阴魂之力,极度强化魔攻和暴击。", - "type": "ring" - }, - { - "name": "炼尸坠", - "desc": "辅助炼尸和鬼道法术,大幅增加魔攻和生命值。", - "type": "necklace" - }, - { - "name": "流云剑", - "desc": "以流云晶石炼制,魔攻极高且稳定,兼有高暴发属性。", - "type": "weapon" - }, - { - "name": "云霞法袍", - "desc": "采用云霞丝炼制,提供高魔防和均衡的物理防护,生命值可靠。", - "type": "armor" - }, - { - "name": "踏风履", - "desc": "以风灵石炼制,提升速度(暴击率)和魔防。", - "type": "boots" - }, - { - "name": "凝神环", - "desc": "用于辅助神识修炼(大衍诀),提升魔攻和暴击。", - "type": "ring" - }, - { - "name": "云峰坠", - "desc": "增加神识强度(Matk),同时增强自身防御力。", - "type": "necklace" - }, - { - "name": "星辰剑", - "desc": "以星辰之力炼制,双攻皆可达到巅峰,同时提供高暴发属性。", - "type": "weapon" - }, - { - "name": "玄黄法袍", - "desc": "顶级防御法袍,提供极致的生命和双防,能够抵抗各系高阶神通。", - "type": "armor" - }, - { - "name": "踏空履", - "desc": "顶尖身法法器,提供高机动性(暴击)和高双防。", - "type": "boots" - }, - { - "name": "聚元灵戒", - "desc": "用于聚集天地元气,均衡提升所有属性。", - "type": "ring" - }, - { - "name": "天星坠", - "desc": "蕴含星辰灵力,增强神识(Matk)和法术暴发。", - "type": "necklace" - }, - { - "name": "玄天灵宝碎片", - "desc": "蕴含玄天之力的顶级法宝残片,双攻和暴发达到人界巅峰。", - "type": "weapon" - }, - { - "name": "真灵护甲", - "desc": "以真灵遗骸伴生物炼制,提供极致的生命值和双防,能够抵抗化神期威压。", - "type": "armor" - }, - { - "name": "化虹靴", - "desc": "蕴含空间之力,提供极高的机动性(暴击)和双防。", - "type": "boots" - }, - { - "name": "五元聚灵环", - "desc": "凝聚五行本源之力,极致均衡地提升所有属性。", - "type": "ring" - }, - { - "name": "玄天神识坠", - "desc": "增强神识,对抗高级心魔和幻境,提供极致的法术暴发。", - "type": "necklace" - } + [ + { + "name": "青锋剑", + "desc": "七玄门江湖利器,锋锐轻快,乃凡人武者梦寐以求的神兵。", + "type": "weapon" + }, + { + "name": "棉铁内甲", + "desc": "以棉花与铁片编织而成的护身软甲,能有效抵御普通刀剑劈砍。", + "type": "armor" + }, + { + "name": "草上飞", + "desc": "轻便的布靴,习武之人常年穿戴,便于施展轻功提纵之术。", + "type": "boots" + }, + { + "name": "掌门指环", + "desc": "七玄门掌门信物,象征凡俗权力,对修仙者而言并无灵力。", + "type": "ring" + }, + { + "name": "平安符", + "desc": "亲人求来的普通符箓,寄托思念,是韩立离家时的随身之物。", + "type": "necklace" + } + ], + [ + { + "name": "飞行符", + "desc": "低阶修士常用代步工具,注入微薄法力即可贴地滑行。", + "type": "weapon" + }, + { + "name": "淡蓝长衫", + "desc": "低阶法衣,略有避尘、清凉效果,是散修常见装扮。", + "type": "armor" + }, + { + "name": "神行靴", + "desc": "刻画了基础轻身符文的靴子,能小幅提升移动速度。", + "type": "boots" + }, + { + "name": "灵石袋", + "desc": "低阶储物袋,空间狭小,用于存放寥寥数块灵石与杂物。", + "type": "ring" + }, + { + "name": "安神香囊", + "desc": "散发宁神香气的小袋,有助于低阶修士初步入定,感受灵气。", + "type": "necklace" + } + ], + [ + { + "name": "金蚨子母刃", + "desc": "顶级法器,一套多枚,变化灵活,是韩立禁地之行主力攻击手段。", + "type": "weapon" + }, + { + "name": "炫光盾", + "desc": "顶级防御法器,激发后形成光盾,可抵挡筑基期以下大部分攻击。", + "type": "armor" + }, + { + "name": "踏云靴", + "desc": "在禁地复杂地形中快速移动、闪避妖兽的关键装备。", + "type": "boots" + }, + { + "name": "灵兽袋", + "desc": "用于携带和临时安置如“血玉蜘蛛”等灵虫、灵兽。", + "type": "ring" + }, + { + "name": "嗅妖炉", + "desc": "特制香炉,点燃后气味可吸引或驱散特定低阶妖兽。", + "type": "necklace" + } + ], + [ + { + "name": "绿煌剑", + "desc": "李化元所赐法宝(雏形或仿品),韩立筑基后主要飞剑,威力远超法器。", + "type": "weapon" + }, + { + "name": "白鳞盾", + "desc": "用妖兽材料炼制的盾牌,守护洞府闭关、抵挡雷劫的可靠防具。", + "type": "armor" + }, + { + "name": "禁制令牌", + "desc": "控制洞府内外阵法禁制的核心信物,兼具简单储物功能。", + "type": "boots" + }, + { + "name": "聚灵阵阵盘", + "desc": "布设聚灵阵的核心,能汇聚后山密地灵气,加速修炼与灵草生长。", + "type": "ring" + }, + { + "name": "养魂木配饰", + "desc": "一小截养魂木所制,开始温养元神,为凝结元婴做长远准备。", + "type": "necklace" + } + ], + [ + { + "name": "天雷子", + "desc": "一次性大威力消耗品,魔道入侵时的杀手锏,可重创筑基修士。", + "type": "weapon" + }, + { + "name": "皇鳞甲", + "desc": "新炼制的贴身内甲,在燕家堡混战中提供了至关重要的防护。", + "type": "armor" + }, + { + "name": "鬼影披风", + "desc": "得自魔道或燕家修士,具有一定隐匿身形、混淆气息的效果。", + "type": "boots" + }, + { + "name": "血咒追魂令", + "desc": "魔道追踪标识或战利品,可能带有不祥的诅咒或印记。", + "type": "ring" + }, + { + "name": "定神符", + "desc": "高阶清心符箓,用于对抗斗法时的精神冲击与魔音干扰。", + "type": "necklace" + } + ], + [ + { + "name": "青龙拐杖", + "desc": "黑煞教主法器,能释放毒龙进行攻击,阴毒诡异。", + "type": "weapon" + }, + { + "name": "血炼尸王甲", + "desc": "以炼尸之术强化的躯体,刀枪不入,力大无穷,是教主最后依仗。", + "type": "armor" + }, + { + "name": "血影遁符", + "desc": "黑煞教高层保命之物,燃烧精血瞬间远遁,代价巨大。", + "type": "boots" + }, + { + "name": "化血刀", + "desc": "吸食精血成长的邪刀,每杀一人威力增一分,煞气极重。", + "type": "ring" + }, + { + "name": "血凝五行丹", + "desc": "黑煞教阴谋核心,能强行凝结“伪金丹”,但隐患无穷。", + "type": "necklace" + } + ], + [ + { + "name": "噬金虫(初代)", + "desc": "于溶洞中首次大量培育的奇虫,开始展现其无物不噬的恐怖潜力。", + "type": "weapon" + }, + { + "name": "土牢符宝", + "desc": "在狭窄溶洞环境中极其有效的困敌符宝,可制造坚固石牢。", + "type": "armor" + }, + { + "name": "夜明玉坠", + "desc": "用于在绝对黑暗的溶洞中提供稳定光源,兼有破幻之效。", + "type": "boots" + }, + { + "name": "封灵盒", + "desc": "专门封存“灵烛果”等天地灵物的玉盒,防止灵气流失。", + "type": "ring" + }, + { + "name": "地脉石髓", + "desc": "溶洞深处经年累月凝聚的土属性至宝,可精进修为或炼制土系法宝。", + "type": "necklace" + } + ], + [ + { + "name": "青火瘴", + "desc": "乱星海常见法器,释放毒火瘴气,适用于海域环境与对付海兽。", + "type": "weapon" + }, + { + "name": "辟水珠", + "desc": "水下行动必备,形成避水光罩,便于在珊瑚海域探索与战斗。", + "type": "armor" + }, + { + "name": "分水刺", + "desc": "水下专用攻击法器,阻力小,速度快,适合近身袭杀海兽。", + "type": "boots" + }, + { + "name": "海图罗盘", + "desc": "记录珊瑚海域复杂航道与危险区域,指引方向的必备之物。", + "type": "ring" + }, + { + "name": "定海佩", + "desc": "蕴含水灵之力,能稳定心神,小幅抵抗深海压力与乱流。", + "type": "necklace" + } + ], + [ + { + "name": "虚天鼎", + "desc": "内殿核心至宝,通天灵宝,引发元婴后期大修士疯狂争夺。", + "type": "weapon" + }, + { + "name": "乾蓝冰焰", + "desc": "守护虚天鼎的极寒火焰,后被韩立收取,威力无穷。", + "type": "armor" + }, + { + "name": "血玉蜘蛛(成熟体)", + "desc": "拉扯虚天鼎出洞的关键灵虫,为此行专门培育至成熟。", + "type": "boots" + }, + { + "name": "补天丹", + "desc": "藏于虚天鼎内的神丹,可弥补灵根资质,是韩立此行最大目标之一。", + "type": "ring" + }, + { + "name": "古宝残片", + "desc": "内殿各处散落的古宝碎片,虽残缺但材料珍贵,可回收利用。", + "type": "necklace" + } + ], + [ + { + "name": "风雷翅", + "desc": "以风希材料炼制,融合风雷之力,是外星海逃遁、追击的顶级利器。", + "type": "weapon" + }, + { + "name": "元龟盾", + "desc": "以深海龟妖材料炼制的重型盾牌,防御力惊人,可抵挡高阶妖兽冲击。", + "type": "armor" + }, + { + "name": "避雷簪", + "desc": "深渊多雷暴,此簪可引偏或吸收部分天雷,保护修士。", + "type": "boots" + }, + { + "name": "猎妖令", + "desc": "记录猎杀妖兽等级与数量的凭证,可在星宫或天星城兑换资源。", + "type": "ring" + }, + { + "name": "深海沉银", + "desc": "深渊底部出产的极重炼器材料,掺入法宝可大幅增加威能与坚韧。", + "type": "necklace" + } + ], + [ + { + "name": "血魔剑", + "desc": "鬼灵门镇派之宝,需精血催动,威力巨大但反噬极强。", + "type": "weapon" + }, + { + "name": "万魂幡", + "desc": "魔道至宝,吞噬生魂祭炼而成,幡出则万鬼哭嚎,阴气森森。", + "type": "armor" + }, + { + "name": "幽冥鬼步", + "desc": "鬼灵门秘传身法,在阴气浓郁之地如鱼得水,身形鬼魅难测。", + "type": "boots" + }, + { + "name": "锁魂链", + "desc": "专攻修士元神与元婴的歹毒法器,一旦被锁极难挣脱。", + "type": "ring" + }, + { + "name": "阴冥珠", + "desc": "汇聚至阴之气凝结的宝珠,是修炼鬼道魔功的至宝。", + "type": "necklace" + } + ], + [ + { + "name": "啼魂兽", + "desc": "形似小猴的变异灵兽,可吞噬鬼物阴魂,是落云宗期间的得力助手。", + "type": "weapon" + }, + { + "name": "六丁天甲符", + "desc": "借助天地灵气形成护甲的神奇符箓,在宗门灵脉之地防御力倍增。", + "type": "armor" + }, + { + "name": "云梦雾履", + "desc": "落云宗特色法靴,行走间有云气相伴,提升遁速且颇具仙家气象。", + "type": "boots" + }, + { + "name": "长老令牌", + "desc": "落云宗客卿长老身份象征,可调用部分宗门资源与弟子。", + "type": "ring" + }, + { + "name": "冰心玉", + "desc": "长期佩戴可保持心境澄澈,抵御心魔,对凝结元婴有辅助之效。", + "type": "necklace" + } + ], + [ + { + "name": "八灵尺(仿制品)", + "desc": "在天星城拍卖会或秘市获得,灵界佛门遗宝仿品,对魔物克制极大。", + "type": "weapon" + }, + { + "name": "星宫长老袍", + "desc": "星宫长老制式法袍,不仅防御出色,更是身份与地位的象征。", + "type": "armor" + }, + { + "name": "传送符(双向)", + "desc": "连接洞府与特定地点的珍贵符箓,在天星城庞大坊市间往来便利。", + "type": "boots" + }, + { + "name": "万宝囊", + "desc": "顶级储物法器,空间巨大,用于收纳在天星城购置的海量材料与宝物。", + "type": "ring" + }, + { + "name": "元磁神山(炼化核心)", + "desc": "修炼元磁神光的核心,也是威力无穷的至宝,可克制五行法宝。", + "type": "necklace" + } + ], + [ + { + "name": "三焰扇(仿制品)", + "desc": "动用海量珍稀材料仿制的通天灵宝,昆吾山决战的关键攻击手段。", + "type": "weapon" + }, + { + "name": "黑风旗(仿制品)", + "desc": "空间类通天灵宝仿制品,可撕裂空间,用于困敌、逃遁或扰乱战场。", + "type": "armor" + }, + { + "name": "破界符", + "desc": "昆吾山空间不稳时的保命神符,可强行破开一小片空间脱身。", + "type": "boots" + }, + { + "name": "珑梦魂晶", + "desc": "与银月\/珑梦相关的魂系至宝,涉及灵界秘密与神魂融合。", + "type": "ring" + }, + { + "name": "玄天仙藤(果实)", + "desc": "人界至高无上的混沌至宝雏形,牵扯界面气运,是昆吾山终极隐秘之一。", + "type": "necklace" + } + ] ] \ No newline at end of file diff --git a/src/Data/maps.php b/src/Data/maps.php index a2e84b0..75d0a87 100644 --- a/src/Data/maps.php +++ b/src/Data/maps.php @@ -24,9 +24,9 @@ return [ 'name' => '野狼帮马贼', // 更名为原著中的敌对势力 'level' => 1, 'hp' => 30, - 'patk' => 6, + 'patk' => 10, 'matk' => 0, // 凡人无魔攻 - 'pdef' => 1, + 'pdef' => 5, 'mdef' => 0, 'exp' => 10, 'spirit_stones' => 0, // 凡人没有灵石,改为银两(逻辑上) diff --git a/src/Data/recovery.json b/src/Data/recovery.json new file mode 100644 index 0000000..72b02c7 --- /dev/null +++ b/src/Data/recovery.json @@ -0,0 +1,114 @@ +[ + { + "region": "七玄门", + "recovery": { + "name": "金创药", + "desc": "江湖常见的止血散,对于刀剑外伤有不错的愈合效果,是凡人武者行走江湖的必备之物。", + "type": "recovery" + } + }, + { + "region": "太南谷外", + "recovery": { + "name": "聚气丹", + "desc": "低阶修士最常用的丹药,可加速恢复和凝聚微薄法力,是散修间交易和自用的基础物资。", + "type": "recovery" + } + }, + { + "region": "血色禁地", + "recovery": { + "name": "定灵丹", + "desc": "筑基期丹药,可快速恢复大量法力,是弟子在禁地内生死搏杀、持续探索的关键保障。", + "type": "recovery" + } + }, + { + "region": "黄枫谷·后山密地", + "recovery": { + "name": "真元丹", + "desc": "适合筑基修士精进法力的丹药,于灵气盎然的密地洞府中使用,效果更佳,用于巩固修为与恢复。", + "type": "recovery" + } + }, + { + "region": "燕家堡·魔道入侵", + "recovery": { + "name": "冰心玉露", + "desc": "用于镇定心神、对抗魔功煞气侵扰的灵液,在混乱的正魔交锋中保持灵台清明至关重要。", + "type": "recovery" + } + }, + { + "region": "越京皇宫·黑煞教", + "recovery": { + "name": "破煞正气水", + "desc": "针对血祭邪煞之气的特效解毒圣水,由秦府秘密提供,是铲除黑煞教妖人的必备支援品。", + "type": "recovery" + } + }, + { + "region": "灵石矿脉·地下溶洞", + "recovery": { + "name": "石钟乳", + "desc": "溶洞顶部滴落的天地灵乳,蕴含精纯灵气,可快速恢复法力并轻微滋养肉身,是洞中宝藏。", + "type": "recovery" + } + }, + { + "region": "乱星海·珊瑚海域", + "recovery": { + "name": "珊瑚心", + "desc": "取自古老灵珊瑚的核心,蕴含丰沛水灵生机,可治疗水系伤害与毒素,并恢复法力。", + "type": "recovery" + } + }, + { + "region": "虚天殿·内殿", + "recovery": { + "name": "万年灵液", + "desc": "一滴便可瞬间补满元婴修士全部法力的天地奇物,是虚天殿内争夺至宝、进行持久战的终极底气。", + "type": "recovery" + } + }, + { + "region": "外星海·深渊", + "recovery": { + "name": "八级妖丹", + "desc": "斩杀深渊高阶妖兽所得,蕴含狂暴而海量的元气,经特殊处理后可作为炼制高级丹药的主材或极端情况下的法力源泉。", + "type": "recovery" + } + }, + { + "region": "鬼灵门·幽冥之地", + "recovery": { + "name": "阴髓钻", + "desc": "幽冥之地阴气凝结的精华,鬼修或魔道修士可直接吸收以恢复魔力、治疗阴属性伤势。", + "type": "recovery" + } + }, + { + "region": "落云宗", + "recovery": { + "name": "五行茶", + "desc": "以落云宗灵泉冲泡的珍稀灵茶,长期饮用可细微调理五行,巩固根基,亦是待客与日常恢复的佳品。", + "type": "recovery" + } + }, + { + "region": "天星城", + "recovery": { + "name": "天仙玉露", + "desc": "乱星海顶级拍卖会出现的珍品,能快速回复大量法力且毫无副作用,是元婴修士也珍视的消耗品。", + "type": "recovery" + } + }, + { + "region": "昆吾山·玄天殿", + "recovery": { + "name": "回阳真水", + "desc": "拥有近乎起死回生之效的逆天神物,能重塑肉身、凝聚元婴,于昆吾山最终决战中关乎生死存亡。", + "type": "recovery" + } + } +] \ No newline at end of file diff --git a/src/Entities/Monster.php b/src/Entities/Monster.php index 457c991..8656875 100644 --- a/src/Entities/Monster.php +++ b/src/Entities/Monster.php @@ -73,7 +73,7 @@ class Monster extends Actor * Each monster is independently selected from the dungeon's monster pool using weighted random selection * @return Actor[] */ - public static function createGroup(int $dungeonId): array + public static function createGroup(int $dungeonId,$play_level): array { // Load data static $maps = null; @@ -85,13 +85,29 @@ class Monster extends Actor if (empty($monsterConfig)) { return [self::create($dungeonId)]; } + $monsterConfig_allow = []; + foreach ($monsterConfig as $item){ + if ($item['level'] <= $play_level){ + $monsterConfig_allow [] = $item; + } + } + $monsterConfig = $monsterConfig_allow; + $levels = array_column($monsterConfig,'level'); + $total = 0; + foreach ($levels as $level){ + $total += $level; + } + $average = $total / count($levels); - // Determine group size (1-5 enemies) - $groupSize = rand(1, 5); + if ($play_level < $average){ + $groupSize = 1; + }else{ + $groupSize = rand(2, 4); + } $group = []; // Create each enemy independently using weighted random selection - for ($i = 0; $i < $groupSize; $i++) { + for ($i = 1; $i < $groupSize; $i++) { $totalWeight = 0; foreach ($monsterConfig as $m) { $totalWeight += $m['weight'] ?? 100; @@ -111,13 +127,13 @@ class Monster extends Actor if (!$selectedConfig) { $selectedConfig = $monsterConfig[0]; } - + $monster = new self(); // Create monster from selected config - $monster = self::create($dungeonId); + $monster->hydrateFromConfig($selectedConfig,$dungeonId); // Add suffix to distinguish multiple monsters of same type if ($groupSize > 1) { - $monster->name .= " (" . ($i + 1) . ")"; + $monster->name .= " (" . ($i) . ")"; } $group[] = $monster; diff --git a/src/Modules/Bag/Equipment.php b/src/Modules/Bag/Equipment.php index 5f87d4c..6157cf1 100644 --- a/src/Modules/Bag/Equipment.php +++ b/src/Modules/Bag/Equipment.php @@ -31,6 +31,19 @@ class Equipment extends Item 'crit' => '暴击率', 'critdmg' => '暴击伤害', ]; + + private static array $statNames = [ + 'patk' => '物攻', + 'matk' => '魔攻', + 'pdef' => '物防', + 'mdef' => '魔防', + 'hp' => '生命', + 'crit' => '暴击', + 'critdmg' => '暴伤', + 'heal' => '治疗', + 'cost' => '消耗', + 'damage' => '伤害倍率', + ]; public static array $typeNames = [ 'weapon' => '武器', 'armor' => '护甲', @@ -354,7 +367,7 @@ class Equipment extends Item { $stats = []; - foreach (self::$typeNames as $key => $name) { + foreach (self::$statNames as $key => $name) { $value = $item[$key] ?? 0; if ($value > 0) { if ($key === 'damage') { @@ -364,7 +377,6 @@ class Equipment extends Item } } } - return $stats ? Colors::GREEN . "(" . implode(" ", $stats) . ")" . Colors::RESET : ""; } diff --git a/src/Modules/Battle.php b/src/Modules/Battle.php index 17718cb..e694da7 100644 --- a/src/Modules/Battle.php +++ b/src/Modules/Battle.php @@ -13,6 +13,7 @@ use Game\Entities\Player; use Game\Entities\Actor; use Game\Entities\Monster; use Game\Entities\Partner; +use Game\Modules\Bag\Equipment; class Battle { @@ -134,7 +135,7 @@ class Battle Screen::delay(500000, $out); // 创建敌人群组 - $this->enemies = Monster::createGroup($this->game->dungeonId); + $this->enemies = Monster::createGroup($this->game->dungeonId,$this->player->level); $this->totalMaxHp = 0; foreach ($this->enemies as $enemy) { @@ -480,7 +481,7 @@ class Battle foreach ($actor->skillSlots as $slot => $spellItem) { if ($spellItem === null) continue; - $actualCost = SpellCalculator::calculateCost($spellItem); + $actualCost = $spellItem['cost']; if ($actor->mana >= $actualCost) { $spellData = [ @@ -555,7 +556,7 @@ class Battle $quality = $spellInfo['quality'] ?? 'common'; - $qualityColor = SpellDisplay::getQualityColor($quality); + $qualityColor = Colors::getColor($quality); // 计算法术伤害 $damageResult = SpellCalculator::calculateDamage($spellInfo, $stats, $target->getStats(), $damageBonus); @@ -690,7 +691,7 @@ class Battle // 显示法术基础信息 $quality = $spellInfo['quality'] ?? 'common'; - $qualityColor = SpellDisplay::getQualityColor($quality); + $qualityColor = Colors::getColor($quality); $casterName = ($caster instanceof Player) ? "你" : $caster->name; $actionVerb = ($caster instanceof Player) ? "施放" : "施放了"; @@ -720,7 +721,7 @@ class Battle { // 显示法术基础信息 $quality = $spellInfo['quality'] ?? 'common'; - $qualityColor = SpellDisplay::getQualityColor($quality); + $qualityColor = Colors::getColor($quality); $casterName = ($caster instanceof Player) ? "你" : $caster->name; $actionVerb = ($caster instanceof Player) ? "施放" : "施放了"; @@ -926,8 +927,8 @@ class Battle // 计算伤害 $physicalDamage = max(1, $stats['patk'] - $targetStats['pdef']); - $magicDamage = max(0, $stats['matk'] - $targetStats['mdef']); - $baseDamage = $physicalDamage + $magicDamage; +// $magicDamage = max(0, $stats['matk'] - $targetStats['mdef']); + $baseDamage = $physicalDamage; $critRate = $stats['crit']; $critDmg = $stats['critdmg']; @@ -1138,7 +1139,7 @@ class Battle if (!empty($allDrops)) { $out->writeln("{$this->yellow}║{$this->reset} {$this->white}掉落:{$this->reset}"); foreach ($allDrops as $item) { - $out->writeln("{$this->yellow}║{$this->reset} " . ItemDisplay::renderDrop($item, "")); + $out->writeln(Equipment::getLineShow($item)); } } diff --git a/src/Modules/StatsPanel.php b/src/Modules/StatsPanel.php index 99cbf1d..803f5e2 100644 --- a/src/Modules/StatsPanel.php +++ b/src/Modules/StatsPanel.php @@ -7,6 +7,7 @@ use Game\Core\Screen; use Game\Core\Input; use Game\Core\ItemDisplay; use Game\Core\SpellDisplay; +use Game\Modules\Bag\Equipment; use Game\Services\EquipmentEnhancer; use Game\Entities\Actor; use Game\Entities\Partner; @@ -229,14 +230,8 @@ class StatsPanel $slotName = $slotNames[$slot]; if ($item) { - $slotLines = ItemDisplay::renderSlot($slotName, $item, "║ [{$slotIndex}] "); - foreach ($slotLines as $i => $line) { - if ($i === 0) { - $out->writeln($line); - } else { - $out->writeln("║ " . substr($line, 6)); // 缩进对齐 - } - } + $slotLines = Equipment::getLineShow($item); + $out->writeln($slotLines); } else { $out->writeln("║ [{$slotIndex}] {$this->cyan}{$slotName}{$this->reset}: " . Colors::GRAY . '(空)' . Colors::RESET); @@ -355,7 +350,7 @@ class StatsPanel foreach ($slots as $slotKey => $slotName) { $currentItem = $actor->equip[$slotKey] ?? null; if ($currentItem) { - $this->game->output->writeln("[{$slotIdx}] {$slotName}: " . ItemDisplay::renderListItem($currentItem)); + $this->game->output->writeln("[{$slotIdx}] {$slotName}: " . Equipment::getLineShow($currentItem)); } else { $this->game->output->writeln("[{$slotIdx}] {$slotName}: (空)"); } @@ -397,7 +392,7 @@ class StatsPanel $displayIdx = 1; $idxMap = []; foreach ($equipableItems as $realIdx => $item) { - $displayStr = ItemDisplay::renderListItem($item, true, false); + $displayStr = Equipment::getLineShow($item); $this->game->output->writeln("[{$displayIdx}] {$displayStr}"); $idxMap[$displayIdx] = $realIdx; $displayIdx++; @@ -451,7 +446,7 @@ class StatsPanel foreach ($slots as $slot => $name) { if (!empty($actor->equip[$slot])) { $item = $actor->equip[$slot]; - $this->game->output->writeln("[{$idx}] {$name}: " . ItemDisplay::renderListItem($item)); + $this->game->output->writeln("[{$idx}] {$name}: " . Equipment::getLineShow($item)); $equipped[$idx] = $slot; $idx++; } diff --git a/test/Test.php b/test/Test.php index f0da6d9..dcfa504 100644 --- a/test/Test.php +++ b/test/Test.php @@ -5,9 +5,9 @@ use Game\Modules\Bag\Spell; require __DIR__ . '/../vendor/autoload.php'; -//$equ = Equipment::createItem('armor',10); -//$res = Equipment::getLineShow($equ); -//echo $res; +$equ = Equipment::createItem('armor',10); +$res = Equipment::getLineShow($equ); +echo $res; $res = Spell::createItem(2,level: 100); echo Spell::getLineShow($res); dd(2);