From 9a5eb6433f92210b7ca0069e237af16fedf9741a Mon Sep 17 00:00:00 2001 From: hant Date: Wed, 3 Dec 2025 23:41:55 +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 --- .idea/hanli-idle.iml | 2 ++ .idea/php.xml | 5 +++++ save.json | 2 +- src/Core/Game.php | 11 ++++++++- src/Data/maps.php | 18 +++++++-------- src/Data/npcs.php | 4 ++-- src/Entities/Actor.php | 11 +++++---- src/Entities/Partner.php | 22 +++++++----------- src/Entities/Player.php | 15 ------------- src/Modules/NpcPanel.php | 34 ++++++++++++++-------------- src/Modules/PartnerPanel.php | 2 +- test/Test.php | 43 ++++++++++++++++++++++++++++++++++++ 12 files changed, 104 insertions(+), 65 deletions(-) create mode 100644 test/Test.php diff --git a/.idea/hanli-idle.iml b/.idea/hanli-idle.iml index ada7d21..043d601 100644 --- a/.idea/hanli-idle.iml +++ b/.idea/hanli-idle.iml @@ -2,7 +2,9 @@ + + diff --git a/.idea/php.xml b/.idea/php.xml index 87f378a..80c7a0d 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -28,6 +28,11 @@ + + + + + diff --git a/save.json b/save.json index 747c056..3fa5846 100644 --- a/save.json +++ b/save.json @@ -1 +1 @@ -{"player":{"hp":110,"maxHp":50,"patk":10,"matk":5,"pdef":5,"mdef":3,"crit":5,"critdmg":130,"level":3,"exp":160,"maxExp":225,"inventory":[{"name":"雷霆锤","type":"weapon","quality":"common","level":1,"patk":8,"matk":3,"pdef":0,"mdef":0,"hp":0,"crit":0,"critdmg":0,"heal":0,"affixes":[],"desc":"Lv.1 common品质的武器","id":"692fa0f61aa45","quantity":1}],"equip":{"weapon":{"name":"青钢剑","type":"weapon","quality":"rare","level":1,"patk":14,"matk":3,"pdef":0,"mdef":0,"hp":0,"crit":0,"critdmg":0,"heal":0,"affixes":["暴击伤害 +6"],"desc":"Lv.1 rare品质的武器","id":"692ee8e0df082","quantity":1},"armor":{"name":"皮甲","type":"armor","quality":"common","level":3,"patk":0,"matk":0,"pdef":6,"mdef":1,"hp":0,"crit":0,"critdmg":0,"heal":0,"affixes":[],"desc":"Lv.3 common品质的防具","id":"692efecedbc7a","quantity":1}},"spiritStones":91,"npcFlags":[],"talentPoints":0,"talents":{"hp":6,"patk":0,"matk":0,"pdef":0,"mdef":0,"crit":0,"critdmg":0},"mana":100,"maxMana":100,"spells":[],"spellBooks":{"3":1,"1":2,"10":2},"partners":[{"id":"li_feiyu","name":"厉飞雨","level":2,"exp":132,"maxExp":150,"baseStats":{"hp":100,"patk":15,"matk":5,"pdef":5,"mdef":3,"crit":10,"critdmg":130,"growth":1.2},"equip":{"weapon":{"name":"青钢剑","type":"weapon","quality":"common","level":1,"patk":6,"matk":2,"pdef":0,"mdef":0,"hp":0,"crit":0,"critdmg":0,"heal":0,"affixes":[],"desc":"Lv.1 common品质的武器","id":"692ee91453dd8","quantity":1}},"talents":{"hp":1,"patk":1,"matk":0,"pdef":0,"mdef":0,"crit":1,"critdmg":0},"talentWeights":{"hp":1,"patk":3,"matk":1,"pdef":1,"mdef":1,"crit":3,"critdmg":2},"mana":80,"maxMana":80,"spells":[],"spellBooks":[]}]},"dungeonId":1,"state":0} \ No newline at end of file +{"player":{"hp":270,"maxHp":0,"patk":10,"matk":5,"pdef":5,"mdef":3,"crit":5,"critdmg":130,"level":11,"exp":1337,"maxExp":5743,"inventory":[{"name":"玄铁剑","type":"weapon","quality":"common","level":1,"patk":11,"matk":0,"pdef":0,"mdef":0,"hp":0,"crit":0,"critdmg":0,"heal":0,"affixes":[],"desc":"Lv.1 common品质的武器","id":"6930554849acb","quantity":1},{"name":"金疮药","type":"consume","quality":"common","level":1,"patk":0,"matk":0,"pdef":0,"mdef":0,"hp":0,"crit":0,"critdmg":0,"heal":35,"affixes":[],"desc":"Lv.1 common品质的药剂","id":"6930578fb29f6","quantity":91},{"name":"培元丹","type":"consume","quality":"common","level":5,"patk":0,"matk":0,"pdef":0,"mdef":0,"hp":0,"crit":0,"critdmg":0,"heal":61,"affixes":[],"desc":"Lv.5 common品质的药剂","id":"693057959f5c2","quantity":1},{"name":"玄铁剑","type":"weapon","quality":"common","level":1,"patk":10,"matk":1,"pdef":0,"mdef":0,"hp":0,"crit":0,"critdmg":0,"heal":0,"affixes":[],"desc":"Lv.1 common品质的武器","id":"69305a28d318c","quantity":1},{"name":"金疮药","type":"consume","quality":"common","level":1,"patk":0,"matk":0,"pdef":0,"mdef":0,"hp":0,"crit":0,"critdmg":0,"heal":37,"affixes":[],"desc":"Lv.1 common品质的药剂","id":"69305a3d522a2","quantity":1}],"equip":{"weapon":{"name":"烈焰刀","type":"weapon","quality":"legendary","level":1,"patk":35,"matk":50,"pdef":0,"mdef":0,"hp":0,"crit":0,"critdmg":27,"heal":0,"affixes":["暴击率 +7","物攻 +15","魔攻 +8%"],"desc":"Lv.1 legendary品质的武器","id":"693041a47105c","quantity":1,"enhanceLevel":0},"armor":{"name":"皮甲","type":"armor","quality":"legendary","level":3,"patk":0,"matk":0,"pdef":26,"mdef":8,"hp":92,"crit":0,"critdmg":0,"heal":0,"affixes":["物攻 +3%","魔攻 +8%","物防 +16"],"desc":"Lv.3 legendary品质的防具","id":"693044ffc1381","quantity":1,"enhanceLevel":0},"necklace":{"name":"金链","type":"necklace","quality":"rare","level":5,"patk":0,"matk":0,"pdef":0,"mdef":0,"hp":57,"crit":0,"critdmg":0,"heal":0,"affixes":["物防 +9"],"desc":"Lv.5 rare品质的项链","id":"693046bc441b6","quantity":1,"enhanceLevel":0}},"spiritStones":3286,"npcFlags":[],"talentPoints":15,"talents":{"hp":12,"patk":0,"matk":0,"pdef":0,"mdef":0,"crit":0,"critdmg":0},"mana":100,"maxMana":100,"spells":[],"spellBooks":{"3":1,"1":40,"10":36},"partners":[{"id":"li_feiyu","name":"厉飞雨","level":13,"exp":301,"maxExp":337,"equip":{"weapon":{"name":"玄铁剑","type":"weapon","quality":"rare","level":5,"patk":15,"matk":1,"pdef":0,"mdef":0,"hp":0,"crit":0,"critdmg":0,"heal":0,"affixes":["暴击 +5"],"desc":"Lv.5 common品质的武器","id":"693055329e36e","quantity":1}},"talents":{"hp":36,"patk":3,"matk":0,"pdef":0,"mdef":0,"crit":0,"critdmg":0},"talentWeights":{"hp":1,"patk":1,"matk":1,"pdef":1,"mdef":1,"crit":1,"critdmg":1},"mana":100,"maxMana":100,"spells":[],"spellBooks":[],"hp":338,"maxHp":0,"patk":15,"matk":5,"pdef":5,"mdef":3,"crit":10,"critdmg":130}]},"dungeonId":1,"state":2} \ No newline at end of file diff --git a/src/Core/Game.php b/src/Core/Game.php index 666e200..0cb2656 100644 --- a/src/Core/Game.php +++ b/src/Core/Game.php @@ -123,7 +123,6 @@ class Game 'level' => $partner->level, 'exp' => $partner->exp, 'maxExp' => $partner->maxExp, - 'baseStats' => $partner->baseStats, 'equip' => $partner->equip, 'talents' => $partner->talents, 'talentWeights' => $partner->talentWeights, @@ -131,6 +130,16 @@ class Game 'maxMana' => $partner->maxMana, 'spells' => $partner->spells, 'spellBooks' => $partner->spellBooks, + + 'hp' => $partner->hp, + 'maxHp' => $partner->maxHp, + 'patk' => $partner->patk, + 'matk' => $partner->matk, + 'pdef' => $partner->pdef, + 'mdef' => $partner->mdef, + 'crit' => $partner->crit, + 'critdmg' => $partner->critdmg, + ]; } diff --git a/src/Data/maps.php b/src/Data/maps.php index 60129cc..b043cb3 100644 --- a/src/Data/maps.php +++ b/src/Data/maps.php @@ -141,7 +141,7 @@ return [ 'exp' => 100, 'spirit_stones' => 20, 'drops' => [ - ['type' => 'weapon', 'name' => '眨眼剑法', 'quality' => 'rare', 'patk' => 15, 'rate' => 20, 'affixes' => ['crit' => 5]], + ['type' => 'weapon', 'name' => '眨眼剑法', 'quality' => 'rare', 'patk' => 15, 'rate' => 20], ['type' => 'necklace', 'name' => '长生锁', 'rate' => 15] + $necklaceTemplate, ['type' => 'consume', 'name' => '清灵散', 'rate' => 40, 'heal' => 80], ], @@ -255,7 +255,7 @@ return [ 'exp' => 300, 'spirit_stones' => 100, 'drops' => [ - ['type' => 'weapon', 'name' => '金竺笔', 'quality' => 'epic', 'matk' => 45, 'rate' => 15, 'affixes' => ['matk' => 10]], + ['type' => 'weapon', 'name' => '金竺笔', 'quality' => 'epic', 'matk' => 45, 'rate' => 15], ['type' => 'armor', 'name' => '墨蛟甲', 'quality' => 'epic', 'pdef' => 20, 'mdef' => 15, 'rate' => 15], ['type' => 'consume', 'name' => '筑基丹', 'rate' => 50, 'heal' => 500], ], @@ -370,7 +370,7 @@ return [ 'exp' => 600, 'spirit_stones' => 250, 'drops' => [ - ['type' => 'weapon', 'name' => '血灵钻', 'quality' => 'epic', 'matk' => 100, 'rate' => 20, 'affixes' => ['crit' => 10]], + ['type' => 'weapon', 'name' => '血灵钻', 'quality' => 'epic', 'matk' => 100, 'rate' => 20], ['type' => 'armor', 'name' => '血灵甲', 'quality' => 'epic', 'pdef' => 40, 'mdef' => 30, 'rate' => 20], ['type' => 'consume', 'name' => '血灵丹', 'rate' => 30, 'heal' => 1000], ], @@ -426,7 +426,7 @@ return [ 'exp' => 1000, 'spirit_stones' => 400, 'drops' => [ - ['type' => 'weapon', 'name' => '青元剑', 'quality' => 'legendary', 'patk' => 100, 'matk' => 80, 'rate' => 15, 'affixes' => ['patk' => 15]], + ['type' => 'weapon', 'name' => '青元剑', 'quality' => 'legendary', 'patk' => 100, 'matk' => 80, 'rate' => 15], ['type' => 'consume', 'name' => '虚天鼎碎片', 'rate' => 10, 'heal' => 2000], // 剧情物品作为高回复药 ['type' => 'ring', 'name' => '黑煞戒', 'rate' => 20] + $ringTemplate, ], @@ -541,7 +541,7 @@ return [ 'exp' => 2500, 'spirit_stones' => 1000, 'drops' => [ - ['type' => 'weapon', 'name' => '天都尸火', 'quality' => 'legendary', 'matk' => 300, 'rate' => 15, 'affixes' => ['critdmg' => 20]], + ['type' => 'weapon', 'name' => '天都尸火', 'quality' => 'legendary', 'matk' => 300, 'rate' => 15], ['type' => 'consume', 'name' => '补天丹', 'rate' => 10, 'heal' => 3000], ['type' => 'necklace', 'name' => '虚天鼎', 'quality' => 'legendary', 'hp' => 2000, 'rate' => 5], ], @@ -597,7 +597,7 @@ return [ 'exp' => 4000, 'spirit_stones' => 1500, 'drops' => [ - ['type' => 'weapon', 'name' => '金蛟剪', 'quality' => 'legendary', 'patk' => 300, 'matk' => 200, 'rate' => 15, 'affixes' => ['crit' => 15]], + ['type' => 'weapon', 'name' => '金蛟剪', 'quality' => 'legendary', 'patk' => 300, 'matk' => 200, 'rate' => 15], ['type' => 'armor', 'name' => '金蛟鳞甲', 'quality' => 'legendary', 'pdef' => 180, 'mdef' => 120, 'rate' => 15], ['type' => 'consume', 'name' => '九曲灵参', 'rate' => 10, 'heal' => 5000], ], @@ -712,7 +712,7 @@ return [ 'exp' => 10000, 'spirit_stones' => 5000, 'drops' => [ - ['type' => 'weapon', 'name' => '黑风旗', 'quality' => 'legendary', 'matk' => 800, 'rate' => 15, 'affixes' => ['matk' => 20]], + ['type' => 'weapon', 'name' => '黑风旗', 'quality' => 'legendary', 'matk' => 800, 'rate' => 15], ['type' => 'armor', 'name' => '魔龙甲', 'quality' => 'legendary', 'pdef' => 350, 'mdef' => 250, 'rate' => 15], ['type' => 'consume', 'name' => '万年灵乳', 'rate' => 20, 'heal' => 8000], ], @@ -771,7 +771,7 @@ return [ 'exp' => 15000, 'spirit_stones' => 8000, 'drops' => [ - ['type' => 'weapon', 'name' => '八灵尺', 'quality' => 'legendary', 'matk' => 1200, 'rate' => 15, 'affixes' => ['crit' => 20]], + ['type' => 'weapon', 'name' => '八灵尺', 'quality' => 'legendary', 'matk' => 1200, 'rate' => 15], ['type' => 'ring', 'name' => '雪晶珠', 'quality' => 'legendary', 'crit' => 15, 'rate' => 15], ['type' => 'consume', 'name' => '回阳水', 'rate' => 10, 'heal' => 10000], ], @@ -827,7 +827,7 @@ return [ 'exp' => 30000, 'spirit_stones' => 15000, 'drops' => [ - ['type' => 'weapon', 'name' => '青竹蜂云剑', 'quality' => 'legendary', 'patk' => 1500, 'matk' => 1000, 'rate' => 20, 'affixes' => ['patk' => 30, 'crit' => 20]], + ['type' => 'weapon', 'name' => '青竹蜂云剑', 'quality' => 'legendary', 'patk' => 1500, 'matk' => 1000, 'rate' => 20], ['type' => 'armor', 'name' => '五行甲', 'quality' => 'legendary', 'pdef' => 1000, 'mdef' => 1000, 'rate' => 20], ['type' => 'consume', 'name' => '飞升令', 'rate' => 100, 'heal' => 99999], // 象征性物品 ], diff --git a/src/Data/npcs.php b/src/Data/npcs.php index 0140cd6..a3dbcc0 100644 --- a/src/Data/npcs.php +++ b/src/Data/npcs.php @@ -11,7 +11,7 @@ return [ 'min_level' => 1, 'desc' => '韩立在七玄门最好的朋友,虽无灵根但武功高强。', 'base_stats' => [ - 'hp' => 100, 'patk' => 15, 'matk' => 5, 'pdef' => 5, 'mdef' => 3, 'crit' => 10, 'critdmg' => 130, 'growth' => 1.2 + 'maxHp' => 100, 'patk' => 15, 'matk' => 5, 'pdef' => 5, 'mdef' => 3, 'crit' => 10, 'critdmg' => 130 ], // 天赋权重:武功型,偏攻击和暴击 'talent_weights' => [ @@ -122,7 +122,7 @@ return [ 'min_level' => 50, 'desc' => '寄宿在虚天鼎中的妖族器灵,实为灵界银月狼族玲珑仙子分魂。', 'base_stats' => [ - 'hp' => 2000, 'patk' => 250, 'matk' => 150, 'pdef' => 100, 'mdef' => 80, 'crit' => 20, 'critdmg' => 180, 'growth' => 2.5 + 'maxHp' => 2000, 'patk' => 250, 'matk' => 150, 'pdef' => 100, 'mdef' => 80, 'crit' => 20, 'critdmg' => 180 ], // 天赋权重:妖族器灵,偏攻击和暴伤 'talent_weights' => [ diff --git a/src/Entities/Actor.php b/src/Entities/Actor.php index 603820b..bac7284 100644 --- a/src/Entities/Actor.php +++ b/src/Entities/Actor.php @@ -68,10 +68,12 @@ class Actor */ public function heal(int $amount): int { - $maxHp = $this->maxHp ?? ($this->baseHp ?? ($this->hp ?? 0)); - $old = $this->hp ?? 0; - $this->hp = min(($this->hp ?? 0) + $amount, $maxHp); - return $this->hp - $old; + $stats = $this->getStats(); + $maxHp = $stats['maxHp']; + $oldHp = $this->hp; + $this->hp = min($this->hp + $amount, $maxHp); + + return $this->hp - $oldHp; } public function fullHeal(): void @@ -200,6 +202,7 @@ class Actor // Base stats $base = [ 'maxHp' => $this->maxHp ?? ($this->baseHp ?? ($this->hp ?? 0)), + 'hp' => $this->hp, 'patk' => $this->patk ?? 0, 'matk' => $this->matk ?? 0, 'pdef' => $this->pdef ?? 0, diff --git a/src/Entities/Partner.php b/src/Entities/Partner.php index 779b175..10d45f0 100644 --- a/src/Entities/Partner.php +++ b/src/Entities/Partner.php @@ -22,15 +22,14 @@ class Partner extends Actor $this->exp = $data['exp'] ?? 0; $this->maxExp = $data['maxExp'] ?? (int)(100 * pow(1.5, $this->level - 1)); - // 从 baseStats 提取属性(只在初始化时使用一次) - $baseStats = $data['baseStats'] ?? []; - $this->patk = $baseStats['patk'] ?? $baseStats['atk'] ?? 10; - $this->matk = $baseStats['matk'] ?? 5; - $this->pdef = $baseStats['pdef'] ?? $baseStats['def'] ?? 5; - $this->mdef = $baseStats['mdef'] ?? 3; - $this->crit = $baseStats['crit'] ?? 5; - $this->critdmg = $baseStats['critdmg'] ?? 150; - + $this->patk = $data['patk'] ; + $this->matk = $data['matk'] ; + $this->pdef = $data['pdef'] ; + $this->mdef = $data['mdef'] ; + $this->crit = $data['crit'] ; + $this->critdmg = $data['critdmg'] ?? 130; + $this->maxHp = $data['maxHp']; + $this->hp = $data['hp'] ?? $data['maxHp']; // 装备和天赋系统 $this->equip = $data['equip'] ?? []; $this->talents = $data['talents'] ?? $this->talents; @@ -41,11 +40,6 @@ class Partner extends Actor $this->maxMana = $data['maxMana'] ?? 100; $this->spells = $data['spells'] ?? $this->spells; $this->spellBooks = $data['spellBooks'] ?? $this->spellBooks; - - // 计算属性并设置生命值 - $stats = $this->getStats(); - $this->maxHp = $stats['maxHp']; - $this->hp = $data['hp'] ?? $stats['maxHp']; } /** diff --git a/src/Entities/Player.php b/src/Entities/Player.php index 464aa34..813f661 100644 --- a/src/Entities/Player.php +++ b/src/Entities/Player.php @@ -44,21 +44,6 @@ class Player extends Actor return false; } - /** - * 恢复生命值,不超过上限 - * @param int $amount 恢复量 - * @return int 实际恢复量 - */ - public function heal(int $amount): int - { - $stats = $this->getStats(); - $maxHp = $stats['maxHp']; - - $oldHp = $this->hp; - $this->hp = min($this->hp + $amount, $maxHp); - - return $this->hp - $oldHp; - } /** * 学习法术 diff --git a/src/Modules/NpcPanel.php b/src/Modules/NpcPanel.php index 43f26a1..66fa361 100644 --- a/src/Modules/NpcPanel.php +++ b/src/Modules/NpcPanel.php @@ -1,4 +1,5 @@ game->output->writeln("目前没有故人可以拜访。"); } else { foreach ($availableNpcs as $index => $npc) { - $idx = $index+1; + $idx = $index + 1; $this->game->output->writeln("[{$idx}] {$npc['name']} <{$npc['title']}>"); } } @@ -50,8 +51,8 @@ class NpcPanel return; } - if (isset($availableNpcs[$choice-1])) { - $this->interact($availableNpcs[$choice-1]); + if (isset($availableNpcs[$choice - 1])) { + $this->interact($availableNpcs[$choice - 1]); } else { $this->game->output->writeln("无效选择"); Screen::sleep(1); @@ -87,12 +88,12 @@ class NpcPanel $this->game->output->writeln("========== {$npc['name']} =========="); $this->game->output->writeln($npc['desc']); $this->game->output->writeln("------------------------------"); - + $actions = $npc['actions'] ?? []; $actionKeys = array_keys($actions); - + foreach ($actionKeys as $idx => $key) { - $label = match($key) { + $label = match ($key) { 'talk' => '交谈', 'gift' => '领取赠礼', 'trade' => '交易', @@ -115,9 +116,9 @@ class NpcPanel $choice = Input::ask($this->game->output, "请选择: "); if ($choice == 0) return; - - if (isset($actionKeys[$choice-1])) { - $actionType = $actionKeys[$choice-1]; + + if (isset($actionKeys[$choice - 1])) { + $actionType = $actionKeys[$choice - 1]; $actionData = $actions[$actionType]; $this->handleAction($actionType, $actionData, $npc); Screen::pause($this->game->output); @@ -146,14 +147,14 @@ class NpcPanel $this->game->output->writeln("你状态很好,无需治疗。"); } break; - + case 'gift': // Check if already received (need storage for this state, maybe in player save data?) // For simplicity, let's just give it for now, or check inventory? // Real implementation should save received gifts in player data. // Let's assume we can give it repeatedly for now or add a simple check if I can modify Player class. // I'll modify Player class to store 'npc_flags'. - + $flag = "gift_{$npc['id']}"; if (isset($this->game->player->npcFlags[$flag])) { $this->game->output->writeln("{$npc['name']}: \"东西已经给你了,别太贪心。\""); @@ -168,7 +169,7 @@ class NpcPanel $this->game->player->npcFlags[$flag] = true; } break; - + case 'trade': $this->game->output->writeln("{$npc['name']}: \"{$data['text']}\""); $this->trade($data['items']); @@ -187,7 +188,7 @@ class NpcPanel $this->game->output->writeln("[0] 取消"); $choice = Input::ask($this->game->output, "购买: "); - if (isset($items[$choice-1])) { + if (isset($items[$choice - 1])) { $itemInfo = $items[$choice]; if ($this->game->player->spiritStones >= $itemInfo['price']) { $this->game->player->spiritStones -= $itemInfo['price']; @@ -247,10 +248,9 @@ class NpcPanel $matk = $stats['matk'] ?? 5; $pdef = $stats['pdef'] ?? $stats['def'] ?? 5; $mdef = $stats['mdef'] ?? 3; - $this->game->output->writeln("生命: {$stats['hp']} 物攻: {$patk} 魔攻: {$matk}"); + $this->game->output->writeln("生命: {$stats['maxHp']} 物攻: {$patk} 魔攻: {$matk}"); $this->game->output->writeln("物防: {$pdef} 魔防: {$mdef}"); $this->game->output->writeln("暴击: {$stats['crit']}% 暴伤: {$stats['critdmg']}%"); - $this->game->output->writeln("成长: {$stats['growth']}x"); $this->game->output->writeln("=============================="); if ($cost > 0) { @@ -277,9 +277,7 @@ class NpcPanel 'exp' => 0, 'baseStats' => $npc['base_stats'], 'equip' => [], - 'talentWeights' => $npc['talent_weights'] ?? [ - 'hp' => 1, 'patk' => 1, 'matk' => 1, 'pdef' => 1, 'mdef' => 1, 'crit' => 1, 'critdmg' => 1 - ], + ...$npc['base_stats'] ]); $player->recruitPartner($partner); diff --git a/src/Modules/PartnerPanel.php b/src/Modules/PartnerPanel.php index 01debde..61f2d07 100644 --- a/src/Modules/PartnerPanel.php +++ b/src/Modules/PartnerPanel.php @@ -81,7 +81,7 @@ class PartnerPanel $this->game->output->writeln("经验: {$this->cyan}{$partner->exp}/{$partner->maxExp}{$this->reset}"); $this->game->output->writeln(""); $this->game->output->writeln("{$this->white}--- 属性 ---{$this->reset}"); - $this->game->output->writeln("生命值: {$this->green}{$stats['maxHp']}{$this->reset}"); + $this->game->output->writeln("生命值: {$this->red}{$stats['hp']}{$this->reset}/{$stats['maxHp']}"); $this->game->output->writeln("物理攻击: {$this->red}{$stats['patk']}{$this->reset}"); $this->game->output->writeln("魔法攻击: {$this->cyan}{$stats['matk']}{$this->reset}"); $this->game->output->writeln("物理防御: {$this->red}{$stats['pdef']}{$this->reset}"); diff --git a/test/Test.php b/test/Test.php new file mode 100644 index 0000000..f8e7afe --- /dev/null +++ b/test/Test.php @@ -0,0 +1,43 @@ +getStats()); \ No newline at end of file