chore: initialize OshimaBot repository (rename from Enhancement)
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using FunGame.Core.Model.EffectResult;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
/// <summary>
|
||||
/// 装备【接力信标】的指引标记 —— 装备期间由穿戴者挂到每名队友的状态栏上。
|
||||
/// <para/>与前两个标记不同,本标记<b>自身即收益</b>:硬直钩子只通知「行动者自己」的特效,
|
||||
/// 因此把标记挂在队友身上,等价于把"硬直减免"当作一层光环施加给队友。
|
||||
/// <para/>无状态增减(只在钩子里返回比率),因此天然幂等;
|
||||
/// 卸装 / 换装时由【接力信标特效】撤回,撤销光环。
|
||||
/// </summary>
|
||||
public class 信标标记 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.信标标记;
|
||||
public override string Name => "信标标记";
|
||||
public override string Description => $"此角色正受 [ {Source} ] 的接力信标指引,普攻与技能硬直减少 {_硬直减免 * 100:0.##}%。";
|
||||
public override EffectType EffectType => EffectType.Mark;
|
||||
|
||||
/// <summary>友方标记,非负面效果</summary>
|
||||
public override bool IsDebuff => false;
|
||||
|
||||
/// <summary>无具体时长,随装备存续</summary>
|
||||
public override bool DurativeWithoutDuration => true;
|
||||
|
||||
/// <summary>内部簿记标记,不可被任何形态的驱散移除</summary>
|
||||
public override DispelledType DispelledType => DispelledType.CannotBeDispelled;
|
||||
|
||||
public override Character Source => _sourceCharacter;
|
||||
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly double _硬直减免;
|
||||
|
||||
/// <summary>标记宿主(由 <see cref="OnEffectGained"/> 捕获;标记总是通过 <see cref="Effect.AddToCharacter"/> 挂载)</summary>
|
||||
private Character? _host;
|
||||
|
||||
public 信标标记(Skill skill, Character sourceCharacter, double 硬直减免) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_硬直减免 = 硬直减免;
|
||||
}
|
||||
|
||||
public override void OnEffectGained(HookContext ctx)
|
||||
{
|
||||
_host = ctx.Trigger;
|
||||
}
|
||||
|
||||
public override AlterHardnessTimeResult AlterHardnessTimeAfterNormalAttack(HardnessContext ctx)
|
||||
{
|
||||
return 计算(ctx);
|
||||
}
|
||||
|
||||
public override AlterHardnessTimeResult AlterHardnessTimeAfterCastSkill(HardnessContext ctx)
|
||||
{
|
||||
return 计算(ctx);
|
||||
}
|
||||
|
||||
private AlterHardnessTimeResult 计算(HardnessContext ctx)
|
||||
{
|
||||
// 硬直钩子按「行动者的特效」分发,本标记只可能挂在行动中的队友身上;仍做一次归属校验
|
||||
if (_host is null || ctx.Trigger != _host) return default;
|
||||
// Factor 语义:最终硬直 = 基础硬直 × (1 + Factor),故"减少 N%"传 -N;default(0) 即不干预
|
||||
return new AlterHardnessTimeResult { Factor = -_硬直减免 };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
using OshimaBot.Content.Items;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
/// <summary>
|
||||
/// 装备【共鸣核心】的监听标记 —— 穿戴时由穿戴者挂到每名队友的状态栏上。
|
||||
/// <para/>与【巡诊标记】同理:框架中大部分细粒度钩子只通知「触发者 + 目标」的特效,
|
||||
/// 穿戴者无法直接监听队友的出手,必须把本标记挂进队友状态栏,
|
||||
/// 让标记以宿主的身份收到 <see cref="Effect.AfterDamageCalculation"/>,再转发给【共鸣核心特效】。
|
||||
/// <para/>本标记自身不产生任何收益,是内部簿记用标记,不可被驱散;
|
||||
/// 卸装 / 换装时由控制器统一撤回,保证幂等。
|
||||
/// </summary>
|
||||
public class 共鸣标记 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.共鸣标记;
|
||||
public override string Name => "共鸣标记";
|
||||
public override string Description => $"此角色与 [ {Source} ] 的共鸣核心产生了共鸣。";
|
||||
public override EffectType EffectType => EffectType.Mark;
|
||||
|
||||
/// <summary>友方标记,非负面效果</summary>
|
||||
public override bool IsDebuff => false;
|
||||
|
||||
/// <summary>无具体时长,随装备存续</summary>
|
||||
public override bool DurativeWithoutDuration => true;
|
||||
|
||||
/// <summary>内部簿记标记,不可被任何形态的驱散移除</summary>
|
||||
public override DispelledType DispelledType => DispelledType.CannotBeDispelled;
|
||||
|
||||
public override Character Source => _sourceCharacter;
|
||||
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly 共鸣核心特效 _controller;
|
||||
|
||||
/// <summary>标记宿主(由 <see cref="OnEffectGained"/> 捕获;标记总是通过 <see cref="Effect.AddToCharacter"/> 挂载)</summary>
|
||||
private Character? _host;
|
||||
|
||||
public 共鸣标记(Skill skill, Character sourceCharacter, 共鸣核心特效 controller) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_controller = controller;
|
||||
}
|
||||
|
||||
public override void OnEffectGained(HookContext ctx)
|
||||
{
|
||||
_host = ctx.Trigger;
|
||||
}
|
||||
|
||||
public override void AfterDamageCalculation(DamageContext ctx)
|
||||
{
|
||||
// 本标记会随宿主收到「宿主参与的所有伤害结算」,只关心宿主作为攻击方造成伤害的那一次
|
||||
Character? host = _host;
|
||||
if (host is null || ctx.Trigger != host) return;
|
||||
if (ctx.DamageResult != DamageResult.Normal && ctx.DamageResult != DamageResult.Critical) return;
|
||||
if (ctx.ActualDamage <= 0) return;
|
||||
_controller.TryGainEnergy(host);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 冻结(Skill skill, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1) : 完全行动不能(nameof(冻结), EffectType.Petrify, skill, sourceCharacter, durative, duration, durationTurn)
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.冻结;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 复制技能 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.复制技能;
|
||||
public override string Name => "复制技能";
|
||||
public override string Description => $"此角色持有技能 [ {_skill.Name} ] 的复制品。来自:[ {Source} ]";
|
||||
public override EffectType EffectType => EffectType.Mark;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override DispelledType DispelledType => DispelledType.CannotBeDispelled;
|
||||
public Skill CopiedSkill => _skill;
|
||||
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly Skill _skill;
|
||||
|
||||
public 复制技能(Skill skill, Character sourceCharacter, Skill copiedSkill) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_skill = copiedSkill.Copy();
|
||||
_skill.Level = copiedSkill.Level;
|
||||
}
|
||||
|
||||
public CharacterActionType LastType { get; set; } = CharacterActionType.None;
|
||||
public Skill? LastSkill { get; set; } = null;
|
||||
|
||||
public override void OnEffectGained(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
_skill.Character = character;
|
||||
_skill.OnLevelUp();
|
||||
character.Skills.Add(_skill);
|
||||
}
|
||||
|
||||
public override void OnEffectLost(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
_skill.RemoveSkillFromCharacter(character);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using FunGame.Core.Model.EffectResult;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 完全免疫 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.完全免疫;
|
||||
public override string Name => "完全免疫";
|
||||
public override string Description => $"此角色处于完全免疫状态,无法选中其作为普通攻击和技能的目标(自释放技能除外),免疫物理伤害和魔法伤害。来自:[ {Source} ] 的 [ {Skill.Name} ]";
|
||||
public override EffectType EffectType => EffectType.PhysicalImmune;
|
||||
public override DispelledType DispelledType => DispelledType.Strong;
|
||||
public override bool IsDebuff => false;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override bool Durative => _durative;
|
||||
public override double Duration => _duration;
|
||||
public override int DurationTurn => _durationTurn;
|
||||
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly bool _durative;
|
||||
private readonly double _duration;
|
||||
private readonly int _durationTurn;
|
||||
|
||||
public 完全免疫(Skill skill, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_durative = durative;
|
||||
_duration = duration;
|
||||
_durationTurn = durationTurn;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
AddImmuneTypesToCharacter(character, [ImmuneType.All]);
|
||||
}
|
||||
|
||||
public override void OnEffectLost(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
RemoveImmuneTypesFromCharacter(character);
|
||||
}
|
||||
|
||||
public override OnImmuneCheckResult OnImmuneCheck(ImmuneContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return default;
|
||||
Character? target = ctx.Target;
|
||||
if (character == target)
|
||||
{
|
||||
return new OnImmuneCheckResult { IgnoreImmunity = true };
|
||||
}
|
||||
return default;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 完全行动不能 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.完全行动不能;
|
||||
public override string Name => _name;
|
||||
public override string Description => $"此角色被{Name}了,不能行动。来自:[ {Source} ] 的 [ {Skill.Name} ]";
|
||||
public override EffectType EffectType => _type;
|
||||
public override DispelledType DispelledType => DispelledType.Strong;
|
||||
public override bool IsDebuff => true;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override bool Durative => _durative;
|
||||
public override double Duration => _duration;
|
||||
public override int DurationTurn => _durationTurn;
|
||||
public override bool ExemptDuration => true;
|
||||
|
||||
private readonly string _name;
|
||||
private readonly EffectType _type;
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly bool _durative;
|
||||
private readonly double _duration;
|
||||
private readonly int _durationTurn;
|
||||
|
||||
public 完全行动不能(string name, EffectType type, Skill skill, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1) : base(skill)
|
||||
{
|
||||
_name = name;
|
||||
_type = type;
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_durative = durative;
|
||||
_duration = duration;
|
||||
_durationTurn = durationTurn;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
AddEffectStatesToCharacter(character, [CharacterState.NotActionable]);
|
||||
InterruptCasting(character, Source);
|
||||
}
|
||||
|
||||
public override void OnEffectLost(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
RemoveEffectStatesFromCharacter(character);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Interface.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using FunGame.Core.Model.EffectResult;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
using OshimaBot.Content.Skills;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 宫监手标记 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.宫监手标记;
|
||||
public override string Name => "宫监手标记";
|
||||
public override string Description => $"{放监.任务要求}。来自:[ {Source} ]";
|
||||
public override EffectType EffectType => EffectType.Mark;
|
||||
public override bool IsDebuff => true;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override DispelledType DispelledType { get; set; } = DispelledType.CannotBeDispelled;
|
||||
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly Character _targetCharacter;
|
||||
private readonly 放监特效 放监;
|
||||
private bool 已完成普攻任务 = false;
|
||||
private bool 已完成指向性技能任务 = false;
|
||||
|
||||
public 宫监手标记(Skill skill, Character sourceCharacter, Character targetCharacter, 放监特效 effect) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_targetCharacter = targetCharacter;
|
||||
放监 = effect;
|
||||
}
|
||||
|
||||
public void 普攻任务完成(Character character)
|
||||
{
|
||||
WriteLine($"[ {character} ] 的「放监」任务 [ 对友方角色普通攻击 ] 完成!");
|
||||
已完成普攻任务 = true;
|
||||
CheckComplete(character);
|
||||
}
|
||||
|
||||
public void 指向性技能任务完成(Character character)
|
||||
{
|
||||
WriteLine($"[ {character} ] 的「放监」任务 [ 对{Source}释放指向性技能 ] 完成!");
|
||||
已完成指向性技能任务 = true;
|
||||
CheckComplete(character);
|
||||
}
|
||||
|
||||
public void CheckComplete(Character character)
|
||||
{
|
||||
if (已完成普攻任务 && 已完成指向性技能任务)
|
||||
{
|
||||
character.Effects.Remove(this);
|
||||
WriteLine($"[ {character} ] 已消除宫监手标记!");
|
||||
}
|
||||
}
|
||||
|
||||
public override void AlterSelectListBeforeSelection(SelectionContext ctx)
|
||||
{
|
||||
ISkill? skill = ctx.Skill;
|
||||
List<Character> enemys = ctx.Enemys;
|
||||
List<Character> teammates = ctx.Teammates;
|
||||
if (skill is NormalAttack)
|
||||
{
|
||||
enemys.AddRange(teammates);
|
||||
}
|
||||
}
|
||||
|
||||
public override BeforeCriticalCheckResult BeforeCriticalCheck(DamageContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character actor) return default;
|
||||
bool isNormalAttack = ctx.IsNormalAttack;
|
||||
if (actor == _targetCharacter && isNormalAttack)
|
||||
{
|
||||
return new BeforeCriticalCheckResult { ThrowingBonusDelta = 300 };
|
||||
}
|
||||
return default;
|
||||
}
|
||||
|
||||
public override BeforeEvadeCheckResult BeforeEvadeCheck(DamageContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character actor) return default;
|
||||
if (actor == _targetCharacter)
|
||||
{
|
||||
return new BeforeEvadeCheckResult { SkipEvadeCheck = true };
|
||||
}
|
||||
return default;
|
||||
}
|
||||
|
||||
public override void AfterDamageCalculation(DamageContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
if (ctx.Enemy is not Character enemy) return;
|
||||
bool isNormalAttack = ctx.IsNormalAttack;
|
||||
DamageResult damageResult = ctx.DamageResult;
|
||||
if (character == _targetCharacter && isNormalAttack && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical))
|
||||
{
|
||||
if (GamingQueue != null && GamingQueue.IsTeammate(character, enemy))
|
||||
{
|
||||
普攻任务完成(character);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void AfterDeathCalculation(DeathContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character death) return;
|
||||
if (death == _targetCharacter)
|
||||
{
|
||||
death.Effects.Remove(this);
|
||||
}
|
||||
if (death == _sourceCharacter)
|
||||
{
|
||||
_targetCharacter.Effects.Remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnEffectLost(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
if (!已完成普攻任务 || !已完成指向性技能任务)
|
||||
{
|
||||
放监.造成伤害(character, !已完成普攻任务 && !已完成指向性技能任务 ? 2 : 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 封技 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.封技;
|
||||
public override string Name => "封技";
|
||||
public override string Description => $"此角色被封技了,不能使用技能(魔法、战技和爆发技)。来自:[ {Source} ] 的 [ {Skill.Name} ]";
|
||||
public override EffectType EffectType => EffectType.Silence;
|
||||
public override DispelledType DispelledType => DispelledType.Weak;
|
||||
public override bool IsDebuff => true;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override bool Durative => _durative;
|
||||
public override double Duration => _duration;
|
||||
public override int DurationTurn => _durationTurn;
|
||||
public override bool ExemptDuration => true;
|
||||
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly bool _durative;
|
||||
private readonly double _duration;
|
||||
private readonly int _durationTurn;
|
||||
|
||||
public 封技(Skill skill, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_durative = durative;
|
||||
_duration = duration;
|
||||
_durationTurn = durationTurn;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
AddEffectStatesToCharacter(character, [CharacterState.SkillRestricted]);
|
||||
InterruptCasting(character, Source);
|
||||
}
|
||||
|
||||
public override void OnEffectLost(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
RemoveEffectStatesFromCharacter(character);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
using OshimaBot.Content.Items;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
/// <summary>
|
||||
/// 装备【行军医箱】的监听标记 —— 穿戴时由穿戴者挂到每名队友的状态栏上。
|
||||
/// <para/>存在意义:框架中大部分细粒度钩子(如 <see cref="Effect.AfterDamageCalculation"/>)
|
||||
/// 只通知「触发者 + 目标」的特效,穿戴者无法直接监听队友的受击事件。
|
||||
/// 因此必须像【开宫】挂【长期监视】那样,把本标记挂进队友状态栏,
|
||||
/// 让标记以宿主自己的身份收到钩子,再把信号转发给穿戴者侧的【行军医箱特效】。
|
||||
/// <para/>本标记自身不产生任何收益,是内部簿记用标记,<b>不可被驱散</b>;
|
||||
/// 当装备被卸下 / 被空投替换时,由控制器统一撤回,保证幂等。
|
||||
/// </summary>
|
||||
public class 巡诊标记 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.巡诊标记;
|
||||
public override string Name => "巡诊标记";
|
||||
public override string Description => $"此角色处于 [ {Source} ] 的行军医箱巡诊范围内。";
|
||||
public override EffectType EffectType => EffectType.Mark;
|
||||
|
||||
/// <summary>友方标记,非负面效果</summary>
|
||||
public override bool IsDebuff => false;
|
||||
|
||||
/// <summary>无具体时长,随装备存续</summary>
|
||||
public override bool DurativeWithoutDuration => true;
|
||||
|
||||
/// <summary>内部簿记标记,不可被任何形态的驱散移除</summary>
|
||||
public override DispelledType DispelledType => DispelledType.CannotBeDispelled;
|
||||
|
||||
public override Character Source => _sourceCharacter;
|
||||
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly 行军医箱特效 _controller;
|
||||
|
||||
/// <summary>标记宿主(由 <see cref="OnEffectGained"/> 捕获;标记总是通过 <see cref="Effect.AddToCharacter"/> 挂载)</summary>
|
||||
private Character? _host;
|
||||
|
||||
public 巡诊标记(Skill skill, Character sourceCharacter, 行军医箱特效 controller) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_controller = controller;
|
||||
}
|
||||
|
||||
public override void OnEffectGained(HookContext ctx)
|
||||
{
|
||||
_host = ctx.Trigger;
|
||||
}
|
||||
|
||||
public override void AfterDamageCalculation(DamageContext ctx)
|
||||
{
|
||||
// 本标记会随宿主收到「宿主参与的所有伤害结算」,只关心宿主作为受击方的那一次
|
||||
Character? host = _host;
|
||||
if (host is null || ctx.Enemy != host) return;
|
||||
if (ctx.DamageResult != DamageResult.Normal && ctx.DamageResult != DamageResult.Critical) return;
|
||||
if (ctx.ActualDamage <= 0) return;
|
||||
_controller.TryEmergencyHeal(host);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
using FunGame.Core.Api;
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
using Milimoe.FunGameTesting.Others;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
/// <summary>
|
||||
/// 强运:被动状态(由【十二宫星环】等来源施加,按回合计时)
|
||||
/// <para/>· 所属角色每个回合结束时,随机生成 2~3 份绑定自身的【回合奖励】
|
||||
/// <para/>· 奖励取自模组公共的 <see cref="RoundRewardPool"/>(与队列内置奖励同构):
|
||||
/// 用 <see cref="Factory.OpenFactory"/> 构造奖励技能(Skill 由 OpenSkill 承载、Effect 按 EffectID 构造),
|
||||
/// 再经 <see cref="FunGame.Core.Interface.Base.IGamingQueue.AddRoundReward"/> 绑定到角色名下
|
||||
/// <para/>· 仅在启用「角色绑定的回合奖励」时才能真正生成(否则 <c>AddRoundReward</c> 返回 false)
|
||||
/// </summary>
|
||||
public class 强运 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.强运;
|
||||
public override string Name => "强运";
|
||||
public override string Description =>
|
||||
$"此角色处于强运状态:每个回合结束时,随机生成 {最小生成数量}~{最大生成数量} 份绑定自身的回合奖励,并顺延到其下一个行动回合。持续 {DurationTurn} 回合。来自:[ {Source} ] 的 [ {Skill.Name} ]";
|
||||
public override bool IsDebuff => false;
|
||||
public override Character? Source => _sourceCharacter;
|
||||
public override bool Durative => _durative;
|
||||
public override double Duration => _duration;
|
||||
public override int DurationTurn => _durationTurn;
|
||||
public override DispelledType DispelledType => DispelledType.CannotBeDispelled;
|
||||
|
||||
/// <summary>每次触发最少生成的奖励数量</summary>
|
||||
public const int 最小生成数量 = 2;
|
||||
|
||||
/// <summary>每次触发最多生成的奖励数量</summary>
|
||||
public const int 最大生成数量 = 3;
|
||||
|
||||
private readonly Character _targetCharacter;
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly bool _durative;
|
||||
private readonly double _duration;
|
||||
private readonly int _durationTurn;
|
||||
|
||||
public 强运(Skill skill, Character targetCharacter, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_targetCharacter = targetCharacter;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_durative = durative;
|
||||
_duration = duration;
|
||||
_durationTurn = durationTurn;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnTurnEnd(TurnContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character || character != _targetCharacter || character.HP <= 0) return;
|
||||
if (GamingQueue is null) return;
|
||||
|
||||
Dictionary<EffectID, Dictionary<string, object>> 奖励池 = RoundRewardPool.Create(Random);
|
||||
EffectID[] ids = [.. 奖励池.Keys];
|
||||
int count = Random.Next(最小生成数量, 最大生成数量 + 1);
|
||||
List<string> generatedNames = [];
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
EffectID id = ids[Random.Next(ids.Length)];
|
||||
Skill reward = 构造奖励(id, 奖励池[id]);
|
||||
if (!GamingQueue.AddRoundReward(character, 1, reward))
|
||||
{
|
||||
break;
|
||||
}
|
||||
generatedNames.Add(reward.Name);
|
||||
}
|
||||
|
||||
if (generatedNames.Count > 0)
|
||||
{
|
||||
WriteLine($"[ {character} ] 受到强运眷顾,为下一行动回合生成了 {generatedNames.Count} 份回合奖励:{string.Join("、", generatedNames)}!");
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteLine($"[ {character} ] 的强运未能生成回合奖励(未启用角色绑定的回合奖励)。");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从公共奖励池构造一份奖励技能(与队列的 CreateRoundRewardSkill 同构)
|
||||
/// </summary>
|
||||
private static Skill 构造奖励(EffectID id, Dictionary<string, object> effectArgs)
|
||||
{
|
||||
Dictionary<string, object> skillArgs = [];
|
||||
if (RoundRewardPool.IsActive(id))
|
||||
{
|
||||
skillArgs.Add("active", true);
|
||||
skillArgs.Add("self", true);
|
||||
skillArgs.Add("enemy", false);
|
||||
}
|
||||
|
||||
Skill skill = Factory.OpenFactory.GetInstance<Skill>((long)id, "", skillArgs);
|
||||
Effect effect = Factory.OpenFactory.GetInstance((long)id, "", skill, new(effectArgs));
|
||||
skill.Effects.Add(effect);
|
||||
skill.Name = $"[R] {effect.Name}";
|
||||
return skill;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using FunGame.Core.Model.EffectResult;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 愤怒 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.愤怒;
|
||||
public override string Name => "愤怒";
|
||||
public override string Description => $"此角色处于愤怒状态,行动受限且失控,行动回合中无法自主行动,仅能对 [ {_targetCharacter} ] 发起普通攻击。来自:[ {Source} ] 的 [ {Skill.Name} ]";
|
||||
public override EffectType EffectType => EffectType.Taunt;
|
||||
public override DispelledType DispelledType => DispelledType.Strong;
|
||||
public override bool IsDebuff => true;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override bool Durative => _durative;
|
||||
public override double Duration => _duration;
|
||||
public override int DurationTurn => _durationTurn;
|
||||
public override bool ExemptDuration => true;
|
||||
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly Character _targetCharacter;
|
||||
private readonly bool _durative;
|
||||
private readonly double _duration;
|
||||
private readonly int _durationTurn;
|
||||
|
||||
public 愤怒(Skill skill, Character sourceCharacter, Character targetCharacter, bool durative = false, double duration = 0, int durationTurn = 1) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_targetCharacter = targetCharacter;
|
||||
_durative = durative;
|
||||
_duration = duration;
|
||||
_durationTurn = durationTurn;
|
||||
}
|
||||
|
||||
public override void AlterSelectListBeforeAction(SelectionContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
List<Character> enemys = ctx.Enemys;
|
||||
List<Character> teammates = ctx.Teammates;
|
||||
// 为了确保角色能够自动化行动,这里需要将角色设置为可行动
|
||||
if (character.CharacterState == CharacterState.ActionRestricted)
|
||||
{
|
||||
GamingQueue?.SetCharactersToAIControl(true, false, character);
|
||||
character.CharacterState = CharacterState.Actionable;
|
||||
}
|
||||
enemys.Clear();
|
||||
teammates.Clear();
|
||||
if (_targetCharacter.HP > 0)
|
||||
{
|
||||
enemys.Add(_targetCharacter);
|
||||
}
|
||||
}
|
||||
|
||||
public override AlterActionTypeResult AlterActionTypeBeforeAction(DecisionContext ctx)
|
||||
{
|
||||
if (_targetCharacter.HP > 0)
|
||||
{
|
||||
// 目标存活:强制倾向普通攻击,禁止使用物品与技能
|
||||
return new AlterActionTypeResult { ForceAction = true, PNormalAttack = 1, CanUseItem = false, CanCastSkill = false };
|
||||
}
|
||||
// 如果目标已死亡,则放弃本回合行动,并在回合结束后自动移除愤怒状态
|
||||
RemainDuration = 0;
|
||||
RemainDurationTurn = 0;
|
||||
return new AlterActionTypeResult { ForceAction = true, ActionType = CharacterActionType.EndTurn };
|
||||
}
|
||||
|
||||
public override void AfterDeathCalculation(DeathContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character death) return;
|
||||
if (death == _targetCharacter)
|
||||
{
|
||||
// 如果目标死亡,则在下次时间流逝时自动移除愤怒状态
|
||||
RemainDuration = 0;
|
||||
RemainDurationTurn = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnTurnEnd(TurnContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
character.UpdateCharacterState();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
GamingQueue?.SetCharactersToAIControl(true, false, character);
|
||||
AddEffectStatesToCharacter(character, [CharacterState.ActionRestricted]);
|
||||
AddEffectTypeToCharacter(character, [EffectType.Taunt]);
|
||||
InterruptCasting(character, Source);
|
||||
}
|
||||
|
||||
public override void OnEffectLost(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
GamingQueue?.SetCharactersToAIControl(true, true, character);
|
||||
RemoveEffectStatesFromCharacter(character);
|
||||
RemoveEffectTypesFromCharacter(character);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 战斗不能 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.战斗不能;
|
||||
public override string Name => "战斗不能";
|
||||
public override string Description => $"此角色处于战斗不能状态,无法普通攻击和使用技能(魔法、战技和爆发技),无法对敌人或者队友使用物品。来自:[ {Source} ] 的 [ {Skill.Name} ]";
|
||||
public override EffectType EffectType => EffectType.Cripple;
|
||||
public override DispelledType DispelledType => DispelledType.Strong;
|
||||
public override bool IsDebuff => true;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override bool Durative => _durative;
|
||||
public override double Duration => _duration;
|
||||
public override int DurationTurn => _durationTurn;
|
||||
public override bool ExemptDuration => true;
|
||||
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly bool _durative;
|
||||
private readonly double _duration;
|
||||
private readonly int _durationTurn;
|
||||
|
||||
public 战斗不能(Skill skill, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_durative = durative;
|
||||
_duration = duration;
|
||||
_durationTurn = durationTurn;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
AddEffectStatesToCharacter(character, [CharacterState.BattleRestricted]);
|
||||
InterruptCasting(character, Source);
|
||||
}
|
||||
|
||||
public override void OnEffectLost(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
RemoveEffectStatesFromCharacter(character);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using FunGame.Core.Model.EffectResult;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 技能免疫 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.技能免疫;
|
||||
public override string Name => "技能免疫";
|
||||
public override string Description => $"此角色处于技能免疫状态,无法选中其作为技能目标(自释放技能除外),并免疫来自技能的伤害。来自:[ {Source} ] 的 [ {Skill.Name} ]";
|
||||
public override EffectType EffectType => EffectType.SkilledImmune;
|
||||
public override DispelledType DispelledType => DispelledType.Weak;
|
||||
public override bool IsDebuff => false;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override bool Durative => _durative;
|
||||
public override double Duration => _duration;
|
||||
public override int DurationTurn => _durationTurn;
|
||||
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly bool _durative;
|
||||
private readonly double _duration;
|
||||
private readonly int _durationTurn;
|
||||
|
||||
public 技能免疫(Skill skill, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_durative = durative;
|
||||
_duration = duration;
|
||||
_durationTurn = durationTurn;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
AddImmuneTypesToCharacter(character, [ImmuneType.Skilled]);
|
||||
}
|
||||
|
||||
public override void OnEffectLost(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
RemoveImmuneTypesFromCharacter(character);
|
||||
}
|
||||
|
||||
public override OnImmuneCheckResult OnImmuneCheck(ImmuneContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return default;
|
||||
Character? target = ctx.Target;
|
||||
if (character == target)
|
||||
{
|
||||
return new OnImmuneCheckResult { IgnoreImmunity = true };
|
||||
}
|
||||
return default;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using FunGame.Core.Model.Framework;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 持续伤害 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.持续伤害;
|
||||
public override string Name { get; set; } = "持续伤害";
|
||||
public override string Description => $"此角色正受到持续伤害,每{GameplayEquilibriumConstant.InGameTime}受到 {(_isPercentage ? $"{_durationDamagePercent * 100:0.##}% 当前生命值 [ {Damage:0.##} ]" : Damage.ToString("0.##"))} 点{CharacterSet.GetDamageTypeName(_damageType)}。来自:[ {Source} ] 的 [ {Skill.Name} ]";
|
||||
public override bool IsDebuff { get; set; } = true;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override bool Durative => _durative;
|
||||
public override double Duration => _duration;
|
||||
public override int DurationTurn => _durationTurn;
|
||||
|
||||
private readonly Character _targetCharacter;
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly bool _durative;
|
||||
private readonly double _duration;
|
||||
private readonly int _durationTurn;
|
||||
private readonly bool _isPercentage;
|
||||
private readonly double _durationDamage;
|
||||
private readonly double _durationDamagePercent;
|
||||
private readonly DamageType _damageType = DamageType.Physical;
|
||||
private readonly DamageCalculationOptions? _options = null;
|
||||
private double Damage => _isPercentage ? _targetCharacter.HP * _durationDamagePercent : _durationDamage;
|
||||
|
||||
public 持续伤害(Skill skill, Character targetCharacter, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1,
|
||||
bool isPercentage = true, double durationDamage = 100, double durationDamagePercent = 0.02, DamageType damageType = DamageType.Physical, DamageCalculationOptions? options = null) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_targetCharacter = targetCharacter;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_durative = durative;
|
||||
_duration = duration;
|
||||
_durationTurn = durationTurn;
|
||||
_isPercentage = isPercentage;
|
||||
_durationDamage = durationDamage;
|
||||
_durationDamagePercent = durationDamagePercent;
|
||||
_damageType = damageType;
|
||||
_options = options;
|
||||
}
|
||||
|
||||
private double GetDamage(double hp, double elapsed)
|
||||
{
|
||||
if (hp <= 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
double damage = _isPercentage ? hp * _durationDamagePercent : _durationDamage;
|
||||
return damage * elapsed;
|
||||
}
|
||||
|
||||
public override void OnTimeElapsed(TimeLapseContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
double elapsed = ctx.Elapsed;
|
||||
if (character == _targetCharacter && character.HP > 0)
|
||||
{
|
||||
double hp = character.HP;
|
||||
double damage = GetDamage(hp, elapsed);
|
||||
if (elapsed > 1)
|
||||
{
|
||||
damage = 0;
|
||||
int loop = 0;
|
||||
int elapsedSecond = (int)elapsed;
|
||||
for (; loop < elapsedSecond; loop++)
|
||||
{
|
||||
double current = GetDamage(hp, 1);
|
||||
damage += current;
|
||||
hp -= current;
|
||||
elapsed--;
|
||||
}
|
||||
if (elapsed > 0)
|
||||
{
|
||||
damage += GetDamage(hp, elapsed);
|
||||
}
|
||||
}
|
||||
DamageToEnemy(Source, character, _damageType, MagicType, damage, _options);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
AddEffectTypeToCharacter(character, [EffectType]);
|
||||
}
|
||||
|
||||
public override void OnEffectLost(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
RemoveEffectTypesFromCharacter(character);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 持续回复 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.持续回复;
|
||||
public override string Name => "持续回复";
|
||||
public override string Description => $"此角色处于持续回复状态,每{GameplayEquilibriumConstant.InGameTime}回复 {(_isPercentage ? $"{_durationHealPercent * 100:0.##}% [ {Heal:0.##} ]" : Heal.ToString("0.##"))} 点当前生命值。来自:[ {Source} ] 的 [ {Skill.Name} ]";
|
||||
public override EffectType EffectType => EffectType.HealOverTime;
|
||||
public override bool IsDebuff => false;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override bool Durative => _durative;
|
||||
public override double Duration => _duration;
|
||||
public override int DurationTurn => _durationTurn;
|
||||
|
||||
private readonly Character _targetCharacter;
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly bool _durative;
|
||||
private readonly double _duration;
|
||||
private readonly int _durationTurn;
|
||||
private readonly bool _isPercentage;
|
||||
private readonly double _durationHeal;
|
||||
private readonly double _durationHealPercent;
|
||||
private double Heal => _isPercentage ? _targetCharacter.HP * _durationHealPercent : _durationHeal;
|
||||
|
||||
public 持续回复(Skill skill, Character targetCharacter, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1,
|
||||
bool isPercentage = true, double durationHeal = 100, double durationHealPercent = 0.02) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_targetCharacter = targetCharacter;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_durative = durative;
|
||||
_duration = duration;
|
||||
_durationTurn = durationTurn;
|
||||
_isPercentage = isPercentage;
|
||||
_durationHeal = durationHeal;
|
||||
_durationHealPercent = durationHealPercent;
|
||||
}
|
||||
|
||||
private double GetHeal(double hp, double elapsed)
|
||||
{
|
||||
if (hp <= 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
double heal = _isPercentage ? hp * _durationHealPercent : _durationHeal;
|
||||
return heal * elapsed;
|
||||
}
|
||||
|
||||
public override void OnTimeElapsed(TimeLapseContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
double elapsed = ctx.Elapsed;
|
||||
if (character == _targetCharacter && character.HP > 0)
|
||||
{
|
||||
double hp = character.HP;
|
||||
double heal = GetHeal(hp, elapsed);
|
||||
if (elapsed > 1)
|
||||
{
|
||||
heal = 0;
|
||||
int loop = 0;
|
||||
int elapsedSecond = (int)elapsed;
|
||||
for (; loop < elapsedSecond; loop++)
|
||||
{
|
||||
double current = GetHeal(hp, 1);
|
||||
heal += current;
|
||||
hp -= current;
|
||||
elapsed--;
|
||||
}
|
||||
if (elapsed > 0)
|
||||
{
|
||||
heal += GetHeal(hp, elapsed);
|
||||
}
|
||||
}
|
||||
HealToTarget(Source, character, heal, triggerEffects: false);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
AddEffectTypeToCharacter(character, [EffectType.HealOverTime]);
|
||||
}
|
||||
|
||||
public override void OnEffectLost(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
RemoveEffectTypesFromCharacter(character);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using FunGame.Core.Model.EffectResult;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 持续性弱驱散 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.持续性弱驱散;
|
||||
public override string Name => "持续性弱驱散";
|
||||
public override string Description => $"此角色正在被持续性弱驱散。来自:[ {Source} ] 的 [ {Skill.Name} ]";
|
||||
public override EffectType EffectType => EffectType.WeakDispelling;
|
||||
public override DispelType DispelType => DispelType.DurativeWeak;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override bool DurativeWithoutDuration => _durativeWithoutDuration;
|
||||
public override bool Durative => _durative;
|
||||
public override double Duration => _duration;
|
||||
public override int DurationTurn => _durationTurn;
|
||||
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly bool _durativeWithoutDuration;
|
||||
private readonly bool _durative;
|
||||
private readonly double _duration;
|
||||
private readonly int _durationTurn;
|
||||
|
||||
public 持续性弱驱散(Skill skill, Character sourceCharacter, bool durativeWithoutDuration = false, bool durative = false, double duration = 0, int durationTurn = 1) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
DispelledType = DispelledType.Weak;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_durativeWithoutDuration = durativeWithoutDuration;
|
||||
if (!_durativeWithoutDuration)
|
||||
{
|
||||
_durative = durative;
|
||||
_duration = duration;
|
||||
_durationTurn = durationTurn;
|
||||
}
|
||||
}
|
||||
|
||||
public override BeforeSkillCastWillBeInterruptedResult BeforeSkillCastWillBeInterrupted(SkillCastContext ctx)
|
||||
{
|
||||
return new BeforeSkillCastWillBeInterruptedResult { BlockInterruption = true };
|
||||
}
|
||||
|
||||
public override void OnEffectGained(HookContext ctx)
|
||||
{
|
||||
if (_durative && RemainDuration == 0)
|
||||
{
|
||||
RemainDuration = Duration;
|
||||
}
|
||||
else if (RemainDurationTurn == 0)
|
||||
{
|
||||
RemainDurationTurn = DurationTurn;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using FunGame.Core.Model.EffectResult;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 持续性强驱散 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.持续性强驱散;
|
||||
public override string Name => "持续性强驱散";
|
||||
public override string Description => $"此角色正在被持续性强驱散。来自:[ {Source} ] 的 [ {Skill.Name} ]";
|
||||
public override EffectType EffectType => EffectType.StrongDispelling;
|
||||
public override DispelType DispelType => DispelType.DurativeStrong;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override bool DurativeWithoutDuration => _durativeWithoutDuration;
|
||||
public override bool Durative => _durative;
|
||||
public override double Duration => _duration;
|
||||
public override int DurationTurn => _durationTurn;
|
||||
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly bool _durativeWithoutDuration;
|
||||
private readonly bool _durative;
|
||||
private readonly double _duration;
|
||||
private readonly int _durationTurn;
|
||||
|
||||
public 持续性强驱散(Skill skill, Character sourceCharacter, bool durativeWithoutDuration = false, bool durative = false, double duration = 0, int durationTurn = 1) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
DispelledType = DispelledType.Strong;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_durativeWithoutDuration = durativeWithoutDuration;
|
||||
if (!_durativeWithoutDuration)
|
||||
{
|
||||
_durative = durative;
|
||||
_duration = duration;
|
||||
_durationTurn = durationTurn;
|
||||
}
|
||||
}
|
||||
|
||||
public override BeforeSkillCastWillBeInterruptedResult BeforeSkillCastWillBeInterrupted(SkillCastContext ctx)
|
||||
{
|
||||
return new BeforeSkillCastWillBeInterruptedResult { BlockInterruption = true };
|
||||
}
|
||||
|
||||
public override void OnEffectGained(HookContext ctx)
|
||||
{
|
||||
if (_durative && RemainDuration == 0)
|
||||
{
|
||||
RemainDuration = Duration;
|
||||
}
|
||||
else if (RemainDurationTurn == 0)
|
||||
{
|
||||
RemainDurationTurn = DurationTurn;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using FunGame.Core.Model.EffectResult;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 时雨标记 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.时雨标记;
|
||||
public override string Name => "时雨标记";
|
||||
public override string Description => $"此角色持有时雨标记。来自:[ {Source} ]";
|
||||
public override EffectType EffectType => EffectType.Mark;
|
||||
public override bool IsDebuff => true;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override DispelledType DispelledType { get; set; } = DispelledType.Weak;
|
||||
|
||||
private readonly Character _sourceCharacter;
|
||||
|
||||
public 时雨标记(Skill skill, Character sourceCharacter) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
}
|
||||
|
||||
public override void OnTurnStart(TurnContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
if (GamingQueue is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
List<Character> enemies = GamingQueue.GetEnemies(character);
|
||||
if (enemies.Contains(Source) && Random.NextDouble() < 0.65)
|
||||
{
|
||||
WriteLine($"[ {character} ] 受到了{nameof(时雨标记)}的影响,陷入了混乱!!!");
|
||||
Effect e = new 混乱(Skill, character, false, 0, 1);
|
||||
character.Effects.Add(e);
|
||||
e.OnEffectGained(new HookContext(GamingQueue, character));
|
||||
}
|
||||
}
|
||||
|
||||
public override AlterActualDamageResult AlterActualDamageAfterCalculation(DamageContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return default;
|
||||
if (ctx.Enemy is not Character enemy) return default;
|
||||
double damage = ctx.Damage;
|
||||
if (GamingQueue is null)
|
||||
{
|
||||
return default;
|
||||
|
||||
}
|
||||
List<Character> teammates = GamingQueue.GetTeammates(character);
|
||||
if ((character == Source || teammates.Contains(Source)) && character.Effects.Any(e => e is 时雨标记) && enemy.Effects.Any(e => e is 时雨标记))
|
||||
{
|
||||
double bonus = damage * 0.25;
|
||||
WriteLine($"[ {character} ] 受到了{nameof(时雨标记)}的影响,伤害提高了 {bonus:0.##} 点!");
|
||||
return new AlterActualDamageResult { DamageDelta = bonus };
|
||||
|
||||
}
|
||||
return default;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using FunGame.Core.Model.EffectResult;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 易伤 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.易伤;
|
||||
public override string Name => "易伤";
|
||||
public override string Description => $"此角色处于易伤状态,额外受到 {_exDamagePercent * 100:0.##}% {CharacterSet.GetDamageTypeName(_damageType)}。来自:[ {Source} ] 的 [ {Skill.Name} ]";
|
||||
public override EffectType EffectType => EffectType.Vulnerable;
|
||||
public override bool IsDebuff => true;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override bool Durative => _durative;
|
||||
public override double Duration => _duration;
|
||||
public override int DurationTurn => _durationTurn;
|
||||
public override bool ExemptDuration => true;
|
||||
|
||||
private readonly DamageType _damageType;
|
||||
private readonly Character _targetCharacter;
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly bool _durative;
|
||||
private readonly double _duration;
|
||||
private readonly int _durationTurn;
|
||||
private readonly double _exDamagePercent;
|
||||
|
||||
public 易伤(Skill skill, Character targetCharacter, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1,
|
||||
DamageType damageType = DamageType.Magical, double exDamagePercent = 0) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_targetCharacter = targetCharacter;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_durative = durative;
|
||||
_duration = duration;
|
||||
_durationTurn = durationTurn;
|
||||
_damageType = damageType;
|
||||
_exDamagePercent = exDamagePercent;
|
||||
}
|
||||
|
||||
public override AlterActualDamageResult AlterActualDamageAfterCalculation(DamageContext ctx)
|
||||
{
|
||||
if (ctx.Enemy is not Character enemy) return default;
|
||||
double damage = ctx.Damage;
|
||||
DamageType damageType = ctx.DamageType;
|
||||
if (enemy == _targetCharacter && damageType == _damageType)
|
||||
{
|
||||
return new AlterActualDamageResult { DamageDelta = damage * _exDamagePercent };
|
||||
|
||||
}
|
||||
return default;
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
AddEffectTypeToCharacter(character, [EffectType.Vulnerable]);
|
||||
}
|
||||
|
||||
public override void OnEffectLost(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
RemoveEffectTypesFromCharacter(character);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using FunGame.Core.Model.EffectResult;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 易损 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.易损;
|
||||
public override string Name => "易损";
|
||||
public override string Description => $"此角色处于易损状态,承受伤害提升 {_exDamagePercent * 100:0.##}%。来自:[ {Source} ] 的 [ {Skill.Name} ]";
|
||||
public override EffectType EffectType => EffectType.Vulnerable;
|
||||
public override bool IsDebuff => true;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override bool Durative => _durative;
|
||||
public override double Duration => _duration;
|
||||
public override int DurationTurn => _durationTurn;
|
||||
public override bool ExemptDuration => true;
|
||||
|
||||
private readonly Character _targetCharacter;
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly bool _durative;
|
||||
private readonly double _duration;
|
||||
private readonly int _durationTurn;
|
||||
private readonly double _exDamagePercent;
|
||||
|
||||
public 易损(Skill skill, Character targetCharacter, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1, double exDamagePercent = 0) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_targetCharacter = targetCharacter;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_durative = durative;
|
||||
_duration = duration;
|
||||
_durationTurn = durationTurn;
|
||||
_exDamagePercent = exDamagePercent;
|
||||
}
|
||||
|
||||
public override AlterActualDamageResult AlterActualDamageAfterCalculation(DamageContext ctx)
|
||||
{
|
||||
if (ctx.Enemy is not Character enemy) return default;
|
||||
double damage = ctx.Damage;
|
||||
if (enemy == _targetCharacter)
|
||||
{
|
||||
return new AlterActualDamageResult { DamageDelta = damage * _exDamagePercent };
|
||||
|
||||
}
|
||||
return default;
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
AddEffectTypeToCharacter(character, [EffectType.Vulnerable]);
|
||||
}
|
||||
|
||||
public override void OnEffectLost(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
RemoveEffectTypesFromCharacter(character);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 标记 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.标记;
|
||||
public override string Name => $"{_name}标记";
|
||||
public override string Description => $"此角色持有{Name}。{OtherDescription}来自:[ {Source} ]";
|
||||
public override EffectType EffectType => EffectType.Mark;
|
||||
public override bool IsDebuff => true;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public string OtherDescription { get; set; } = "";
|
||||
|
||||
private readonly string _name;
|
||||
private readonly Character _sourceCharacter;
|
||||
|
||||
public 标记(Skill skill, string name, Character sourceCharacter) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_name = name;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 气绝 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.气绝;
|
||||
public override string Name => "气绝";
|
||||
public override string Description => $"此角色处于气绝状态,行动受限并且每{GameplayEquilibriumConstant.InGameTime}流失 {(_isPercentage ? $"{_durationDamagePercent * 100:0.##}% [ {Damage:0.##} ]" : Damage.ToString("0.##"))} 点当前生命值,此生命流失效果不会导致角色死亡。来自:[ {Source} ] 的 [ {Skill.Name} ]";
|
||||
public override EffectType EffectType => EffectType.Bleed;
|
||||
public override DispelledType DispelledType => DispelledType.Strong;
|
||||
public override bool IsDebuff => true;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override bool Durative => _durative;
|
||||
public override double Duration => _duration;
|
||||
public override int DurationTurn => _durationTurn;
|
||||
public override bool ExemptDuration => true;
|
||||
|
||||
private readonly Character _targetCharacter;
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly bool _durative;
|
||||
private readonly double _duration;
|
||||
private readonly int _durationTurn;
|
||||
private readonly bool _isPercentage;
|
||||
private readonly double _durationDamage;
|
||||
private readonly double _durationDamagePercent;
|
||||
private double Damage => _isPercentage ? _targetCharacter.HP * _durationDamagePercent : _durationDamage;
|
||||
|
||||
public 气绝(Skill skill, Character targetCharacter, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1,
|
||||
bool isPercentage = true, double durationDamage = 100, double durationDamagePercent = 0.02) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_targetCharacter = targetCharacter;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_durative = durative;
|
||||
_duration = duration;
|
||||
_durationTurn = durationTurn;
|
||||
_isPercentage = isPercentage;
|
||||
_durationDamage = durationDamage;
|
||||
_durationDamagePercent = durationDamagePercent;
|
||||
}
|
||||
|
||||
private double GetDamage(double hp, double elapsed)
|
||||
{
|
||||
if (hp <= 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
double damage = _isPercentage ? hp * _durationDamagePercent : _durationDamage;
|
||||
return damage * elapsed;
|
||||
}
|
||||
|
||||
public override void OnTimeElapsed(TimeLapseContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
double elapsed = ctx.Elapsed;
|
||||
if (character == _targetCharacter && character.HP > 0)
|
||||
{
|
||||
double hp = character.HP;
|
||||
double damage = GetDamage(hp, elapsed);
|
||||
if (elapsed > 1)
|
||||
{
|
||||
damage = 0;
|
||||
int loop = 0;
|
||||
int elapsedSecond = (int)elapsed;
|
||||
for (; loop < elapsedSecond; loop++)
|
||||
{
|
||||
double current = GetDamage(hp, 1);
|
||||
damage += current;
|
||||
hp -= current;
|
||||
elapsed--;
|
||||
}
|
||||
if (elapsed > 0)
|
||||
{
|
||||
damage += GetDamage(hp, elapsed);
|
||||
}
|
||||
}
|
||||
character.HP -= damage;
|
||||
if (character.HP <= 0)
|
||||
{
|
||||
character.HP = 1;
|
||||
}
|
||||
GamingQueue?.CalculateCharacterDamageStatistics(Source, character, damage, DamageType.True);
|
||||
WriteLine($"[ {character} ] 因气绝而流失了 {damage: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;
|
||||
}
|
||||
AddEffectTypeToCharacter(character, [EffectType.Bleed]);
|
||||
AddEffectStatesToCharacter(character, [CharacterState.ActionRestricted]);
|
||||
InterruptCasting(character, Source);
|
||||
}
|
||||
|
||||
public override void OnEffectLost(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
RemoveEffectTypesFromCharacter(character);
|
||||
RemoveEffectStatesFromCharacter(character);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 海王星的野望标记 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.海王星的野望标记;
|
||||
public override string Name => "海王星的野望标记";
|
||||
public override string Description => $"此角色持有海王星的野望标记。来自:[ {Source} ]";
|
||||
public override EffectType EffectType => EffectType.Mark;
|
||||
public override bool IsDebuff => true;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override DispelledType DispelledType => DispelledType.CannotBeDispelled;
|
||||
|
||||
private readonly Character _sourceCharacter;
|
||||
|
||||
public 海王星的野望标记(Skill skill, Character sourceCharacter) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using FunGame.Core.Model.EffectResult;
|
||||
using FunGame.Core.Model.Framework;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 混乱 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.混乱;
|
||||
public override string Name => "混乱";
|
||||
public override string Description => $"此角色处于混乱状态,行动受限且失控,行动回合中无法自主行动而是随机行动,在进行攻击指令时,可能会选取友方角色为目标。来自:[ {Source} ] 的 [ {Skill.Name} ]";
|
||||
public override EffectType EffectType => EffectType.Confusion;
|
||||
public override DispelledType DispelledType => DispelledType.Strong;
|
||||
public override bool IsDebuff => true;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override bool Durative => _durative;
|
||||
public override double Duration => _duration;
|
||||
public override int DurationTurn => _durationTurn;
|
||||
public override bool ExemptDuration => true;
|
||||
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly bool _durative;
|
||||
private readonly double _duration;
|
||||
private readonly int _durationTurn;
|
||||
|
||||
public 混乱(Skill skill, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_durative = durative;
|
||||
_duration = duration;
|
||||
_durationTurn = durationTurn;
|
||||
}
|
||||
|
||||
public override void AlterSelectListBeforeAction(SelectionContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
List<Character> enemys = ctx.Enemys;
|
||||
List<Character> teammates = ctx.Teammates;
|
||||
// 为了确保角色能够混乱行动,这里需要将角色设置为可行动
|
||||
if (character.CharacterState == CharacterState.ActionRestricted)
|
||||
{
|
||||
GamingQueue?.SetCharactersToAIControl(true, false, character);
|
||||
character.CharacterState = CharacterState.Actionable;
|
||||
}
|
||||
enemys.AddRange(teammates);
|
||||
teammates.AddRange(enemys);
|
||||
}
|
||||
|
||||
public override AlterActionTypeResult AlterActionTypeBeforeAction(DecisionContext ctx)
|
||||
{
|
||||
DecisionPoints dp = ctx.DP;
|
||||
return new AlterActionTypeResult
|
||||
{
|
||||
ForceAction = true,
|
||||
ActionType = GamingQueue?.GetActionType(dp, ctx.PUseItem, ctx.PCastSkill, ctx.PNormalAttack) ?? CharacterActionType.EndTurn
|
||||
};
|
||||
}
|
||||
|
||||
public override void OnTurnEnd(TurnContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
character.UpdateCharacterState();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
GamingQueue?.SetCharactersToAIControl(true, false, character);
|
||||
AddEffectStatesToCharacter(character, [CharacterState.ActionRestricted]);
|
||||
AddEffectTypeToCharacter(character, [EffectType.Confusion]);
|
||||
InterruptCasting(character, Source);
|
||||
}
|
||||
|
||||
public override void OnEffectLost(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
GamingQueue?.SetCharactersToAIControl(true, true, character);
|
||||
RemoveEffectStatesFromCharacter(character);
|
||||
RemoveEffectTypesFromCharacter(character);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 物理免疫 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.物理免疫;
|
||||
public override string Name => "物理免疫";
|
||||
public override string Description => $"此角色处于物理免疫状态,免疫物理伤害。来自:[ {Source} ] 的 [ {Skill.Name} ]";
|
||||
public override EffectType EffectType => EffectType.PhysicalImmune;
|
||||
public override DispelledType DispelledType => DispelledType.Weak;
|
||||
public override bool IsDebuff => false;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override bool Durative => _durative;
|
||||
public override double Duration => _duration;
|
||||
public override int DurationTurn => _durationTurn;
|
||||
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly bool _durative;
|
||||
private readonly double _duration;
|
||||
private readonly int _durationTurn;
|
||||
|
||||
public 物理免疫(Skill skill, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_durative = durative;
|
||||
_duration = duration;
|
||||
_durationTurn = durationTurn;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
AddImmuneTypesToCharacter(character, [ImmuneType.Physical]);
|
||||
}
|
||||
|
||||
public override void OnEffectLost(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
RemoveImmuneTypesFromCharacter(character);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using FunGame.Core.Model.EffectResult;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 物理护盾 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.物理护盾;
|
||||
public override string Name => "物理护盾";
|
||||
public override string Description => $"此角色拥有物理护盾{CurrentShield}。来自:[ {Source} ] 的 [ {Skill.Name} ]";
|
||||
public override EffectType EffectType => EffectType.Shield;
|
||||
public override DispelledType DispelledType => DispelledType.CannotBeDispelled;
|
||||
public override bool DurativeWithoutDuration => true;
|
||||
public override bool IsDebuff => false;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override bool Durative => _durative;
|
||||
public override double Duration => _duration;
|
||||
public override int DurationTurn => _durationTurn;
|
||||
|
||||
private string CurrentShield
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_targetCharacter != null && _targetCharacter.Shield.ShieldOfEffects.TryGetValue(this, out ShieldOfEffect? value) && value != null)
|
||||
{
|
||||
return $",护盾值:{value.Shield:0.##} 点";
|
||||
}
|
||||
else return "";
|
||||
}
|
||||
}
|
||||
private readonly Character _targetCharacter;
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly double _shield;
|
||||
private readonly bool _durative;
|
||||
private readonly double _duration;
|
||||
private readonly int _durationTurn;
|
||||
|
||||
public 物理护盾(Skill skill, Character targetCharacter, Character sourceCharacter, double shield, bool durative = false, double duration = 0, int durationTurn = 0) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_targetCharacter = targetCharacter;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_durative = durative;
|
||||
_duration = duration;
|
||||
_durationTurn = durationTurn;
|
||||
_shield = shield;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
character.Shield.AddShieldOfEffect(new(this, _shield, ShieldType.Physical, MagicType.None));
|
||||
}
|
||||
|
||||
public override void OnEffectLost(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
character.Shield.RemoveShieldOfEffect(this);
|
||||
}
|
||||
|
||||
public override OnShieldBrokenResult OnShieldBroken(ShieldContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return default;
|
||||
Effect? effet = ctx.ShieldEffect;
|
||||
if (effet == this)
|
||||
{
|
||||
character.Shield.RemoveShieldOfEffect(this);
|
||||
character.Effects.Remove(this);
|
||||
}
|
||||
return default;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 电刑标记 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.电刑标记;
|
||||
public override string Name => "电刑标记";
|
||||
public override string Description => $"此角色持有电刑标记,层数:{层数} 层。来自:[ {Source} ]";
|
||||
public override EffectType EffectType => EffectType.Mark;
|
||||
public override bool IsDebuff => true;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public int 层数 { get; set; } = 1;
|
||||
|
||||
private readonly Character _sourceCharacter;
|
||||
|
||||
public 电刑标记(Skill skill, Character sourceCharacter) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 眩晕(Skill skill, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1) : 完全行动不能(nameof(眩晕), EffectType.Stun, skill, sourceCharacter, durative, duration, durationTurn)
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.眩晕;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 石化(Skill skill, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1) : 完全行动不能(nameof(石化), EffectType.Petrify, skill, sourceCharacter, durative, duration, durationTurn)
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.石化;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using FunGame.Core.Model.EffectResult;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 禁止治疗 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.禁止治疗;
|
||||
public override string Name => "禁止治疗";
|
||||
public override string Description => $"此角色已被禁止治疗{禁止类型}。来自:[ {Source} ] 的 [ {Skill.Name} ]";
|
||||
public override EffectType EffectType => EffectType.GrievousWound;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override bool Durative => _durative;
|
||||
public override double Duration => _duration;
|
||||
public override int DurationTurn => _durationTurn;
|
||||
|
||||
public string 禁止类型
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_allowRecovery && _allowLifeSteal && _allowHealing)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
List<string> strings = [];
|
||||
if (!_allowRecovery)
|
||||
{
|
||||
strings.Add("自然回复");
|
||||
}
|
||||
if (!_allowLifeSteal)
|
||||
{
|
||||
strings.Add("生命偷取");
|
||||
}
|
||||
if (!_allowHealing)
|
||||
{
|
||||
strings.Add("应用治疗");
|
||||
}
|
||||
return $"({string.Join("、", strings)})";
|
||||
}
|
||||
}
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly bool _allowRecovery;
|
||||
private readonly bool _allowLifeSteal;
|
||||
private readonly bool _allowHealing;
|
||||
private readonly bool _durative;
|
||||
private readonly double _duration;
|
||||
private readonly int _durationTurn;
|
||||
|
||||
public 禁止治疗(Skill skill, Character sourceCharacter, bool allowRecovery = false, bool allowLifeSteal = false, bool allowHealing = false, bool durative = false, double duration = 0, int durationTurn = 1) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_allowRecovery = allowRecovery;
|
||||
_allowLifeSteal = allowLifeSteal;
|
||||
_allowHealing = allowHealing;
|
||||
if (!_allowHealing)
|
||||
{
|
||||
_allowLifeSteal = false;
|
||||
_allowRecovery = false;
|
||||
}
|
||||
_durative = durative;
|
||||
_duration = duration;
|
||||
_durationTurn = durationTurn;
|
||||
}
|
||||
|
||||
public override BeforeApplyRecoveryResult BeforeApplyRecoveryAtTimeLapsing(TimeLapseContext ctx)
|
||||
{
|
||||
return new BeforeApplyRecoveryResult { CancelRecovery = !_allowRecovery };
|
||||
}
|
||||
|
||||
public override BeforeLifestealResult BeforeLifesteal(LifestealContext ctx)
|
||||
{
|
||||
return new BeforeLifestealResult { CancelLifesteal = !_allowLifeSteal };
|
||||
}
|
||||
|
||||
public override BeforeHealToTargetResult BeforeHealToTarget(HealContext ctx)
|
||||
{
|
||||
return new BeforeHealToTargetResult { CancelHeal = !_allowHealing };
|
||||
}
|
||||
|
||||
public override void OnEffectGained(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
if (_allowRecovery && _allowLifeSteal && _allowHealing)
|
||||
{
|
||||
character.Effects.Remove(this);
|
||||
return;
|
||||
}
|
||||
if (_durative && RemainDuration == 0)
|
||||
{
|
||||
RemainDuration = Duration;
|
||||
}
|
||||
else if (RemainDurationTurn == 0)
|
||||
{
|
||||
RemainDurationTurn = DurationTurn;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 累积之压标记 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.累积之压标记;
|
||||
public override string Name => "累积之压标记";
|
||||
public override string Description => $"此角色持有累积之压标记。来自:[ {Source} ]";
|
||||
public override EffectType EffectType => EffectType.Mark;
|
||||
public override bool IsDebuff => true;
|
||||
public override bool DurativeWithoutDuration => true;
|
||||
public override Character Source => _sourceCharacter;
|
||||
|
||||
private readonly Character _sourceCharacter;
|
||||
|
||||
public 累积之压标记(Skill skill, Character sourceCharacter) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 缴械 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.缴械;
|
||||
public override string Name => "缴械";
|
||||
public override string Description => $"此角色被缴械了,不能使用普通攻击。来自:[ {Source} ] 的 [ {Skill.Name} ]";
|
||||
public override EffectType EffectType => EffectType.Disarm;
|
||||
public override DispelledType DispelledType => DispelledType.Weak;
|
||||
public override bool IsDebuff => true;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override bool Durative => _durative;
|
||||
public override double Duration => _duration;
|
||||
public override int DurationTurn => _durationTurn;
|
||||
public override bool ExemptDuration => true;
|
||||
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly bool _durative;
|
||||
private readonly double _duration;
|
||||
private readonly int _durationTurn;
|
||||
|
||||
public 缴械(Skill skill, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_durative = durative;
|
||||
_duration = duration;
|
||||
_durationTurn = durationTurn;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
AddEffectStatesToCharacter(character, [CharacterState.AttackRestricted]);
|
||||
}
|
||||
|
||||
public override void OnEffectLost(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
RemoveEffectStatesFromCharacter(character);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using FunGame.Core.Model.EffectResult;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 虚弱 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.虚弱;
|
||||
public override string Name => "虚弱";
|
||||
public override string Description => $"此角色处于虚弱状态,伤害降低 {_damageReductionPercent * 100:0.##}%," +
|
||||
$"物理护甲降低 {_DEFReductionPercent * 100:0.##}%,魔法抗性降低 {_MDFReductionPercent * 100:0.##}%,治疗效果降低 {_healingReductionPercent * 100:0.##}%。来自:[ {Source} ] 的 [ {Skill.Name} ]";
|
||||
public override EffectType EffectType => EffectType.Weaken;
|
||||
public override DispelledType DispelledType => DispelledType.Weak;
|
||||
public override bool IsDebuff => true;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override bool Durative => _durative;
|
||||
public override double Duration => _duration;
|
||||
public override int DurationTurn => _durationTurn;
|
||||
public override bool ExemptDuration => true;
|
||||
|
||||
private readonly Character _targetCharacter;
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly bool _durative;
|
||||
private readonly double _duration;
|
||||
private readonly int _durationTurn;
|
||||
private readonly double _damageReductionPercent;
|
||||
private readonly double _DEFReductionPercent;
|
||||
private readonly double _MDFReductionPercent;
|
||||
private readonly double _healingReductionPercent;
|
||||
|
||||
public 虚弱(Skill skill, Character targetCharacter, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1,
|
||||
double damageReductionPercent = 0, double DEFReductionPercent = 0, double MDFReductionPercent = 0, double healingReductionPercent = 0) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_targetCharacter = targetCharacter;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_durative = durative;
|
||||
_duration = duration;
|
||||
_durationTurn = durationTurn;
|
||||
_damageReductionPercent = damageReductionPercent;
|
||||
_DEFReductionPercent = DEFReductionPercent;
|
||||
_MDFReductionPercent = MDFReductionPercent;
|
||||
_healingReductionPercent = healingReductionPercent;
|
||||
}
|
||||
|
||||
public override AlterActualDamageResult AlterActualDamageAfterCalculation(DamageContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return default;
|
||||
double damage = ctx.Damage;
|
||||
if (character == _targetCharacter)
|
||||
{
|
||||
return new AlterActualDamageResult { DamageDelta = -(damage * _damageReductionPercent) };
|
||||
|
||||
}
|
||||
return default;
|
||||
|
||||
}
|
||||
|
||||
public override AlterHealValueResult AlterHealValueBeforeHealToTarget(HealContext ctx)
|
||||
{
|
||||
if (ctx.Target is not Character target) return default;
|
||||
double heal = ctx.Heal;
|
||||
if (target == _targetCharacter)
|
||||
{
|
||||
return new AlterHealValueResult { HealDelta = -(heal * _healingReductionPercent) };
|
||||
}
|
||||
return default;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
character.ExDEFPercentage -= _DEFReductionPercent;
|
||||
character.MDF[character.MagicType] -= _MDFReductionPercent;
|
||||
AddEffectTypeToCharacter(character, [EffectType.Weaken, EffectType.GrievousWound]);
|
||||
}
|
||||
|
||||
public override void OnEffectLost(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
character.ExDEFPercentage += _DEFReductionPercent;
|
||||
character.MDF[character.MagicType] += _MDFReductionPercent;
|
||||
RemoveEffectTypesFromCharacter(character);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using FunGame.Core.Model.EffectResult;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 迟滞 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.迟滞;
|
||||
public override string Name { get; set; } = "迟滞";
|
||||
public override string Description => $"此角色处于迟滞状态,普通攻击和技能的硬直时间、当前行动等待时间延长 {_hardnessReductionPercent * 100:0.##}%。来自:[ {Source} ] 的 [ {Skill.Name} ]";
|
||||
public override EffectType EffectType => EffectType.Slow;
|
||||
public override DispelledType DispelledType => DispelledType.Weak;
|
||||
public override bool IsDebuff => true;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override bool Durative => _durative;
|
||||
public override double Duration => _duration;
|
||||
public override int DurationTurn => _durationTurn;
|
||||
public override bool ExemptDuration => true;
|
||||
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly bool _durative;
|
||||
private readonly double _duration;
|
||||
private readonly int _durationTurn;
|
||||
private readonly double _hardnessReductionPercent;
|
||||
|
||||
public 迟滞(Skill skill, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1, double healingReductionPercent = 0) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_durative = durative;
|
||||
_duration = duration;
|
||||
_durationTurn = durationTurn;
|
||||
_hardnessReductionPercent = healingReductionPercent;
|
||||
}
|
||||
|
||||
public override AlterHardnessTimeResult AlterHardnessTimeAfterCastSkill(HardnessContext ctx)
|
||||
{
|
||||
return new AlterHardnessTimeResult { Factor = _hardnessReductionPercent };
|
||||
}
|
||||
|
||||
public override AlterHardnessTimeResult AlterHardnessTimeAfterNormalAttack(HardnessContext ctx)
|
||||
{
|
||||
return new AlterHardnessTimeResult { Factor = _hardnessReductionPercent };
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
AddEffectTypeToCharacter(character, [EffectType.Slow]);
|
||||
}
|
||||
|
||||
public override void OnEffectLost(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
RemoveEffectTypesFromCharacter(character);
|
||||
}
|
||||
|
||||
public void ApplyChange(Character character)
|
||||
{
|
||||
GamingQueue?.ChangeCharacterHardnessTime(character, _hardnessReductionPercent, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using FunGame.Core.Model.EffectResult;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 长期监视 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.长期监视;
|
||||
public override string Name => "长期监视";
|
||||
public override string Description => $"此角色正在被长期监视。来自:[ {Source} ]";
|
||||
public override EffectType EffectType => EffectType.Mark;
|
||||
public override bool IsDebuff => true;
|
||||
public override bool DurativeWithoutDuration => true;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override DispelledType DispelledType => DispelledType.CannotBeDispelled;
|
||||
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly Character _targetCharacter;
|
||||
|
||||
public 长期监视(Skill skill, Character sourceCharacter, Character targetCharacter) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_targetCharacter = targetCharacter;
|
||||
}
|
||||
|
||||
public CharacterActionType LastType { get; set; } = CharacterActionType.None;
|
||||
public Skill? LastSkill { get; set; } = null;
|
||||
|
||||
public override void OnCharacterActionStart(ActionContext ctx)
|
||||
{
|
||||
CharacterActionType type = ctx.ActionType;
|
||||
if (type == CharacterActionType.NormalAttack)
|
||||
{
|
||||
LastType = type;
|
||||
}
|
||||
}
|
||||
|
||||
public override BeforeSkillCastedOnStatusResult BeforeSkillCastedOnStatus(SkillCastContext ctx)
|
||||
{
|
||||
LastType = CharacterActionType.CastSkill;
|
||||
LastSkill = ctx.Skill;
|
||||
return default;
|
||||
}
|
||||
|
||||
public override void AfterDeathCalculation(DeathContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character death) return;
|
||||
bool hasMaster = ctx.HasMaster;
|
||||
Character? killer = ctx.Killer;
|
||||
if (GamingQueue != null && !hasMaster && killer != null && killer == _targetCharacter && Source != null && death != Source && GamingQueue.Queue.Contains(Source))
|
||||
{
|
||||
WriteLine($"[ {Source} ] 正在观察 [ {killer} ] 的情绪。");
|
||||
if (LastType == CharacterActionType.NormalAttack)
|
||||
{
|
||||
Source.NormalAttack.SetMagicType(new(Skill.Effects.First(), true, MagicType, 999), GamingQueue);
|
||||
Effect e = new IgnoreEvade(Skill, new()
|
||||
{
|
||||
{ "p", 1 }
|
||||
}, Source)
|
||||
{
|
||||
Name = Name,
|
||||
Durative = false,
|
||||
DurationTurn = 3,
|
||||
RemainDurationTurn = 3
|
||||
};
|
||||
e.OnEffectGained(new HookContext(GamingQueue, Source));
|
||||
Source.Effects.Add(e);
|
||||
WriteLine($"[ {Source} ] 获得了无视闪避效果,持续 3 回合!");
|
||||
}
|
||||
else if (LastType == CharacterActionType.CastSkill && LastSkill != null)
|
||||
{
|
||||
复制技能 e = new(Skill, Source, LastSkill)
|
||||
{
|
||||
Durative = false,
|
||||
DurationTurn = 3,
|
||||
RemainDurationTurn = 3
|
||||
};
|
||||
e.CopiedSkill.Values[nameof(时雨标记)] = 1;
|
||||
e.CopiedSkill.CurrentCD = 0;
|
||||
e.CopiedSkill.FreeCostEP = true;
|
||||
e.CopiedSkill.FreeCostMP = true;
|
||||
e.CopiedSkill.Enable = true;
|
||||
e.CopiedSkill.IsInEffect = false;
|
||||
e.OnEffectGained(new HookContext(GamingQueue, Source));
|
||||
Source.Effects.Add(e);
|
||||
WriteLine($"[ {Source} ] 复制了 [ {killer} ] 的技能:{LastSkill.Name}!!");
|
||||
}
|
||||
if (killer.Effects.FirstOrDefault(e => e is 时雨标记 && e.Source == Source) is 时雨标记 e2)
|
||||
{
|
||||
e2.RemainDurationTurn = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
e2 = new 时雨标记(Skill, Source)
|
||||
{
|
||||
Durative = false,
|
||||
DurationTurn = 3,
|
||||
RemainDurationTurn = 3
|
||||
};
|
||||
e2.OnEffectGained(new HookContext(GamingQueue, killer));
|
||||
killer.Effects.Add(e2);
|
||||
WriteLine($"[ {Source} ] 给予了 [ {killer} ] 时雨标记!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using FunGame.Core.Model.EffectResult;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 魔法免疫 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.魔法免疫;
|
||||
public override string Name => "魔法免疫";
|
||||
public override string Description => $"此角色处于魔法免疫状态,无法选中其作为魔法技能的目标(自释放魔法技能除外),并且免疫魔法伤害。来自:[ {Source} ] 的 [ {Skill.Name} ]";
|
||||
public override EffectType EffectType => EffectType.MagicalImmune;
|
||||
public override DispelledType DispelledType => DispelledType.Weak;
|
||||
public override bool IsDebuff => false;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override bool Durative => _durative;
|
||||
public override double Duration => _duration;
|
||||
public override int DurationTurn => _durationTurn;
|
||||
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly bool _durative;
|
||||
private readonly double _duration;
|
||||
private readonly int _durationTurn;
|
||||
|
||||
public 魔法免疫(Skill skill, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_durative = durative;
|
||||
_duration = duration;
|
||||
_durationTurn = durationTurn;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
AddImmuneTypesToCharacter(character, [ImmuneType.Magical]);
|
||||
}
|
||||
|
||||
public override void OnEffectLost(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
RemoveImmuneTypesFromCharacter(character);
|
||||
}
|
||||
|
||||
public override OnImmuneCheckResult OnImmuneCheck(ImmuneContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return default;
|
||||
Character? target = ctx.Target;
|
||||
if (character == target)
|
||||
{
|
||||
return new OnImmuneCheckResult { IgnoreImmunity = true };
|
||||
}
|
||||
return default;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
using FunGame.Core.Entity;
|
||||
using FunGame.Core.Library.Constant;
|
||||
using FunGame.Core.Model.EffectContext;
|
||||
using FunGame.Core.Model.EffectResult;
|
||||
using OshimaBot.Content.Effects.OpenEffects;
|
||||
|
||||
namespace OshimaBot.Content.Effects.PassiveEffects
|
||||
{
|
||||
public class 魔法护盾 : Effect
|
||||
{
|
||||
public override long Id => (long)PassiveEffectID.魔法护盾;
|
||||
public override string Name => "魔法护盾";
|
||||
public override string Description => $"此角色拥有魔法护盾{CurrentShield}。来自:[ {Source} ] 的 [ {Skill.Name} ]";
|
||||
public override EffectType EffectType => EffectType.Shield;
|
||||
public override DispelledType DispelledType => DispelledType.CannotBeDispelled;
|
||||
public override bool DurativeWithoutDuration => true;
|
||||
public override bool IsDebuff => false;
|
||||
public override Character Source => _sourceCharacter;
|
||||
public override bool Durative => _durative;
|
||||
public override double Duration => _duration;
|
||||
public override int DurationTurn => _durationTurn;
|
||||
|
||||
private string CurrentShield
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_targetCharacter != null && _targetCharacter.Shield.ShieldOfEffects.TryGetValue(this, out ShieldOfEffect? value) && value != null)
|
||||
{
|
||||
return $",护盾值:{value.Shield:0.##} 点";
|
||||
}
|
||||
else return "";
|
||||
}
|
||||
}
|
||||
private readonly Character _targetCharacter;
|
||||
private readonly Character _sourceCharacter;
|
||||
private readonly double _shield;
|
||||
private readonly bool _durative;
|
||||
private readonly double _duration;
|
||||
private readonly int _durationTurn;
|
||||
|
||||
public 魔法护盾(Skill skill, Character targetCharacter, Character sourceCharacter, double shield, bool durative = false, double duration = 0, int durationTurn = 0) : base(skill)
|
||||
{
|
||||
GamingQueue = skill.GamingQueue;
|
||||
_targetCharacter = targetCharacter;
|
||||
_sourceCharacter = sourceCharacter;
|
||||
_durative = durative;
|
||||
_duration = duration;
|
||||
_durationTurn = durationTurn;
|
||||
_shield = shield;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
character.Shield.AddShieldOfEffect(new(this, _shield, ShieldType.Magical, MagicType.None));
|
||||
}
|
||||
|
||||
public override void OnEffectLost(HookContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return;
|
||||
character.Shield.RemoveShieldOfEffect(this);
|
||||
}
|
||||
|
||||
public override OnShieldBrokenResult OnShieldBroken(ShieldContext ctx)
|
||||
{
|
||||
if (ctx.Trigger is not Character character) return default;
|
||||
Effect? effet = ctx.ShieldEffect;
|
||||
if (effet == this)
|
||||
{
|
||||
character.Shield.RemoveShieldOfEffect(this);
|
||||
character.Effects.Remove(this);
|
||||
}
|
||||
return default;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user