コード例 #1
0
    public void Conjure_Impl(string skillId, Units target, Vector3?targetPos, bool isPvp = false)
    {
        Skill skillById = this.self.getSkillById(skillId);

        if (SkillUtility.IsBurnUnitSkill(skillById) && targetPos.HasValue)
        {
            Units touchUnit = ManualControlTarget.GetTouchUnit(targetPos.Value);
            if (touchUnit != null && (touchUnit.GetType() == typeof(Tower) || touchUnit.GetType() == typeof(Home)))
            {
                base.OnSkillFailedBeforeStart(skillById);
                ClientLogger.Warn(string.Concat(new object[]
                {
                    "不能摆蘑菇在这里",
                    touchUnit,
                    "  ",
                    targetPos.Value
                }));
                return;
            }
        }
        if (this.self.CanSkill || skillById.CheckSkillCanUseSpecial)
        {
            if (target == null && !targetPos.HasValue)
            {
                target = this.self.GetAttackTarget();
            }
            skillById.attackTarget   = target;
            skillById.attackPosition = targetPos;
            if (skillById.CheckCondition() && skillById.CheckTargets())
            {
                if (isPvp)
                {
                    UseSkillInfo useSkillInfo = new UseSkillInfo
                    {
                        unitId         = this.self.unique_id,
                        skillId        = skillById.skillMainId,
                        targetUnit     = (!(skillById.attackTarget != null)) ? 0 : skillById.attackTarget.unique_id,
                        targetPosition = (!skillById.attackPosition.HasValue) ? null : MoveController.Vector3ToSVector3(skillById.attackPosition.Value),
                        targetRotate   = this.self.transform.eulerAngles.y
                    };
                    PvpEvent.SendUseSkill(useSkillInfo);
                    this.sendUseSkills[skillId]     = true;
                    this.sendUseSkillTicks[skillId] = DateTime.Now.Ticks;
                    this.self.moveController.clearContinueMovingTarget();
                    if (GlobalSettings.Instance.ClientGoAhead)
                    {
                        List <Units> list = new List <Units>();
                        if (target != null)
                        {
                            list.Add(target);
                        }
                        ActionManager.ReadySkill(new SkillDataKey(useSkillInfo.skillId, skillById.skillLevel, 0), this.self, list, skillById.attackPosition, skillById, false);
                    }
                }
                else
                {
                    this.self.InterruptAction(SkillInterruptType.Initiative);
                    skillById.OnSkillStartCallback             = new Callback <Skill>(base.OnSkillStart);
                    skillById.OnSkillEndCallback               = new Callback <Skill>(base.OnSkillEnd);
                    skillById.OnSkillFailedBeforeStartCallback = new Callback <Skill>(base.OnSkillFailedBeforeStart);
                    skillById.Start();
                    base.currSkill = skillById;
                }
            }
            else
            {
                base.OnSkillFailedBeforeStart(skillById);
            }
        }
    }