chore: initialize OshimaBot repository (rename from Enhancement)

This commit is contained in:
2026-11-09 19:38:28 +08:00
commit f9052358a9
414 changed files with 36653 additions and 0 deletions
@@ -0,0 +1,66 @@
using FunGame.Core.Entity;
using FunGame.Core.Library.Constant;
using FunGame.Core.Model.EffectContext;
namespace OshimaBot.Content.Effects.OpenEffects
{
public class SkillHardTimeReduce2 : Effect
{
public override long Id => (long)EffectID.SkillHardTimeReduce2;
public override string Name { get; set; } = "主动技能硬直减少";
public override string Description => $"减少角色的所有主动技能 {减少比例 * 100:0.##}% 硬直时间。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : "");
private readonly double 减少比例 = 0;
public override void OnEffectGained(HookContext ctx)
{
if (ctx.Trigger is not Character character) return;
if (Durative && RemainDuration == 0)
{
RemainDuration = Duration;
}
else if (RemainDurationTurn == 0)
{
RemainDurationTurn = DurationTurn;
}
foreach (Skill s in character.Skills)
{
s.ExHardnessTime2 -= 减少比例;
}
foreach (Skill? s in character.Items.Select(i => i.Skills.Active))
{
if (s != null)
s.ExHardnessTime2 -= 减少比例;
}
}
public override void OnEffectLost(HookContext ctx)
{
if (ctx.Trigger is not Character character) return;
foreach (Skill s in character.Skills)
{
s.ExHardnessTime2 += 减少比例;
}
foreach (Skill? s in character.Items.Select(i => i.Skills.Active))
{
if (s != null)
s.ExHardnessTime2 += 减少比例;
}
}
public SkillHardTimeReduce2(Skill skill, Dictionary<string, object> args, Character? source = null) : base(skill, args)
{
EffectType = EffectType.Item;
GamingQueue = skill.GamingQueue;
Source = source;
if (Values.Count > 0)
{
string key = Values.Keys.FirstOrDefault(s => s.Equals("shtr", StringComparison.CurrentCultureIgnoreCase)) ?? "";
if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double shtr) && shtr > 0)
{
减少比例 = shtr;
}
}
}
}
}