Ejemplo n.º 1
0
    /// <summary>
    /// 状态造成的伤害计算
    /// </summary>
    /// <param name="source"></param>
    /// <param name="target"></param>
    /// <returns></returns>
    public override int dmgCaused(BattleRoleData source, BattleRoleData target)
    {
        int basicVal;

        if (!UseSourceAToDmg)
        {
            basicVal = ExtraDmg.DATA;
            if (ExtraDmg.dataTag == NumberData.DataType.percent)
            {
                basicVal = (int)(target.HpController.MaxHp * ExtraDmg.DECIMAL);
            }
        }
        else
        {
            float _decimal = AllRandomSetClass.SimplePercentToDecimal(UsePercent);
            float val      = 0;
            if (stateKind == SkillKind.Elemental)
            {
                val = source.ThisBasicRoleProperty()._role.at *_decimal;
            }
            else if (stateKind == SkillKind.Physical)
            {
                val = source.ThisBasicRoleProperty()._role.mt *_decimal;
            }
            else if (stateKind == SkillKind.Arcane)
            {
                val = (source.ThisBasicRoleProperty()._role.mt
                       + source.ThisBasicRoleProperty()._role.at)
                      * _decimal;
            }
            basicVal = (int)val;
        }
        return(basicVal);
    }
Ejemplo n.º 2
0
    public int valCaused(BattleRoleData source, BattleRoleData target, SkillKind kind)
    {
        int           B   = 0;
        NumberData    d   = physicalND;
        AttributeData atb = AttributeData.AT;

        if (kind == SkillKind.Elemental)
        {
            atb = AttributeData.MT;
            d   = elementalND;
        }
        else if (kind == SkillKind.Physical)
        {
            atb = AttributeData.AT;
            d   = physicalND;
        }
        else if (kind == SkillKind.Arcane)
        {
            d = arcaneND;
        }
        if (physicalND.dataTag == NumberData.DataType.percent)
        {
            for (int i = 0; i < SkillGrade; i++)
            {
                d.DATA += 10;
            }

            HSkilInfo hsi = GetComponent <HSkilInfo>();
            if (hsi && hsi.UseAppointedAtb)
            {
                atb = hsi.Atb;
            }
            else
            {
                if (kind == SkillKind.Arcane)
                {
                    B = (int)((source.ThisBasicRoleProperty().ReadRA(AttributeData.MT)
                               + source.ThisBasicRoleProperty().ReadRA(AttributeData.AT)) / 2
                              * d.DECIMAL);
                }
            }
            B = (int)(source.ThisBasicRoleProperty().ReadRA(atb) * d.DECIMAL);
        }
        else
        {
            B = physicalND.DATA;
        }
        if (HSModifity)
        {
            B = HSModifity.AllResult(source, target, kind, SkillGrade);
        }
        B = ValChangedByCharacterType(source, target, B);
        return(B);
    }
Ejemplo n.º 3
0
    public static int AddTpAfterSkill(SDConstants.AddMpTpType addType
                                      , BattleRoleData source)
    {
        if (source._Tag != SDConstants.CharacterType.Hero)
        {
            return(0);
        }
        GDEHeroData hero      = SDDataManager.Instance.getHeroByHashcode(source.unitHashcode);
        HeroInfo    info      = SDDataManager.Instance.getHeroInfoById(source.UnitId);
        int         baseTp    = info.RAL.Tp + hero.RoleAttritubeList.AD_List[(int)AttributeData.Tp];
        int         currentTp = source.ThisBasicRoleProperty().RoleBasicRA.Tp;
        //
        float upRate0 = currentTp * 1f / baseTp;
        float upRate1 = 1;

        if (addType == SDConstants.AddMpTpType.PreferMp ||
            addType == SDConstants.AddMpTpType.PreferBoth)
        {
            upRate1 = 1.5f;
        }
        else if (addType == SDConstants.AddMpTpType.LowMp ||
                 addType == SDConstants.AddMpTpType.LowBoth)
        {
            upRate1 = 0.5f;
        }
        else if (addType == SDConstants.AddMpTpType.YearnMp ||
                 addType == SDConstants.AddMpTpType.YearnBoth)
        {
            upRate1 = 2f;
        }
        return((int)(SDConstants.SkillAddMinMp * upRate0 * upRate1));
    }
Ejemplo n.º 4
0
    public void initThisPanel(BattleRoleData unit)
    {
        NameString = unit.ThisBasicRoleProperty().Name;
        if (!unit.IsEnemy)
        {
            RaceString   = heroRace((int)unit.HeroProperty._hero._heroRace);
            CareerString = heroCareer((int)unit.HeroProperty._hero._heroJob);
            if (unit.HeroProperty._hero.nameBeforeId != 0)
            {
                NameBeforeString = nameBeforeReturn(unit.HeroProperty._hero.nameBeforeId);
            }
        }
        else
        {
            RaceString   = enemyRace((int)unit.EnemyProperty._enemy.race);
            CareerString = enemyCareer((int)unit.EnemyProperty._enemy._job);
        }
        string all = "";

        all += NameBeforeString != null?"<size=10><i>" + NameBeforeString + "</i></size></n>"
            : "<size=10> </size></n>";
        all += "<size=20>" + NameString + "</size></n>";
        all += CareerString != null ? CareerString : "";
        all += CareerString != null && RaceString != null ? "·" : ""
               + (RaceString != null ? RaceString : "</n>");
        all      += DetailString;
        TEXT.text = all;
    }
Ejemplo n.º 5
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);
    }
Ejemplo n.º 6
0
    /// <summary>
    /// 状态造成的属性影响计算
    /// </summary>
    /// <param name="source"></param>
    /// <param name="target"></param>
    /// <returns></returns>
    public override RoleAttributeList ralCaused(BattleRoleData source, BattleRoleData target)
    {
        RoleAttributeList ral = new RoleAttributeList();
        //RoleAttributeList sourceRal = source.ThisBasicRoleProperty()._role.ThisRoleAttributes.Clone;
        RoleAttributeList targetRal = source.ThisBasicRoleProperty()._role.ThisRoleAttributes.Clone;

        for (int i = 0; i < AllChangesInRAL.Count; i++)
        {
            ChangeInRAL c = AllChangesInRAL[i];
            int         d = c.ChangeData.DATA;
            if (!c.IsForRD)
            {
                if (c.UseDataType == ChangeInRAL.DataOrigin.normal)
                {
                    if (c.ChangeData.dataTag == NumberData.DataType.percent)
                    {
                        d = (int)(targetRal.read(c.ADTag)
                                  * c.ChangeData.DECIMAL);
                    }
                }
                else if (c.UseDataType == ChangeInRAL.DataOrigin.otherAtb)
                {
                    int ori = targetRal.read(c.OtherAtb);
                    d = (int)(ori * AllRandomSetClass.SimplePercentToDecimal(c.UsePercent));
                }
                else if (c.UseDataType == ChangeInRAL.DataOrigin.armor)
                {
                    RoleAttributeList _ral = getRALFromEquip(c.UsePos, source, target).Clone;
                    d = _ral.read(c.ADTag);
                }

                ral.Add(d, c.ADTag);
            }
            else
            {
                if (c.UseDataType == ChangeInRAL.DataOrigin.normal)
                {
                    if (c.ChangeData.dataTag == NumberData.DataType.percent)
                    {
                        d = (int)(targetRal.read(c.STag)
                                  * c.ChangeData.DECIMAL);
                    }
                }
                else if (c.UseDataType == ChangeInRAL.DataOrigin.otherAtb)
                {
                    int ori = targetRal.read(c.OtherAtb);
                    d = (int)(ori * AllRandomSetClass.SimplePercentToDecimal(c.UsePercent));
                }
                else if (c.UseDataType == ChangeInRAL.DataOrigin.armor)
                {
                    RoleAttributeList _ral = getRALFromEquip(c.UsePos, source, target).Clone;
                    d = _ral.read(c.STag);
                }

                ral.Add(d, c.STag);
            }
        }
        return(ral);
    }
Ejemplo n.º 7
0
    public IEnumerator IERefreshState()
    {
        yield return(new WaitForSeconds(0.5f));

        maxTp       = _unit.ThisBasicRoleProperty()._role.ReadCurrentRoleRA((int)AttributeData.Tp);
        currentTp   = 0;
        TpText.text = "" + currentTp;
        checkTpFull();
    }
Ejemplo n.º 8
0
    public IEnumerator IEStartSkill(BattleRoleData source, BattleRoleData target, NumberData _val)
    {
        source.playMoveTowardAnimation(target.unit_model.position);
        yield return(new WaitForSeconds(moveTowardAndBackTime));

        //
        source.unit_character_model.CurrentCharacterModel.ChangeModelAnim
            (source.unit_character_model.CurrentCharacterModel.anim_attack, false);
        SLEffectManager.Instance.playCommonEffectSlash(target.transform.position);
        yield return(new WaitForSeconds(SDConstants.AnimTime_ATTACK - hitTime));

        //
        float r = 0;

        if (_val.dataTag == NumberData.DataType.integer)
        {
            r = AllRandomSetClass.SimplePercentToDecimal(_val.DATA);
        }
        else
        {
            r = _val.DECIMAL;
        }

        //目标敌人级别越高成功率越低
        int level = target.ThisBasicRoleProperty().LEVEL;

        for (int i = 0; i < level; i++)
        {
            r *= 0.8f;
        }

        //
        if (UnityEngine.Random.Range(0, 1) < r)//捕获成功
        {
            SDDataManager.Instance.AddSlave(target.ThisBasicRoleProperty().ID);
            target.HpController.FadeAndDisappear();
        }
        source.unit_character_model.CurrentCharacterModel.ChangeModelAnim
            (source.unit_character_model.CurrentCharacterModel.anim_idle, true);
        source.playMoveBackAnimation();
        yield return(new WaitForSeconds(moveTowardAndBackTime));

        StartCoroutine(IEWaitForEnd(source));
    }
Ejemplo n.º 9
0
    public int PDUsingRA_PerSkillGrade; //%
    #endregion
    public int UsingRAShow(BattleRoleData source, AttributeData tag, int LEVEL, int SkillGrade)
    {
        int bc1
            = (int)(AllRandomSetClass.SimplePercentToDecimal(BCPerformDataUsingRA
                                                             + PDUsingRA_PerSkillGrade * SkillGrade
                                                             + PDUsingRA_PerLevel * LEVEL)
                    * source.ThisBasicRoleProperty().ReadRA(tag));//计算受source属性影响值

        return(bc1);
    }
Ejemplo n.º 10
0
    public void BuildThisStatusVision(BattleRoleData unit, HP_Controller hpC)
    {
        heroUnit = unit;
        HpC      = hpC;

        heroNameText.text = heroUnit.ThisBasicRoleProperty().Name;


        RefreshHeroStatus();
    }
Ejemplo n.º 11
0
    public int ValCaused(BattleRoleData source, BattleRoleData target)
    {
        HSExportDmgModifity S = GetComponent <HSExportDmgModifity>();

        if (S)
        {
            //int level = source.ThisBasicRoleProperty().LEVEL;
            return(S.AllResult(source, target, AttributeData.MT, SkillGrade));
        }
        return(source.ThisBasicRoleProperty().ReadRA(AttributeData.MT));
    }
Ejemplo n.º 12
0
 public void RefreshUnitSpeeds(List <BattleRoleData> allUnits)
 {
     for (int i = 0; i < allUnits.Count; i++)
     {
         BattleRoleData BUnit = allUnits[i];
         //if(!BUnit.IsDead)
         int speed = BUnit.ThisBasicRoleProperty()._role.speed;
         standardSpeedArray[i] = speed;
     }
     BuildABMoveSpeed(allActionUnits);
 }
Ejemplo n.º 13
0
    public IEnumerator IEStartSkill(BattleRoleData source, BattleRoleData target)
    {
        source.playMoveTowardAnimation(target.unit_model.position);
        yield return(new WaitForSeconds(moveTowardAndBackTime));

        source.unit_character_model.CurrentCharacterModel.ChangeModelAnim
            (source.unit_character_model.CurrentCharacterModel.anim_attack, false);
        SLEffectManager.Instance.playCommonEffectSlash(target.transform.position);
        yield return(new WaitForSeconds(SDConstants.AnimTime_ATTACK - hitTime));

        int damage = dmgCaused(source, target);

        #region 计算技能状态
        source.SkillCheck(this, target);
        IsCausedCritDmg = source.CritHappen;
        IsCausedMiss    = !source.AccurHappen;
        IsCausedFault   = source.FaultHappen;
        if (IsCausedCritDmg)
        {
            float criD
                = AllRandomSetClass.SimplePercentToDecimal
                      (source.ThisBasicRoleProperty().CRIDmg + 100);
            damage = (int)(damage * criD);
        }
        int NowExpect = (int)(UnityEngine.Random.Range(-1f, 1f) * source.ExpectResult);
        #endregion
        damage += NowExpect;
        #region  输技能状态
        target.HpController.isCriDmg    = IsCausedCritDmg;
        target.HpController.isEvoHappen = IsCausedMiss;
        target.HpController.isFault     = IsCausedFault;
        #endregion

        damage = (int)(damage * AllRandomSetClass.SimplePercentToDecimal(100 + target.PhysModify));

        Debug.Log(source.name + " slash cause " + damage + " damage to " + target.name);
        target.HpController.getDamage(damage, SkillKind.Physical);

        yield return(new WaitForSeconds(hitTime));

        //yield return new WaitForSeconds(skillLastTime);
        source.unit_character_model.CurrentCharacterModel.ChangeModelAnim
            (source.unit_character_model.CurrentCharacterModel.anim_idle, true);
        source.playMoveBackAnimation();
        yield return(new WaitForSeconds(moveTowardAndBackTime));

        StartCoroutine(IEWaitForEnd(source));
    }
Ejemplo n.º 14
0
    public void refreshBtnState()
    {
        Debug.Log("Refresh This SKill:" + this.name + " State");
        bool btnEnable = true;

        #region 该技能存在使用次数限制
        if (SkillFiniteTimes > 0)
        {
            if (SFT_CurrentTimes >= SkillFiniteTimes)
            {
                btnEnable = false;
            }
            //显示当前剩余次数
        }
        #endregion
        BattleRoleData   Unit      = BM._currentBattleUnit;
        OneRoleClassData R         = Unit.ThisBasicRoleProperty()._role;
        RoleBarChart     CurrentBC = R.ReadAllMaxSSD;
        #region 该技能消耗超过角色现有量
        bool flag = CheckIfCanConsume(Unit);
        if (!flag)
        {
            btnEnable = false;
        }
        #endregion
        #region 角色状态影响技能
        if (Unit.checkPerState(StateTag.Hush))
        {
            if (this is NormalAttack)
            {
                btnEnable = true;
            }
            else
            {
                btnEnable = false;
            }
        }
        #endregion
        SkillDisable = !btnEnable;
        if (!btnEnable)//显示技能是否可以继续使用
        {
            _btn.interactable = false;
        }
        else
        {
            _btn.interactable = true;
        }
    }
Ejemplo n.º 15
0
    public IEnumerator IEStartSkill(BattleRoleData source, BattleRoleData target, NumberData _val, bool useSpecial = false)
    {
        source.unit_character_model.CurrentCharacterModel.ChangeModelAnim
            (source.unit_character_model.CurrentCharacterModel.anim_cast, false);
        SLEffectManager.Instance.playCommonEffectCast(source.transform.position);
        yield return(new WaitForSeconds(castLastTime));

        int val = _val.DATA;

        if (_val.dataTag == NumberData.DataType.percent)
        {
            val = (int)(target.HpController.MaxHp * _val.DECIMAL);
        }

        if (useSpecial)
        {
            #region 计算技能状态
            source.SkillCheck(this, target);
            IsCausedCritDmg = source.CritHappen;
            IsCausedMiss    = !source.AccurHappen;
            IsCausedFault   = source.FaultHappen;
            float criD = 1;
            if (IsCausedCritDmg)
            {
                criD
                    = AllRandomSetClass.SimplePercentToDecimal
                          (source.ThisBasicRoleProperty().CRIDmg + 100);
            }
            int NowExpect = (int)(UnityEngine.Random.Range(-1f, 1f) * source.ExpectResult);
            #endregion
            val  = (int)(val * criD);
            val += NowExpect;
            #region  输技能状态
            target.HpController.isCriDmg    = IsCausedCritDmg;
            target.HpController.isEvoHappen = IsCausedMiss;
            target.HpController.isFault     = IsCausedFault;
            #endregion
        }
        SLEffectManager.Instance.playCommonEffectLocalBarChartAdd(target.transform.position);
        yield return(new WaitForSeconds(effectLastTime));

        Debug.Log(source.name + " heal cause " + val + " to " + target.name);
        target.HpController.addHp(val);
        yield return(new WaitForSeconds(skillLastTime));

        StartCoroutine(IEWaitForShortEnd(source));
    }
Ejemplo n.º 16
0
    public bool StatePossibility(BattleRoleData target)
    {
        if (AimAtSelf)
        {
            Success = AllRandomSetClass.PercentIdentify(StatePossibilityBuff);
            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);
    }
Ejemplo n.º 17
0
    public virtual int dmgCaused(BattleRoleData source, BattleRoleData target)
    {
        SkillKind     kind = SkillKind.Physical;
        AttributeData Atb  = AttributeData.AT;
        HSkilInfo     hsi  = GetComponent <HSkilInfo>();

        if (hsi)
        {
            kind = hsi.kind;
            if (hsi.UseAppointedAtb)
            {
                Atb = hsi.Atb;
            }
            else
            {
                if (kind == SkillKind.Physical)
                {
                    Atb = AttributeData.AT;
                }
                else if (kind == SkillKind.Elemental)
                {
                    Atb = AttributeData.MT;
                }
                else if (kind == SkillKind.Arcane)
                {
                    Atb = AttributeData.MT;
                }
            }
        }
        int atk = source.ThisBasicRoleProperty().ReadRA(Atb);

        if (atk <= 0)
        {
            atk = SDConstants.MinDamageCount;
        }
        HSExportDmgModifity S = HSModifity;

        if (S)
        {
            atk = S.AllResult(source, target, kind, SkillGrade);
        }

        atk = ValChangedByCharacterType(source, target, atk);

        return(atk);
    }
Ejemplo n.º 18
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);
     }
 }
Ejemplo n.º 19
0
    public IEnumerator IEStartSkill(BattleRoleData source, BattleRoleData target, int dmgVal)
    {
        source.unit_character_model.CurrentCharacterModel.ChangeModelAnim
            (source.unit_character_model.CurrentCharacterModel.anim_cast, false);
        SLEffectManager.Instance.playCommonEffectCast(source.transform.position);
        yield return(new WaitForSeconds(castLastTime));

        source.playBulletCastAnimation(bullet, source.unit_model.position, target.unit_model.position);
        yield return(new WaitForSeconds(bulletLastTime));

        #region 计算技能状态
        source.SkillCheck(this, target);
        IsCausedCritDmg = source.CritHappen;
        IsCausedMiss    = !source.AccurHappen;
        IsCausedFault   = source.FaultHappen;
        float criD = 1;
        if (IsCausedCritDmg)
        {
            criD
                = AllRandomSetClass.SimplePercentToDecimal
                      (source.ThisBasicRoleProperty().CRIDmg + 100);
        }
        int NowExpect = (int)(UnityEngine.Random.Range(-1f, 1f) * source.ExpectResult);
        #endregion
        dmgVal  = (int)(dmgVal * criD);
        dmgVal += NowExpect;
        Debug.Log(source.name + "shoot cause" + dmgVal + " damage to " + target.name);
        //source.unit_character_model.CurrentCharacterModel.ChangeModelAnim(SDConstants.AnimName_IDLE, true);
        #region  输技能状态
        target.HpController.isCriDmg    = IsCausedCritDmg;
        target.HpController.isEvoHappen = IsCausedMiss;
        target.HpController.isFault     = IsCausedFault;
        #endregion
        dmgVal = (int)(dmgVal * AllRandomSetClass.SimplePercentToDecimal(100 + target.PhysModify));
        target.HpController.getDamage(dmgVal, _skillKind);

        yield return(new WaitForSeconds(skillLastTime));

        StartCoroutine(IEWaitForEnd(source));
    }
Ejemplo n.º 20
0
    public bool CheckIfCanConsume(BattleRoleData source)
    {
        if (IsOmega)
        {
            if (source.MpController.currentMp < source.MpController.maxMp)
            {
                Debug.Log("无法消耗足量法力"); return(false);
            }
        }
        else
        {
            int bc = BCCostPerTime
                     + BCCostPerLevel * source.ThisBasicRoleProperty().LEVEL
                     + BCCostPerSkillGrade * skillgrade
                     + (int)(BCCostUsingPercent * source.MpController.maxMp * 0.01f);
            if (source.MpController.currentMp < bc && bc > 0)
            {
                Debug.Log("无法消耗足量法力"); return(false);
            }
        }

        Debug.Log("技能消耗符合条件");
        return(true);
    }
Ejemplo n.º 21
0
    /// <summary>
    /// 技能消耗
    /// </summary>
    /// <param name="source"></param>
    /// <param name="target"></param>
    public virtual void CalculateBeforeFunction(BattleRoleData source, BattleRoleData target)
    {
        int BC = BCCostPerTime;

        BC += BCCostPerLevel * source.ThisBasicRoleProperty().LEVEL;
        BC += BCCostPerSkillGrade * skillgrade;
        BC += (int)(BCCostUsingPercent * source.MpController.maxMp * 0.01f);
        //
        if (IsOmega)
        {
            BC = source.MpController.maxMp;
        }
        //
        source.MpController.consumeMp(BC);
        //
        if (GetComponent <HSkilInfo>())
        {
            UseSkillAddMpTp(source, GetComponent <HSkilInfo>().AfterwardsAddType);
        }
        else
        {
            UseSkillAddMpTp(source, SDConstants.AddMpTpType.PreferMp);
        }
    }
Ejemplo n.º 22
0
    //关卡开始时初始化所有行动单元,赋予速度
    public void initAction(List <BattleRoleData> allUnits)
    {
        stopAction();
        foreach (Transform t in actionUnitParent)
        {
            Destroy(t.gameObject);
        }
        //
        standardSpeedArray = new int[allUnits.Count];
        allActionUnits     = new List <ActionRoleData>();
        for (int i = 0; i < allUnits.Count; i++)
        {
            BattleRoleData BUnit      = allUnits[i];
            Transform      actionUnit = Instantiate(actionUnitPrefab) as Transform;
            actionUnit.SetParent(actionUnitParent);
            actionUnit.GetComponent <ActionRoleData>().nameText.text = BUnit.name;
            ActionRoleData unit = actionUnit.GetComponent <ActionRoleData>();
            //
            int speed = BUnit.ThisBasicRoleProperty()._role.ReadCurrentRoleRA(AttributeData.Speed);
            standardSpeedArray[i] = speed;
            unit.speed            = speed;
            //
            //actionUnit.GetComponent<Canvas>().sortingOrder = i;
            if (BUnit._Tag == SDConstants.CharacterType.Enemy)
            {
                actionUnit.position = startEnemyPos.position;
                unit.isEnemy        = true;
                if (BUnit.IsBoss)
                {
                    unit.headImage.initCharacterModelById
                        (BUnit.UnitId, SDConstants.CharacterAnimType.Enemy, 0.15f, true);
                }
                else
                {
                    unit.headImage.initCharacterModelById
                        (BUnit.UnitId, SDConstants.CharacterAnimType.Enemy, 0.3f, true);
                }
            }
            else
            {
                actionUnit.position = startHeroPos.position;
                unit.isEnemy        = false;
                int    hashcode = BUnit.unitHashcode;
                string heroId   = SDDataManager.Instance.getHeroIdByHashcode(hashcode);
                SDConstants.CharacterAnimType type
                    = (SDConstants.CharacterAnimType)
                          (SDDataManager.Instance.getHeroCareerById(heroId));
                //unit.headImage.initCharacterModel(hashcode, type, 3f);
            }
            actionUnit.localScale = Vector3.one;
            if (BUnit.ReadThisStateEnable(StateTag.Dizzy))
            {
                unit.stateBgImage.sprite = unit.stateSprites[1];
            }
            else
            {
                unit.stateBgImage.sprite = unit.stateSprites[0];
            }
            unit.battleUnit = BUnit;
            unit.isActed    = false;
            allActionUnits.Add(unit);
            if (BUnit.IsDead)
            {
                actionUnit.gameObject.SetActive(false);
            }
        }

        BuildABMoveSpeed(allActionUnits);
        //BM.NextActionUnit();
        startAction();
    }
Ejemplo n.º 23
0
    public IEnumerator IEStartSkill(BattleRoleData source, BattleRoleData target
                                    , int physicalVal, int elementalVal, int arcaneVal)
    {
        source.unit_character_model.CurrentCharacterModel.ChangeModelAnim
            (source.unit_character_model.CurrentCharacterModel.anim_cast, false);
        SLEffectManager.Instance.playCommonEffectCast(source.transform.position);
        yield return(new WaitForSeconds(castLastTime));

        source.playBulletCastAnimation(bullet, source.unit_model.position, target.unit_model.position);
        yield return(new WaitForSeconds(bulletLastTime));

        int d0 = physicalVal;
        int d1 = elementalVal;
        int d2 = arcaneVal;

        #region 计算技能状态
        source.SkillCheck(this, target);
        IsCausedCritDmg = source.CritHappen;
        IsCausedMiss    = !source.AccurHappen;
        IsCausedFault   = source.FaultHappen;
        if (IsCausedCritDmg)
        {
            float criD
                = AllRandomSetClass.SimplePercentToDecimal
                      (source.ThisBasicRoleProperty().CRIDmg + 100);
            d0 = (int)(d0 * criD);
            d1 = (int)(d1 * criD);
            d2 = (int)(d2 * criD);
        }
        #endregion
        #region Expect
        int NowExpect = (int)(UnityEngine.Random.Range(-1f, 1f) * source.ExpectResult);
        d0       += NowExpect;
        NowExpect = (int)(UnityEngine.Random.Range(-1f, 1f) * source.ExpectResult);
        d1       += NowExpect;
        NowExpect = (int)(UnityEngine.Random.Range(-1f, 1f) * source.ExpectResult);
        d2       += NowExpect;
        #endregion
        #region  输技能状态
        target.HpController.isCriDmg    = IsCausedCritDmg;
        target.HpController.isEvoHappen = IsCausedMiss;
        target.HpController.isFault     = IsCausedFault;
        #endregion
        float DECIMAL = AllRandomSetClass.SimplePercentToDecimal(100 + target.PhysModify);
        d0 = (int)(d0 * DECIMAL);
        d1 = (int)(d1 * DECIMAL);
        d2 = (int)(d2 * DECIMAL);

        Debug.Log(source.name + " slash cause "
                  + d0 + " physical damage "
                  + d1 + " elemental damage "
                  + d2 + " arcane damage"
                  + " to " + target.name);
        target.HpController.getDamage(d0, SkillKind.Physical);
        target.HpController.getDamage(d1, SkillKind.Elemental);
        target.HpController.getDamage(d2, SkillKind.Arcane);

        yield return(new WaitForSeconds(skillLastTime));

        StartCoroutine(IEWaitForEnd(source));
    }
Ejemplo n.º 24
0
    public int AllResult(BattleRoleData source, BattleRoleData target, AttributeData tag, int SkillGrade)
    {
        int LEVEL = source.ThisBasicRoleProperty().LEVEL;

        return(UsingRAShow(source, tag, LEVEL, SkillGrade));
    }
Ejemplo n.º 25
0
 public void initHpPanel()
 {
     if (_characterType == SDConstants.CharacterType.Hero)
     {
         ShowHpStatus = true;
     }
     else
     {
         ShowHpStatus = false;
         if (ShowHpStatus || SDGameManager.Instance.showEnemyState)
         {
             ShowHpStatus = true;
         }
         if (_unit.ThisBasicRoleProperty().ForceShield > 0)
         {
             foreShieldImg.transform.localScale = Vector3.one;
         }
         else
         {
             foreShieldImg.transform.localScale = Vector3.zero;
         }
     }
     reFreshState();
 }