mirror of
https://github.com/oshima-studios/OshimaGameModule.git
synced 2025-08-02 12:02:56 +00:00
添加新的物品
This commit is contained in:
parent
fe9d07902c
commit
64f8ff961a
@ -259,7 +259,7 @@ namespace Oshima.Core.Controllers
|
|||||||
character = FunGameService.Characters[1].Copy();
|
character = FunGameService.Characters[1].Copy();
|
||||||
msg.Add($"技能展示的属性基于演示角色:[ {character} ]");
|
msg.Add($"技能展示的属性基于演示角色:[ {character} ]");
|
||||||
}
|
}
|
||||||
IEnumerable<Skill> skills = FunGameService.Skills.Union(FunGameService.Magics);
|
IEnumerable<Skill> skills = FunGameService.AllSkills;
|
||||||
if (id != null && FunGameService.Characters.Count > 1)
|
if (id != null && FunGameService.Characters.Count > 1)
|
||||||
{
|
{
|
||||||
Skill? skill = skills.Where(s => s.Id == id).FirstOrDefault()?.Copy();
|
Skill? skill = skills.Where(s => s.Id == id).FirstOrDefault()?.Copy();
|
||||||
@ -280,6 +280,46 @@ namespace Oshima.Core.Controllers
|
|||||||
return NetworkUtility.JsonSerialize("");
|
return NetworkUtility.JsonSerialize("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet("skillinfoname")]
|
||||||
|
public string GetSkillInfo_Name([FromQuery] long? qq = null, [FromQuery] string? name = null)
|
||||||
|
{
|
||||||
|
long userid = qq ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11));
|
||||||
|
PluginConfig pc = new("saved", userid.ToString());
|
||||||
|
pc.LoadConfig();
|
||||||
|
List<string> msg = [];
|
||||||
|
Character? character = null;
|
||||||
|
if (pc.Count > 0)
|
||||||
|
{
|
||||||
|
User user = FunGameService.GetUser(pc);
|
||||||
|
character = user.Inventory.MainCharacter;
|
||||||
|
msg.Add($"技能展示的属性基于你的主战角色:[ {character} ]");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
character = FunGameService.Characters[1].Copy();
|
||||||
|
msg.Add($"技能展示的属性基于演示角色:[ {character} ]");
|
||||||
|
}
|
||||||
|
IEnumerable<Skill> skills = FunGameService.AllSkills;
|
||||||
|
if (name != null && FunGameService.Characters.Count > 1)
|
||||||
|
{
|
||||||
|
Skill? skill = skills.Where(s => s.Name == name).FirstOrDefault()?.Copy();
|
||||||
|
if (skill != null)
|
||||||
|
{
|
||||||
|
msg.Add(character.ToStringWithLevel() + "\r\n" + skill.ToString());
|
||||||
|
skill.Character = character;
|
||||||
|
skill.Level++; ;
|
||||||
|
msg.Add(character.ToStringWithLevel() + "\r\n" + skill.ToString());
|
||||||
|
character.Level = General.GameplayEquilibriumConstant.MaxLevel;
|
||||||
|
skill.Level = skill.IsMagic ? General.GameplayEquilibriumConstant.MaxMagicLevel : General.GameplayEquilibriumConstant.MaxSkillLevel;
|
||||||
|
msg.Add(character.ToStringWithLevel() + "\r\n" + skill.ToString());
|
||||||
|
|
||||||
|
return NetworkUtility.JsonSerialize(string.Join("\r\n", msg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NetworkUtility.JsonSerialize("");
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet("iteminfo")]
|
[HttpGet("iteminfo")]
|
||||||
public string GetItemInfo([FromQuery] long? qq = null, [FromQuery] long? id = null)
|
public string GetItemInfo([FromQuery] long? qq = null, [FromQuery] long? id = null)
|
||||||
{
|
{
|
||||||
@ -1555,6 +1595,8 @@ namespace Oshima.Core.Controllers
|
|||||||
|
|
||||||
if (user1 != null && user2 != null)
|
if (user1 != null && user2 != null)
|
||||||
{
|
{
|
||||||
|
user1.Inventory.MainCharacter.Recovery(EP: 200);
|
||||||
|
user2.Inventory.MainCharacter.Recovery(EP: 200);
|
||||||
return FunGameActionQueue.NewAndStartGame([user1.Inventory.MainCharacter, user2.Inventory.MainCharacter], false, false, false, false, showAllRound);
|
return FunGameActionQueue.NewAndStartGame([user1.Inventory.MainCharacter, user2.Inventory.MainCharacter], false, false, false, false, showAllRound);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1645,8 +1687,12 @@ namespace Oshima.Core.Controllers
|
|||||||
|
|
||||||
if (user1 != null && user2 != null)
|
if (user1 != null && user2 != null)
|
||||||
{
|
{
|
||||||
Character[] squad1 = [.. user1.Inventory.Characters.Where(c => user1.Inventory.Squad.Contains(c.Id)).Select(c => c.Copy())];
|
Character[] squad1 = [.. user1.Inventory.Characters.Where(c => user1.Inventory.Squad.Contains(c.Id)).Select(c => c)];
|
||||||
Character[] squad2 = [.. user2.Inventory.Characters.Where(c => user2.Inventory.Squad.Contains(c.Id)).Select(c => c.Copy())];
|
Character[] squad2 = [.. user2.Inventory.Characters.Where(c => user2.Inventory.Squad.Contains(c.Id)).Select(c => c)];
|
||||||
|
foreach (Character character in squad1.Union(squad2))
|
||||||
|
{
|
||||||
|
character.Recovery(EP: 200);
|
||||||
|
}
|
||||||
Team team1 = new($"{user1.Username}的小队", squad1);
|
Team team1 = new($"{user1.Username}的小队", squad1);
|
||||||
Team team2 = new($"{user2.Username}的小队", squad2);
|
Team team2 = new($"{user2.Username}的小队", squad2);
|
||||||
return FunGameActionQueue.NewAndStartTeamGame([team1, team2], 0, 0, false, false, false, false, showAllRound);
|
return FunGameActionQueue.NewAndStartTeamGame([team1, team2], 0, 0, false, false, false, false, showAllRound);
|
||||||
|
@ -15,6 +15,8 @@ namespace Oshima.Core.Utils
|
|||||||
{
|
{
|
||||||
public static List<Character> Characters { get; } = [];
|
public static List<Character> Characters { get; } = [];
|
||||||
public static List<Skill> Skills { get; } = [];
|
public static List<Skill> Skills { get; } = [];
|
||||||
|
public static List<Skill> PassiveSkills { get; } = [];
|
||||||
|
public static List<Skill> SuperSkills { get; } = [];
|
||||||
public static List<Skill> Magics { get; } = [];
|
public static List<Skill> Magics { get; } = [];
|
||||||
public static List<Item> Equipment { get; } = [];
|
public static List<Item> Equipment { get; } = [];
|
||||||
public static List<Item> Items { get; } = [];
|
public static List<Item> Items { get; } = [];
|
||||||
@ -41,15 +43,20 @@ namespace Oshima.Core.Utils
|
|||||||
|
|
||||||
Skills.AddRange([new 疾风步()]);
|
Skills.AddRange([new 疾风步()]);
|
||||||
|
|
||||||
|
SuperSkills.AddRange([new 嗜血本能(), new 平衡强化(), new 绝对领域(), new 精准打击(), new 三重叠加(), new 变幻之心(), new 力量爆发(), new 能量毁灭(), new 血之狂欢(), new 迅捷之势(), new 天赐之力(), new 魔法涌流()]);
|
||||||
|
|
||||||
|
PassiveSkills.AddRange([new META马(), new 心灵之火(), new 魔法震荡(), new 灵能反射(), new 智慧与力量(), new 致命打击(), new 毁灭之势(), new 枯竭打击(), new 破釜沉舟(), new 累积之压(), new 敏捷之刃(), new 弱者猎手()]);
|
||||||
|
|
||||||
Magics.AddRange([new 冰霜攻击(), new 火之矢(), new 水之矢(), new 风之轮(), new 石之锤(), new 心灵之霞(), new 次元上升(), new 暗物质(), new 回复术(), new 治愈术(),
|
Magics.AddRange([new 冰霜攻击(), new 火之矢(), new 水之矢(), new 风之轮(), new 石之锤(), new 心灵之霞(), new 次元上升(), new 暗物质(), new 回复术(), new 治愈术(),
|
||||||
new 时间加速(), new 时间减速(), new 沉默十字(), new 反魔法领域()]);
|
new 时间加速(), new 时间减速(), new 沉默十字(), new 反魔法领域()]);
|
||||||
|
|
||||||
Dictionary<string, Item> exItems = Factory.GetGameModuleInstances<Item>(OshimaGameModuleConstant.General, OshimaGameModuleConstant.Item);
|
Dictionary<string, Item> exItems = Factory.GetGameModuleInstances<Item>(OshimaGameModuleConstant.General, OshimaGameModuleConstant.Item);
|
||||||
Equipment.AddRange(exItems.Values.Where(i => (int)i.ItemType >= 0 && (int)i.ItemType < 5));
|
Equipment.AddRange(exItems.Values.Where(i => (int)i.ItemType >= 0 && (int)i.ItemType < 5));
|
||||||
Equipment.AddRange([new 攻击之爪5(), new 攻击之爪15(), new 攻击之爪25(), new 攻击之爪35()]);
|
Equipment.AddRange([new 攻击之爪8(), new 攻击之爪20(), new 攻击之爪35(), new 攻击之爪50()]);
|
||||||
|
|
||||||
Items.AddRange(exItems.Values.Where(i => (int)i.ItemType > 4));
|
Items.AddRange(exItems.Values.Where(i => (int)i.ItemType > 4));
|
||||||
Items.AddRange([new 小经验书(), new 中经验书(), new 大经验书(), new 升华之印(), new 流光之印(), new 永恒之印(), new 技能卷轴(), new 智慧之果(), new 奥术符文(), new 混沌之核()]);
|
Items.AddRange([new 小经验书(), new 中经验书(), new 大经验书(), new 升华之印(), new 流光之印(), new 永恒之印(), new 技能卷轴(), new 智慧之果(), new 奥术符文(), new 混沌之核(),
|
||||||
|
new 小回复药(), new 中回复药(), new 大回复药(), new 魔力填充剂1(), new 魔力填充剂2(), new 魔力填充剂3(), new 能量饮料1(), new 能量饮料2(), new 能量饮料3()]);
|
||||||
|
|
||||||
AllItems.AddRange(Equipment);
|
AllItems.AddRange(Equipment);
|
||||||
AllItems.AddRange(Items);
|
AllItems.AddRange(Items);
|
||||||
@ -65,7 +72,9 @@ namespace Oshima.Core.Utils
|
|||||||
ItemSkills.AddRange([.. Equipment.SelectMany(i => i.Skills.Passives), .. Items.SelectMany(i => i.Skills.Passives)]);
|
ItemSkills.AddRange([.. Equipment.SelectMany(i => i.Skills.Passives), .. Items.SelectMany(i => i.Skills.Passives)]);
|
||||||
|
|
||||||
AllSkills.AddRange(Skills);
|
AllSkills.AddRange(Skills);
|
||||||
|
AllSkills.AddRange(PassiveSkills);
|
||||||
AllSkills.AddRange(ItemSkills);
|
AllSkills.AddRange(ItemSkills);
|
||||||
|
AllSkills.AddRange(SuperSkills);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Item> GenerateMagicCards(int count, QualityType? qualityType = null)
|
public static List<Item> GenerateMagicCards(int count, QualityType? qualityType = null)
|
||||||
@ -363,6 +372,8 @@ namespace Oshima.Core.Utils
|
|||||||
Characters.Clear();
|
Characters.Clear();
|
||||||
Equipment.Clear();
|
Equipment.Clear();
|
||||||
Skills.Clear();
|
Skills.Clear();
|
||||||
|
SuperSkills.Clear();
|
||||||
|
PassiveSkills.Clear();
|
||||||
Magics.Clear();
|
Magics.Clear();
|
||||||
AllItems.Clear();
|
AllItems.Clear();
|
||||||
ItemSkills.Clear();
|
ItemSkills.Clear();
|
||||||
|
@ -5,42 +5,29 @@ using Oshima.FunGame.OshimaModules.Skills;
|
|||||||
|
|
||||||
namespace Oshima.FunGame.OshimaModules.Items
|
namespace Oshima.FunGame.OshimaModules.Items
|
||||||
{
|
{
|
||||||
public class 攻击之爪5 : Item
|
public class 攻击之爪8 : Item
|
||||||
{
|
{
|
||||||
public override long Id => (long)AccessoryID.攻击之爪5;
|
public override long Id => (long)AccessoryID.攻击之爪8;
|
||||||
public override string Name => "攻击之爪 +5";
|
public override string Name => "攻击之爪 +8";
|
||||||
public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : "";
|
public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : "";
|
||||||
public override QualityType QualityType => QualityType.White;
|
public override QualityType QualityType => QualityType.White;
|
||||||
|
|
||||||
public 攻击之爪5(Character? character = null) : base(ItemType.Accessory)
|
public 攻击之爪8(Character? character = null) : base(ItemType.Accessory)
|
||||||
{
|
{
|
||||||
Skills.Passives.Add(new 攻击之爪技能(character, this, 5));
|
Skills.Passives.Add(new 攻击之爪技能(character, this, 8));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class 攻击之爪15 : Item
|
public class 攻击之爪20 : Item
|
||||||
{
|
{
|
||||||
public override long Id => (long)AccessoryID.攻击之爪15;
|
public override long Id => (long)AccessoryID.攻击之爪20;
|
||||||
public override string Name => "攻击之爪 +15";
|
public override string Name => "攻击之爪 +20";
|
||||||
public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : "";
|
public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : "";
|
||||||
public override QualityType QualityType => QualityType.Green;
|
public override QualityType QualityType => QualityType.Green;
|
||||||
|
|
||||||
public 攻击之爪15(Character? character = null) : base(ItemType.Accessory)
|
public 攻击之爪20(Character? character = null) : base(ItemType.Accessory)
|
||||||
{
|
{
|
||||||
Skills.Passives.Add(new 攻击之爪技能(character, this, 15));
|
Skills.Passives.Add(new 攻击之爪技能(character, this, 20));
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class 攻击之爪25 : Item
|
|
||||||
{
|
|
||||||
public override long Id => (long)AccessoryID.攻击之爪25;
|
|
||||||
public override string Name => "攻击之爪 +25";
|
|
||||||
public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : "";
|
|
||||||
public override QualityType QualityType => QualityType.Blue;
|
|
||||||
|
|
||||||
public 攻击之爪25(Character? character = null) : base(ItemType.Accessory)
|
|
||||||
{
|
|
||||||
Skills.Passives.Add(new 攻击之爪技能(character, this, 25));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +36,7 @@ namespace Oshima.FunGame.OshimaModules.Items
|
|||||||
public override long Id => (long)AccessoryID.攻击之爪35;
|
public override long Id => (long)AccessoryID.攻击之爪35;
|
||||||
public override string Name => "攻击之爪 +35";
|
public override string Name => "攻击之爪 +35";
|
||||||
public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : "";
|
public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : "";
|
||||||
public override QualityType QualityType => QualityType.Purple;
|
public override QualityType QualityType => QualityType.Blue;
|
||||||
|
|
||||||
public 攻击之爪35(Character? character = null) : base(ItemType.Accessory)
|
public 攻击之爪35(Character? character = null) : base(ItemType.Accessory)
|
||||||
{
|
{
|
||||||
@ -57,6 +44,19 @@ namespace Oshima.FunGame.OshimaModules.Items
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class 攻击之爪50 : Item
|
||||||
|
{
|
||||||
|
public override long Id => (long)AccessoryID.攻击之爪50;
|
||||||
|
public override string Name => "攻击之爪 +50";
|
||||||
|
public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : "";
|
||||||
|
public override QualityType QualityType => QualityType.Purple;
|
||||||
|
|
||||||
|
public 攻击之爪50(Character? character = null) : base(ItemType.Accessory)
|
||||||
|
{
|
||||||
|
Skills.Passives.Add(new 攻击之爪技能(character, this, 50));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class 攻击之爪技能 : Skill
|
public class 攻击之爪技能 : Skill
|
||||||
{
|
{
|
||||||
public override long Id => (long)ItemPassiveID.攻击之爪;
|
public override long Id => (long)ItemPassiveID.攻击之爪;
|
||||||
|
149
OshimaModules/Items/Consumable/回复药.cs
Normal file
149
OshimaModules/Items/Consumable/回复药.cs
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
using Milimoe.FunGame.Core.Entity;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
|
using Oshima.FunGame.OshimaModules.Effects.ItemEffects;
|
||||||
|
using Oshima.FunGame.OshimaModules.Skills;
|
||||||
|
|
||||||
|
namespace Oshima.FunGame.OshimaModules.Items
|
||||||
|
{
|
||||||
|
public class 回复药
|
||||||
|
{
|
||||||
|
public interface HPBook
|
||||||
|
{
|
||||||
|
public double HP { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Init(Item item, double exp, int remainUseTimes = 1)
|
||||||
|
{
|
||||||
|
item.Skills.Active = new 回复药技能(item, exp);
|
||||||
|
item.RemainUseTimes = remainUseTimes;
|
||||||
|
item.IsInGameItem = false;
|
||||||
|
item.IsReduceTimesAfterUse = true;
|
||||||
|
item.IsRemoveAfterUse = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string UseItem(Item item, Character character)
|
||||||
|
{
|
||||||
|
if (item.Skills.Active != null)
|
||||||
|
{
|
||||||
|
item.Skills.Active.OnSkillCasted([character]);
|
||||||
|
string msg = $"对角色 [ {character} ] 使用 [ {item.Name} ] 成功!";
|
||||||
|
if (item is HPBook hpBook)
|
||||||
|
{
|
||||||
|
msg += $"回复了 {hpBook.HP} 点生命值!";
|
||||||
|
}
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
return "此物品没有主动技能,无法被使用!";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool OnItemUsed(Item item, Dictionary<string, object> args)
|
||||||
|
{
|
||||||
|
string msg = "";
|
||||||
|
bool result = false;
|
||||||
|
Character[] targets = [];
|
||||||
|
string key = args.Keys.FirstOrDefault(s => s.Equals("targets", StringComparison.CurrentCultureIgnoreCase)) ?? "";
|
||||||
|
if (key != "" && args.TryGetValue(key, out object? value) && value is Character[] temp)
|
||||||
|
{
|
||||||
|
if (temp.Length > 0)
|
||||||
|
{
|
||||||
|
targets = [temp[0]];
|
||||||
|
msg = UseItem(item, temp[0]);
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg = $"使用物品失败,没有作用目标!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["msg"] = msg;
|
||||||
|
key = args.Keys.FirstOrDefault(s => s.Equals("useCount", StringComparison.CurrentCultureIgnoreCase)) ?? "";
|
||||||
|
if (key != "" && args.TryGetValue(key, out value) && value is int count && targets.Length > 0)
|
||||||
|
{
|
||||||
|
string truemsg = $"对角色 [ {targets[0]} ] 使用 {count} 个 [ {item.Name} ] 成功!";
|
||||||
|
if (item is HPBook expBook)
|
||||||
|
{
|
||||||
|
truemsg += $"回复了 {expBook.HP * count} 点生命值!";
|
||||||
|
}
|
||||||
|
args["truemsg"] = truemsg;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class 小回复药 : Item, 回复药.HPBook
|
||||||
|
{
|
||||||
|
public override long Id => (long)ConsumableID.小回复药;
|
||||||
|
public override string Name => "小回复药";
|
||||||
|
public override string Description => Skills.Active?.Description ?? "";
|
||||||
|
public override QualityType QualityType => QualityType.White;
|
||||||
|
public double HP { get; set; } = 300;
|
||||||
|
|
||||||
|
public 小回复药(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable)
|
||||||
|
{
|
||||||
|
User = user;
|
||||||
|
回复药.Init(this, HP, remainUseTimes);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnItemUsed(Dictionary<string, object> args)
|
||||||
|
{
|
||||||
|
return 回复药.OnItemUsed(this, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class 中回复药 : Item, 回复药.HPBook
|
||||||
|
{
|
||||||
|
public override long Id => (long)ConsumableID.中回复药;
|
||||||
|
public override string Name => "中回复药";
|
||||||
|
public override string Description => Skills.Active?.Description ?? "";
|
||||||
|
public override QualityType QualityType => QualityType.Green;
|
||||||
|
public double HP { get; set; } = 700;
|
||||||
|
|
||||||
|
public 中回复药(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable)
|
||||||
|
{
|
||||||
|
User = user;
|
||||||
|
回复药.Init(this, HP, remainUseTimes);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnItemUsed(Dictionary<string, object> args)
|
||||||
|
{
|
||||||
|
return 回复药.OnItemUsed(this, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class 大回复药 : Item, 回复药.HPBook
|
||||||
|
{
|
||||||
|
public override long Id => (long)ConsumableID.大回复药;
|
||||||
|
public override string Name => "大回复药";
|
||||||
|
public override string Description => Skills.Active?.Description ?? "";
|
||||||
|
public override QualityType QualityType => QualityType.Blue;
|
||||||
|
public double HP { get; set; } = 1500;
|
||||||
|
|
||||||
|
public 大回复药(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable)
|
||||||
|
{
|
||||||
|
User = user;
|
||||||
|
回复药.Init(this, HP, remainUseTimes);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnItemUsed(Dictionary<string, object> args)
|
||||||
|
{
|
||||||
|
return 回复药.OnItemUsed(this, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class 回复药技能 : Skill
|
||||||
|
{
|
||||||
|
public override long Id => (long)ItemActiveID.回复药;
|
||||||
|
public override string Name => "回复药";
|
||||||
|
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
|
||||||
|
|
||||||
|
public 回复药技能(Item? item = null, double hp = 0) : base(SkillType.Item)
|
||||||
|
{
|
||||||
|
Level = 1;
|
||||||
|
Item = item;
|
||||||
|
Effects.Add(new RecoverHP(this, new()
|
||||||
|
{
|
||||||
|
{ "hp", hp }
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
149
OshimaModules/Items/Consumable/能量饮料.cs
Normal file
149
OshimaModules/Items/Consumable/能量饮料.cs
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
using Milimoe.FunGame.Core.Entity;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
|
using Oshima.FunGame.OshimaModules.Effects.ItemEffects;
|
||||||
|
using Oshima.FunGame.OshimaModules.Skills;
|
||||||
|
|
||||||
|
namespace Oshima.FunGame.OshimaModules.Items
|
||||||
|
{
|
||||||
|
public class 能量饮料
|
||||||
|
{
|
||||||
|
public interface EPBook
|
||||||
|
{
|
||||||
|
public double EP { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Init(Item item, double exp, int remainUseTimes = 1)
|
||||||
|
{
|
||||||
|
item.Skills.Active = new 能量饮料技能(item, exp);
|
||||||
|
item.RemainUseTimes = remainUseTimes;
|
||||||
|
item.IsInGameItem = false;
|
||||||
|
item.IsReduceTimesAfterUse = true;
|
||||||
|
item.IsRemoveAfterUse = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string UseItem(Item item, Character character)
|
||||||
|
{
|
||||||
|
if (item.Skills.Active != null)
|
||||||
|
{
|
||||||
|
item.Skills.Active.OnSkillCasted([character]);
|
||||||
|
string msg = $"对角色 [ {character} ] 使用 [ {item.Name} ] 成功!";
|
||||||
|
if (item is EPBook hpBook)
|
||||||
|
{
|
||||||
|
msg += $"回复了 {hpBook.EP} 点能量值!";
|
||||||
|
}
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
return "此物品没有主动技能,无法被使用!";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool OnItemUsed(Item item, Dictionary<string, object> args)
|
||||||
|
{
|
||||||
|
string msg = "";
|
||||||
|
bool result = false;
|
||||||
|
Character[] targets = [];
|
||||||
|
string key = args.Keys.FirstOrDefault(s => s.Equals("targets", StringComparison.CurrentCultureIgnoreCase)) ?? "";
|
||||||
|
if (key != "" && args.TryGetValue(key, out object? value) && value is Character[] temp)
|
||||||
|
{
|
||||||
|
if (temp.Length > 0)
|
||||||
|
{
|
||||||
|
targets = [temp[0]];
|
||||||
|
msg = UseItem(item, temp[0]);
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg = $"使用物品失败,没有作用目标!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["msg"] = msg;
|
||||||
|
key = args.Keys.FirstOrDefault(s => s.Equals("useCount", StringComparison.CurrentCultureIgnoreCase)) ?? "";
|
||||||
|
if (key != "" && args.TryGetValue(key, out value) && value is int count && targets.Length > 0)
|
||||||
|
{
|
||||||
|
string truemsg = $"对角色 [ {targets[0]} ] 使用 {count} 个 [ {item.Name} ] 成功!";
|
||||||
|
if (item is EPBook expBook)
|
||||||
|
{
|
||||||
|
truemsg += $"回复了 {expBook.EP * count} 点能量值!";
|
||||||
|
}
|
||||||
|
args["truemsg"] = truemsg;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class 能量饮料1 : Item, 能量饮料.EPBook
|
||||||
|
{
|
||||||
|
public override long Id => (long)ConsumableID.能量饮料1;
|
||||||
|
public override string Name => "能量饮料";
|
||||||
|
public override string Description => Skills.Active?.Description ?? "";
|
||||||
|
public override QualityType QualityType => QualityType.Green;
|
||||||
|
public double EP { get; set; } = 50;
|
||||||
|
|
||||||
|
public 能量饮料1(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable)
|
||||||
|
{
|
||||||
|
User = user;
|
||||||
|
能量饮料.Init(this, EP, remainUseTimes);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnItemUsed(Dictionary<string, object> args)
|
||||||
|
{
|
||||||
|
return 能量饮料.OnItemUsed(this, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class 能量饮料2 : Item, 能量饮料.EPBook
|
||||||
|
{
|
||||||
|
public override long Id => (long)ConsumableID.能量饮料2;
|
||||||
|
public override string Name => "能量饮料 Pro";
|
||||||
|
public override string Description => Skills.Active?.Description ?? "";
|
||||||
|
public override QualityType QualityType => QualityType.Blue;
|
||||||
|
public double EP { get; set; } = 100;
|
||||||
|
|
||||||
|
public 能量饮料2(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable)
|
||||||
|
{
|
||||||
|
User = user;
|
||||||
|
能量饮料.Init(this, EP, remainUseTimes);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnItemUsed(Dictionary<string, object> args)
|
||||||
|
{
|
||||||
|
return 能量饮料.OnItemUsed(this, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class 能量饮料3 : Item, 能量饮料.EPBook
|
||||||
|
{
|
||||||
|
public override long Id => (long)ConsumableID.能量饮料3;
|
||||||
|
public override string Name => "能量饮料 Pro Max";
|
||||||
|
public override string Description => Skills.Active?.Description ?? "";
|
||||||
|
public override QualityType QualityType => QualityType.Purple;
|
||||||
|
public double EP { get; set; } = 200;
|
||||||
|
|
||||||
|
public 能量饮料3(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable)
|
||||||
|
{
|
||||||
|
User = user;
|
||||||
|
能量饮料.Init(this, EP, remainUseTimes);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnItemUsed(Dictionary<string, object> args)
|
||||||
|
{
|
||||||
|
return 能量饮料.OnItemUsed(this, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class 能量饮料技能 : Skill
|
||||||
|
{
|
||||||
|
public override long Id => (long)ItemActiveID.能量饮料;
|
||||||
|
public override string Name => "能量饮料";
|
||||||
|
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
|
||||||
|
|
||||||
|
public 能量饮料技能(Item? item = null, double ep = 0) : base(SkillType.Item)
|
||||||
|
{
|
||||||
|
Level = 1;
|
||||||
|
Item = item;
|
||||||
|
Effects.Add(new GetEP(this, new()
|
||||||
|
{
|
||||||
|
{ "ep", ep }
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
149
OshimaModules/Items/Consumable/魔力填充剂.cs
Normal file
149
OshimaModules/Items/Consumable/魔力填充剂.cs
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
using Milimoe.FunGame.Core.Entity;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
|
using Oshima.FunGame.OshimaModules.Effects.ItemEffects;
|
||||||
|
using Oshima.FunGame.OshimaModules.Skills;
|
||||||
|
|
||||||
|
namespace Oshima.FunGame.OshimaModules.Items
|
||||||
|
{
|
||||||
|
public class 魔力填充剂
|
||||||
|
{
|
||||||
|
public interface MPBook
|
||||||
|
{
|
||||||
|
public double MP { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Init(Item item, double exp, int remainUseTimes = 1)
|
||||||
|
{
|
||||||
|
item.Skills.Active = new 魔力填充剂技能(item, exp);
|
||||||
|
item.RemainUseTimes = remainUseTimes;
|
||||||
|
item.IsInGameItem = false;
|
||||||
|
item.IsReduceTimesAfterUse = true;
|
||||||
|
item.IsRemoveAfterUse = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string UseItem(Item item, Character character)
|
||||||
|
{
|
||||||
|
if (item.Skills.Active != null)
|
||||||
|
{
|
||||||
|
item.Skills.Active.OnSkillCasted([character]);
|
||||||
|
string msg = $"对角色 [ {character} ] 使用 [ {item.Name} ] 成功!";
|
||||||
|
if (item is MPBook hpBook)
|
||||||
|
{
|
||||||
|
msg += $"回复了 {hpBook.MP} 点魔法值!";
|
||||||
|
}
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
return "此物品没有主动技能,无法被使用!";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool OnItemUsed(Item item, Dictionary<string, object> args)
|
||||||
|
{
|
||||||
|
string msg = "";
|
||||||
|
bool result = false;
|
||||||
|
Character[] targets = [];
|
||||||
|
string key = args.Keys.FirstOrDefault(s => s.Equals("targets", StringComparison.CurrentCultureIgnoreCase)) ?? "";
|
||||||
|
if (key != "" && args.TryGetValue(key, out object? value) && value is Character[] temp)
|
||||||
|
{
|
||||||
|
if (temp.Length > 0)
|
||||||
|
{
|
||||||
|
targets = [temp[0]];
|
||||||
|
msg = UseItem(item, temp[0]);
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg = $"使用物品失败,没有作用目标!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["msg"] = msg;
|
||||||
|
key = args.Keys.FirstOrDefault(s => s.Equals("useCount", StringComparison.CurrentCultureIgnoreCase)) ?? "";
|
||||||
|
if (key != "" && args.TryGetValue(key, out value) && value is int count && targets.Length > 0)
|
||||||
|
{
|
||||||
|
string truemsg = $"对角色 [ {targets[0]} ] 使用 {count} 个 [ {item.Name} ] 成功!";
|
||||||
|
if (item is MPBook expBook)
|
||||||
|
{
|
||||||
|
truemsg += $"回复了 {expBook.MP * count} 点魔法值!";
|
||||||
|
}
|
||||||
|
args["truemsg"] = truemsg;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class 魔力填充剂1 : Item, 魔力填充剂.MPBook
|
||||||
|
{
|
||||||
|
public override long Id => (long)ConsumableID.魔力填充剂1;
|
||||||
|
public override string Name => "魔力填充剂Ⅰ型";
|
||||||
|
public override string Description => Skills.Active?.Description ?? "";
|
||||||
|
public override QualityType QualityType => QualityType.White;
|
||||||
|
public double MP { get; set; } = 300;
|
||||||
|
|
||||||
|
public 魔力填充剂1(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable)
|
||||||
|
{
|
||||||
|
User = user;
|
||||||
|
魔力填充剂.Init(this, MP, remainUseTimes);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnItemUsed(Dictionary<string, object> args)
|
||||||
|
{
|
||||||
|
return 魔力填充剂.OnItemUsed(this, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class 魔力填充剂2 : Item, 魔力填充剂.MPBook
|
||||||
|
{
|
||||||
|
public override long Id => (long)ConsumableID.魔力填充剂2;
|
||||||
|
public override string Name => "魔力填充剂Ⅱ型";
|
||||||
|
public override string Description => Skills.Active?.Description ?? "";
|
||||||
|
public override QualityType QualityType => QualityType.Green;
|
||||||
|
public double MP { get; set; } = 700;
|
||||||
|
|
||||||
|
public 魔力填充剂2(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable)
|
||||||
|
{
|
||||||
|
User = user;
|
||||||
|
魔力填充剂.Init(this, MP, remainUseTimes);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnItemUsed(Dictionary<string, object> args)
|
||||||
|
{
|
||||||
|
return 魔力填充剂.OnItemUsed(this, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class 魔力填充剂3 : Item, 魔力填充剂.MPBook
|
||||||
|
{
|
||||||
|
public override long Id => (long)ConsumableID.魔力填充剂3;
|
||||||
|
public override string Name => "魔力填充剂Ⅲ型";
|
||||||
|
public override string Description => Skills.Active?.Description ?? "";
|
||||||
|
public override QualityType QualityType => QualityType.Blue;
|
||||||
|
public double MP { get; set; } = 1500;
|
||||||
|
|
||||||
|
public 魔力填充剂3(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable)
|
||||||
|
{
|
||||||
|
User = user;
|
||||||
|
魔力填充剂.Init(this, MP, remainUseTimes);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnItemUsed(Dictionary<string, object> args)
|
||||||
|
{
|
||||||
|
return 魔力填充剂.OnItemUsed(this, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class 魔力填充剂技能 : Skill
|
||||||
|
{
|
||||||
|
public override long Id => (long)ItemActiveID.魔力填充剂;
|
||||||
|
public override string Name => "魔力填充剂";
|
||||||
|
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
|
||||||
|
|
||||||
|
public 魔力填充剂技能(Item? item = null, double mp = 0) : base(SkillType.Item)
|
||||||
|
{
|
||||||
|
Level = 1;
|
||||||
|
Item = item;
|
||||||
|
Effects.Add(new RecoverMP(this, new()
|
||||||
|
{
|
||||||
|
{ "mp", mp }
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,10 +2,10 @@
|
|||||||
{
|
{
|
||||||
public enum AccessoryID : long
|
public enum AccessoryID : long
|
||||||
{
|
{
|
||||||
攻击之爪5 = 14001,
|
攻击之爪8 = 14001,
|
||||||
攻击之爪15 = 14002,
|
攻击之爪20 = 14002,
|
||||||
攻击之爪25 = 14003,
|
攻击之爪35 = 14003,
|
||||||
攻击之爪35 = 14004,
|
攻击之爪50 = 14004,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ConsumableID : long
|
public enum ConsumableID : long
|
||||||
@ -13,6 +13,15 @@
|
|||||||
小经验书 = 15001,
|
小经验书 = 15001,
|
||||||
中经验书 = 15002,
|
中经验书 = 15002,
|
||||||
大经验书 = 15003,
|
大经验书 = 15003,
|
||||||
|
小回复药 = 15004,
|
||||||
|
中回复药 = 15005,
|
||||||
|
大回复药 = 15006,
|
||||||
|
魔力填充剂1 = 15007,
|
||||||
|
魔力填充剂2 = 15008,
|
||||||
|
魔力填充剂3 = 15009,
|
||||||
|
能量饮料1 = 15010,
|
||||||
|
能量饮料2 = 15011,
|
||||||
|
能量饮料3 = 15012,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SpecialItemID : long
|
public enum SpecialItemID : long
|
||||||
|
@ -25,10 +25,10 @@ namespace Oshima.FunGame.OshimaModules
|
|||||||
{
|
{
|
||||||
return id switch
|
return id switch
|
||||||
{
|
{
|
||||||
(long)AccessoryID.攻击之爪5 => new 攻击之爪5(),
|
(long)AccessoryID.攻击之爪8 => new 攻击之爪8(),
|
||||||
(long)AccessoryID.攻击之爪15 => new 攻击之爪15(),
|
(long)AccessoryID.攻击之爪20 => new 攻击之爪20(),
|
||||||
(long)AccessoryID.攻击之爪25 => new 攻击之爪25(),
|
|
||||||
(long)AccessoryID.攻击之爪35 => new 攻击之爪35(),
|
(long)AccessoryID.攻击之爪35 => new 攻击之爪35(),
|
||||||
|
(long)AccessoryID.攻击之爪50 => new 攻击之爪50(),
|
||||||
(long)ConsumableID.小经验书 => new 小经验书(),
|
(long)ConsumableID.小经验书 => new 小经验书(),
|
||||||
(long)ConsumableID.中经验书 => new 中经验书(),
|
(long)ConsumableID.中经验书 => new 中经验书(),
|
||||||
(long)ConsumableID.大经验书 => new 大经验书(),
|
(long)ConsumableID.大经验书 => new 大经验书(),
|
||||||
@ -39,6 +39,15 @@ namespace Oshima.FunGame.OshimaModules
|
|||||||
(long)SpecialItemID.智慧之果 => new 智慧之果(),
|
(long)SpecialItemID.智慧之果 => new 智慧之果(),
|
||||||
(long)SpecialItemID.奥术符文 => new 奥术符文(),
|
(long)SpecialItemID.奥术符文 => new 奥术符文(),
|
||||||
(long)SpecialItemID.混沌之核 => new 混沌之核(),
|
(long)SpecialItemID.混沌之核 => new 混沌之核(),
|
||||||
|
(long)ConsumableID.小回复药 => new 小回复药(),
|
||||||
|
(long)ConsumableID.中回复药 => new 中回复药(),
|
||||||
|
(long)ConsumableID.大回复药 => new 大回复药(),
|
||||||
|
(long)ConsumableID.魔力填充剂1 => new 魔力填充剂1(),
|
||||||
|
(long)ConsumableID.魔力填充剂2 => new 魔力填充剂2(),
|
||||||
|
(long)ConsumableID.魔力填充剂3 => new 魔力填充剂3(),
|
||||||
|
(long)ConsumableID.能量饮料1 => new 能量饮料1(),
|
||||||
|
(long)ConsumableID.能量饮料2 => new 能量饮料2(),
|
||||||
|
(long)ConsumableID.能量饮料3 => new 能量饮料3(),
|
||||||
_ => null,
|
_ => null,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -105,5 +105,8 @@
|
|||||||
public enum ItemActiveID : long
|
public enum ItemActiveID : long
|
||||||
{
|
{
|
||||||
经验书 = 6001,
|
经验书 = 6001,
|
||||||
|
回复药 = 6002,
|
||||||
|
魔力填充剂 = 6003,
|
||||||
|
能量饮料 = 6004
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user