Exemplo n.º 1
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);
    }
Exemplo n.º 2
0
    public void RefreshCERAL()
    {
        RoleAttributeList ral = ThisRoleAttributes.Clone;

        ral.Add(AllARevision);
        ral.Add(extraRALChangeData);
        CurrentExportRAL = ral.Clone;
    }
Exemplo n.º 3
0
 public void CheckRaceEffect()
 {
     #region heroSide
     List <BattleRoleData> humans = BM.Remaining_SRL.FindAll(x =>
     {
         return(x.HeroProperty._hero._heroRace == Race.Human);
     });
     if (humans.Count > 1)
     {
         int count = humans.Count;
         selfRALChange.Add(5 * count, AttributeData.AT);
         selfRALChange.Add(5 * count, AttributeData.MT);
         if (count % 2 == 0)
         {
             BM.heroToEnemyDmg_event += (x) =>
             {
                 return((int)(x * AllRandomSetClass.SimplePercentToDecimal(100 + count / 2 * 5)));
             };
         }
     }
     //
     List <BattleRoleData> elfs = BM.Remaining_SRL.FindAll(x =>
     {
         return(x.HeroProperty._hero._heroRace == Race.Elf);
     });
     if (elfs.Count > 1)
     {
         int count = elfs.Count;
         selfRALChange.Add(5 * count, AttributeData.AT);
         selfRALChange.Add(5 * count, AttributeData.MT);
         if (count % 2 == 0)
         {
             selfRALChange.Add(count, AttributeData.Crit);
             selfRALChange.Add(count, AttributeData.Evo);
         }
     }
     //
     List <BattleRoleData> dragonborns = BM.Remaining_SRL.FindAll(x =>
     {
         return(x.HeroProperty._hero._heroRace == Race.Dragonborn);
     });
     if (dragonborns.Count > 1)
     {
         int count = dragonborns.Count;
         selfRALChange.Add(5 * count, AttributeData.AT);
         selfRALChange.Add(5 * count, AttributeData.MT);
         if (count % 2 == 0)
         {
             BM.enemyToHeroDmg_event += (x) =>
             {
                 return((int)(x * AllRandomSetClass.SimplePercentToDecimal(100 - count / 2 * 5)));
             };
         }
     }
     #endregion
     #region enemySide
     //for(int i=0;i<)
     #endregion
 }
Exemplo n.º 4
0
    public static RoleAttributeList RALAddedByLevel(RoleAttributeList basicRAL)
    {
        RoleAttributeList ral = basicRAL;
        int lvl = SDGameManager.Instance.currentLevel;
        //每章结束循环利用数据
        int index = lvl / SDConstants.LevelNumPerChapter;

        ral.AddPerc(75 * index, AttributeData.Hp);
        ral.AddPerc(75 * index, AttributeData.AT);
        ral.AddPerc(75 * index, AttributeData.AD);
        ral.AddPerc(75 * index, AttributeData.MT);
        ral.AddPerc(75 * index, AttributeData.MD);
        ral.Add(5 * index, AttributeData.Evo);
        ral.Add(10 * index, AttributeData.Accur);
        ral.Add(2 * index, AttributeData.Speed);
        return(ral);
    }
Exemplo n.º 5
0
    /// <summary>
    /// 全战斗属性百分比增减+-()%
    /// </summary>
    /// <param name="ForwardRA">原属性</param>
    /// <param name="Percent">增加或减少的百分比</param>
    /// <returns></returns>
    public static RoleAttributeList RAChangeInPercent(RoleAttributeList ForwardRA, int Percent)
    {
        float             Decimal = AllRandomSetClass.SimplePercentToDecimal(Percent);
        RoleAttributeList RA      = ForwardRA;

        for (int i = 0; i < (int)AttributeData.End; i++)
        {
            AttributeData Tag = (AttributeData)i;
            RA.Add((int)(RA.read(Tag) * Decimal), Tag);
        }
        for (int i = 0; i < (int)StateTag.End; i++)
        {
            StateTag Tag = (StateTag)i;
            RA.Add((int)(RA.read(Tag) * Decimal), Tag);
        }
        return(RA);
    }
Exemplo n.º 6
0
    public void initHero(int heroHashCode)
    {
        unitHashcode = heroHashCode;
        SDHero h;

        if (GetComponent <SDHero>())
        {
            h = GetComponent <SDHero>();
        }
        else
        {
            h = gameObject.AddComponent <SDHero>();
        }
        HeroProperty._hero = h;
        GDEHeroData heroData
            = SDDataManager.Instance.GetHeroOwnedByHashcode(unitHashcode);

        //
        if (heroData != null)
        {
            HeroProperty._hero.nameBeforeId = heroData.nameBeforeId;

            //
            UnitId          = SDDataManager.Instance.getHeroIdByHashcode(unitHashcode);
            HeroProperty.ID = HeroProperty._hero.ID = UnitId;
            ROHeroData dal = SDDataManager.Instance
                             .getHeroDataByID(UnitId, heroData.starNumUpgradeTimes);
            //
            unit_character_model.initHeroCharacterModel(heroHashCode, SDConstants.HERO_MODEL_RATIO);
            //
            int grade = SDDataManager.Instance.getLevelByExp(heroData.exp);
            HeroProperty._hero.grade = grade;

            RoleAttributeList _ral = dal.ExportRAL;
            _ral.Add(RoleAttributeList.GDEToRAL(heroData.RoleAttritubeList));
            //
            Race _race = dal.Info.Race.Race;
            //
            HeroProperty._hero.initData_Hero
                (dal.Info.Career.Career, _race
                , grade, 0, dal.starNum
                , _ral
                , dal.CRIDmg, dal.DmgReduction, dal.DmgReflection, dal.RewardRate
                , dal.BarChartRegendPerTurn, UnitId, dal.Info.Name, heroData.wakeNum);;
            HeroProperty._hero.gender = (CharacterSex)heroData.sex;
            addSkillByCareerByRaceByStarnum(heroHashCode, dal.starNum);
        }
    }
Exemplo n.º 7
0
    public void initData_supplement_H_Caster(RoleAttributeList ra, int grade)
    {
        RoleAttributeList gradeEffect = AdolescentSet.AttritubeShowByLevel_basic(grade
                                                                                 , 0.6f       //生命
                                                                                 , 0.75f      //法力
                                                                                 , 0.6f       //怒气
                                                                                 , 0.2f, 0.2f //物攻防
                                                                                 , 1.1f, 0.6f //法攻防
                                                                                 );

        RoleBasicRA = ra.Clone;
        RoleBasicRA.Add(gradeEffect);//等级加成
        AddTempleMultiplier(Job.Priest);
        //额外效果
        CRIDmg += 25;
    }
Exemplo n.º 8
0
    public void initData_supplement_H_Fighter(RoleAttributeList ra, int grade)
    {
        RoleAttributeList gradeEffect = AdolescentSet.AttritubeShowByLevel_basic(grade
                                                                                 , 1.2f       //生命
                                                                                 , 0.1f       //法力
                                                                                 , 1f         //怒气
                                                                                 , 0.2f, 1f   //物攻防
                                                                                 , 0.1f, 0.1f //法攻防
                                                                                 );

        RoleBasicRA = ra.Clone;
        RoleBasicRA.Add(gradeEffect);//等级加成
        AddTempleMultiplier(Job.Fighter);
        //额外效果
        DmgReduction += 10;
    }
Exemplo n.º 9
0
    public void checkAllStandardStates()
    {
        RoleAttributeList RAL = new RoleAttributeList();

        for (int i = 0; i < CurrentStateList.Count; i++)
        {
            if (CurrentStateList[i].LastTime <= 0)
            {
                CurrentStateList.RemoveAt(i);
            }
            else
            {
                if (CurrentStateList[i].StateEndType == StandardState.StateEndType.time)
                {
                    CurrentStateList[i].LastTime--;
                }
                //
                RAL.Add(CurrentStateList[i].RAL);
                stateExtraDamage += CurrentStateList[i].ExtraDmg;
                AllRegend        += CurrentStateList[i].BarChart;
                CurrentStateList[i].ExtraFunction(this);
            }
        }
        Debug.Log("StandardState_IfHaveData: " + RAL.HaveData);
        ThisBasicRoleProperty()._role.AllARevision.Add(RAL);
        Debug.Log("AllARevision_IfHaveData: "
                  + ThisBasicRoleProperty()._role.AllARevision.HaveData);
        //
        if (RAL.AllAttributeData.ToList().Exists(x => x > 0) ||
            RAL.AllResistData.ToList().Exists(x => x > 0))
        {
            Unit_Buff.gameObject.SetActive(true);
        }
        else
        {
            Unit_Buff.gameObject.SetActive(false);
        }
        if (RAL.AllAttributeData.ToList().Exists(x => x < 0) ||
            RAL.AllResistData.ToList().Exists(x => x < 0))
        {
            Unit_Debuff.gameObject.SetActive(true);
        }
        else
        {
            Unit_Debuff.gameObject.SetActive(false);
        }
    }