2025-07-04 01:40:49 +08:00

90 lines
4.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
using Oshima.FunGame.OshimaModules.Effects.PassiveEffects;
using Oshima.FunGame.OshimaModules.Skills;
namespace Oshima.FunGame.OshimaModules.Effects.SkillEffects
{
public class : Effect
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"对{Skill.TargetDescription()}施加{CharacterSet.GetImmuneTypeName(ImmuneType)},持续 {持续时间}。";
public override DispelledType DispelledType => _dispelledType;
private ImmuneType ImmuneType { get; set; } = ImmuneType.None;
private string => _durative && _duration > 0 ? + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}");
private double => _durative && _duration > 0 ? _duration + _levelGrowth * (Level - 1) : (!_durative && _durationTurn > 0 ? _durationTurn + _levelGrowth * (Level - 1) : 0);
private DispelledType _dispelledType = DispelledType.Weak;
private readonly bool _durative;
private readonly double _duration;
private readonly int _durationTurn;
private readonly double _levelGrowth;
public (Skill skill, ImmuneType type, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0) : base(skill)
{
GamingQueue = skill.GamingQueue;
ImmuneType = type;
_durative = durative;
_duration = duration;
_durationTurn = durationTurn;
_levelGrowth = levelGrowth;
_dispelledType = type switch
{
ImmuneType.All => DispelledType.Strong,
ImmuneType.Special => DispelledType.Special,
_ => DispelledType.Weak
};
}
public override void OnSkillCasted(Character caster, List<Character> targets, Dictionary<string, object> others)
{
foreach (Character target in targets)
{
if (target.HP <= 0) continue;
WriteLine($"[ {caster} ] 获得了{CharacterSet.GetImmuneTypeName(ImmuneType)}!持续 {持续时间}");
switch (ImmuneType)
{
case ImmuneType.Physical:
{
EffectType = EffectType.PhysicalImmune;
e = new(Skill, caster, _durative, _duration + _levelGrowth * (Level - 1), Convert.ToInt32(_durationTurn + _levelGrowth * (Level - 1)));
_dispelledType = DispelledType.Weak;
target.Effects.Add(e);
e.OnEffectGained(target);
break;
}
case ImmuneType.Magical:
{
EffectType = EffectType.MagicalImmune;
e = new(Skill, caster, _durative, _duration + _levelGrowth * (Level - 1), Convert.ToInt32(_durationTurn + _levelGrowth * (Level - 1)));
_dispelledType = DispelledType.Weak;
target.Effects.Add(e);
e.OnEffectGained(target);
break;
}
case ImmuneType.Skilled:
{
EffectType = EffectType.SkilledImmune;
e = new(Skill, caster, _durative, _duration + _levelGrowth * (Level - 1), Convert.ToInt32(_durationTurn + _levelGrowth * (Level - 1)));
_dispelledType = DispelledType.Weak;
target.Effects.Add(e);
e.OnEffectGained(target);
break;
}
case ImmuneType.All:
{
EffectType = EffectType.AllImmune;
e = new(Skill, caster, _durative, _duration + _levelGrowth * (Level - 1), Convert.ToInt32(_durationTurn + _levelGrowth * (Level - 1)));
_dispelledType = DispelledType.Strong;
target.Effects.Add(e);
e.OnEffectGained(target);
break;
}
}
GamingQueue?.LastRound.ApplyEffects.TryAdd(target, [EffectType]);
}
}
}
}