private bool UseImpl(PoolObjHandle <ActorRoot> user) { if (this.skillContext == null || !this.skillContext.TargetActor || this.cfgData == null) { return(false); } BuffHolderComponent buffHolderComp = this.skillContext.TargetActor.get_handle().BuffHolderComp; if (buffHolderComp == null) { return(false); } if (!this.CheckUseRule(this.skillContext)) { return(false); } if (!buffHolderComp.overlayRule.CheckOverlay(this)) { return(false); } bool flag = false; bool flag2 = false; VInt3 value = VInt3.forward; switch (this.skillContext.AppointType) { case 2: flag = true; break; case 3: flag2 = true; value = this.skillContext.UseVector; if (this.skillContext.TargetID != 0u) { PoolObjHandle <ActorRoot> actor = Singleton <GameObjMgr> .GetInstance().GetActor(this.skillContext.TargetID); if (actor) { Vector3 vector = actor.get_handle().myTransform.position - user.get_handle().myTransform.position; vector.y = 0f; vector.Normalize(); value = (VInt3)vector; } } break; case 4: flag = true; flag2 = true; value = this.skillContext.EndVector - this.skillContext.UseVector; if (value.get_sqrMagnitudeLong() < 1L) { value = VInt3.forward; } break; } GameObject gameObject = (!this.skillContext.Originator) ? null : this.skillContext.Originator.get_handle().gameObject; GameObject gameObject2 = (!this.skillContext.TargetActor) ? null : this.skillContext.TargetActor.get_handle().gameObject; this.curAction = new PoolObjHandle <Action>(ActionManager.Instance.PlayAction(this.ActionName, true, false, new GameObject[] { gameObject, gameObject2 })); if (!this.curAction) { return(false); } this.curAction.get_handle().onActionStop += new ActionStopDelegate(this.OnActionStoped); this.curAction.get_handle().refParams.AddRefParam("SkillObj", this); this.curAction.get_handle().refParams.AddRefParam("SkillContext", this.skillContext); this.curAction.get_handle().refParams.AddRefParam("TargetActor", this.skillContext.TargetActor); this.curAction.get_handle().refParams.SetRefParam("_BulletPos", this.skillContext.EffectPos); this.curAction.get_handle().refParams.SetRefParam("_BulletDir", this.skillContext.EffectDir); if (flag) { this.curAction.get_handle().refParams.SetRefParam("_TargetPos", this.skillContext.UseVector); } if (flag2) { this.curAction.get_handle().refParams.SetRefParam("_TargetDir", value); } if (this.cfgData != null) { SkillSlotType slotType = this.skillContext.SlotType; int num = this.cfgData.iDuration; if (slotType >= SkillSlotType.SLOT_SKILL_1 && slotType <= SkillSlotType.SLOT_SKILL_3) { int num2 = 1; if (this.skillContext.Originator && this.skillContext.Originator.get_handle().SkillControl != null) { SkillSlot skillSlot = null; this.skillContext.Originator.get_handle().SkillControl.TryGetSkillSlot(slotType, out skillSlot); if (skillSlot != null) { num2 = skillSlot.GetSkillLevel(); } } num2 = ((num2 >= 1) ? num2 : 1); num += (num2 - 1) * this.cfgData.iDurationGrow; } if (this.skillContext.Originator && this.skillContext.Originator.get_handle() != null && this.skillContext.Originator.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && this.skillContext.Originator.get_handle().TheStaticData.TheHeroOnlyInfo.AttackDistanceType == 2 && this.cfgData.iLongRangeReduction > 0) { num = num * this.cfgData.iLongRangeReduction / 10000; } this.curAction.get_handle().ResetLength(num, false); if (this.cfgData.bEffectType == 2) { this.DealTenacity(this.skillContext.TargetActor); } } bool flag3 = true; if (this.cfgData.bShowType != 0 || this.cfgData.bFloatTextID > 0) { if (!this.skillContext.TargetActor || this.skillContext.TargetActor.get_handle() == null || this.skillContext.TargetActor.get_handle().BuffHolderComp == null || this.skillContext.TargetActor.get_handle().BuffHolderComp.SpawnedBuffList == null) { return(false); } for (int i = 0; i < this.skillContext.TargetActor.get_handle().BuffHolderComp.SpawnedBuffList.get_Count(); i++) { BuffSkill buffSkill = this.skillContext.TargetActor.get_handle().BuffHolderComp.SpawnedBuffList.get_Item(i); if (buffSkill != null && buffSkill.cfgData != null && buffSkill.cfgData.iCfgID == this.cfgData.iCfgID) { flag3 = false; break; } } if (flag3) { SpawnBuffEventParam spawnBuffEventParam = new SpawnBuffEventParam((uint)this.cfgData.bShowType, (uint)this.cfgData.bFloatTextID, this.skillContext.TargetActor); Singleton <GameSkillEventSys> .GetInstance().SendEvent <SpawnBuffEventParam>(GameSkillEventDef.Event_SpawnBuff, this.skillContext.TargetActor, ref spawnBuffEventParam, GameSkillEventChannel.Channel_HostCtrlActor); } } this.skillContext.TargetActor.get_handle().BuffHolderComp.AddBuff(this); if (this.cfgData.bEffectType == 2 && this.cfgData.bShowType != 2) { LimitMoveEventParam limitMoveEventParam = new LimitMoveEventParam(base.CurAction.get_handle().length, this.SkillID, this.skillContext.TargetActor); Singleton <GameSkillEventSys> .GetInstance().SendEvent <LimitMoveEventParam>(GameSkillEventDef.AllEvent_LimitMove, this.skillContext.TargetActor, ref limitMoveEventParam, GameSkillEventChannel.Channel_AllActor); } if (this.bAgeImmeExcute) { this.curAction.get_handle().UpdateLogic((int)Singleton <FrameSynchr> .GetInstance().FrameDelta); } return(true); }
private bool UseImpl(PoolObjHandle <ActorRoot> user) { if (((base.skillContext == null) || (base.skillContext.TargetActor == 0)) || (this.cfgData == null)) { return(false); } BuffHolderComponent buffHolderComp = base.skillContext.TargetActor.handle.BuffHolderComp; if (buffHolderComp == null) { return(false); } if (!this.CheckUseRule(base.skillContext)) { return(false); } if (!buffHolderComp.overlayRule.CheckOverlay(this)) { return(false); } bool flag = false; bool flag2 = false; VInt3 forward = VInt3.forward; switch (base.skillContext.AppointType) { case SkillRangeAppointType.Pos: flag = true; break; case SkillRangeAppointType.Directional: flag2 = true; forward = base.skillContext.UseVector; break; case SkillRangeAppointType.Track: flag = true; flag2 = true; forward = base.skillContext.EndVector - base.skillContext.UseVector; if (forward.sqrMagnitudeLong < 1L) { forward = VInt3.forward; } break; } GameObject obj2 = (base.skillContext.Originator == 0) ? null : base.skillContext.Originator.handle.gameObject; GameObject obj3 = (base.skillContext.TargetActor == 0) ? null : base.skillContext.TargetActor.handle.gameObject; GameObject[] objArray1 = new GameObject[] { obj2, obj3 }; base.curAction = new PoolObjHandle <AGE.Action>(ActionManager.Instance.PlayAction(base.ActionName, true, false, objArray1)); if (base.curAction == 0) { return(false); } this.curAction.handle.onActionStop += new ActionStopDelegate(this.OnActionStoped); this.curAction.handle.refParams.AddRefParam("SkillObj", this); this.curAction.handle.refParams.AddRefParam("SkillContext", base.skillContext); this.curAction.handle.refParams.AddRefParam("TargetActor", base.skillContext.TargetActor); this.curAction.handle.refParams.SetRefParam("_BulletPos", base.skillContext.EffectPos); this.curAction.handle.refParams.SetRefParam("_BulletDir", base.skillContext.EffectDir); if (flag) { this.curAction.handle.refParams.SetRefParam("_TargetPos", base.skillContext.UseVector); } if (flag2) { this.curAction.handle.refParams.SetRefParam("_TargetDir", forward); } if (this.cfgData != null) { SkillSlotType slotType = base.skillContext.SlotType; int iDuration = this.cfgData.iDuration; if ((slotType >= SkillSlotType.SLOT_SKILL_1) && (slotType <= SkillSlotType.SLOT_SKILL_3)) { int skillLevel = 1; if ((base.skillContext.Originator != 0) && (base.skillContext.Originator.handle.SkillControl != null)) { SkillSlot slot = null; base.skillContext.Originator.handle.SkillControl.TryGetSkillSlot(slotType, out slot); if (slot != null) { skillLevel = slot.GetSkillLevel(); } } skillLevel = (skillLevel >= 1) ? skillLevel : 1; iDuration += (skillLevel - 1) * this.cfgData.iDurationGrow; } if ((((base.skillContext.Originator != 0) && (base.skillContext.Originator.handle != null)) && ((base.skillContext.Originator.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && (base.skillContext.Originator.handle.TheStaticData.TheHeroOnlyInfo.AttackDistanceType == 2))) && (this.cfgData.iLongRangeReduction > 0)) { iDuration = (iDuration * this.cfgData.iLongRangeReduction) / 0x2710; } this.curAction.handle.ResetLength(iDuration, false); if (this.cfgData.dwEffectType == 2) { this.DealTenacity(base.skillContext.TargetActor); } } bool flag3 = true; if ((this.cfgData.dwShowType != 0) || (this.cfgData.dwFloatTextID > 0)) { BuffSkill skill = null; if (((base.skillContext.TargetActor == 0) || (base.skillContext.TargetActor.handle == null)) || ((base.skillContext.TargetActor.handle.BuffHolderComp == null) || (base.skillContext.TargetActor.handle.BuffHolderComp.SpawnedBuffList == null))) { return(false); } for (int i = 0; i < base.skillContext.TargetActor.handle.BuffHolderComp.SpawnedBuffList.Count; i++) { skill = base.skillContext.TargetActor.handle.BuffHolderComp.SpawnedBuffList[i]; if (((skill != null) && (skill.cfgData != null)) && (skill.cfgData.iCfgID == this.cfgData.iCfgID)) { flag3 = false; break; } } if (flag3) { SpawnBuffEventParam param = new SpawnBuffEventParam(this.cfgData.dwShowType, this.cfgData.dwFloatTextID, base.skillContext.TargetActor); Singleton <GameSkillEventSys> .GetInstance().SendEvent <SpawnBuffEventParam>(GameSkillEventDef.Event_SpawnBuff, base.skillContext.TargetActor, ref param, GameSkillEventChannel.Channel_HostCtrlActor); } } base.skillContext.TargetActor.handle.BuffHolderComp.AddBuff(this); if ((this.cfgData.dwEffectType == 2) && (this.cfgData.dwShowType != 2)) { LimitMoveEventParam param2 = new LimitMoveEventParam(base.CurAction.handle.length, base.SkillID, base.skillContext.TargetActor); Singleton <GameSkillEventSys> .GetInstance().SendEvent <LimitMoveEventParam>(GameSkillEventDef.AllEvent_LimitMove, base.skillContext.TargetActor, ref param2, GameSkillEventChannel.Channel_AllActor); } if (base.bAgeImmeExcute) { this.curAction.handle.UpdateLogic((int)Singleton <FrameSynchr> .GetInstance().FrameDelta); } return(true); }
public override bool Use(PoolObjHandle <ActorRoot> user, SkillUseContext context) { if (((context == null) || (context.TargetActor == 0)) || (this.cfgData == null)) { return(false); } this.skillContext = context.Clone(); BuffHolderComponent buffHolderComp = context.TargetActor.handle.BuffHolderComp; if (buffHolderComp == null) { return(false); } if (!this.CheckUseRule(context)) { return(false); } if (!buffHolderComp.overlayRule.CheckOverlay(this)) { return(false); } bool flag = false; bool flag2 = false; VInt3 forward = VInt3.forward; switch (context.AppointType) { case SkillRangeAppointType.Pos: flag = true; break; case SkillRangeAppointType.Directional: flag2 = true; forward = context.UseVector; break; case SkillRangeAppointType.Track: flag = true; flag2 = true; forward = context.EndVector - context.UseVector; if (forward.sqrMagnitudeLong < 1L) { forward = VInt3.forward; } break; } GameObject obj2 = (context.Originator == 0) ? null : context.Originator.handle.gameObject; GameObject obj3 = (context.TargetActor == 0) ? null : context.TargetActor.handle.gameObject; GameObject[] objArray1 = new GameObject[] { obj2, obj3 }; base.curAction = ActionManager.Instance.PlayAction(base.ActionName, true, false, objArray1); if (base.curAction == null) { return(false); } base.curAction.onActionStop += new ActionStopDelegate(this.OnActionStoped); base.curAction.refParams.AddRefParam("SkillObj", this); base.curAction.refParams.AddRefParam("SkillContext", context); base.curAction.refParams.AddRefParam("TargetActor", context.TargetActor); base.curAction.refParams.SetRefParam("_BulletPos", context.EffectPos); base.curAction.refParams.SetRefParam("_BulletDir", context.EffectDir); if (flag) { base.curAction.refParams.SetRefParam("_TargetPos", context.UseVector); } if (flag2) { base.curAction.refParams.SetRefParam("_TargetDir", forward); } if (this.cfgData != null) { SkillSlotType slotType = context.SlotType; int iDuration = this.cfgData.iDuration; if ((slotType >= SkillSlotType.SLOT_SKILL_1) && (slotType <= SkillSlotType.SLOT_SKILL_3)) { int skillLevel = 1; if ((context.Originator != 0) && (context.Originator.handle.SkillControl != null)) { SkillSlot slot = null; context.Originator.handle.SkillControl.TryGetSkillSlot(slotType, out slot); if (slot != null) { skillLevel = slot.GetSkillLevel(); } } skillLevel = (skillLevel >= 1) ? skillLevel : 1; iDuration += (skillLevel - 1) * this.cfgData.iDurationGrow; } base.curAction.ResetLength(iDuration, false); if (this.cfgData.dwEffectType == 2) { this.DealTenacity(context.TargetActor); } } context.TargetActor.handle.BuffHolderComp.AddBuff(this); if (this.cfgData.dwShowType != 0) { SpawnBuffEventParam param = new SpawnBuffEventParam(this.cfgData.dwShowType, context.TargetActor); Singleton <GameSkillEventSys> .GetInstance().SendEvent <SpawnBuffEventParam>(GameSkillEventDef.Event_SpawnBuff, context.TargetActor, ref param, GameSkillEventChannel.Channel_HostCtrlActor); } if ((this.cfgData.dwEffectType == 2) && (this.cfgData.dwShowType != 2)) { LimitMoveEventParam param2 = new LimitMoveEventParam(base.CurAction.length, base.SkillID, context.TargetActor); Singleton <GameSkillEventSys> .GetInstance().SendEvent <LimitMoveEventParam>(GameSkillEventDef.Event_LimitMove, context.TargetActor, ref param2, GameSkillEventChannel.Channel_AllActor); } return(true); }