CalcAttribute() 공개 메소드

public CalcAttribute ( ) : void
리턴 void
예제 #1
0
        private bool Action_Equip_Operation(ActionInfo info, PlayerObject play)
        {
            String[] option = info.param.Split(' ');
            String command = option[0].ToLower();
            RoleItemInfo role_item = null;
            switch (command)
            {
                case "checkequip": //检测装备位置是否存在
                    {
                        byte postion = Convert.ToByte(option[1]);
                        role_item = play.GetItemSystem().GetEquipByPostion(postion);
                        return role_item == null ? false : true;
                    }
                case "setequippro": //设置装备属性
                    {
                        byte postion = Convert.ToByte(option[1]);
                        role_item = play.GetItemSystem().GetEquipByPostion(postion);
                        if (role_item == null) return false;
                        String op = option[2];
                        bool ret = true;
                        switch (op)
                        {
                            case "shui_attack":
                                {
                                    String opex = option[3];
                                    byte v = Convert.ToByte(option[4]);
                                    switch (opex)
                                    {
                                        case "=":
                                            {    role_item.shui_attack = v;   break; }
                                        case "-":
                                            {   role_item.shui_attack -= v;     break;  }
                                        case "+":
                                            {   role_item.shui_attack += v; break; }
                                    }
                                    break;
                                }
                            case "di_attack":
                                {
                                    String opex = option[3];
                                    byte v = Convert.ToByte(option[4]);
                                    switch (opex)
                                    {
                                        case "=":    {   role_item.di_attack = v;  break;  }
                                        case "-":   {   role_item.di_attack -= v;     break; }
                                        case "+": {   role_item.di_attack += v;  break; }
                                    }
                                    break;

                                }
                            case "huo_attack":
                                {
                                    String opex = option[3];
                                    byte v = Convert.ToByte(option[4]);
                                    switch (opex)
                                    {
                                        case "=":{   role_item.huo_attack = v;  break;  }
                                        case "-": {   role_item.huo_attack -= v;   break;  }
                                        case "+":  {    role_item.huo_attack += v;     break;  }
                                    }
                                    break;

                                }
                            case "feng_attack":
                                {
                                    String opex = option[3];
                                    byte v = Convert.ToByte(option[4]);
                                    switch (opex)
                                    {
                                        case "=": {   role_item.feng_attack = v;     break;    }
                                        case "-":     {         role_item.feng_attack -= v;     break;       }
                                        case "+":  {        role_item.feng_attack += v;   break;      }
                                    }
                                    break;

                                }
                            case "hole": //装备打洞 0为第一个洞 1为第二个洞 2为第三个洞
                                {
                                   String opex = option[3];
                                    byte v = Convert.ToByte(option[4]);

                                    switch (opex)
                                    {
                                        case "=": { role_item.OpenGem(v); break; }

                                    }
                                    break;
                                }
                            default:
                                {
                                    ret = false;
                                    break;
                                }
                        }
                        play.GetItemSystem().UpdateItemInfo(role_item.id);
                        play.CalcAttribute();//重新计算属性
                        return ret;
                    }
                case "checkequippro": //获取装备属性
                    {
                        byte postion = Convert.ToByte(option[1]);
                        role_item = play.GetItemSystem().GetEquipByPostion(postion);
                        if (role_item == null) return false;
                        String op = option[2];
                        String opex = option[3];
                        int v = Convert.ToInt32(option[4]);
                        switch (op)
                        {
                            case "shui_attack":
                                {
                                    switch (opex)
                                    {
                                        case "=":
                                            { return role_item.shui_attack == v; }
                                        case ">":
                                            { return role_item.shui_attack > v;}
                                        case ">=":
                                            {return role_item.shui_attack >= v;}
                                        case "<":
                                            {return role_item.shui_attack < v;    }
                                        case "<=":
                                            {  return role_item.shui_attack <= v;}
                                        default: { break; }
                                    }
                                    break;
                                }
                            case "di_attack":
                                {
                                    switch (opex)
                                    {
                                        case "=":
                                            {     return role_item.di_attack == v; }
                                        case ">":
                                            {return role_item.di_attack > v; }
                                        case ">=":
                                            { return role_item.di_attack >= v; }
                                        case "<":
                                            {  return role_item.di_attack < v; }
                                        case "<=":
                                            { return role_item.di_attack <= v;}
                                        default: { break; }
                                    }
                                    break;
                                }
                            case "huo_attack":
                                {
                                    switch (opex)
                                    {
                                        case "=":
                                            {   return role_item.huo_attack == v; }
                                        case ">":
                                            {       return role_item.huo_attack > v; }
                                        case ">=":
                                            {     return role_item.huo_attack >= v;   }
                                        case "<":
                                            {     return role_item.huo_attack < v;  }
                                        case "<=":
                                            {    return role_item.huo_attack <= v;  }
                                        default: { break; }
                                    }
                                    break;
                                }
                            case "feng_attack":
                                {
                                    switch (opex)
                                    {
                                        case "=":      {    return role_item.feng_attack == v;  }
                                        case ">":     {     return role_item.feng_attack > v;  }
                                        case ">=":  {    return role_item.feng_attack >= v;  }
                                        case "<":  {    return role_item.feng_attack < v;  }
                                        case "<=":{       return role_item.feng_attack <= v;  }
                                        default: { break; }
                                    }
                                    break;
                                }
                            case "hole": //装备打洞数量
                                {
                                    switch (opex)
                                    {
                                        case "=": { return role_item.GetGemCount() == v; }
                                    }
                                    break;
                                }
                            default: { break; }
                        }
                        break;
                    }
            }
            return false;
        }