コード例 #1
0
        public HechizoModel MapearHechizoModel(string tipo, string nombre, string idImagen, string idEfecto, string idSonido, string descripcion,
                                               string palabrasMagicas, string maxMana, string minMana, string maxEnergia, string minEnergia, string paralizar,
                                               string inmovilizar, string congelar, string maxDaño, string minDaño, bool envenenar)
        {
            HechizoModel hm = new HechizoModel();

            try
            {
                hm.Tipo            = Convert.ToInt16(tipo);
                hm.Nombre          = nombre;
                hm.IdImagen        = Convert.ToInt16(idImagen);
                hm.IdEfecto        = Convert.ToInt16(idEfecto);
                hm.IdSonido        = Convert.ToInt16(idSonido);
                hm.Descripcion     = descripcion;
                hm.PalabrasMagicas = palabrasMagicas;
                hm.Consumo         = ConsumoModel.Mapear(Convert.ToInt16(maxMana), Convert.ToInt16(minMana), Convert.ToInt16(maxEnergia), Convert.ToInt16(minEnergia));
                hm.Temporales      = TemporalesModel.Mapear(Convert.ToInt16(paralizar), Convert.ToInt16(inmovilizar), Convert.ToInt16(congelar));
                hm.Ataque          = AtaqueModel.Mapear(Convert.ToInt16(maxDaño), Convert.ToInt16(minDaño), envenenar);
            }
            catch (Exception)
            {
                return(new HechizoModel());
            }

            return(hm);
        }
コード例 #2
0
        public HechizoModel MapearHechizoModel(Hechizo h)
        {
            HechizoModel hm = new HechizoModel();

            try
            {
                hm.Id              = h.id;
                hm.Tipo            = Convert.ToInt16(h.tipo);
                hm.Nombre          = h.nombre;
                hm.IdImagen        = Convert.ToInt16(h.idImagen);
                hm.IdEfecto        = Convert.ToInt16(h.idEfecto);
                hm.IdSonido        = Convert.ToInt16(h.idSonido);
                hm.Descripcion     = h.descripcion;
                hm.PalabrasMagicas = h.palabrasMagicas;
                hm.Consumo         = ConsumoModel.Mapear(h.consumo.maxMana, h.consumo.minMana, h.consumo.maxEnergia, h.consumo.minEnergia);
                hm.Temporales      = TemporalesModel.Mapear(h.temporales.paralizar, h.temporales.inmovilizar, h.temporales.congelar);
                hm.Ataque          = AtaqueModel.Mapear(h.ataque.maxDaño, h.ataque.minDaño, h.ataque.envenenar);
            }
            catch (Exception)
            {
                return(new HechizoModel());
            }

            return(hm);
        }