削弱技能

This commit is contained in:
milimoe 2025-07-08 23:51:56 +08:00
parent 04f28099c6
commit 6476578a1b
Signed by: milimoe
GPG Key ID: 9554D37E4B8991D0
9 changed files with 129 additions and 101 deletions

View File

@ -9,7 +9,14 @@ namespace Oshima.FunGame.OshimaModules.Effects.SkillEffects
{ {
public override long Id => Skill.Id; public override long Id => Skill.Id;
public override string Name => Skill.Name; public override string Name => Skill.Name;
public override string Description => $"{ActualProbability * 100:0.##}% 概率对{Skill.TargetDescription()}造成{GetEffectTypeName(_effectType)} {持续时间}。{(_description != "" ? _description : "")}"; public override string Description
{
get
{
SetDescription();
return $"{ActualProbability * 100:0.##}% 概率对{Skill.TargetDescription()}造成{GetEffectTypeName(_effectType)} {持续时间}。{(_description != "" ? _description : "")}";
}
}
public override EffectType EffectType => _effectType; public override EffectType EffectType => _effectType;
public override DispelledType DispelledType => _dispelledType; public override DispelledType DispelledType => _dispelledType;
@ -17,7 +24,6 @@ namespace Oshima.FunGame.OshimaModules.Effects.SkillEffects
private string => _durative && _duration > 0 ? $"{实际持续时间:0.##}" + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); private string => _durative && _duration > 0 ? $"{实际持续时间: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 double => _durative && _duration > 0 ? _duration + _levelGrowth * (Level - 1) : (!_durative && _durationTurn > 0 ? _durationTurn + _levelGrowth * (Level - 1) : 0);
private readonly EffectType _effectType; private readonly EffectType _effectType;
private readonly DispelledType _dispelledType = DispelledType.Weak;
private readonly bool _durative; private readonly bool _durative;
private readonly double _duration; private readonly double _duration;
private readonly int _durationTurn; private readonly int _durationTurn;
@ -25,7 +31,8 @@ namespace Oshima.FunGame.OshimaModules.Effects.SkillEffects
private readonly double _probability; private readonly double _probability;
private readonly double _probabilityLevelGrowth; private readonly double _probabilityLevelGrowth;
private readonly object[] _args; private readonly object[] _args;
private readonly string _description = ""; private DispelledType _dispelledType = DispelledType.Weak;
private string _description = "";
public (Skill skill, EffectType effectType, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0, double probability = 0, double probabilityLevelGrowth = 0, params object[] args) : base(skill) public (Skill skill, EffectType effectType, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0, double probability = 0, double probabilityLevelGrowth = 0, params object[] args) : base(skill)
{ {
@ -38,83 +45,7 @@ namespace Oshima.FunGame.OshimaModules.Effects.SkillEffects
_probability = probability; _probability = probability;
_probabilityLevelGrowth = probabilityLevelGrowth; _probabilityLevelGrowth = probabilityLevelGrowth;
_args = args; _args = args;
switch (_effectType) SetDescription();
{
case EffectType.Silence:
_dispelledType = DispelledType.Weak;
_description = "封技:不能使用技能(魔法、战技和爆发技),并解除当前施法。";
break;
case EffectType.Confusion:
_dispelledType = DispelledType.Strong;
_description = "混乱:进入行动受限状态,失控并随机行动,且在进行攻击指令时,可能会选取友方角色为目标。";
break;
case EffectType.Taunt:
_dispelledType = DispelledType.Strong;
_description = "愤怒:进入行动受限状态,失控并随机行动,行动回合内仅能对嘲讽者发起普通攻击。";
break;
case EffectType.Delay:
_dispelledType = DispelledType.Weak;
_description = "迟滞:延长普通攻击和技能的硬直时间、当前行动等待时间。";
break;
case EffectType.Stun:
_dispelledType = DispelledType.Strong;
_description = "眩晕:进入完全行动不能状态。";
break;
case EffectType.Freeze:
_dispelledType = DispelledType.Strong;
_description = "冻结:进入完全行动不能状态。";
break;
case EffectType.Petrify:
_dispelledType = DispelledType.Strong;
_description = "石化:进入完全行动不能状态。";
break;
case EffectType.Vulnerable:
DamageType damageType = DamageType.Magical;
if (_args.Length > 0 && _args[0] is DamageType dt)
{
damageType = dt;
}
double exDamagePercent = 0;
if (_args.Length > 1 && _args[1] is double percent)
{
exDamagePercent = percent;
}
if (exDamagePercent > 0)
{
_dispelledType = DispelledType.Weak;
_description = $"易伤:额外受到 {exDamagePercent * 100:0.##}% {CharacterSet.GetDamageTypeName(damageType)}。";
}
break;
case EffectType.Bleed:
_dispelledType = DispelledType.Strong;
bool isPercentage = false;
double durationDamage = 0;
double durationDamagePercent = 0;
if (_args.Length > 0 && _args[0] is bool isPerc)
{
isPercentage = isPerc;
}
if (_args.Length > 1 && _args[1] is double durDamage)
{
durationDamage = durDamage;
}
if (_args.Length > 2 && _args[2] is double durDamagePercent)
{
durationDamagePercent = durDamagePercent;
}
if (isPercentage && durationDamagePercent > 0 || !isPercentage && durationDamage > 0)
{
string damageString = isPercentage ? $"流失 {durationDamagePercent * 100:0.##}% 当前生命值" : $"流失 {durationDamage:0.##} 点生命值";
_description = $"气绝:进入行动受限状态并每{GameplayEquilibriumConstant.InGameTime}{damageString},此效果不会导致角色死亡。";
}
break;
case EffectType.Cripple:
_dispelledType = DispelledType.Strong;
_description = "战斗不能:无法普通攻击和使用技能(魔法、战技和爆发技)。";
break;
default:
break;
}
} }
public override void OnSkillCasted(Character caster, List<Character> targets, Dictionary<string, object> others) public override void OnSkillCasted(Character caster, List<Character> targets, Dictionary<string, object> others)
@ -176,6 +107,7 @@ namespace Oshima.FunGame.OshimaModules.Effects.SkillEffects
bool isPercentage = false; bool isPercentage = false;
double durationDamage = 0; double durationDamage = 0;
double durationDamagePercent = 0; double durationDamagePercent = 0;
double durationDamageLevelGrowth = 0;
if (_args.Length > 0 && _args[0] is bool isPerc) if (_args.Length > 0 && _args[0] is bool isPerc)
{ {
isPercentage = isPerc; isPercentage = isPerc;
@ -188,8 +120,14 @@ namespace Oshima.FunGame.OshimaModules.Effects.SkillEffects
{ {
durationDamagePercent = durDamagePercent; durationDamagePercent = durDamagePercent;
} }
if (_args.Length > 3 && _args[3] is double durDamageLevelGrowth)
{
durationDamageLevelGrowth = durDamageLevelGrowth;
}
if (isPercentage && durationDamagePercent > 0 || !isPercentage && durationDamage > 0) if (isPercentage && durationDamagePercent > 0 || !isPercentage && durationDamage > 0)
{ {
if (Level > 0) durationDamage += durationDamageLevelGrowth * (Level - 1);
if (Level > 0) durationDamagePercent += durationDamageLevelGrowth * (Level - 1);
string damageString = isPercentage ? $"流失 {durationDamagePercent * 100:0.##}% 当前生命值" : $"流失 {durationDamage:0.##} 点生命值"; string damageString = isPercentage ? $"流失 {durationDamagePercent * 100:0.##}% 当前生命值" : $"流失 {durationDamage:0.##} 点生命值";
WriteLine($"[ {caster} ] 对 [ {target} ] 造成了气绝! [ {target} ] 进入行动受限状态且每{GameplayEquilibriumConstant.InGameTime}{damageString}!持续时间:{持续时间}"); WriteLine($"[ {caster} ] 对 [ {target} ] 造成了气绝! [ {target} ] 进入行动受限状态且每{GameplayEquilibriumConstant.InGameTime}{damageString}!持续时间:{持续时间}");
e = new (Skill, target, caster, _durative, duration, durationTurn, isPercentage, durationDamage, durationDamagePercent); e = new (Skill, target, caster, _durative, duration, durationTurn, isPercentage, durationDamage, durationDamagePercent);
@ -211,6 +149,94 @@ namespace Oshima.FunGame.OshimaModules.Effects.SkillEffects
} }
} }
private void SetDescription()
{
switch (_effectType)
{
case EffectType.Silence:
_dispelledType = DispelledType.Weak;
_description = "封技:不能使用技能(魔法、战技和爆发技),并解除当前施法。";
break;
case EffectType.Confusion:
_dispelledType = DispelledType.Strong;
_description = "混乱:进入行动受限状态,失控并随机行动,且在进行攻击指令时,可能会选取友方角色为目标。";
break;
case EffectType.Taunt:
_dispelledType = DispelledType.Strong;
_description = "愤怒:进入行动受限状态,失控并随机行动,行动回合内仅能对嘲讽者发起普通攻击。";
break;
case EffectType.Delay:
_dispelledType = DispelledType.Weak;
_description = "迟滞:延长普通攻击和技能的硬直时间、当前行动等待时间。";
break;
case EffectType.Stun:
_dispelledType = DispelledType.Strong;
_description = "眩晕:进入完全行动不能状态。";
break;
case EffectType.Freeze:
_dispelledType = DispelledType.Strong;
_description = "冻结:进入完全行动不能状态。";
break;
case EffectType.Petrify:
_dispelledType = DispelledType.Strong;
_description = "石化:进入完全行动不能状态。";
break;
case EffectType.Vulnerable:
DamageType damageType = DamageType.Magical;
if (_args.Length > 0 && _args[0] is DamageType dt)
{
damageType = dt;
}
double exDamagePercent = 0;
if (_args.Length > 1 && _args[1] is double percent)
{
exDamagePercent = percent;
}
if (exDamagePercent > 0)
{
_dispelledType = DispelledType.Weak;
_description = $"易伤:额外受到 {exDamagePercent * 100:0.##}% {CharacterSet.GetDamageTypeName(damageType)}。";
}
break;
case EffectType.Bleed:
_dispelledType = DispelledType.Strong;
bool isPercentage = false;
double durationDamage = 0;
double durationDamagePercent = 0;
double durationDamageLevelGrowth = 0;
if (_args.Length > 0 && _args[0] is bool isPerc)
{
isPercentage = isPerc;
}
if (_args.Length > 1 && _args[1] is double durDamage)
{
durationDamage = durDamage;
}
if (_args.Length > 2 && _args[2] is double durDamagePercent)
{
durationDamagePercent = durDamagePercent;
}
if (_args.Length > 3 && _args[3] is double durDamageLevelGrowth)
{
durationDamageLevelGrowth = durDamageLevelGrowth;
}
if (isPercentage && durationDamagePercent > 0 || !isPercentage && durationDamage > 0)
{
if (Level > 0) durationDamage += durationDamageLevelGrowth * (Level - 1);
if (Level > 0) durationDamagePercent += durationDamageLevelGrowth * (Level - 1);
string damageString = isPercentage ? $"流失 {durationDamagePercent * 100:0.##}% 当前生命值" : $"流失 {durationDamage:0.##} 点生命值";
_description = $"气绝:进入行动受限状态并每{GameplayEquilibriumConstant.InGameTime}{damageString},此效果不会导致角色死亡。";
}
break;
case EffectType.Cripple:
_dispelledType = DispelledType.Strong;
_description = "战斗不能:无法普通攻击和使用技能(魔法、战技和爆发技)。";
break;
default:
break;
}
}
private static string GetEffectTypeName(EffectType type) private static string GetEffectTypeName(EffectType type)
{ {
return type switch return type switch

View File

@ -32,8 +32,8 @@ namespace Oshima.FunGame.OshimaModules.Skills
public (Character? character = null) : base(SkillType.Magic, character) public (Character? character = null) : base(SkillType.Magic, character)
{ {
Effects.Add(new (this, 55, 25, DamageType.Magical)); Effects.Add(new (this, 75, 15, DamageType.Magical));
Effects.Add(new (this, EffectType.Bleed, true, 3, 0, 0.5, 0.24, 0.08, false, 85.0)); Effects.Add(new (this, EffectType.Bleed, true, 3, 0, 0.5, 0.45, 0.05, false, 85.0));
} }
} }
} }

View File

@ -19,7 +19,7 @@ namespace Oshima.FunGame.OshimaModules.Skills
public (Character? character = null) : base(SkillType.Magic, character) public (Character? character = null) : base(SkillType.Magic, character)
{ {
Effects.Add(new (this, 45, 20, DamageType.Magical)); Effects.Add(new (this, 45, 20, DamageType.Magical));
Effects.Add(new (this, EffectType.Silence, true, 8, 0, 1.2, 0.24, 0.08)); Effects.Add(new (this, EffectType.Silence, true, 8, 0, 1.2, 0.45, 0.05));
} }
} }
} }

View File

@ -40,10 +40,12 @@ namespace Oshima.FunGame.OshimaModules.Skills
{ {
return Level switch return Level switch
{ {
3 => 2,
4 => 2,
5 => 2, 5 => 2,
6 => 2, 6 => 3,
7 => 2, 7 => 3,
8 => 2, 8 => 3,
_ => 1 _ => 1
}; };
} }

View File

@ -22,9 +22,9 @@ namespace Oshima.FunGame.OshimaModules.Skills
{ {
4 => 2, 4 => 2,
5 => 2, 5 => 2,
6 => 3, 6 => 2,
7 => 3, 7 => 3,
8 => 4, 8 => 3,
_ => 1 _ => 1
}; };
} }
@ -32,8 +32,8 @@ namespace Oshima.FunGame.OshimaModules.Skills
public (Character? character = null) : base(SkillType.Magic, character) public (Character? character = null) : base(SkillType.Magic, character)
{ {
Effects.Add(new (this, 55, 25, DamageType.Magical)); Effects.Add(new (this, 70, 30, DamageType.Magical));
Effects.Add(new (this, EffectType.Cripple, true, 3, 0, 1, 0.24, 0.08)); Effects.Add(new (this, EffectType.Cripple, true, 3, 0, 1, 0.45, 0.05));
} }
} }
} }

View File

@ -33,7 +33,7 @@ namespace Oshima.FunGame.OshimaModules.Skills
public (Character? character = null) : base(SkillType.Magic, character) public (Character? character = null) : base(SkillType.Magic, character)
{ {
Effects.Add(new (this, 60, 20, DamageType.Magical)); Effects.Add(new (this, 60, 20, DamageType.Magical));
Effects.Add(new (this, EffectType.Silence, false, 0, 2, 0, 0.24, 0.08)); Effects.Add(new (this, EffectType.Silence, false, 0, 2, 0, 0.45, 0.05));
} }
} }
} }

View File

@ -22,9 +22,9 @@ namespace Oshima.FunGame.OshimaModules.Skills
{ {
4 => 2, 4 => 2,
5 => 2, 5 => 2,
6 => 3, 6 => 2,
7 => 3, 7 => 3,
8 => 4, 8 => 3,
_ => 1 _ => 1
}; };
} }
@ -32,9 +32,9 @@ namespace Oshima.FunGame.OshimaModules.Skills
public (Character? character = null) : base(SkillType.Magic, character) public (Character? character = null) : base(SkillType.Magic, character)
{ {
Effects.Add(new (this, 65, 25, DamageType.Magical)); Effects.Add(new (this, 60, 30, DamageType.Magical));
Effects.Add(new (this, EffectType.Freeze, false, 0, 2, 0, 0.24, 0.08)); Effects.Add(new (this, EffectType.Freeze, false, 0, 2, 0, 0.45, 0.05));
Effects.Add(new (this, EffectType.Vulnerable, false, 0, 3, 0, 0.24, 0.08, DamageType.Magical, 0.3)); Effects.Add(new (this, EffectType.Vulnerable, false, 0, 3, 0, 0.45, 0.05, DamageType.Magical, 0.3));
} }
} }
} }

View File

@ -32,7 +32,7 @@ namespace Oshima.FunGame.OshimaModules.Skills
public (Character? character = null) : base(SkillType.Magic, character) public (Character? character = null) : base(SkillType.Magic, character)
{ {
Effects.Add(new (this, false, 0, 2, 0, 0.24, 0.08)); Effects.Add(new (this, false, 0, 2, 0, 0.45, 0.05));
} }
} }

View File

@ -22,9 +22,9 @@ namespace Oshima.FunGame.OshimaModules.Skills
{ {
4 => 2, 4 => 2,
5 => 2, 5 => 2,
6 => 3, 6 => 2,
7 => 3, 7 => 3,
8 => 4, 8 => 3,
_ => 1 _ => 1
}; };
} }
@ -32,8 +32,8 @@ namespace Oshima.FunGame.OshimaModules.Skills
public (Character? character = null) : base(SkillType.Magic, character) public (Character? character = null) : base(SkillType.Magic, character)
{ {
Effects.Add(new (this, 60, 40, DamageType.Magical)); Effects.Add(new (this, 65, 35, DamageType.Magical));
Effects.Add(new (this, EffectType.Stun, true, 6, 0, 0.7, 0.24, 0.08)); Effects.Add(new (this, EffectType.Stun, true, 6, 0, 0.7, 0.45, 0.05));
} }
} }
} }