From 306b0ec14827819e2d5d6031ddc5bdf537f218d2 Mon Sep 17 00:00:00 2001 From: milimoe Date: Thu, 5 Sep 2024 01:03:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=88=98=E6=96=97=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/Character/Character.cs | 47 +++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/Entity/Character/Character.cs b/Entity/Character/Character.cs index 13848f8..6ffd318 100644 --- a/Entity/Character/Character.cs +++ b/Entity/Character/Character.cs @@ -145,9 +145,14 @@ namespace Milimoe.FunGame.Core.Entity public double ExHP2 { get; set; } = 0; /// - /// 生命值 = 基础生命值 + 额外生命值 + 额外生命值2 + /// 最大生命值 = 基础生命值 + 额外生命值 + 额外生命值2 /// - public double HP => BaseHP + ExHP + ExHP2; + public double MaxHP => BaseHP + ExHP + ExHP2; + + /// + /// 当前生命值 [ 战斗相关 ] + /// + public double HP { get; set; } = 0; /// /// 初始魔法值 [ 初始设定 ] @@ -171,12 +176,17 @@ namespace Milimoe.FunGame.Core.Entity public double ExMP2 { get; set; } = 0; /// - /// 魔法值 = 基础魔法值 + 额外魔法值 + 额外魔法值2 + /// 最大魔法值 = 基础魔法值 + 额外魔法值 + 额外魔法值2 /// - public double MP => BaseMP + ExMP + ExMP2; + public double MaxMP => BaseMP + ExMP + ExMP2; /// - /// 爆发能量 [ 战斗相关 ] + /// 当前魔法值 [ 战斗相关 ] + /// + public double MP { get; set; } = 0; + + /// + /// 当前爆发能量 [ 战斗相关 ] /// public double EP { get; set; } = 0; @@ -585,6 +595,32 @@ namespace Milimoe.FunGame.Core.Entity return new(); } + /// + /// 回复状态至满 + /// + /// + public void Recovery(double EP = -1) + { + HP = MaxHP; + MP = MaxMP; + if (EP != -1) this.EP = EP; + } + + /// + /// 按时间回复状态 + /// + /// + /// + public void Recovery(int time, double EP = -1) + { + if (time > 0) + { + HP = Math.Min(MaxHP, Calculation.Round2Digits(HP + HR * time)); + MP = Math.Min(MaxMP, Calculation.Round2Digits(MP + MR * time)); + if (EP != -1) this.EP = EP; + } + } + /// /// 比较一个角色(只比较 ) /// @@ -674,6 +710,7 @@ namespace Milimoe.FunGame.Core.Entity Skills = new(Skills), Items = new(Items), }; + c.Recovery(); return c; } }