Files
Main/Assets/Code/Logic/_Required/Entity/Character/Buff/ChangeModelBuff.cs
2025-01-25 04:38:09 +08:00

66 lines
2.3 KiB
C#

using Thousandto.Cfg.Data;
using Thousandto.Code.Center;
using Thousandto.Code.Global;
namespace Thousandto.Code.Logic
{
//变身buff
public class ChangeModelBuff : Buff
{
protected override void OnAddBuffSpecial(Character owner)
{
base.OnAddBuffSpecial(owner);
if (owner is Player)
{
Player p = owner as Player;
var changeCfg = DeclareChangeModel.Get(Cfg.Id);
if (changeCfg != null)
{
p.StartChangeModel(changeCfg);
if (p.IsLocalPlayer())
{
var lp = p as LocalPlayer;
if (lp.IsOnMount)
{
//下马
lp.MountDown();
}
var paramsArray = changeCfg.Skill.Split('_');
int[] changeSkills = new int[4];
for (int i = 0; i < changeSkills.Length && i < paramsArray.Length; ++i)
{
changeSkills[i] = int.Parse(paramsArray[i]);
}
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_SET_CHANGEMODEL_SKILL, Cfg.Id);
//重新开始挂机
GameCenter.LuaSystem.Adaptor.RestartMandate();
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_CHANGE_SKILL_CHANGED);
//功能开启检测
GameCenter.BlockingUpPromptSystem.AddNewFunction(0, 10000005);
}
}
}
}
protected override void OnDeleteBuffSpecial(Character owner)
{
base.OnDeleteBuffSpecial(owner);
if (owner is Player)
{
var player = owner as Player;
player.StopChangeModel();
if (owner.IsLocalPlayer())
{
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_CLEAR_CHANGEMODEL_SKILL);
//重新开始挂机
GameCenter.LuaSystem.Adaptor.RestartMandate();
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_CHANGE_SKILL_CHANGED);
}
}
}
}
}