chore: initialize OshimaBot repository (rename from Enhancement)
This commit is contained in:
@@ -0,0 +1,190 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using OshimaBot.Content.Effects.ItemEffects;
|
||||
using OshimaBot.Content.Skills;
|
||||
|
||||
namespace OshimaBot.Content.Items
|
||||
{
|
||||
public class 回复药
|
||||
{
|
||||
public interface HPRecovery
|
||||
{
|
||||
public double HP { get; set; }
|
||||
}
|
||||
|
||||
public static void Init(Item item, double hp, int remainUseTimes = 1, bool isPercentage = false)
|
||||
{
|
||||
item.Skills.Active = new 回复药技能(item, hp, isPercentage);
|
||||
item.RemainUseTimes = remainUseTimes;
|
||||
item.IsReduceTimesAfterUse = true;
|
||||
item.IsRemoveAfterUse = true;
|
||||
}
|
||||
|
||||
public static string UseItem(User user, Item item, Character character)
|
||||
{
|
||||
if (item.Skills.Active != null)
|
||||
{
|
||||
item.Skills.Active.OnSkillCasted(user, [character]);
|
||||
string msg = $"对角色 [ {character} ] 使用 [ {item.Name} ] 成功!";
|
||||
if (item is HPRecovery hpBook)
|
||||
{
|
||||
msg += $"回复了 {hpBook.HP} 点生命值!";
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
return "此物品没有主动技能,无法被使用!";
|
||||
}
|
||||
|
||||
public static bool OnItemUsed(User user, Item item, int times, 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(user, item, temp[0]);
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"使用物品失败,没有作用目标!";
|
||||
}
|
||||
}
|
||||
args["msg"] = msg;
|
||||
if (result)
|
||||
{
|
||||
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 HPRecovery expBook)
|
||||
{
|
||||
truemsg += $"回复了 {expBook.HP * count} 点生命值!";
|
||||
}
|
||||
args["truemsg"] = truemsg;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
args["truemsg"] = msg;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public class 小回复药 : Item, 回复药.HPRecovery
|
||||
{
|
||||
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; } = 600;
|
||||
|
||||
public 小回复药(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable)
|
||||
{
|
||||
User = user;
|
||||
回复药.Init(this, HP, remainUseTimes);
|
||||
}
|
||||
|
||||
protected override bool OnItemUsed(User user, int times, Dictionary<string, object> args)
|
||||
{
|
||||
return 回复药.OnItemUsed(user, this, times, args);
|
||||
}
|
||||
}
|
||||
|
||||
public class 中回复药 : Item, 回复药.HPRecovery
|
||||
{
|
||||
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; } = 1800;
|
||||
|
||||
public 中回复药(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable)
|
||||
{
|
||||
User = user;
|
||||
回复药.Init(this, HP, remainUseTimes);
|
||||
}
|
||||
|
||||
protected override bool OnItemUsed(User user, int times, Dictionary<string, object> args)
|
||||
{
|
||||
return 回复药.OnItemUsed(user, this, times, args);
|
||||
}
|
||||
}
|
||||
|
||||
public class 大回复药 : Item, 回复药.HPRecovery
|
||||
{
|
||||
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; } = 3000;
|
||||
|
||||
public 大回复药(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable)
|
||||
{
|
||||
User = user;
|
||||
回复药.Init(this, HP, remainUseTimes);
|
||||
}
|
||||
|
||||
protected override bool OnItemUsed(User user, int times, Dictionary<string, object> args)
|
||||
{
|
||||
return 回复药.OnItemUsed(user, this, times, args);
|
||||
}
|
||||
}
|
||||
|
||||
public class 全回复药 : Item, 回复药.HPRecovery
|
||||
{
|
||||
public override long Id => (long)ConsumableID.全回复药;
|
||||
public override string Name => "全回复药";
|
||||
public override string Description => Skills.Active?.Description ?? "";
|
||||
public override QualityType QualityType => QualityType.Purple;
|
||||
public double HP { get; set; } = 1;
|
||||
|
||||
public 全回复药(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable)
|
||||
{
|
||||
User = user;
|
||||
回复药.Init(this, HP, remainUseTimes, true);
|
||||
}
|
||||
|
||||
protected override bool OnItemUsed(User user, int times, Dictionary<string, object> args)
|
||||
{
|
||||
return 回复药.OnItemUsed(user, this, times, args);
|
||||
}
|
||||
}
|
||||
|
||||
public class 回复药技能 : Skill
|
||||
{
|
||||
public override long Id => (long)ItemActiveID.回复药;
|
||||
public override string Name => "回复药";
|
||||
public override string Description => string.Join("", Effects.Select(e => e.Description));
|
||||
public override bool CanSelectSelf => true;
|
||||
public override bool CanSelectTeammate => true;
|
||||
public override bool CanSelectEnemy => false;
|
||||
public override int CanSelectTargetCount => 1;
|
||||
|
||||
public 回复药技能(Item? item = null, double hp = 0, bool isPercentage = false) : base(SkillType.Item)
|
||||
{
|
||||
Level = 1;
|
||||
Item = item;
|
||||
SelectTargetPredicates.Add(c => c.HP > 0 && c.HP < c.MaxHP);
|
||||
if (!isPercentage)
|
||||
{
|
||||
Effects.Add(new RecoverHP(this, new()
|
||||
{
|
||||
{ "hp", hp }
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
Effects.Add(new RecoverHP2(this, new()
|
||||
{
|
||||
{ "hp", hp }
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using OshimaBot.Content.Effects.ItemEffects;
|
||||
using OshimaBot.Content.Effects.SkillEffects;
|
||||
using OshimaBot.Content.Skills;
|
||||
|
||||
namespace OshimaBot.Content.Items
|
||||
{
|
||||
public class 复苏药
|
||||
{
|
||||
public interface HPRecovery
|
||||
{
|
||||
public double HP { get; set; }
|
||||
}
|
||||
|
||||
public static void Init(Item item, double hp, int remainUseTimes = 1, bool isPercentage = false)
|
||||
{
|
||||
item.Skills.Active = new 复苏药技能(item, hp, isPercentage);
|
||||
item.RemainUseTimes = remainUseTimes;
|
||||
item.IsReduceTimesAfterUse = true;
|
||||
item.IsRemoveAfterUse = true;
|
||||
}
|
||||
|
||||
public static string UseItem(User user, Item item, Character character)
|
||||
{
|
||||
if (item.Skills.Active != null)
|
||||
{
|
||||
item.Skills.Active.OnSkillCasted(user, [character]);
|
||||
string msg = $"对角色 [ {character} ] 使用 [ {item.Name} ] 成功!";
|
||||
if (item is HPRecovery hpBook)
|
||||
{
|
||||
msg += $"回复了 {hpBook.HP} 点生命值!";
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
return "此物品没有主动技能,无法被使用!";
|
||||
}
|
||||
|
||||
public static bool OnItemUsed(User user, Item item, int times, 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(user, item, temp[0]);
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"使用物品失败,没有作用目标!";
|
||||
}
|
||||
}
|
||||
args["msg"] = msg;
|
||||
if (result)
|
||||
{
|
||||
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 HPRecovery expBook)
|
||||
{
|
||||
truemsg += $"回复了 {expBook.HP * count} 点生命值!";
|
||||
}
|
||||
args["truemsg"] = truemsg;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
args["truemsg"] = msg;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public class 复苏药1 : Item, 复苏药.HPRecovery
|
||||
{
|
||||
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 HP { get; set; } = 500;
|
||||
|
||||
public 复苏药1(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable)
|
||||
{
|
||||
User = user;
|
||||
复苏药.Init(this, HP, remainUseTimes);
|
||||
}
|
||||
|
||||
protected override bool OnItemUsed(User user, int times, Dictionary<string, object> args)
|
||||
{
|
||||
return 复苏药.OnItemUsed(user, this, times, args);
|
||||
}
|
||||
}
|
||||
|
||||
public class 复苏药2 : Item, 复苏药.HPRecovery
|
||||
{
|
||||
public override long Id => (long)ConsumableID.复苏药2;
|
||||
public override string Name => "复苏药·改";
|
||||
public override string Description => Skills.Active?.Description ?? "";
|
||||
public override QualityType QualityType => QualityType.Blue;
|
||||
public double HP { get; set; } = 2500;
|
||||
|
||||
public 复苏药2(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable)
|
||||
{
|
||||
User = user;
|
||||
复苏药.Init(this, HP, remainUseTimes);
|
||||
}
|
||||
|
||||
protected override bool OnItemUsed(User user, int times, Dictionary<string, object> args)
|
||||
{
|
||||
return 复苏药.OnItemUsed(user, this, times, args);
|
||||
}
|
||||
}
|
||||
|
||||
public class 复苏药3 : Item, 复苏药.HPRecovery
|
||||
{
|
||||
public override long Id => (long)ConsumableID.复苏药3;
|
||||
public override string Name => "复苏药·全";
|
||||
public override string Description => Skills.Active?.Description ?? "";
|
||||
public override QualityType QualityType => QualityType.Purple;
|
||||
public double HP { get; set; } = 1;
|
||||
|
||||
public 复苏药3(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable)
|
||||
{
|
||||
User = user;
|
||||
复苏药.Init(this, HP, remainUseTimes, true);
|
||||
}
|
||||
|
||||
protected override bool OnItemUsed(User user, int times, Dictionary<string, object> args)
|
||||
{
|
||||
return 复苏药.OnItemUsed(user, this, times, args);
|
||||
}
|
||||
}
|
||||
|
||||
public class 复苏药技能 : Skill
|
||||
{
|
||||
public override long Id => (long)ItemActiveID.复苏药;
|
||||
public override string Name => "复苏药";
|
||||
public override string Description => string.Join("", Effects.Select(e => e.Description));
|
||||
public override bool SelectAllTeammates => _canSelectAllTeammates;
|
||||
public override bool SelectAllEnemies => _canSelectAllEnemies;
|
||||
public override bool CanSelectSelf => _canSelectSelf;
|
||||
public override bool CanSelectTeammate => _canSelectTeammate;
|
||||
public override bool CanSelectEnemy => _canSelectEnemy;
|
||||
public override int CanSelectTargetCount => _canSelectCount;
|
||||
public override bool AllowSelectDead => true;
|
||||
|
||||
private readonly bool _canSelectAllTeammates;
|
||||
private readonly bool _canSelectAllEnemies;
|
||||
private readonly bool _canSelectSelf;
|
||||
private readonly bool _canSelectTeammate;
|
||||
private readonly bool _canSelectEnemy;
|
||||
private readonly int _canSelectCount;
|
||||
|
||||
public 复苏药技能(Item? item = null, double hp = 0, bool isPercentage = false, bool canSelectAllTeammates = false, bool canSelectAllEnemies = false, bool canSelectSelf = true, bool canSelectTeammate = true, bool canSelectEnemy = false, int canSelectCount = 1) : base(SkillType.Item)
|
||||
{
|
||||
Level = 1;
|
||||
Item = item;
|
||||
_canSelectAllTeammates = canSelectAllTeammates;
|
||||
_canSelectAllEnemies = canSelectAllEnemies;
|
||||
_canSelectSelf = canSelectSelf;
|
||||
_canSelectTeammate = canSelectTeammate;
|
||||
_canSelectEnemy = canSelectEnemy;
|
||||
_canSelectCount = canSelectCount;
|
||||
SelectTargetPredicates.Add(c => c.HP >= 0 && c.HP < c.MaxHP);
|
||||
Effects.Add(new 强驱散特效(this));
|
||||
if (!isPercentage)
|
||||
{
|
||||
Effects.Add(new RecoverHP(this, new()
|
||||
{
|
||||
{ "hp", hp },
|
||||
{ "respawn", true }
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
Effects.Add(new RecoverHP2(this, new()
|
||||
{
|
||||
{ "hp", hp },
|
||||
{ "respawn", true }
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using OshimaBot.Content.Effects.ItemEffects;
|
||||
using OshimaBot.Content.Skills;
|
||||
|
||||
namespace OshimaBot.Content.Items
|
||||
{
|
||||
public class 经验书
|
||||
{
|
||||
public interface EXPBook
|
||||
{
|
||||
public double EXP { 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(User user, Item item, Character character)
|
||||
{
|
||||
if (item.Skills.Active != null)
|
||||
{
|
||||
item.Skills.Active.OnSkillCasted(user, [character]);
|
||||
string msg = $"对角色 [ {character} ] 使用 [ {item.Name} ] 成功!";
|
||||
if (item is EXPBook expBook)
|
||||
{
|
||||
msg += $"获得了 {expBook.EXP} 点经验值!";
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
return "此物品没有主动技能,无法被使用!";
|
||||
}
|
||||
|
||||
public static bool OnItemUsed(User user, Item item, int times, 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(user, item, temp[0]);
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"使用物品失败,没有作用目标!";
|
||||
}
|
||||
}
|
||||
args["msg"] = msg;
|
||||
if (result)
|
||||
{
|
||||
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 EXPBook expBook)
|
||||
{
|
||||
truemsg += $"获得了 {expBook.EXP * count} 点经验值!";
|
||||
}
|
||||
args["truemsg"] = truemsg;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
args["truemsg"] = msg;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public class 小经验书 : Item, 经验书.EXPBook
|
||||
{
|
||||
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 EXP { get; set; } = 200;
|
||||
|
||||
public 小经验书(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable)
|
||||
{
|
||||
User = user;
|
||||
经验书.Init(this, EXP, remainUseTimes);
|
||||
}
|
||||
|
||||
protected override bool OnItemUsed(User user, int times, Dictionary<string, object> args)
|
||||
{
|
||||
return 经验书.OnItemUsed(user, this, times, args);
|
||||
}
|
||||
}
|
||||
|
||||
public class 中经验书 : Item, 经验书.EXPBook
|
||||
{
|
||||
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 EXP { get; set; } = 500;
|
||||
|
||||
public 中经验书(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable)
|
||||
{
|
||||
User = user;
|
||||
经验书.Init(this, EXP, remainUseTimes);
|
||||
}
|
||||
|
||||
protected override bool OnItemUsed(User user, int times, Dictionary<string, object> args)
|
||||
{
|
||||
return 经验书.OnItemUsed(user, this, times, args);
|
||||
}
|
||||
}
|
||||
|
||||
public class 大经验书 : Item, 经验书.EXPBook
|
||||
{
|
||||
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 EXP { get; set; } = 1000;
|
||||
|
||||
public 大经验书(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable)
|
||||
{
|
||||
User = user;
|
||||
经验书.Init(this, EXP, remainUseTimes);
|
||||
}
|
||||
|
||||
protected override bool OnItemUsed(User user, int times, Dictionary<string, object> args)
|
||||
{
|
||||
return 经验书.OnItemUsed(user, this, times, 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 override bool CanSelectSelf => true;
|
||||
public override bool CanSelectTeammate => true;
|
||||
public override bool CanSelectEnemy => false;
|
||||
public override int CanSelectTargetCount => 1;
|
||||
|
||||
public 经验书技能(Item? item = null, double exp = 0) : base(SkillType.Item)
|
||||
{
|
||||
Level = 1;
|
||||
Item = item;
|
||||
Effects.Add(new GetEXP(this, new()
|
||||
{
|
||||
{ "exp", exp }
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using OshimaBot.Content.Effects.ItemEffects;
|
||||
using OshimaBot.Content.Skills;
|
||||
|
||||
namespace OshimaBot.Content.Items
|
||||
{
|
||||
public class 能量饮料
|
||||
{
|
||||
public interface EPAdd
|
||||
{
|
||||
public double EP { get; set; }
|
||||
}
|
||||
|
||||
public static void Init(Item item, double ep, int remainUseTimes = 1)
|
||||
{
|
||||
item.Skills.Active = new 能量饮料技能(item, ep);
|
||||
item.RemainUseTimes = remainUseTimes;
|
||||
item.IsReduceTimesAfterUse = true;
|
||||
item.IsRemoveAfterUse = true;
|
||||
}
|
||||
|
||||
public static string UseItem(User user, Item item, Character character)
|
||||
{
|
||||
if (item.Skills.Active != null)
|
||||
{
|
||||
item.Skills.Active.OnSkillCasted(user, [character]);
|
||||
string msg = $"对角色 [ {character} ] 使用 [ {item.Name} ] 成功!";
|
||||
if (item is EPAdd hpBook)
|
||||
{
|
||||
msg += $"获得了 {hpBook.EP} 点能量值!";
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
return "此物品没有主动技能,无法被使用!";
|
||||
}
|
||||
|
||||
public static bool OnItemUsed(User user, Item item, int times, 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(user, item, temp[0]);
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"使用物品失败,没有作用目标!";
|
||||
}
|
||||
}
|
||||
args["msg"] = msg;
|
||||
if (result)
|
||||
{
|
||||
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 EPAdd expBook)
|
||||
{
|
||||
truemsg += $"获得了 {expBook.EP * count} 点能量值!";
|
||||
}
|
||||
args["truemsg"] = truemsg;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
args["truemsg"] = msg;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public class 能量饮料1 : Item, 能量饮料.EPAdd
|
||||
{
|
||||
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(User user, int times, Dictionary<string, object> args)
|
||||
{
|
||||
return 能量饮料.OnItemUsed(user, this, times, args);
|
||||
}
|
||||
}
|
||||
|
||||
public class 能量饮料2 : Item, 能量饮料.EPAdd
|
||||
{
|
||||
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(User user, int times, Dictionary<string, object> args)
|
||||
{
|
||||
return 能量饮料.OnItemUsed(user, this, times, args);
|
||||
}
|
||||
}
|
||||
|
||||
public class 能量饮料3 : Item, 能量饮料.EPAdd
|
||||
{
|
||||
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(User user, int times, Dictionary<string, object> args)
|
||||
{
|
||||
return 能量饮料.OnItemUsed(user, this, times, args);
|
||||
}
|
||||
}
|
||||
|
||||
public class 能量饮料技能 : Skill
|
||||
{
|
||||
public override long Id => (long)ItemActiveID.能量饮料;
|
||||
public override string Name => "能量饮料";
|
||||
public override string Description => string.Join("", Effects.Select(e => e.Description));
|
||||
public override bool CanSelectSelf => true;
|
||||
public override bool CanSelectTeammate => true;
|
||||
public override bool CanSelectEnemy => false;
|
||||
public override int CanSelectTargetCount => 1;
|
||||
|
||||
public 能量饮料技能(Item? item = null, double ep = 0) : base(SkillType.Item)
|
||||
{
|
||||
Level = 1;
|
||||
Item = item;
|
||||
Effects.Add(new GetEP(this, new()
|
||||
{
|
||||
{ "ep", ep }
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using OshimaBot.Content.Effects.ItemEffects;
|
||||
using OshimaBot.Content.Skills;
|
||||
|
||||
namespace OshimaBot.Content.Items
|
||||
{
|
||||
public class 魔力填充剂
|
||||
{
|
||||
public interface MPRecovery
|
||||
{
|
||||
public double MP { get; set; }
|
||||
}
|
||||
|
||||
public static void Init(Item item, double mp, int remainUseTimes = 1, bool isPercentage = false)
|
||||
{
|
||||
item.Skills.Active = new 魔力填充剂技能(item, mp, isPercentage);
|
||||
item.RemainUseTimes = remainUseTimes;
|
||||
item.IsReduceTimesAfterUse = true;
|
||||
item.IsRemoveAfterUse = true;
|
||||
}
|
||||
|
||||
public static string UseItem(User user, Item item, Character character)
|
||||
{
|
||||
if (item.Skills.Active != null)
|
||||
{
|
||||
item.Skills.Active.OnSkillCasted(user, [character]);
|
||||
string msg = $"对角色 [ {character} ] 使用 [ {item.Name} ] 成功!";
|
||||
if (item is MPRecovery hpBook)
|
||||
{
|
||||
msg += $"回复了 {hpBook.MP} 点魔法值!";
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
return "此物品没有主动技能,无法被使用!";
|
||||
}
|
||||
|
||||
public static bool OnItemUsed(User user, Item item, int times, 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(user, item, temp[0]);
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"使用物品失败,没有作用目标!";
|
||||
}
|
||||
}
|
||||
args["msg"] = msg;
|
||||
if (result)
|
||||
{
|
||||
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 MPRecovery expBook)
|
||||
{
|
||||
truemsg += $"回复了 {expBook.MP * count} 点魔法值!";
|
||||
}
|
||||
args["truemsg"] = truemsg;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
args["truemsg"] = msg;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public class 魔力填充剂1 : Item, 魔力填充剂.MPRecovery
|
||||
{
|
||||
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(User user, int times, Dictionary<string, object> args)
|
||||
{
|
||||
return 魔力填充剂.OnItemUsed(user, this, times, args);
|
||||
}
|
||||
}
|
||||
|
||||
public class 魔力填充剂2 : Item, 魔力填充剂.MPRecovery
|
||||
{
|
||||
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(User user, int times, Dictionary<string, object> args)
|
||||
{
|
||||
return 魔力填充剂.OnItemUsed(user, this, times, args);
|
||||
}
|
||||
}
|
||||
|
||||
public class 魔力填充剂3 : Item, 魔力填充剂.MPRecovery
|
||||
{
|
||||
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(User user, int times, Dictionary<string, object> args)
|
||||
{
|
||||
return 魔力填充剂.OnItemUsed(user, this, times, args);
|
||||
}
|
||||
}
|
||||
|
||||
public class 魔力填充剂技能 : Skill
|
||||
{
|
||||
public override long Id => (long)ItemActiveID.魔力填充剂;
|
||||
public override string Name => "魔力填充剂";
|
||||
public override string Description => string.Join("", Effects.Select(e => e.Description));
|
||||
public override bool CanSelectSelf => true;
|
||||
public override bool CanSelectTeammate => true;
|
||||
public override bool CanSelectEnemy => false;
|
||||
public override int CanSelectTargetCount => 1;
|
||||
|
||||
public 魔力填充剂技能(Item? item = null, double mp = 0, bool isPercentage = false) : base(SkillType.Item)
|
||||
{
|
||||
Level = 1;
|
||||
Item = item;
|
||||
if (!isPercentage)
|
||||
{
|
||||
Effects.Add(new RecoverMP(this, new()
|
||||
{
|
||||
{ "mp", mp }
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
Effects.Add(new RecoverMP2(this, new()
|
||||
{
|
||||
{ "mp", mp }
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user