mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-04-22 03:59:35 +08:00
添加 AlterEnemyListBeforeAction
This commit is contained in:
parent
dc008b1d95
commit
64ce1f8c92
@ -170,8 +170,8 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
|||||||
|
|
||||||
if (isCheckProtected)
|
if (isCheckProtected)
|
||||||
{
|
{
|
||||||
// 查找保护条件 5人局为3次,9人局为4次
|
// 查找保护条件 被插队超过此次数便能获得插队补偿 即行动保护
|
||||||
int countProtected = _queue.Count >= 9 ? 4 : ((_queue.Count >= 5) ? 3 : 2);
|
int countProtected = _queue.Count;
|
||||||
|
|
||||||
// 查找队列中是否有满足插队补偿条件的角色(最后一个)
|
// 查找队列中是否有满足插队补偿条件的角色(最后一个)
|
||||||
var list = _queue
|
var list = _queue
|
||||||
@ -409,6 +409,21 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
|||||||
WriteLine("[ " + character + $" ] 完全行动不能!");
|
WriteLine("[ " + character + $" ] 完全行动不能!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<Character> enemysTemp = new(enemys);
|
||||||
|
List<Character> teammatesTemp = new(teammates);
|
||||||
|
List<Skill> skillsTemp = new(skills);
|
||||||
|
Dictionary<Character, int> continuousKillingTemp = new(_continuousKilling);
|
||||||
|
Dictionary<Character, int> earnedMoneyTemp = new(_earnedMoney);
|
||||||
|
foreach (Effect e in character.Effects.Where(e => e.Level > 0).ToList())
|
||||||
|
{
|
||||||
|
if (e.AlterEnemyListBeforeAction(character, enemysTemp, teammatesTemp, skillsTemp, continuousKillingTemp, earnedMoneyTemp))
|
||||||
|
{
|
||||||
|
enemys = enemysTemp.Distinct().ToList();
|
||||||
|
teammates = teammatesTemp.Distinct().ToList();
|
||||||
|
skills = skillsTemp.Distinct().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (type == CharacterActionType.NormalAttack)
|
if (type == CharacterActionType.NormalAttack)
|
||||||
{
|
{
|
||||||
// 使用普通攻击逻辑
|
// 使用普通攻击逻辑
|
||||||
@ -453,7 +468,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
|||||||
|
|
||||||
foreach (Effect effect in character.Effects.Where(e => e.Level > 0).ToList())
|
foreach (Effect effect in character.Effects.Where(e => e.Level > 0).ToList())
|
||||||
{
|
{
|
||||||
effect.AlterHardnessTimeAfterCastSkill(character, ref baseTime, ref isCheckProtected);
|
effect.AlterHardnessTimeAfterCastSkill(character, skill, ref baseTime, ref isCheckProtected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -485,7 +500,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
|||||||
|
|
||||||
foreach (Effect effect in character.Effects.Where(e => e.Level > 0).ToList())
|
foreach (Effect effect in character.Effects.Where(e => e.Level > 0).ToList())
|
||||||
{
|
{
|
||||||
effect.AlterHardnessTimeAfterCastSkill(character, ref baseTime, ref isCheckProtected);
|
effect.AlterHardnessTimeAfterCastSkill(character, skill, ref baseTime, ref isCheckProtected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (type == CharacterActionType.CastSuperSkill)
|
else if (type == CharacterActionType.CastSuperSkill)
|
||||||
@ -515,7 +530,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
|||||||
|
|
||||||
foreach (Effect effect in character.Effects.Where(e => e.Level > 0).ToList())
|
foreach (Effect effect in character.Effects.Where(e => e.Level > 0).ToList())
|
||||||
{
|
{
|
||||||
effect.AlterHardnessTimeAfterCastSkill(character, ref baseTime, ref isCheckProtected);
|
effect.AlterHardnessTimeAfterCastSkill(character, skill, ref baseTime, ref isCheckProtected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (type == CharacterActionType.UseItem)
|
else if (type == CharacterActionType.UseItem)
|
||||||
|
@ -177,9 +177,10 @@ namespace Milimoe.FunGame.Core.Entity
|
|||||||
/// 在完成释放技能动作之后修改硬直时间
|
/// 在完成释放技能动作之后修改硬直时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="character"></param>
|
/// <param name="character"></param>
|
||||||
|
/// <param name="skill"></param>
|
||||||
/// <param name="baseHardnessTime"></param>
|
/// <param name="baseHardnessTime"></param>
|
||||||
/// <param name="isCheckProtected"></param>
|
/// <param name="isCheckProtected"></param>
|
||||||
public virtual void AlterHardnessTimeAfterCastSkill(Character character, ref double baseHardnessTime, ref bool isCheckProtected)
|
public virtual void AlterHardnessTimeAfterCastSkill(Character character, Skill skill, ref double baseHardnessTime, ref bool isCheckProtected)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -336,11 +337,28 @@ namespace Milimoe.FunGame.Core.Entity
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 角色属性发生变化
|
/// 角色属性发生变化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="character"></param>
|
||||||
public virtual void OnAttributeChanged(Character character)
|
public virtual void OnAttributeChanged(Character character)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 行动开始前,修改可选择的 <paramref name="enemys"/>, <paramref name="teammates"/>, <paramref name="skills"/> 列表<para/>
|
||||||
|
/// 注意 <paramref name="continuousKilling"/> 和 <paramref name="earnedMoney"/> 是副本,修改无效
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="character"></param>
|
||||||
|
/// <param name="enemys"></param>
|
||||||
|
/// <param name="teammates"></param>
|
||||||
|
/// <param name="skills"></param>
|
||||||
|
/// <param name="continuousKilling"></param>
|
||||||
|
/// <param name="earnedMoney"></param>
|
||||||
|
/// <returns>返回 true 表示更改生效</returns>
|
||||||
|
public virtual bool AlterEnemyListBeforeAction(Character character, List<Character> enemys, List<Character> teammates, List<Skill> skills, Dictionary<Character, int> continuousKilling, Dictionary<Character, int> earnedMoney)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 对敌人造成技能伤害 [ 强烈建议使用此方法造成伤害而不是自行调用 <see cref="ActionQueue.DamageToEnemy"/> ]
|
/// 对敌人造成技能伤害 [ 强烈建议使用此方法造成伤害而不是自行调用 <see cref="ActionQueue.DamageToEnemy"/> ]
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -368,6 +386,10 @@ namespace Milimoe.FunGame.Core.Entity
|
|||||||
ActionQueue?.InterruptCasting(caster, interrupter);
|
ActionQueue?.InterruptCasting(caster, interrupter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 返回特效详情
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
StringBuilder builder = new();
|
StringBuilder builder = new();
|
||||||
@ -386,6 +408,11 @@ namespace Milimoe.FunGame.Core.Entity
|
|||||||
return builder.ToString();
|
return builder.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 比较两个特效
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="other"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public override bool Equals(IBaseEntity? other)
|
public override bool Equals(IBaseEntity? other)
|
||||||
{
|
{
|
||||||
return other is Effect c && c.Name == Name;
|
return other is Effect c && c.Name == Name;
|
||||||
|
@ -176,26 +176,26 @@ namespace Milimoe.FunGame.Core.Entity
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 技能开始吟唱时 [ 吟唱魔法、释放战技和爆发技、预释放爆发技均可触发 ]
|
/// 技能开始吟唱时 [ 吟唱魔法、释放战技和爆发技、预释放爆发技均可触发 ]
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void OnSkillCasting(ActionQueue queue, Character actor)
|
public void OnSkillCasting(ActionQueue queue, Character caster)
|
||||||
{
|
{
|
||||||
ActionQueue = queue;
|
ActionQueue = queue;
|
||||||
foreach (Effect e in Effects)
|
foreach (Effect e in Effects)
|
||||||
{
|
{
|
||||||
e.ActionQueue = ActionQueue;
|
e.ActionQueue = ActionQueue;
|
||||||
e.OnSkillCasting(actor);
|
e.OnSkillCasting(caster);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 触发技能效果
|
/// 触发技能效果
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void OnSkillCasted(ActionQueue queue, Character actor, List<Character> enemys, List<Character> teammates)
|
public void OnSkillCasted(ActionQueue queue, Character caster, List<Character> enemys, List<Character> teammates)
|
||||||
{
|
{
|
||||||
ActionQueue = queue;
|
ActionQueue = queue;
|
||||||
foreach (Effect e in Effects)
|
foreach (Effect e in Effects)
|
||||||
{
|
{
|
||||||
e.ActionQueue = ActionQueue;
|
e.ActionQueue = ActionQueue;
|
||||||
e.OnSkillCasted(actor, enemys, teammates, OtherArgs);
|
e.OnSkillCasted(caster, enemys, teammates, OtherArgs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user