public ActionResult DeleteSpecial(Specials deleteSpecial)
        {
            var delete = _carDealer.GetSpecialsById(deleteSpecial.SpecialsId);

            _carDealer.DeleteSpecial(delete);
            return(RedirectToAction("Special"));
        }
Exemple #2
0
    void Start()
    {
        specials = gameObject.GetComponentInParent<Specials>();
        stats = gameObject.GetComponentInParent<Stats>();

        gameObject.SetActive(false);
    }
        public ActionResult Specials(SpecialsViewModel model)
        {
            if (ModelState.IsValid)
            {
                var repo = SpecialsRepositoryFactory.GetRepository();

                try
                {
                    Specials special = new Specials();
                    special.SpecialTitle       = model.SpecialToAdd.SpecialTitle;
                    special.SpecialDescription = model.SpecialToAdd.SpecialDescription;

                    repo.AddSpecial(special);

                    return(RedirectToAction("Specials"));
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else
            {
                return(View(model));
            }
        }
Exemple #4
0
        public List <Specials> GetSpecials()
        {
            List <Specials> specials = new List <Specials>();

            using (SqlConnection conn = new SqlConnection())
            {
                conn.ConnectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
                SqlCommand cmd = new SqlCommand();

                cmd.Connection  = conn;
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.CommandText = "GetSpecials";


                conn.Open();
                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        Specials currentRow = new Specials();

                        currentRow.special_ID  = (int)dr["special_ID"];
                        currentRow.name        = dr["name"].ToString();
                        currentRow.description = dr["description"].ToString();

                        specials.Add(currentRow);
                    }
                }
            }
            return(specials);
        }
        public Specials ReadBySpecialId(int SpecialId)
        {
            Specials Special = new Specials();

            using (var cn = new SqlConnection(Settings.GetConnectionString()))
            {
                SqlCommand cmd = new SqlCommand("ReadBySpecialId", cn);
                cmd.CommandType = CommandType.StoredProcedure;

                cn.Open();

                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        Specials currentSpecial = new Specials();
                        currentSpecial.SpecialId   = (int)dr["SpecialId"];
                        currentSpecial.Title       = dr["Title"].ToString();
                        currentSpecial.Description = dr["Description"].ToString();


                        Special = currentSpecial;
                    }
                }
                cn.Close();
            }
            return(Special);
        }
Exemple #6
0
 public override void Level_01()
 {
     BAB = Level;
     Specials.Add(new Ranger_Specials().Favored_Enemy());
     Specials.Add(new Ranger_Specials().Track(this));
     Specials.Add(new Ranger_Specials().Wild_Empathy());
 }
Exemple #7
0
        public virtual void UseSpecial(ITetriNETCallback callback, int targetId, Specials special)
        {
            Log.Default.WriteLine(LogLevels.Debug, "UseSpecial {0} {1}", targetId, special);

            IPlayer player = PlayerManager[callback];

            if (player != null)
            {
                //
                player.ResetTimeout(); // player alive
                //
                IPlayer target = PlayerManager[targetId];
                if (target != null)
                {
                    //
                    HostUseSpecial?.Invoke(player, target, special);
                }
                else
                {
                    Log.Default.WriteLine(LogLevels.Warning, "UseSpecial to unknown player {0} from {1}", targetId, player.Name);
                }
            }
            else
            {
                Log.Default.WriteLine(LogLevels.Warning, "UseSpecial from unknown player");
            }
        }
Exemple #8
0
        public static void SampleDataCanAddAndDeleteSpecial()
        {
            Specials specialToAdd = new Specials();
            var      repo         = new SpecialsRepositorySampleData();

            specialToAdd.SpecialTitle       = "Fourth Special";
            specialToAdd.SpecialDescription = "Special4 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum magna arcu, congue sit amet mattis quis, molestie a sem. ";

            repo.AddSpecial(specialToAdd);
            var specials = repo.GetAllSpecials().ToList();
            var special  = repo.GetSpecialById(4);

            Assert.IsNotNull(special);
            Assert.AreEqual(4, specials.Count);

            Assert.AreEqual(4, specials[3].SpecialId);
            Assert.AreEqual("Fourth Special", specials[3].SpecialTitle);
            Assert.AreEqual("Special4 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum magna arcu, congue sit amet mattis quis, molestie a sem. ", specials[3].SpecialDescription);

            repo.DeleteSpecial(4);

            specials = repo.GetAllSpecials().ToList();
            special  = repo.GetSpecialById(4);

            Assert.IsNull(special);
            Assert.AreEqual(3, specials.Count);
        }
Exemple #9
0
        public ActionResult Specials(Specials model)
        {
            var repo = RepositoryFactory.GetRepository();

            repo.AddSpecial(model);
            return(RedirectToAction("Specials", "Admin"));
        }
        public IHttpActionResult PutSpecials(int id, Specials specials)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != specials.specialsID)
            {
                return(BadRequest());
            }

            db.Entry(specials).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SpecialsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #11
0
        static Config()
        {
            Menu = MenuExtensions.CreatMainMenu("kalistaMenu", "卡莉丝塔 - 冠军之矛");

            Orbwalker = Menu.AddOrbwalker("走砍设置", "走砍设置");
            Orbwalker.RegisterCustomMode("逃跑", "逃跑", 'S');
            Menu.AddSeparator();
            Menu.AddBool("调试", "调试");

            // All modes
            Modes.Initialize();

            // Misc
            Misc.Initialize();

            // Items
            Items.Initialize();

            // Drawing
            Drawing.Initialize();

            // Specials
            Specials.Initialize();

            AutoLevelUp.Initialize(Menu);
        }
        public IHttpActionResult PutSpecial(int id, Specials special)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != special.ID)
            {
                return BadRequest();
            }

            db.Entry(special).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SpecialExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
Exemple #13
0
        public object GetLastOvas(int pag = 1)
        {
            object specials = new Specials();

            using (HttpClient AruppiClient = new HttpClient())
            {
                string url = _iconfiguration.GetSection("Keys").GetSection("UrlFlv").Value + string.Format("OVA/added/{0}", pag);

                AruppiClient.BaseAddress = new Uri(url);

                StringBuilder path = new StringBuilder(url);

                using (HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, new Uri(path.ToString())))
                {
                    try
                    {
                        HttpResponseMessage response = AruppiClient.GetAsync(url).Result;

                        string jsonString = response.Content.ReadAsStringAsync().Result;

                        specials = JsonConvert.DeserializeObject <object>(jsonString);
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
            return(specials);
        }
Exemple #14
0
        public Specials GetByID(int specialID)
        {
            Specials special = null;

            using (var cn = new SqlConnection(Settings.GetConnectionString()))
            {
                SqlCommand cmd = new SqlCommand("SingleSpecial", cn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@SpecialID", specialID);
                cn.Open();

                //SELECT VehicleID, [Year], Mileage, MSRP, SalesPrice, [Description], Picture, Featured, VIN, UserID, ModelID, ColorID, TypeID, TransmissionID, InteriorID
                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    if (dr.Read())
                    {
                        special                    = new Specials();
                        special.SpecialID          = (int)dr["SpecialID"];
                        special.SpecialTitle       = dr["SpecialTitle"].ToString();
                        special.SpecialDescription = dr["SpecialDescription"].ToString();
                    }
                }
            }

            return(special);
        }
        public ActionResult DeleteSpecials(Specials sp)
        {
            var repo = CarFactory.Create();

            repo.DeleteSpecial(sp.SpecialId);
            return(RedirectToAction("Specials"));
        }
Exemple #16
0
 public override void Level_01()
 {
     BAB = Level * 3 / 4;
     Specials.Add(new Druid_Specials().Nature_Bond());
     Specials.Add(new Druid_Specials().Nature_Sense());
     Specials.Add(new Druid_Specials().Wild_Empathy());
 }
Exemple #17
0
 public void DisplayBoard(IBoard board)
 {
     for (int y = board.Height; y >= 1; y--)
     {
         StringBuilder sb = new StringBuilder(String.Format("{0:00}|", y));
         for (int x = 1; x <= board.Width; x++)
         {
             byte cellValue = board[x, y];
             if (cellValue == CellHelper.EmptyCell)
             {
                 sb.Append(".");
             }
             else
             {
                 Pieces   cellPiece   = CellHelper.GetColor(cellValue);
                 Specials cellSpecial = CellHelper.GetSpecial(cellValue);
                 if (cellSpecial == Specials.Invalid)
                 {
                     sb.Append((int)cellPiece);
                 }
                 else
                 {
                     sb.Append(ConvertSpecial(cellSpecial));
                 }
             }
         }
         sb.Append("|");
         Console.SetCursorPosition(0 + 0, board.Height - y + 0);
         Console.Write(sb.ToString());
     }
     Console.SetCursorPosition(0 + 2, board.Height + 0);
     Console.Write("".PadLeft(board.Width + 2, '-'));
 }
        protected override void Parse(Expression expression)
        {
            if (expression is MethodCallExpression methodCallExpression)
            {
                switch (methodCallExpression.Method.Name)
                {
                case "Count":
                    Special    = Specials.Count;
                    expression = methodCallExpression.Arguments.FirstOrDefault();
                    break;

                case "GetType":
                    Special    = Specials.Type;
                    expression = methodCallExpression.Object;
                    break;
                }

                if (expression == null)
                {
                    return;
                }
            }

            try
            {
                base.Parse(expression);
            } catch (ExpressionInvalidException) {}
        }
        public void RemoveSpecial(int?id)
        {
            Specials specials = _context.Specials.Find(id);

            _context.Specials.Remove(specials);
            _context.SaveChanges();
        }
Exemple #20
0
    void Attack(TBC_Character _attacker, TBC_Character _reciever, Specials _special)
    {
        float damage = 0;

        if (!IsImmune(_special.element, _reciever))
        {
            if (_reciever.elementalWeakness.Contains(_special.element))
            {
                //DoubleDamage
                damage = Damage(doubleDamageMult, damageRandomRange, _attacker, _reciever, _special);
                //Add Effect
                Effector(_special, _reciever, 1);
            }
            else
            {
                //RegularDamage
                damage = Damage(damageMult, damageRandomRange, _attacker, _reciever, _special);
                //Add Effect
                Effector(_special, _reciever, 2);
            }
        }
        else
        {
            //HalfDamage
            damage = Damage(reducedDamageMult, damageRandomRange, _attacker, _reciever, _special);
        }
        //Add Damage
        _reciever.hitPoints -= damage;
    }
        public List <Specials> GetSpecials()
        {
            List <Specials> specials = new List <Specials>();

            using (var conn = new SqlConnection(Settings.GetConnectionString()))
            {
                SqlCommand cmd = new SqlCommand("SpecialsSelectAll", conn);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                conn.Open();

                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        Specials row = new Specials();

                        row.SpecialsID    = (int)dr["SpecialsID"];
                        row.Title         = dr["Title"].ToString();
                        row.Description   = dr["Description"].ToString();
                        row.ImageFileName = dr["ImageFileName"].ToString();

                        specials.Add(row);
                    }
                }
            }

            return(specials);
        }
Exemple #22
0
        // Associated with Specials
        public void SpawnSpecialBlocks(int count, Func <Specials> randomFunc)
        {
            // Build list of cells without any specials
            List <int> cellsOccupiedWithoutSpecials = Cells.Select((cell, index) => new
            {
                cell,
                index
            })
                                                      .Where(x => x.cell != CellHelper.EmptyCell && !CellHelper.IsSpecial(x.cell))
                                                      .Select(x => x.index)
                                                      .ToList();

            // Transform 'count' cells into special
            for (int i = 0; i < count; i++)
            {
                int n = cellsOccupiedWithoutSpecials.Count;
                if (n > 0) // if there is at least one non-special piece
                {
                    // get random piece without specials
                    int randomCell = Randomizer.Instance.Next(n);
                    int cellIndex  = cellsOccupiedWithoutSpecials[randomCell];
                    // get random special
                    Specials special = randomFunc();
                    // add special
                    Cells[cellIndex] = CellHelper.SetSpecial(special);

                    // remove piece from available list
                    cellsOccupiedWithoutSpecials.RemoveAt(randomCell);
                }
                else
                {
                    break; // no more cells without specials
                }
            }
        }
        public Specials GetSpecialsById(int?id)
        {
            Specials specials = null;

            using (var conn = new SqlConnection(Settings.GetConnectionString()))
            {
                SqlCommand cmd = new SqlCommand("SpecialsSelect", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@SpecialsID", id);

                conn.Open();

                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    if (dr.Read())
                    {
                        specials               = new Specials();
                        specials.SpecialsID    = (int)dr["SpecialsID"];
                        specials.Title         = dr["Title"].ToString();
                        specials.Description   = dr["Description"].ToString();
                        specials.ImageFileName = dr["ImageFileName"].ToString();
                    }
                }

                return(specials);
            }
        }
Exemple #24
0
        public ActionResult DeleteSpecial(int SpecialsId)
        {
            var      repo  = RepositoryFactory.GetRepository();
            Specials model = repo.GetSpecialById(SpecialsId);

            return(View(model));
        }
Exemple #25
0
        public Specials GetSpecialById(int SpecialId)
        {
            Specials special = new Specials();

            using (var cn = new SqlConnection(Settings.GetConnectionString()))
            {
                SqlCommand cmd = new SqlCommand("GetSpecial", cn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@SpecialId", SpecialId);

                cn.Open();

                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    if (dr.Read())
                    {
                        special.SpecialId          = (int)SpecialId;
                        special.SpecialTitle       = dr["SpecialTitle"].ToString();
                        special.SpecialDescription = dr["SpecialDescription"].ToString();
                    }
                }
                return(special);
            }
        }
        public IHttpActionResult PostSpecials(Specials specials)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Specials.Add(specials);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (SpecialsExists(specials.specialsID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = specials.specialsID }, specials));
        }
        public void WriteRequestSpecialCommon(Specials inputType)
        {
            var optionHandler = new OptionManager();
            var response      = optionHandler.WriteOptions(specialValues[inputType]);

            Common.AssertWriteUnsuccessOption(response, ResultCode.InvalidParameter);
        }
        public void InsertSpecial(Specials special)
        {
            using (var cn = new SqlConnection(Settings.GetConnectionString()))
            {
                SqlCommand cmd = new SqlCommand("SpecialInsert", cn);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlParameter param = new SqlParameter("SpecialsId", SqlDbType.Int);
                param.Direction = ParameterDirection.Output;

                cmd.Parameters.Add(param);
                cmd.Parameters.AddWithValue("@Title", special.Title);
                cmd.Parameters.AddWithValue("@Description", special.Description);
                if (string.IsNullOrEmpty(special.SpecialsImage))
                {
                    cmd.Parameters.AddWithValue("@SpecialsImage", DBNull.Value);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@SpecialsImage", special.SpecialsImage);
                }

                cn.Open();
                cmd.ExecuteNonQuery();
                special.SpecialsId = (int)param.Value;
            }
        }
Exemple #29
0
        private void Special(IPlayer player, IPlayer target, Specials special)
        {
            Log.Default.WriteLine(LogLevels.Info, "UseSpecial[{0}][{1}]{2}", player.Name, target.Name, special);

            // Update statistics
            UpdateStatistics(player.Name, target.Name, special);
            // Store special id locally
            int specialId = SpecialId;

            // Increment special
            SpecialId++;
            // If special is Switch, call OnGridModified with switched grids
            if (special == Specials.SwitchFields)
            {
                // Switch locally
                byte[] tmp = target.Grid;
                target.Grid = player.Grid;
                player.Grid = tmp;

                // Send switched grid to player and target
                player.OnGridModified(player.Id, player.Grid);
                if (player != target)
                {
                    target.OnGridModified(target.Id, target.Grid);
                }
                // They will send their grid when receiving them (with an optional capping)
            }
            // Inform about special use
            foreach (IEntity entity in Entities)
            {
                entity.OnSpecialUsed(specialId, player.Id, target.Id, special);
            }
        }
        public IEnumerable <Specials> GetAll()
        {
            List <Specials> specials = new List <Specials>();

            using (var cn = new SqlConnection(Settings.GetConnectionString()))
            {
                SqlCommand cmd = new SqlCommand("SpecialsSelectAll", cn);
                cmd.CommandType = CommandType.StoredProcedure;

                cn.Open();
                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        Specials currentRow = new Specials();
                        currentRow.SpecialTitleID     = (int)dr["SpecialTitleID"];
                        currentRow.SpecialTitle       = dr["SpecialTitle"].ToString();
                        currentRow.SpecialDescription = dr["SpecialDescription"].ToString();

                        specials.Add(currentRow);
                    }
                }
            }
            return(specials);
        }
Exemple #31
0
 public override void Level_01()
 {
     BAB = Level;
     Specials.Add(new Paladin_Specials().Aura_of_Good());
     Specials.Add(new Paladin_Specials().Detect_Evil());
     Specials.Add(new Paladin_Specials().Smite_Evil(this));
 }
Exemple #32
0
        public void DeleteSpecial(int specialId)
        {
            Specials sp = context.Specials.Find(specialId);

            context.Specials.Remove(sp);
            context.SaveChanges();
        }
Exemple #33
0
        public LispEnvironment(LispEnvironment parent)
        {
            this.parent = parent;
            this.symbols = parent.symbols;
            this.specials = parent.specials;

            if (Level >= 256)
            {
                throw new EnvironmentException("Stack overflow!");
            }
        }
Exemple #34
0
    public void BuildCard(int attack, int defense, Specials offSpecial = Specials.NONE, Specials defSpecial = Specials.NONE)
    {
        this.attack = attack;
        attackText.text = attack.ToString();
        this.defense = defense;
        defenseText.text = defense.ToString();

        if (offSpecial != Specials.NONE)
            this.offSpecial = offSpecial;
        if (defSpecial != Specials.NONE)
            this.defSpecial = defSpecial;
    }
	// Use this for initialization
	void Start () {
	
		database = GameObject.FindGameObjectWithTag ("Database");
		displays = GameObject.FindGameObjectWithTag ("Background").GetComponent<UIScripts> ();
		spec = GameObject.FindGameObjectWithTag ("Background").GetComponent<Specials> ();
		specIt = GameObject.FindGameObjectWithTag ("Background").GetComponent<SpecialItems> ();
		player = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> ();
		itemData = database.GetComponent<ItemData> ();
		attData = database.GetComponent<AttackDatabase> ();

	
	}
        public IHttpActionResult PostSpecial(Specials Special)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.Special.Add(Special);
            db.SaveChanges();

            return CreatedAtRoute("DefaultApi", new { id = Special.ID }, Special);
        }
Exemple #37
0
 public bool Enqueue(Specials special)
 {
     bool result = false;
     lock (_lock)
     {
         if (_queue.Count < _size)
         {
             _queue.Add(special);
             result = true;
         }
     }
     return result;
 }
Exemple #38
0
 public bool Dequeue(out Specials special)
 {
     special = 0;
     bool result = false;
     lock (_lock)
     {
         if (_queue.Count > 0)
         {
             special = _queue[0];
             _queue.RemoveAt(0);
             result = true;
         }
     }
     return result;
 }
Exemple #39
0
    public Card AssembleCard(Card card, int attack, int defense, Specials offSpecial = Specials.NONE, Specials defSpecial = Specials.NONE)
    {
        card.transform.SetParent(deckSpot.transform);
        card.attack = attack;
        attackText.text = attack.ToString();
        card.defense = defense;
        defenseText.text = defense.ToString();

        card.gameObject.GetComponent<Draggable>().enabled = false;

        if (offSpecial != Specials.NONE)
            card.offSpecial = offSpecial;
        if (defSpecial != Specials.NONE)
            card.defSpecial = defSpecial;

        return card;
    }
Exemple #40
0
	// Use this for initialization
	void Start () {

		database = GameObject.FindGameObjectWithTag ("Database");
		if (GameObject.FindGameObjectWithTag ("Background")) {
			displays = GameObject.FindGameObjectWithTag ("Background").GetComponent<UIScripts> ();
			spec = GameObject.FindGameObjectWithTag ("Background").GetComponent<Specials> ();
		}

		itemData = database.GetComponent<ItemData> ();
		maxHealth = health;
		maxMagic = magic;
		maxEnergy = energy;
		anim = GetComponent<Animator> ();
		resetMagicTimer = magicTimer;
		resetSpecialTimer = specialTimer;

		//Used to allow the player to move around on the screen.
		pos = gameObject.transform.position;
	}
Exemple #41
0
 public void ClientFinishContinuousSpecial(Specials special)
 {
     SetCallbackAndAddress();
     Host.ClientFinishContinuousSpecial(special);
 }
Exemple #42
0
 public void ClientUseSpecial(Guid targetId, Specials special)
 {
     SetCallbackAndAddress();
     Host.ClientUseSpecial(targetId, special);
 }
Exemple #43
0
        private void FinishContinuousSpecialAction(IClient client, Specials special)
        {
            Log.Default.WriteLine(LogLevels.Debug, "Game {0}: FinishContinuousSpecial[{1}]: {2}", Name, client.Name, special);

            // Send to everyone except sender
            foreach (IClient target in Clients.Where(x => x != client))
                target.OnContinuousSpecialFinished(client.Id, special);
        }
 public void ClientFinishContinuousSpecial(Specials special)
 {
     IClient client = ClientManager[ClientCallback];
     if (client != null)
         HostClientFinishContinuousSpecial.Do(x => x(client, special));
     else
         Log.Default.WriteLine(LogLevels.Warning, "ClientFinishContinuousSpecial from unknown client");
 }
Exemple #45
0
 public void ClientUseSpecial(Guid targetId, Specials special)
 {
     IClient client = ClientManager[ClientCallback];
     IClient target = ClientManager[targetId];
     if (client != null && HostClientUseSpecial != null)
         HostClientUseSpecial(client, target, special);
 }
Exemple #46
0
 public static Instruction Create(Specials specials, Label label)
 {
     Instruction i = new Instruction();
     i.type = InstructionType.Special;
     i.operand = label;
     i.operandType = typeof(Label);
     i.special = specials;
     return i;
 }
Exemple #47
0
 public LispEnvironment(SymbolsTable symbols, Specials specials)
     : this(NoParent)
 {
     this.symbols = symbols;
     this.specials = specials;
 }
Exemple #48
0
 private void UpdateStatistics(string playerName, string targetName, Specials special)
 {
     _gameStatistics[playerName].SpecialsUsed[special][targetName]++;
 }
 public void OnSpecialUsed(Guid playerId, Guid targetId, int specialId, Specials special)
 {
     throw new NotImplementedException();
 }
 public void OnContinuousSpecialFinished(Guid playerId, Specials special)
 {
     throw new NotImplementedException();
 }
Exemple #51
0
 private void addSpecial(Specials s)
 {
     switch(s) {
     case Specials.Nonlethal:
         special[0] = true;
         break;
     case Specials.Fragile:
         special[1] = true;
         break;
     case Specials.Monk:
         special[2] = true;
         break;
     case Specials.Disarm:
         special[3] = true;
         break;
     case Specials.Trip:
         special[4] = true;
         break;
     case Specials.Reach:
         special[5] = true;
         break;
     case Specials.Brace:
         special[6] = true;
         break;
     case Specials.Grapple:
         special[7] = true;
         break;
     case Specials.Double:
         special[8] = true;
         break;
     case Specials.Performance:
         special[9] = true;
         break;
     case Specials.Improvised:
         special[10] = true;
         break;
     case Specials.Blocking:
         special[11] = true;
         break;
     case Specials.Sunder:
         special[12] = true;
         break;
     default:
         break;
     }
 }
Exemple #52
0
 public static byte SetSpecial(Specials special)
 {
     return (byte)special;
 }
Exemple #53
0
 public void OnSpecialUsed(Guid playerId, Guid targetId, int specialId, Specials special)
 {
     UpdateCallInfo(System.Reflection.MethodBase.GetCurrentMethod().Name, playerId, targetId, specialId, specialId);
 }
Exemple #54
0
 public bool FinishContinuousSpecial(IClient client, Specials special)
 {
     if (client == null)
         throw new ArgumentNullException("client");
     if (client.Game != this)
     {
         Log.Default.WriteLine(LogLevels.Error, "Cannot finish continuous special, client {0} is not in this game {1} but in game {2}", client.Name, Name, client.Game == null ? "???" : client.Game.Name);
         return false;
     }
     //
     _actionQueue.Enqueue(() => FinishContinuousSpecialAction(client, special)); // Must be handled even if game is not started
     return true;
 }
Exemple #55
0
 public void OnContinuousSpecialFinished(Guid playerId, Specials special)
 {
     UpdateCallInfo(System.Reflection.MethodBase.GetCurrentMethod().Name, playerId, special);
 }
Exemple #56
0
 public bool UseSpecial(IClient client, IClient target, Specials special)
 {
     if (client == null)
         throw new ArgumentNullException("client");
     if (target == null)
         throw new ArgumentNullException("target");
     if (State != GameStates.GameStarted)
     {
         Log.Default.WriteLine(LogLevels.Warning, "Cannot use special, game {0} is not started", Name);
         return false;
     }
     if (client.Game != this)
     {
         Log.Default.WriteLine(LogLevels.Error, "Cannot use special, client {0} is not in this game {1} but in game {2}", client.Name, Name, client.Game == null ? "???" : client.Game.Name);
         return false;
     }
     if (target.Game != this)
     {
         Log.Default.WriteLine(LogLevels.Error, "Cannot use special, target {0} is not in this game {1} but in game {2}", client.Name, Name, client.Game == null ? "???" : client.Game.Name);
         return false;
     }
     if (client.State != ClientStates.Playing)
     {
         Log.Default.WriteLine(LogLevels.Warning, "Cannot use special, client {0} is not playing", client.Name);
         return false;
     }
     if (target.State != ClientStates.Playing)
     {
         Log.Default.WriteLine(LogLevels.Warning, "Cannot use special, target {0} is not playing", target.Name);
         return false;
     }
     //
     _actionQueue.Enqueue(() => UseSpecialAction(client, target, special));
     return true;
 }
Exemple #57
0
 public static Instruction Create(Specials specials, LocalBuilder lvar)
 {
     Instruction i = new Instruction();
     i.type = InstructionType.Special;
     i.operand = lvar;
     i.operandType = typeof(LocalBuilder);
     i.special = specials;
     return i;
 }
 public void ClientUseSpecial(Guid targetId, Specials special)
 {
     IClient client = ClientManager[ClientCallback];
     if (client != null)
     {
         IClient target = ClientManager[targetId];
         if (target != null)
             HostClientUseSpecial.Do(x => x(client, target, special));
         else
             Log.Default.WriteLine(LogLevels.Warning, "ClientUseSpecial to unknown client");
     }
     else
         Log.Default.WriteLine(LogLevels.Warning, "ClientUseSpecial from unknown client");
 }
Exemple #59
0
        private void UseSpecialAction(IClient client, IClient target, Specials special)
        {
            Log.Default.WriteLine(LogLevels.Debug, "Game {0}: UseSpecial[{1}][{2}]:{3}", Name, client.Name, target.Name, special);

            if (target.State != ClientStates.Playing)
            {
                Log.Default.WriteLine(LogLevels.Warning, "Cannot use special on a non-playing client");
                return;
            }

            // Update statistics
            UpdateStatistics(client.Name, target.Name, special);
            // Store special id locally
            int specialId = _specialId;
            // Increment special
            _specialId++;
            // If special is Switch, call OnGridModified with switched grids
            if (special == Specials.SwitchFields)
            {
                // Switch locally
                byte[] tmp = target.Grid;
                target.Grid = client.Grid;
                client.Grid = tmp;

                // Send switched grid to player and target
                client.OnGridModified(client.Id, client.Grid);
                if (client != target)
                    target.OnGridModified(target.Id, target.Grid);
                // Client and target will send their grid when receiving them (with an optional capping)
            }
            // Inform about special use
            foreach (IClient c in Clients)
                c.OnSpecialUsed(client.Id, target.Id, specialId, special);
        }
Exemple #60
0
 public void ClientFinishContinuousSpecial(Specials special)
 {
     IClient client = ClientManager[ClientCallback];
     if (client != null && HostClientFinishContinuousSpecial != null)
         HostClientFinishContinuousSpecial(client, special);
 }