mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2026-03-05 22:20:26 +00:00
添加了动作结束后的钩子
This commit is contained in:
parent
8d3d19737c
commit
f4b8882a2e
@ -947,7 +947,7 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 在角色行动后触发
|
||||
/// 在角色行动后触发,注意这个钩子是广播队列所有角色
|
||||
/// </summary>
|
||||
/// <param name="actor"></param>
|
||||
/// <param name="dp"></param>
|
||||
@ -978,6 +978,61 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 角色完成移动后
|
||||
/// </summary>
|
||||
/// <param name="character"></param>
|
||||
/// <param name="target"></param>
|
||||
public virtual void AfterCharacterMove(Character character, Grid target)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 角色完成普通攻击后
|
||||
/// </summary>
|
||||
/// <param name="character"></param>
|
||||
/// <param name="normalAttack"></param>
|
||||
/// <param name="targets"></param>
|
||||
public virtual void AfterCharacterNormalAttack(Character character, NormalAttack normalAttack, List<Character> targets)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 角色开始吟唱后
|
||||
/// </summary>
|
||||
/// <param name="character"></param>
|
||||
/// <param name="skill"></param>
|
||||
/// <param name="targets"></param>
|
||||
public virtual void AfterCharacterStartCasting(Character character, Skill skill, List<Character> targets)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 角色释放技能后
|
||||
/// </summary>
|
||||
/// <param name="character"></param>
|
||||
/// <param name="skill"></param>
|
||||
/// <param name="targets"></param>
|
||||
public virtual void AfterCharacterCastSkill(Character character, Skill skill, List<Character> targets)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 角色使用物品后
|
||||
/// </summary>
|
||||
/// <param name="character"></param>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="skill"></param>
|
||||
/// <param name="targets"></param>
|
||||
public virtual void AfterCharacterUseItem(Character character, Item item, Skill skill, List<Character> targets)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 对敌人造成技能伤害 [ 强烈建议使用此方法造成伤害而不是自行调用 <see cref="IGamingQueue.DamageToEnemy"/> ]
|
||||
/// </summary>
|
||||
@ -994,10 +1049,8 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
int changeCount = 0;
|
||||
DamageResult result = DamageResult.Normal;
|
||||
double damage = expectedDamage;
|
||||
options ??= new(actor)
|
||||
{
|
||||
Skill = Skill
|
||||
};
|
||||
options ??= new(actor);
|
||||
options.Skill = Skill;
|
||||
if (options.ExpectedDamage == 0) options.ExpectedDamage = expectedDamage;
|
||||
if (options.NeedCalculate && damageType != DamageType.True)
|
||||
{
|
||||
|
||||
@ -1395,6 +1395,13 @@ namespace Milimoe.FunGame.Core.Model
|
||||
OnCharacterNormalAttackEvent(character, dp, targets);
|
||||
|
||||
character.NormalAttack.Attack(this, character, null, targets);
|
||||
|
||||
effects = [.. character.Effects.Where(e => e.IsInEffect)];
|
||||
foreach (Effect effect in effects)
|
||||
{
|
||||
effect.AfterCharacterNormalAttack(character, character.NormalAttack, targets);
|
||||
}
|
||||
|
||||
baseTime += character.NormalAttack.RealHardnessTime;
|
||||
effects = [.. character.Effects.Where(e => e.IsInEffect)];
|
||||
foreach (Effect effect in effects)
|
||||
@ -1485,6 +1492,12 @@ namespace Milimoe.FunGame.Core.Model
|
||||
baseTime += skill.RealCastTime;
|
||||
isCheckProtected = false;
|
||||
skill.OnSkillCasting(this, character, targets, grids);
|
||||
|
||||
effects = [.. character.Effects.Where(e => e.IsInEffect)];
|
||||
foreach (Effect effect in effects)
|
||||
{
|
||||
effect.AfterCharacterStartCasting(character, skill, targets);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1554,6 +1567,13 @@ namespace Milimoe.FunGame.Core.Model
|
||||
OnCharacterPreCastSkillEvent(character, dp, skillTarget);
|
||||
|
||||
skill.OnSkillCasting(this, character, targets, grids);
|
||||
|
||||
effects = [.. character.Effects.Where(e => e.IsInEffect)];
|
||||
foreach (Effect effect in effects)
|
||||
{
|
||||
effect.AfterCharacterStartCasting(character, skill, targets);
|
||||
}
|
||||
|
||||
skill.BeforeSkillCasted();
|
||||
|
||||
character.EP -= cost;
|
||||
@ -1566,6 +1586,13 @@ namespace Milimoe.FunGame.Core.Model
|
||||
OnCharacterCastSkillEvent(character, dp, skillTarget, cost);
|
||||
|
||||
skill.OnSkillCasted(this, character, targets, grids);
|
||||
|
||||
effects = [.. character.Effects.Where(e => e.IsInEffect)];
|
||||
foreach (Effect effect in effects)
|
||||
{
|
||||
effect.AfterCharacterCastSkill(character, skill, targets);
|
||||
}
|
||||
|
||||
effects = [.. character.Effects.Where(e => e.IsInEffect)];
|
||||
foreach (Effect effect in effects)
|
||||
{
|
||||
@ -1636,6 +1663,12 @@ namespace Milimoe.FunGame.Core.Model
|
||||
|
||||
skill.OnSkillCasted(this, character, targets, grids);
|
||||
|
||||
effects = [.. character.Effects.Where(e => e.IsInEffect)];
|
||||
foreach (Effect effect in effects)
|
||||
{
|
||||
effect.AfterCharacterCastSkill(character, skill, targets);
|
||||
}
|
||||
|
||||
effects = [.. character.Effects.Where(e => e.IsInEffect)];
|
||||
foreach (Effect effect in effects)
|
||||
{
|
||||
@ -1702,6 +1735,12 @@ namespace Milimoe.FunGame.Core.Model
|
||||
|
||||
skill.OnSkillCasted(this, character, targets, grids);
|
||||
|
||||
effects = [.. character.Effects.Where(e => e.IsInEffect)];
|
||||
foreach (Effect effect in effects)
|
||||
{
|
||||
effect.AfterCharacterCastSkill(character, skill, targets);
|
||||
}
|
||||
|
||||
effects = [.. character.Effects.Where(e => e.IsInEffect)];
|
||||
foreach (Effect effect in effects)
|
||||
{
|
||||
@ -1825,7 +1864,7 @@ namespace Milimoe.FunGame.Core.Model
|
||||
|
||||
OnCharacterActionTakenEvent(character, dp, type, LastRound);
|
||||
|
||||
effects = [.. character.Effects.Where(e => e.IsInEffect)];
|
||||
effects = [.. _queue.Union([character]).SelectMany(c => c.Effects).Where(e => e.IsInEffect).Distinct()];
|
||||
foreach (Effect effect in effects)
|
||||
{
|
||||
effect.OnCharacterActionTaken(character, dp, type);
|
||||
@ -2769,8 +2808,9 @@ namespace Milimoe.FunGame.Core.Model
|
||||
}
|
||||
|
||||
healStrings.Add($" = {heal:0.##} 点生命值");
|
||||
string healString = "";
|
||||
if (!IsDebug) healStrings.Clear();
|
||||
string healString = $"【{string.Join("", healStrings)}】";
|
||||
else healString = $"【{string.Join("", healStrings)}】";
|
||||
|
||||
if (target.HP > 0 || (isDead && canRespawn))
|
||||
{
|
||||
@ -3043,6 +3083,13 @@ namespace Milimoe.FunGame.Core.Model
|
||||
OnCharacterUseItemEvent(character, dp, item, targets);
|
||||
|
||||
skill.OnSkillCasting(this, character, targets, grids);
|
||||
|
||||
Effect[] effects = [.. character.Effects.Where(e => e.IsInEffect)];
|
||||
foreach (Effect effect in effects)
|
||||
{
|
||||
effect.AfterCharacterStartCasting(character, skill, targets);
|
||||
}
|
||||
|
||||
skill.BeforeSkillCasted();
|
||||
|
||||
skill.CurrentCD = skill.RealCD;
|
||||
@ -3071,6 +3118,18 @@ namespace Milimoe.FunGame.Core.Model
|
||||
OnCharacterCastItemSkillEvent(character, dp, item, skillTarget, costMP, costEP);
|
||||
|
||||
skill.OnSkillCasted(this, character, targets, grids);
|
||||
|
||||
effects = [.. character.Effects.Where(e => e.IsInEffect)];
|
||||
foreach (Effect effect in effects)
|
||||
{
|
||||
effect.AfterCharacterCastSkill(character, skill, targets);
|
||||
}
|
||||
|
||||
effects = [.. character.Effects.Where(e => e.IsInEffect)];
|
||||
foreach (Effect effect in effects)
|
||||
{
|
||||
effect.AfterCharacterUseItem(character, item, skill, targets);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -4045,6 +4104,11 @@ namespace Milimoe.FunGame.Core.Model
|
||||
|
||||
AddCharacter(character, newHardnessTime, false);
|
||||
skill.OnSkillCasting(this, character, [], []);
|
||||
Effect[] effects = [.. character.Effects.Where(e => e.IsInEffect)];
|
||||
foreach (Effect effect in effects)
|
||||
{
|
||||
effect.AfterCharacterStartCasting(character, skill, []);
|
||||
}
|
||||
OnQueueUpdatedEvent(_queue, character, dp, 0, QueueUpdatedReason.PreCastSuperSkill, "设置角色预释放爆发技的硬直时间。");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user