Beispiel #1
0
 public void refreshSkillDetail()
 {
     #region allSkills
     if (currentSkill != null)
     {
         SkillFunction function
             = HDP.skillDetailList.AllSkillList[currentSkill.SkillFunctionID]
               .GetComponent <SkillFunction>();
         if (currentSkill.UseAppointedPrefab)
         {
             function = currentSkill.SkillPrefab.GetComponent <SkillFunction>();
         }
         //
         skill_limit.text = SDGameManager.T
                                (currentSkill.isOmegaSkill ? "绝招" : "普通");
         skill_name.text = currentSkill.SkillName + "·Lv " + currentSkill.lv;
         skill_basedata.text
             = (function.CritR != 0 ? string.Format("基础暴击修正 {0:D}", function.CritR) : "")
               + (function.AccuracyR != 0 ? string.Format("·基础精度修正 {0:D}", function.AccuracyR) : "")
               + (function.ExpectR != 0 ? string.Format("·基础期望修正 {0:D}", function.ExpectR) : "");
         skill_desc.text = currentSkill.Desc;
     }
     #endregion
     #region equipedSkills
     heroDetail.readHeroSkills();
     #endregion
 }
Beispiel #2
0
 public void SkillCheck(SkillFunction _skill, BattleRoleData _targetUnit)
 {
     CheckThisSkillCauseAccur(_skill, _targetUnit);
     CheckThisSkillCauseFault();
     CheckThisSkillCauseCrit(_skill);
     CheckThisSkillCauseExpect(_skill);
 }
    public void chooseRandomSkillFromGroup()
    {
        //CurrentSkill = SkillGroup[0];
        List <SkillFunction> list = new List <SkillFunction>();

        for (int i = 0; i < SkillGroup.Length; i++)
        {
            SkillFunction skill = SkillGroup[i];
            if (skill.isSkillAvailable() && skill.isSkillMeetConditionToAutoRelease())
            {
                list.Add(skill);
            }
        }
        if (list.Count > 0)
        {
            CurrentSkill = list[UnityEngine.Random.Range(0, list.Count)];
        }
        else
        {
            if (BM == null)
            {
                BM = FindObjectOfType <BattleManager>();
            }
            CurrentSkill = BM.normalAttackSkill;
        }
    }
Beispiel #4
0
    public bool StatePossibility(SkillFunction HS, BattleRoleData source, BattleRoleData target)
    {
        if (AllRandomSetClass.PercentIdentify(StatePossibilityBuff))
        {
            if (HS.ThisSkillAim == SkillAim.Self)
            {
                Success = true; return(Success);
            }
            if (HS.ThisSkillAim == SkillAim.Friend)
            {
                Success = true; return(Success);
            }
        }
        float rate = AllRandomSetClass.SimplePercentToDecimal
                         (StatePossibilityBuff
                         - target.ThisBasicRoleProperty().ReadRA(stateTag));

        rate = Mathf.Clamp(rate, 0.05f, 0.95f);
        if (UnityEngine.Random.Range(0, 1f) < rate)
        {
            Success = true;
            return(Success);
        }
        Success = false;
        return(Success);
    }
Beispiel #5
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string jsonStr = value.ToString();

            ObservableCollection <SkillFunction> skillConditionList = new ObservableCollection <SkillFunction>();

            JArray jArray = JArray.Parse(jsonStr);

            foreach (JObject jo in jArray)
            {
                String className = jo["ClassName"].ToString();
                jo.Remove("ClassName");

                if (!AssemblyManager.Instance.SkillFunctionTypes.ContainsKey(className))
                {
                    LogManager.Instance.Warn("找不到对应的动态类: " + className + ", 此数据已直接丢弃。");
                    LogManager.Instance.Warn("请确保动态类型配置中已定义了此类型,然后重启编辑器。");
                    continue;
                }

                Type          type           = AssemblyManager.Instance.SkillFunctionTypes[className];
                SkillFunction skillCondition = JsonConvert.DeserializeObject(jo.ToString(), type) as SkillFunction;

                skillConditionList.Add(skillCondition);
            }

            return(skillConditionList);
        }
Beispiel #6
0
 public Skills(float p, float cd, bool r, SkillFunction SkillName)
 {
     Probabilidade = p;
     CoolDown      = cd;
     isReady       = r;
     ActiveSkill   = SkillName;
 }
Beispiel #7
0
    public int ExpectResult;//期望最终浮动
    public void CheckThisSkillCauseExpect(SkillFunction _skill)
    {
        int _expect  = ThisBasicRoleProperty().ReadRA(AttributeData.Expect);
        int _expectR = _skill.ExpectR;
        int Ex       = (int)(_expect * AllRandomSetClass.SimplePercentToDecimal(_expectR + 100));

        ExpectResult = Ex;
    }
 public Skill(string name, string description, SkillFunction function, Creature caster, int minAp, int maxCooldown)
 {
     this.name        = name;
     this.description = description;
     this.function    = function;
     this.caster      = caster;
     this.minAP       = minAp;
     this.maxCooldown = maxCooldown;
 }
Beispiel #9
0
    public bool CritHappen;//暴击-判定成功
    public void CheckThisSkillCauseCrit(SkillFunction _skill)
    {
        int   baseC   = ThisBasicRoleProperty().ReadRA(AttributeData.Crit);
        int   realC   = (int)(baseC * AllRandomSetClass.SimplePercentToDecimal(_skill.CritR + 100));
        float Rate    = AdolescentSet.CritFunction(realC);
        bool  _IsCrit = UnityEngine.Random.Range(0, 1f) < Rate;

        CritHappen = _IsCrit;
    }
Beispiel #10
0
 public void StartState(SkillFunction HS, BattleRoleData source, BattleRoleData target)
 {
     SkillGrade = HS.SkillGrade;
     NAME       = HS.name;
     if (StatePossibility(HS, source, target))
     {
         SimpleStartState(source, target);
     }
 }
Beispiel #11
0
 //开启面板(成功选择技能)
 public void BtnToOpenSDP(SkillFunction skill)
 {
     if (skill.skillIndex >= 0)
     {
         _currentActionPanel.OpenSDP(skill);
     }
     else
     {
         BtnToCloseSDP();
     }
 }
    public void OpenSDP(SkillFunction skill)
    {
        HSkilInfo info   = skill.GetComponent <HSkilInfo>();
        OneSkill  detail = info.HSDetail;

        SkillPanelContent.GetComponent <Image>().color = Color.clear;
        SkillPanelContent.GetChild(0).localScale       = Vector3.zero;
        SkillPanelContent.localScale = Vector3.one;
        SkillDetailsPanel.DOScale(Vector3.one, 0.15f).SetEase(Ease.OutBack);
        //显示当前技能详情
        ShowThisSkillDetails(skill, detail);
    }
 void Start()
 {
     SkillDetailsPanel                  = SkillPanelContent.GetChild(0);
     SkillDetailsPanel.localScale       = Vector3.zero;
     GetComponent <CanvasGroup>().alpha = 0;
     //
     if (BM == null)
     {
         BM = FindObjectOfType <BattleManager>();
     }
     DefaultSkill = BM.normalAttackSkill;
 }
Beispiel #14
0
    /// <summary>
    /// 英雄标准技能自动化后的目标选择
    /// </summary>
    public void chooseAutoBattleTarget()
    {
        _currentSkill = _currentActionPanel.CurrentSkill;
        bool ToHero = true;

        if (_currentSkill.ThisSkillAim == SkillAim.Self || _currentSkill.ThisSkillAim == SkillAim.All)
        {
            _currentTargetUnit = _currentBattleUnit;
            _currentTUType     = _currentBattleUnit._Tag;
            return;
        }
        else if (_currentSkill.ThisSkillAim == SkillAim.Friend && _currentBattleUnit.IsEnemy)
        {
            ToHero = false;
        }
        else if (_currentSkill.ThisSkillAim == SkillAim.Other && !_currentBattleUnit.IsEnemy)
        {
            ToHero = false;
        }
        if (ToHero)
        {
            if (Remaining_SRL.Count <= 0)
            {
                Debug.Log("GameOver");
            }
            else
            {
                int _rand = UnityEngine.Random.Range(0, Remaining_SRL.Count);
                if (_currentSkill.name.Contains("Heal"))
                {
                    _rand = AutoHealTarget(false);
                }
                _currentTargetUnit = Remaining_SRL[_rand];
                _currentTUType     = SDConstants.CharacterType.Hero;
            }
        }
        else
        {
            //if (Remaining_ORL.Count <= 0) BattleSuccess();
            //else
            if (Remaining_ORL.Count > 0)
            {
                int _rand = UnityEngine.Random.Range(0, Remaining_ORL.Count);
                if (_currentSkill.name.Contains("Heal"))
                {
                    _rand = AutoHealTarget(true);
                }
                _currentTargetUnit = Remaining_ORL[_rand];
                _currentTUType     = SDConstants.CharacterType.Enemy;
            }
        }
    }
Beispiel #15
0
 public Skill(string skillName, int skillLevel, int maxSkillLevel, SkillFunction skillFunction
              , float skillDelay, int mp, int hp = 0, int gold = 0)
 {
     this.skillName       = skillName;
     this.skillLevel      = skillLevel;
     this.maxSkillLevel   = maxSkillLevel;
     this.skillFunction   = skillFunction;
     this.skillDelay      = skillDelay;
     this.skillDelayTimer = 0;
     this.mp   = mp;
     this.hp   = hp;
     this.gold = gold;
 }
 public void refreshSkillsStatus()
 {
     activeSign.gameObject.SetActive(false);
     if (BM._currentBUType == SDConstants.CharacterType.Enemy)
     {
         if (SkillGroup != null && SkillGroup.Length > 0)
         {
             chooseASkillFromSkillGroup();
             DefaultSkill = CurrentSkill;
         }
     }
     CurrentSkill = DefaultSkill;
     BM.showCurrentUnitSkillTarget();
     BroadcastMessage("refreshBtnState");
 }
 public void chooseASkillFromSkillGroup()
 {
     CurrentSkill = SkillGroup[0];
     for (int i = 0; i < SkillGroup.Length; i++)
     {
         SkillFunction skill = SkillGroup[i];
         if (skill.isSkillAvailable())
         {
             if (skill.isSkillMeetConditionToAutoRelease())
             {
                 CurrentSkill = skill;
                 return;
             }
         }
     }
 }
Beispiel #18
0
        private void onBtn_AddFunction(object sender, RoutedEventArgs e)
        {
            if (lsbFunctions.ItemsSource == null)
            {
                return;
            }

            SkillFunctionPickWindow window = new SkillFunctionPickWindow();

            if (window.ShowDialog() == true)
            {
                SkillFunction newFunction = (SkillFunction)Activator.CreateInstance(window.PickedType);
                var           list        = (ObservableCollection <SkillFunction>)lsbFunctions.ItemsSource;
                list.Add(newFunction);
            }
        }
    public void ShowThisSkillDetails(SkillFunction skill, OneSkill detail)
    {
        SkillName.text = detail.SkillName + "·Lv " + skill.SkillGrade;
        SkillBaseData.text
            = (skill.CritR != 0 ? string.Format("基础暴击修正 {0:D}", skill.CritR) : "")
              + (skill.AccuracyR != 0?string.Format("·基础精度修正 {0:D}", skill.AccuracyR):"")
              + (skill.ExpectR != 0?string.Format("·基础期望修正 {0:D}", skill.ExpectR):"");
        SkillDesc.text = detail.Desc;

        /*
         * SkillTag.text = CurrentSkill.ThisSkillBreed.ToString()
         + "·" + CurrentSkill.ThisSkillKind.ToString() + "·" + CurrentSkill.ThisSkillTarget.ToString();
         + SkillBaseData.text = (CurrentSkill.AccuracyR != 0 ? "基础精度修正(" + SignedNumber(CurrentSkill.AccuracyR) + "%)·" : "")
         + CurrentSkill.AllTargetResults != null ? DamageFixText(CurrentSkill.AllTargetResults.All_Use_Array[0]) : ""
         + (CurrentSkill.CritR != 0 ? "基础暴击修正(" + SignedNumber(CurrentSkill.CritR) + "%)·" : "");
         */
    }
Beispiel #20
0
        private void lsbFunctions_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            spFunctionParams.Children.Clear();

            if (lsbFunctions.SelectedItem == null)
            {
                return;
            }

            SkillFunction skillFunction = lsbFunctions.SelectedItem as SkillFunction;

            Type skillConditionType = skillFunction.GetType();

            foreach (var p in skillConditionType.GetProperties())
            {
                Grid grid = createPropEntryGrid(p);
                spFunctionParams.Children.Add(grid);
            }
        }
Beispiel #21
0
 public bool AccurHappen;//精准·闪避-判定成功
 public void CheckThisSkillCauseAccur(SkillFunction _skill, BattleRoleData _targetUnit)
 {
     if (_targetUnit.IsEnemy == IsEnemy)
     {
         AccurHappen = true;
     }
     else
     {
         BasicRoleProperty _target = _targetUnit.ThisBasicRoleProperty();
         int   baseA    = ThisBasicRoleProperty().ReadRA(AttributeData.Accur);
         int   realA    = (int)(baseA * AllRandomSetClass.SimplePercentToDecimal(_skill.AccuracyR + 100));
         int   Evo      = _target.ReadRA(AttributeData.Evo);
         float Rate     = AdolescentSet.AccurFunction(realA, Evo);
         float t        = UnityEngine.Random.Range(0, 1f);
         bool  _IsAccur = t < Rate;
         AccurHappen = _IsAccur;
         Debug.Log("精准度计算:" + _IsAccur + " || " + t + " " + Rate
                   + "--evo:" + Evo + "--accur:" + realA + "--baseAccur:" + baseA
                   + "--skillAccuracyR:" + _skill.AccuracyR);
     }
 }
Beispiel #22
0
 /// <summary>
 /// 敌人释放技能时判定目标
 /// </summary>
 public void chooseRandomHeroToAttack()
 {
     //Debug.Log("敌方:" + _currentBattleUnit.name + " 自动选择目标");
     _currentSkill = _currentActionPanel.CurrentSkill;
     if (_currentSkill.ThisSkillAim == SkillAim.Other)
     {
         _currentTargetUnit = Remaining_SRL[TauntFunction()];
         _currentTUType     = SDConstants.CharacterType.Hero;
     }
     else
     {
         if (_currentSkill.ThisSkillAim == SkillAim.Self || _currentSkill.ThisSkillAim == SkillAim.All)
         {
             _currentTargetUnit = _currentBattleUnit;
         }
         else
         {
             int _rand = UnityEngine.Random.Range(0, Remaining_ORL.Count);
             _currentTargetUnit = Remaining_ORL[_rand];
             _currentTUType     = SDConstants.CharacterType.Enemy;
         }
     }
 }
Beispiel #23
0
    public void ConfirmSkillAndTarget()
    {
        ActionConfirm = false;
        if (_currentActionPanel == null || _currentActionPanel.CurrentSkill == null)
        {
            return;
        }
        _currentSkill = _currentActionPanel.CurrentSkill;
        int touchId = SelectController.WhenPointDownIndex();

        if (_currentSkill.ThisSkillAim == SkillAim.Self || _currentSkill.RandomTarget)
        {
            if (confirmSkillStep == 0)
            {
                confirmSkillStep = 1;
            }
            else if (confirmSkillStep == 1)
            {
                ActionConfirm      = true;
                _currentTargetUnit = All_Array[touchId];
                _currentTUType     = _currentTargetUnit._Tag;
                //
                if (_currentSkill.ThisSkillAim != SkillAim.Self)
                {
                    SelectController.ConfirmTarget(touchId);
                }
                else
                {
                    currentTouchId = 0;
                }
            }
        }
        else
        {
            if (All_Array[touchId].IsOptionTarget)
            {
                if (currentTouchId < 0)
                {
                    currentTouchId = touchId;
                }
                if (touchId != currentTouchId)
                {
                    currentTouchId   = touchId;
                    confirmSkillStep = 0;
                }
                else
                {
                    if (confirmSkillStep == 1)
                    {
                        ActionConfirm = true;
                    }
                    else if (confirmSkillStep == 0)
                    {
                        confirmSkillStep   = 1;
                        _currentTargetUnit = All_Array[currentTouchId];
                        _currentTUType     = _currentTargetUnit._Tag;

                        SelectController.ConfirmTarget(touchId);
                    }
                }
            }
            else
            {
                RolePlayJumpAnim(All_Array[touchId]);
                Debug.Log("无效目标");
            }
        }
    }
    public void addSkill(OneSkill skill, Transform trans, string heroId)
    {
        Transform s;

        if (!skill.UseAppointedPrefab)
        {
            if (skill.SkillFunctionID < 0)
            {
                return;
            }
            int index = skill.SkillFunctionID;
            s = Instantiate(SDL.AllSkillList[index]) as Transform;
        }
        else
        {
            s = Instantiate(skill.SkillPrefab) as Transform;
            s.GetComponent <Button>().interactable = true;
            HSExportDmgModifity HSE = s.GetComponent <HSExportDmgModifity>();
            if (HSE)
            {
                HSE.BCPerformDataUsingRA    = skill.DataSet.BCPerformDataUsingRA;
                HSE.PDUsingRA_PerLevel      = skill.DataSet.PDUsingRA_PerLevel;
                HSE.PDUsingRA_PerSkillGrade = skill.DataSet.PDUsingRA_PerSkillGrade;
            }
            SkillFunction sf = s.GetComponent <SkillFunction>();
            if (sf)
            {
                sf.UseState       = skill.DataSet.UseState;
                sf._standardState = skill.DataSet._standardState;
            }
        }

        s.GetComponentInChildren <HSkilInfo>().HSDetail = skill;
        s.SetParent(trans);
        s.GetComponent <RectTransform>().anchoredPosition = Vector2.zero;
        s.localScale = Vector3.one;
        HSkilInfo info = s.GetComponent <HSkilInfo>();

        info.breed = skill.Breed;
        if (skill.Kind != SkillKind.End)
        {
            info.kind = skill.Kind;
        }
        if (skill.SkillAoe != SDConstants.AOEType.End)
        {
            info.AOEType = skill.SkillAoe;
        }
        if (skill.MpTpAddType != SDConstants.AddMpTpType.End)
        {
            info.AfterwardsAddType = skill.MpTpAddType;
        }
        SkillFunction basicSkillController = s.GetComponent <SkillFunction>();

        if (skill.Aim != SkillAim.End)
        {
            basicSkillController.ThisSkillAim = skill.Aim;
        }

        basicSkillController.SkillGrade = skill.lv;
        basicSkillController.IsOmega    = skill.isOmegaSkill;


        if (skill.BulletImg != null && skill.BulletImg != "")
        {
            basicSkillController.bullet.GetComponent <Image>().sprite
                = Resources.Load <Sprite>("Sprites/" + skill.BulletImg);
        }
        //判断是否为稀有角色



        //
        basicSkillController.initIcon();
    }
Beispiel #25
0
 public static void overrideClick(SkillFunction func)
 {
     isOverriding = true;
     selectCreature(null);
     overrideFunction = func;
 }
Beispiel #26
0
 public void ChangeModelAnim(string TriggerName, bool IsLoop = false)
 {
     if (_isDead)
     {
         return;
     }
     if (TriggerName == null || TriggerName == "")
     {
         return;
     }
     if (isFinalBossModel)
     {
         if (TriggerName == anim_hurt ||
             TriggerName == anim_attack ||
             TriggerName == anim_die)
         {
             transform.DOShakePosition(0.2f, new Vector3(1, 1, 1));
         }
     }
     current_anim_time = 0;
     if (_Tag == SDConstants.CharacterType.Hero ||
         _Tag == SDConstants.CharacterType.Enemy)
     {
         string AnimName = TriggerName;
         if (_Tag == SDConstants.CharacterType.Hero)
         {
             HeroInfo      info           = SDDataManager.Instance.getHeroInfoById(CMC.id);
             Job           career         = info.Career.Career;
             List <string> fixedAnimNames = AllAnimations.FindAll
                                                (x => x.Contains(TriggerName));
             AnimName = fixedAnimNames.Find(x => x.Contains(TriggerName));
             //
             if (TriggerName == anim_attack)
             {
                 if (career == Job.Ranger)
                 {
                     AnimName = fixedAnimNames.Find(x => x.Contains("2"));
                 }
                 else
                 {
                     AnimName = fixedAnimNames.Find(x => x.Contains("1"));
                     if (AnimName == null)
                     {
                         AnimName = "attect-01";
                     }
                 }
                 current_anim_time = SDConstants.AnimTime_ATTACK;
             }
             if (TriggerName == anim_cast)
             {
                 if (career == Job.Priest)
                 {
                     AnimName = fixedAnimNames.Find(x => x.Contains("3"));
                 }
                 else
                 {
                     AnimName = fixedAnimNames.Find(x => x.Contains("2"));
                 }
                 BattleRoleData      source = GetComponentInParent <BattleRoleData>();
                 BattleManager       BM     = source.BM;
                 SkillFunction       skill  = BM._currentSkill;
                 SDConstants.AOEType aoe    = skill.AOEType;
                 if (skill.IsOmega)
                 {
                     AnimName = fixedAnimNames.Find(x => x.Contains("4"));
                 }
                 current_anim_time = SDConstants.AnimTime_CAST;
             }
             if (TriggerName == anim_jump)
             {
                 AnimName = AllAnimations.Find(x => x.Contains("cast") && x.Contains("1"));
             }
             if (TriggerName == anim_die)
             {
                 current_anim_time = SDConstants.AnimTime_DIE;
             }
         }
         else
         {
             AnimName = AllAnimations.Find(x => x.Contains(TriggerName));
             if (AnimName == null)
             {
                 return;
             }
         }
         current_anim_name = AnimName;
         StartCoroutine(IEChangeModelAnim(AnimName, IsLoop));
     }
 }