添加死亡显示

This commit is contained in:
milimoe 2025-04-28 00:24:03 +08:00
parent 27867da38d
commit 4d0e44afd8
Signed by: milimoe
GPG Key ID: 05D280912DA6C69E
6 changed files with 114 additions and 26 deletions

View File

@ -32,7 +32,7 @@ namespace Oshima.FunGame.OshimaModules.Effects.SkillEffects
{
foreach (Character target in targets)
{
WriteLine($"[ {target} ] 的行动速度提升了 {SPD:0.##} !持续时间:{持续时间} {GameplayEquilibriumConstant.InGameTime}");
WriteLine($"[ {target} ] 的行动速度提升了 {SPD:0.##} !持续时间:{持续时间}");
ExSPD e = new(Skill, new Dictionary<string, object>()
{
{ "exspd", SPD }

View File

@ -1,5 +1,4 @@
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
using Oshima.FunGame.OshimaModules.Effects.PassiveEffects;
namespace Oshima.FunGame.OshimaModules.Effects.SkillEffects
@ -9,7 +8,6 @@ namespace Oshima.FunGame.OshimaModules.Effects.SkillEffects
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"对目标{(Skill.CanSelectTargetCount > 1 ? $" {Skill.CanSelectTargetCount} " : "")}敌人造成封技 {封技时间},无法使用技能(魔法、战技和爆发技),并打断当前施法。";
public override DispelledType DispelledType => DispelledType.Strong;
private string => _durative && _duration > 0 ? + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}");
private double => _durative && _duration > 0 ? _duration + _levelGrowth * (Level - 1) : (!_durative && _durationTurn > 0 ? _durationTurn + _levelGrowth * (Level - 1) : 0);

View File

@ -32,7 +32,7 @@ namespace Oshima.FunGame.OshimaModules.Effects.SkillEffects
{
foreach (Character target in targets)
{
WriteLine($"[ {target} ] 的行动速度降低了 {-SPD:0.##} !持续时间:{持续时间} {GameplayEquilibriumConstant.InGameTime}");
WriteLine($"[ {target} ] 的行动速度降低了 {-SPD:0.##} !持续时间:{持续时间}");
ExSPD e = new(Skill, new Dictionary<string, object>()
{
{ "exspd", SPD }

View File

@ -317,6 +317,7 @@ namespace Oshima.FunGame.OshimaServers.Service
}
}
newSkill.Level = skill.Level;
newSkill.Item = item;
item.Skills.Passives.Add(newSkill);
}
List<string> strings = [];
@ -428,8 +429,8 @@ namespace Oshima.FunGame.OshimaServers.Service
{
User user = pc.Get<User>("user") ?? Factory.GetUser();
List<Character> characters = new(user.Inventory.Characters);
List<Item> items = new(user.Inventory.Items);
List<Character> characters = [.. user.Inventory.Characters];
List<Item> items = [.. user.Inventory.Items];
Character mc = user.Inventory.MainCharacter;
List<long> squad = [.. user.Inventory.Squad];
Dictionary<long, DateTime> training = user.Inventory.Training.ToDictionary(kv => kv.Key, kv => kv.Value);
@ -468,12 +469,16 @@ namespace Oshima.FunGame.OshimaServers.Service
// 自动回血
DateTime now = DateTime.Now;
int seconds = (int)(now - user.LastTime).TotalSeconds;
double recoveryHP = realCharacter.HR * seconds;
double recoveryMP = realCharacter.MR * seconds;
double recoveryEP = realCharacter.ER * seconds;
realCharacter.HP += recoveryHP;
realCharacter.MP += recoveryMP;
realCharacter.EP += recoveryEP;
// 死了不回,要去治疗
if (realCharacter.HP > 0)
{
double recoveryHP = realCharacter.HR * seconds;
double recoveryMP = realCharacter.MR * seconds;
double recoveryEP = realCharacter.ER * seconds;
realCharacter.HP += recoveryHP;
realCharacter.MP += recoveryMP;
realCharacter.EP += recoveryEP;
}
// 减少所有技能的冷却时间
foreach (Skill skill in realCharacter.Skills)
{
@ -485,7 +490,7 @@ namespace Oshima.FunGame.OshimaServers.Service
}
}
// 移除到时间的特效
List<Effect> effects = realCharacter.Effects.Where(e => e.Level > 0).ToList();
List<Effect> effects = [.. realCharacter.Effects];
foreach (Effect effect in effects)
{
if (effect.Level == 0)
@ -541,7 +546,7 @@ namespace Oshima.FunGame.OshimaServers.Service
public static IEnumerable<T> GetPage<T>(IEnumerable<T> list, int showPage, int pageSize)
{
return list.Skip((showPage - 1) * pageSize).Take(pageSize).ToList();
return [.. list.Skip((showPage - 1) * pageSize).Take(pageSize)];
}
public static string GetDrawCardResult(int reduce, User user, bool isMulti = false, int multiCount = 1)
@ -568,7 +573,7 @@ namespace Oshima.FunGame.OshimaServers.Service
{
case 1:
if ((int)type > (int)QualityType.Orange) type = QualityType.Orange;
Item[] = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("11") && i.QualityType == type).ToArray();
Item[] = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("11") && i.QualityType == type)];
Item a = [Random.Shared.Next(.Length)].Copy();
SetSellAndTradeTime(a);
user.Inventory.Items.Add(a);
@ -577,7 +582,7 @@ namespace Oshima.FunGame.OshimaServers.Service
case 2:
if ((int)type > (int)QualityType.Green) type = QualityType.Green;
Item[] = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("12") && i.QualityType == type).ToArray();
Item[] = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("12") && i.QualityType == type)];
Item b = [Random.Shared.Next(.Length)].Copy();
SetSellAndTradeTime(b);
user.Inventory.Items.Add(b);
@ -586,7 +591,7 @@ namespace Oshima.FunGame.OshimaServers.Service
case 3:
if ((int)type > (int)QualityType.Green) type = QualityType.Green;
Item[] = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("13") && i.QualityType == type).ToArray();
Item[] = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("13") && i.QualityType == type)];
Item c = [Random.Shared.Next(.Length)].Copy();
SetSellAndTradeTime(c);
user.Inventory.Items.Add(c);
@ -595,7 +600,7 @@ namespace Oshima.FunGame.OshimaServers.Service
case 4:
if ((int)type > (int)QualityType.Purple) type = QualityType.Purple;
Item[] = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("14") && i.QualityType == type).ToArray();
Item[] = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("14") && i.QualityType == type)];
Item d = [Random.Shared.Next(.Length)].Copy();
SetSellAndTradeTime(d);
user.Inventory.Items.Add(d);
@ -684,7 +689,7 @@ namespace Oshima.FunGame.OshimaServers.Service
{
case 1:
if ((int)type > (int)QualityType.Orange) type = QualityType.Orange;
Item[] = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("11") && i.QualityType == type).ToArray();
Item[] = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("11") && i.QualityType == type)];
Item a = [Random.Shared.Next(.Length)].Copy();
SetSellAndTradeTime(a);
user.Inventory.Items.Add(a);
@ -693,7 +698,7 @@ namespace Oshima.FunGame.OshimaServers.Service
case 2:
if ((int)type > (int)QualityType.Green) type = QualityType.Green;
Item[] = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("12") && i.QualityType == type).ToArray();
Item[] = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("12") && i.QualityType == type)];
Item b = [Random.Shared.Next(.Length)].Copy();
SetSellAndTradeTime(b);
user.Inventory.Items.Add(b);
@ -702,7 +707,7 @@ namespace Oshima.FunGame.OshimaServers.Service
case 3:
if ((int)type > (int)QualityType.Green) type = QualityType.Green;
Item[] = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("13") && i.QualityType == type).ToArray();
Item[] = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("13") && i.QualityType == type)];
Item c = [Random.Shared.Next(.Length)].Copy();
SetSellAndTradeTime(c);
user.Inventory.Items.Add(c);
@ -711,7 +716,7 @@ namespace Oshima.FunGame.OshimaServers.Service
case 4:
if ((int)type > (int)QualityType.Purple) type = QualityType.Purple;
Item[] = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("14") && i.QualityType == type).ToArray();
Item[] = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("14") && i.QualityType == type)];
Item d = [Random.Shared.Next(.Length)].Copy();
SetSellAndTradeTime(d);
user.Inventory.Items.Add(d);
@ -1295,10 +1300,10 @@ namespace Oshima.FunGame.OshimaServers.Service
boss.Level = cLevel;
boss.NormalAttack.Level = naLevel;
boss.NormalAttack.HardnessTime = 6;
Item[] weapons = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("11") && (int)i.QualityType == 4).ToArray();
Item[] armors = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("12") && (int)i.QualityType == 1).ToArray();
Item[] shoes = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("13") && (int)i.QualityType == 1).ToArray();
Item[] accessory = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("14") && (int)i.QualityType == 3).ToArray();
Item[] weapons = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("11") && (int)i.QualityType == 4)];
Item[] armors = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("12") && (int)i.QualityType == 1)];
Item[] shoes = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("13") && (int)i.QualityType == 1)];
Item[] accessory = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("14") && (int)i.QualityType == 3)];
Item? a = null, b = null, c = null, d = null, d2 = null;
if (weapons.Length > 0)
{

View File

@ -4,6 +4,7 @@ using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
using Milimoe.FunGame.Core.Model;
using Oshima.FunGame.OshimaModules.Effects.OpenEffects;
using Oshima.FunGame.OshimaModules.Skills;
namespace Oshima.FunGame.OshimaServers.Service
{
@ -114,6 +115,11 @@ namespace Oshima.FunGame.OshimaServers.Service
c.Level = clevel;
c.NormalAttack.Level = mlevel;
FunGameService.AddCharacterSkills(c, 1, slevel, slevel);
Skill = new (c)
{
Level = slevel
};
c.Skills.Add();
}
// 创建顺序表并排序

View File

@ -5151,6 +5151,85 @@ namespace Oshima.FunGame.WebAPI.Controllers
}
}
[HttpPost("springoflife")]
public string SpringOfLife([FromQuery] long? uid = null)
{
long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11));
PluginConfig pc = new("saved", userid.ToString());
pc.LoadConfig();
string msg = "";
if (pc.Count > 0)
{
User user = FunGameService.GetUser(pc);
int dead = user.Inventory.Characters.Count(c => c.HP <= 0);
int halfdown = user.Inventory.Characters.Count(c => (c.HP / c.MaxHP) < 0.5 && c.HP > 0);
int halfup = user.Inventory.Characters.Count(c => (c.HP / c.MaxHP) >= 0.5);
double deadNeed = 10000 * dead;
double halfdownNeed = 6000 * halfdown;
double halfupNeed = 2000 * halfup;
double total = deadNeed + halfdownNeed + halfupNeed;
if (user.Inventory.Credits >= total)
{
user.Inventory.Credits -= total;
foreach (Character character in user.Inventory.Characters)
{
character.Recovery();
}
msg = $"感谢使用生命之泉服务!你已消费:{total} {General.GameplayEquilibriumConstant.InGameCurrency}。";
user.LastTime = DateTime.Now;
pc.Add("user", user);
pc.SaveConfig();
}
else
{
msg = $"你的 {General.GameplayEquilibriumConstant.InGameCurrency} 不足 {total} 呢!无法饮用生命之泉!";
}
msg += $"{dead} 个死亡角色,{halfdown} 个 50% 以下的角色,{halfup} 个 50% 以上的角色)\r\n" +
$"收费标准:\r\n10000 {General.GameplayEquilibriumConstant.InGameCurrency} / 死亡角色\r\n" +
$"6000 {General.GameplayEquilibriumConstant.InGameCurrency} / 50% 生命值以下的角色\r\n" +
$"2000 {General.GameplayEquilibriumConstant.InGameCurrency} / 50% 生命值以上的角色";
return msg;
}
else
{
return noSaved;
}
}
[HttpPost("template")]
public string Template([FromQuery] long? uid = null)
{
long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11));
PluginConfig pc = new("saved", userid.ToString());
pc.LoadConfig();
string msg = "";
if (pc.Count > 0)
{
User user = FunGameService.GetUser(pc);
user.LastTime = DateTime.Now;
pc.Add("user", user);
pc.SaveConfig();
return msg;
}
else
{
return noSaved;
}
}
[HttpGet("reload")]
public string Relaod([FromQuery] long? master = null)
{