feat: Simplifies honorable execution (#2089)
This commit is contained in:
parent
c0eb6c81fe
commit
6d879e1d22
1 changed files with 25 additions and 76 deletions
|
|
@ -42,7 +42,7 @@ public class HonorableExecution : SamuraiMove
|
||||||
|
|
||||||
var swingBonus = Math.Max(1, (int)(bushido / 720.0));
|
var swingBonus = Math.Max(1, (int)(bushido / 720.0));
|
||||||
|
|
||||||
timer = new HonorableExecutionTimer(attacker, swingBonus);
|
timer = new HonorableExecutionTimer(TimeSpan.FromSeconds(20.0), attacker, swingBonus: swingBonus);
|
||||||
|
|
||||||
(attacker as PlayerMobile)?.AddBuff(
|
(attacker as PlayerMobile)?.AddBuff(
|
||||||
new BuffInfo(
|
new BuffInfo(
|
||||||
|
|
@ -56,23 +56,20 @@ public class HonorableExecution : SamuraiMove
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var mods = new List<object>
|
attacker.AddResistanceMod(new ResistanceMod(ResistanceType.Physical, "PhysicalResistHonorableExecution", -40));
|
||||||
{
|
attacker.AddResistanceMod(new ResistanceMod(ResistanceType.Fire, "FireResistHonorableExecution", -40));
|
||||||
new ResistanceMod(ResistanceType.Physical, "PhysicalResistHonorableExecution", -40),
|
attacker.AddResistanceMod(new ResistanceMod(ResistanceType.Cold, "ColdResistHonorableExecution", -40));
|
||||||
new ResistanceMod(ResistanceType.Fire, "FireResistHonorableExecution", -40),
|
attacker.AddResistanceMod(new ResistanceMod(ResistanceType.Poison, "PoisonResistHonorableExecution", -40));
|
||||||
new ResistanceMod(ResistanceType.Cold, "ColdResistHonorableExecution", -40),
|
attacker.AddResistanceMod(new ResistanceMod(ResistanceType.Energy, "EnergyResistHonorableExecution", -40));
|
||||||
new ResistanceMod(ResistanceType.Poison, "PoisonResistHonorableExecution", -40),
|
|
||||||
new ResistanceMod(ResistanceType.Energy, "EnergyResistHonorableExecution", -40)
|
|
||||||
};
|
|
||||||
|
|
||||||
var resSpells = attacker.Skills.MagicResist.Value;
|
var resSpells = attacker.Skills.MagicResist.Value;
|
||||||
|
|
||||||
if (resSpells > 0.0)
|
if (resSpells > 0.0)
|
||||||
{
|
{
|
||||||
mods.Add(new DefaultSkillMod(SkillName.MagicResist, "MagicResistHonorableExecution", true, -resSpells));
|
attacker.AddSkillMod(new DefaultSkillMod(SkillName.MagicResist, "MagicResistHonorableExecution", true, -resSpells));
|
||||||
}
|
}
|
||||||
|
|
||||||
timer = new HonorableExecutionTimer(attacker, mods);
|
timer = new HonorableExecutionTimer(TimeSpan.FromSeconds(7.0), attacker, penalty: true);
|
||||||
|
|
||||||
if (Core.HS)
|
if (Core.HS)
|
||||||
{
|
{
|
||||||
|
|
@ -101,9 +98,9 @@ public class HonorableExecution : SamuraiMove
|
||||||
CheckGain(attacker);
|
CheckGain(attacker);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetSwingBonus(Mobile target) => _table.TryGetValue(target, out var info) ? info.m_SwingBonus : 0;
|
public static int GetSwingBonus(Mobile target) => _table.TryGetValue(target, out var info) ? info._swingBonus : 0;
|
||||||
|
|
||||||
public static bool IsUnderPenalty(Mobile target) => _table.TryGetValue(target, out var info) && info.m_Penalty;
|
public static bool IsUnderPenalty(Mobile target) => _table.TryGetValue(target, out var info) && info._penalty;
|
||||||
|
|
||||||
public static void RemovePenalty(Mobile target)
|
public static void RemovePenalty(Mobile target)
|
||||||
{
|
{
|
||||||
|
|
@ -115,81 +112,33 @@ public class HonorableExecution : SamuraiMove
|
||||||
|
|
||||||
private class HonorableExecutionTimer : Timer
|
private class HonorableExecutionTimer : Timer
|
||||||
{
|
{
|
||||||
public readonly Mobile m_Mobile;
|
public readonly Mobile _from;
|
||||||
public readonly List<object> m_Mods;
|
public readonly bool _penalty;
|
||||||
public readonly bool m_Penalty;
|
public readonly int _swingBonus;
|
||||||
public readonly int m_SwingBonus;
|
|
||||||
|
|
||||||
public HonorableExecutionTimer(Mobile from, List<object> mods) : this(TimeSpan.FromSeconds(7.0), from, 0, mods, mods != null)
|
public HonorableExecutionTimer(TimeSpan duration, Mobile from, int swingBonus = 0, bool penalty = false) : base(duration)
|
||||||
{
|
{
|
||||||
}
|
_from = from;
|
||||||
|
_swingBonus = swingBonus;
|
||||||
public HonorableExecutionTimer(Mobile from, int swingBonus) : this(TimeSpan.FromSeconds(20.0), from, swingBonus)
|
_penalty = penalty;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public HonorableExecutionTimer(
|
|
||||||
TimeSpan duration, Mobile from, int swingBonus, List<object> mods = null, bool penalty = false
|
|
||||||
) : base(duration)
|
|
||||||
{
|
|
||||||
m_Mobile = from;
|
|
||||||
m_SwingBonus = swingBonus;
|
|
||||||
m_Mods = mods;
|
|
||||||
m_Penalty = penalty;
|
|
||||||
|
|
||||||
Apply();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnTick()
|
protected override void OnTick()
|
||||||
{
|
{
|
||||||
m_Mobile?.Delta(MobileDelta.WeaponDamage);
|
_from?.Delta(MobileDelta.WeaponDamage);
|
||||||
RemovePenalty(m_Mobile);
|
RemovePenalty(_from);
|
||||||
}
|
|
||||||
|
|
||||||
public void Apply()
|
|
||||||
{
|
|
||||||
if (m_Mods == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < m_Mods.Count; ++i)
|
|
||||||
{
|
|
||||||
var mod = m_Mods[i];
|
|
||||||
|
|
||||||
if (mod is ResistanceMod resistanceMod)
|
|
||||||
{
|
|
||||||
m_Mobile.AddResistanceMod(resistanceMod);
|
|
||||||
}
|
|
||||||
else if (mod is SkillMod skillMod)
|
|
||||||
{
|
|
||||||
m_Mobile.AddSkillMod(skillMod);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
Stop();
|
Stop();
|
||||||
|
|
||||||
if (m_Mods == null)
|
_from.RemoveResistanceMod("PhysicalResistHonorableExecution");
|
||||||
{
|
_from.RemoveResistanceMod("FireResistHonorableExecution");
|
||||||
return;
|
_from.RemoveResistanceMod("ColdResistHonorableExecution");
|
||||||
}
|
_from.RemoveResistanceMod("PoisonResistHonorableExecution");
|
||||||
|
_from.RemoveResistanceMod("EnergyResistHonorableExecution");
|
||||||
for (var i = 0; i < m_Mods.Count; ++i)
|
_from.RemoveSkillMod("MagicResistHonorableExecution");
|
||||||
{
|
|
||||||
var mod = m_Mods[i];
|
|
||||||
|
|
||||||
if (mod is ResistanceMod resistanceMod)
|
|
||||||
{
|
|
||||||
m_Mobile?.RemoveResistanceMod(resistanceMod);
|
|
||||||
}
|
|
||||||
else if (mod is SkillMod skillMod)
|
|
||||||
{
|
|
||||||
m_Mobile?.RemoveSkillMod(skillMod);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue