Example #1
0
 public void AddData(string[] lineArray)
 {
     for (int i = 1; i < lineArray.Length; i++)
     {
         lineArray[i] = lineArray[i].Replace("\r", "");
         string[]           strArray = lineArray[i].Split(","[0]);
         StaticSkillLevelVo vo       = new StaticSkillLevelVo(strArray);
         _datapool.Add(vo);
     }
 }
Example #2
0
 public void AddSkill(ServantVo vo, StaticSkillLevelVo skillVo)
 {
     if (vo.skills.Count < vo.maxSkillNum)
     {
         SkillVo newSkill = new SkillVo();
         newSkill.id    = skillVo.skillId;
         newSkill.level = skillVo.level;
         vo.skills.Add(newSkill);
     }
 }
Example #3
0
    private void UpdateInfo()
    {
        if (nowVo == null)
        {
            return;
        }
        StaticSkillVo      staticSkillVo      = StaticDataPool.Instance.staticSkillPool.GetStaticDataVo(nowVo.id);
        StaticSkillLevelVo staticSkillLevelVo = StaticDataPool.Instance.staticSkillLevelPool.GetStaticDataVo(nowVo.id, nowVo.level);

        nowIcon.sprite = ResourceManager.Instance.GetSkillIcon(staticSkillVo.icon);
        nowName.text   = staticSkillVo.skillname;
        nowDesc.text   = staticSkillVo.desc;
        nowLevel.text  = "Lv." + nowVo.level;
        needExp.text   = "需要灵魂:" + Tools.ChangeNum(staticSkillLevelVo.needExp);
    }
Example #4
0
 public int LevelUp()
 {
     //0 满级 1 经验不足 2 成功
     if (level == 10)
     {
         return(0);
     }
     else
     {
         StaticSkillLevelVo staticVo = StaticDataPool.Instance.staticSkillLevelPool.GetStaticDataVo(id, level);
         if (DataManager.Instance.roleVo.exp >= staticVo.needExp)
         {
             DataManager.Instance.roleVo.exp -= staticVo.needExp;
             GameRoot.Instance.evt.CallEvent(GameEventDefine.ROLE_INFO, null);
             level += 1;
             return(2);
         }
         else
         {
             return(1);
         }
     }
 }
Example #5
0
    protected virtual void SkillAttack(BaseUnit baseUnit)
    {
        StaticSkillLevelVo nowSkill = skillList[Random.Range(0, skillList.Count)];

        if (nowMp >= nowSkill.cost)
        {
            nowMp -= nowSkill.cost;
        }
        float attackNum = 0;
        float atk       = 0;
        float def       = 0;

        critRate = 1 / (1 + 10000 / critNum);
        duckRate = 1 / (1 + 10000 / duckNum);
        bool ifCrit = Random.Range(0f, 1f) < critRate;

        //对敌人的效果
        if (nowSkill.type == 1)//法术
        {
            atk = magicAttack;
            def = baseUnit.magicDefance;
        }
        else if (nowSkill.type == 2)//物理
        {
            atk = Random.Range(attackSmall, attackBig);
            def = baseUnit.magicDefance;
        }
        else
        {
            attackNum = 0;
        }
        if (Random.Range(0f, 1f) < duckRate)
        {
            attackNum = 0;
        }
        else
        {
            if (nowSkill.targetType == 1)//百分比伤害
            {
                attackNum = atk * Random.Range(nowSkill.targetMin, nowSkill.targetMax) * (ifCrit ? critDamage : 1.0f) * (1 - (def / (baseUnit.defanceRate * baseUnit.level + def)));
            }
            else if (nowSkill.targetType == 2)//数值伤害
            {
                attackNum = (atk + Random.Range(nowSkill.targetMin, nowSkill.targetMax)) * (ifCrit ? critDamage : 1.0f) * (1 - (def / (baseUnit.defanceRate * baseUnit.level + def)));
            }
        }
        baseUnit.Hurt(attackNum);
        //对自己的效果,依据属性(0无效果1伤害2血量3蓝量4攻击小5攻击大6护甲7法攻8法抗9固定数值10暴击11闪避12最大血量)
        switch (nowSkill.selfDepend)
        {
        case 1: Effect(nowSkill.selfType, attackNum * nowSkill.selfValue); break;

        case 2: Effect(nowSkill.selfType, nowHp * nowSkill.selfValue); break;

        case 3: Effect(nowSkill.selfType, nowMp * nowSkill.selfValue); break;

        case 4: Effect(nowSkill.selfType, attackSmall * nowSkill.selfValue); break;

        case 5: Effect(nowSkill.selfType, attackBig * nowSkill.selfValue); break;

        case 6: Effect(nowSkill.selfType, defance * nowSkill.selfValue); break;

        case 7: Effect(nowSkill.selfType, magicAttack * nowSkill.selfValue); break;

        case 8: Effect(nowSkill.selfType, magicDefance * nowSkill.selfValue); break;

        case 9: Effect(nowSkill.selfType, nowSkill.selfValue); break;

        case 10: Effect(nowSkill.selfType, critNum * nowSkill.selfValue); break;

        case 11: Effect(nowSkill.selfType, duckNum * nowSkill.selfValue); break;

        case 12: Effect(nowSkill.selfType, maxHp * nowSkill.selfValue); break;

        default: break;
        }
        if (nowSkill.buffId != 0)
        {
            if (Random.Range(0, 1) < nowSkill.buffRate)
            {
                if (nowSkill.buffTarget == 0)
                {
                    baseUnit.AddBuff(nowSkill.buffId, nowSkill.level, this);
                }
                else if (nowSkill.buffTarget == 1)
                {
                    AddBuff(nowSkill.buffId, nowSkill.level, this);
                }
            }
        }
    }