Example #1
0
 public Bomb(int x, int y, int power, Player owner)
     : base(x, y)
 {
     Power = power;
     Owner = owner;
     TimerManager._.GetNewTimer(false,GameParameters._.ExplosionDelay)
 }
Example #2
0
 public static void MoveBomb(string direction, Player p)
 {
     var b = p.MyBombTeleguide;
     if(b != null)
     {
         if (direction == Direction.Up.ToString())
         {
             b.Percenty -= 5;
             //p.NewSens = Direction.Up;
         }
         else if (direction == Direction.Down.ToString())
         {
             b.Percenty += 5;
             //p.NewSens = Direction.Down;
         }
         else if (direction == Direction.Right.ToString())
         {
             b.Percentx += 5;
             //p.NewSens = Direction.Right;
         }
         else if (direction == Direction.Left.ToString())
         {
             b.Percentx -= 5;
             //p.NewSens = Direction.Left;
         }
     }
 }
Example #3
0
 public void KilledBy(Player killer, Player killed)
 {
     CheckExistance(killer.Id);
     if(killer.Id != killed.Id)
     {
         _scoreMap[killer.Id] += 1;
     }
 }
Example #4
0
 public Bomb(int x, int y, int power, Player owner, bool autoStart = true, BombType t = BombType.Normal)
     : base(x, y)
 {
     Power = power;
     Owner = owner;
     directionMoving = Direction.None;
     _type = t;
     itération = 0;
     if (!autoStart) return;
     StartBomb();
 }
Example #5
0
 public static void Move(string direction, Player p)
 {
     if (direction == Direction.Up.ToString())
     {
         p.Percenty -= p.Speed;
         p.NewSens = Direction.Up;
     }
     else if (direction == Direction.Down.ToString())
     {
         p.Percenty += p.Speed;
         p.NewSens = Direction.Down;
     }
     else if (direction == Direction.Right.ToString())
     {
         p.Percentx += p.Speed;
         p.NewSens = Direction.Right;
     }
     else if (direction == Direction.Left.ToString())
     {
         p.Percentx -= p.Speed;
         p.NewSens = Direction.Left;
     }
 }
Example #6
0
 public void ChangeLabelTime(Timer t, Player p)
 {
     var id = p.Id;
     if (Convert.ToInt32(cdLabel[id].Content) > 1)
     {
         cdLabel[id].Opacity = 1;
         var s = Convert.ToInt32(cdLabel[id].Content.ToString()) - 1;
         cdLabel[id].Content = s;
     }
     else
     {
         cdLabel[id].Opacity = 0;
         t.AutoReset = false;
     }
 }
Example #7
0
 public void Killed(Player p)
 {
     _scoreMap[p.Id] += 1;
 }
Example #8
0
 public void InitPlayersCrazy()
 {
     if (TheCurrentMap != null)
     {
         if (GameParameters._.PlayerCount > 0)
         {
             var p = new Player(1, GameParameters._.PlayerSkin[1], 0, 0, TheCurrentMap);
             p.InitCrazySkills();
             TheCurrentMap.ListOfPlayer.Add(p);
         }
         if (GameParameters._.PlayerCount > 1)
         {
             var p = new Player(2, GameParameters._.PlayerSkin[2], Length - 1, Length - 1, TheCurrentMap);
             p.InitCrazySkills();
             TheCurrentMap.ListOfPlayer.Add(p);
         }
         if (GameParameters._.PlayerCount > 2)
         {
             var p = new Player(3, GameParameters._.PlayerSkin[3], 0, Length - 1, TheCurrentMap);
             p.InitCrazySkills();
             TheCurrentMap.ListOfPlayer.Add(p);
         }
         if (GameParameters._.PlayerCount > 3)
         {
             var p = new Player(4, GameParameters._.PlayerSkin[4], Length - 1, 0, TheCurrentMap);
             p.InitCrazySkills();
             TheCurrentMap.ListOfPlayer.Add(p);
         }
     }
     else
     {
         throw new Exception("Problem : Map is not initialized");
     }
 }
Example #9
0
 public static void PutMultipleBomb(Player p)
 {
     p.PutMultipleBomb();
 }
Example #10
0
 public static Bomb PutABomb(Player p, bool spec)
 {
     return p.PutABomb(spec);
 }
Example #11
0
 public int GetScore(Player p)
 {
     CheckExistance(p.Id);
     return _scoreMap[p.Id];
 }
Example #12
0
        public EntityOfDeath(int x, int y, Game g, Player o, bool b = false, int mod = 0)
            : base(x, y)
        {
            thereIsOne = false;
            blocus = b;
            hurt = true;
            G = g;
            owner = o;
            mode = mod;
            if (G.TheCurrentMap.GetEntityOfDeath(x,y) == null || (G.TheCurrentMap.GetEntityOfDeath(x,y) != null && !G.TheCurrentMap.GetEntityOfDeath(x,y).Blocus))
            {
                if(G.TheCurrentMap.GetEntityOfDeath(x,y) != null)
                {
                    try
                    {
                        G.TheCurrentMap.ListOfEntityOfDeath.Remove(G.TheCurrentMap.GetEntityOfDeath(x, y));
                    }catch(Exception e)
                    {

                    }
                }
                G.TheCurrentMap.ListOfEntityOfDeath.Add(this);
                var listEntity = new List<Entity>();
                listEntity.AddRange(G.TheCurrentMap.GetCompleteList());
                foreach (var e in listEntity.Where(play => play.X == x && play.Y == y))
                {
                    if (e is Bomb)
                    {
                        var bt = (Bomb) e;
                        if(GameParameters._.Type == GameType.Classic)
                        {
                            var theBomb = G.TheCurrentMap.ListOfBomb.FirstOrDefault(c => c.X == e.X && c.Y == e.Y);
                            if (theBomb != null) theBomb.Explode(G);
                        }else
                        if(bt.Type != BombType.Mine)
                        {
                            switch (bt.Type)
                            {
                                case BombType.Normal:
                                    var theBomb = G.TheCurrentMap.ListOfBomb.FirstOrDefault(c => c.X == e.X && c.Y == e.Y);
                                    if (theBomb != null) theBomb.Explode(G);
                                    break;
                                case BombType.Teleguide:
                                    var theBomb7 = G.TheCurrentMap.ListOfBomb.FirstOrDefault(c => c.X == e.X && c.Y == e.Y);
                                    if (theBomb7 != null)
                                    {
                                        theBomb7.Owner.MyBombTeleguide = null;
                                        theBomb7.Owner.beAvaliableLag();
                                        theBomb7.Explode(G);
                                    }
                                    break;
                                case BombType.Cataclysm:
                                    var theBomb2 = G.TheCurrentMap.ListOfBomb.FirstOrDefault(c => c.X == e.X && c.Y == e.Y);
                                    if (theBomb2 != null) theBomb2.ExplodeCata(G);
                                    break;
                                case BombType.Flower:
                                    var theBomb3 = G.TheCurrentMap.ListOfBomb.FirstOrDefault(c => c.X == e.X && c.Y == e.Y);
                                    if (theBomb3 != null) theBomb3.ExplodeFlower(G);
                                    break;
                                case BombType.Freeze:
                                    var theBomb4 = G.TheCurrentMap.ListOfBomb.FirstOrDefault(c => c.X == e.X && c.Y == e.Y);
                                    if (theBomb4 != null) theBomb4.ExplodeFreeze(G);
                                    break;
                                case BombType.Dark:
                                    var theBomb6 = G.TheCurrentMap.ListOfBomb.FirstOrDefault(c => c.X == e.X && c.Y == e.Y);
                                    if (theBomb6 != null) theBomb6.ExplodeDark(G);
                                    break;
                                default:
                                    var theBomb5 = G.TheCurrentMap.ListOfBomb.FirstOrDefault(c => c.X == e.X && c.Y == e.Y);
                                    if (theBomb5 != null) theBomb5.Explode(G);
                                    break;
                            }

                        }

                    }
                    else
                        if (e is SoftBlock)
                        {
                            var theSoftBlock = G.TheCurrentMap.ListOfSoftBlock.First(c => c.X == e.X && c.Y == e.Y);
                            theSoftBlock.Destroy(G.TheCurrentMap);
                            G.TheCurrentMap.ListOfSoftBlock.Remove(theSoftBlock);
                            Texture._.DeleteTextureEntity(e);
                        }
                        else if (e is Upgrade)
                        {
                            var theUpgrade = G.TheCurrentMap.ListOfUpgrade.First(c => c.X == e.X && c.Y == e.Y);
                            theUpgrade.Burn();
                            G.TheCurrentMap.ListOfUpgrade.Remove(theUpgrade);
                            Texture._.DeleteTextureEntity(e);
                        }
                        else if (e is UpgradeBomb)
                        {
                            var theUpgradeBomb = G.TheCurrentMap.ListOfUpgradeBomb.First(c => c.X == e.X && c.Y == e.Y);
                            theUpgradeBomb.Burn();
                            G.TheCurrentMap.ListOfUpgradeBomb.Remove(theUpgradeBomb);
                            Texture._.DeleteTextureEntity(e);
                        }
                        else if (e is Player)
                        {
                            if(mode == 0)
                            {
                                var play = (Player)e;
                                if (!(play.Invincible))
                                {
                                    Score._.KilledBy(owner, play);
                                    if (play.Die())
                                    {
                                        var thePlayer = G.TheCurrentMap.ListOfPlayer.FirstOrDefault(c => c.X == play.X && c.Y == play.Y);
                                        if (thePlayer != null)
                                        {
                                            G.TheCurrentMap.ListOfPlayer.Remove(thePlayer);
                                            Texture._.DeleteTextureEntity(thePlayer);
                                            thereIsOne = true;
                                        }
                                    }
                                    else
                                    {
                                        play.cling();
                                    }
                                }
                            }
                            else if (mode == 1)
                            {
                                var play = (Player)e;
                                if (e != null)
                                {
                                    play.freezePlayer();
                                }
                            }
                            else if (mode == 2)
                            {
                                var play = (Player)e;
                                if (e != null)
                                {
                                    play.cursePlayer();
                                }
                            }

                        }
                }
                if (thereIsOne)
                {
                    G.TheCurrentMap.CheckForAllDead();
                }
            }
            TimerManager._.AddNewTimer(false, 500, true, null, SupressBlocus);
            TimerManager._.AddNewTimer(false, 700, true, null, Supress);
        }
Example #13
0
 public Key GetKey(Player p, Direction d)
 {
     return KeysPlayer.FirstOrDefault(keys => keys.Value == p.Id + "_" + d.ToString()).Key; ;
 }
Example #14
0
 public void ReplaceKey(Player p, Direction d, Key k)
 {
     var key = KeysPlayer.FirstOrDefault(keys => keys.Value == p.Id + "_" + d.ToString()).Key;
     KeysPlayer.Remove(key);
     KeysPlayer.Add(k, p.Id + "_" + d.ToString());
 }
Example #15
0
 public int GetSurvive(Player p)
 {
     CheckExistanceSurvive(p.Id);
     return _surviveMap[p.Id];
 }
Example #16
0
        public void Teleport(Player p)
        {
            var l = ListOfPlayer.Where(c => c != null && c.Id != p.Id);
            var count = l.Count();
            if(count > 0)
            {
                var thenumber = rand.Next(count);
                var p2 = l.ElementAt(thenumber);
                var oldX = p.X;
                var oldY = p.Y;
                p.X = p2.X;
                p.Y = p2.Y;
                p2.X = oldX;
                p2.Y = oldY;
                p.Percentx = 0;
                p.Percenty = 0;
                p2.Percentx = 0;
                p2.Percenty = 0;

                //if(p.X == 0)
                //{
                //    p.Percentx = 10;
                //}else if(p.X == Game.Length - 1)
                //{
                //    p.Percentx = -10;
                //}else
                //{
                //    p.Percentx = 0;
                //}

                //if (p.Y == 0)
                //{
                //    p.Percenty = -10;
                //}
                //else if (p.Y == Game.Length - 1)
                //{
                //    p.Percenty = 10;
                //}
                //else
                //{
                //    p.Percenty = 0;
                //}

                //if (p2.X == 0)
                //{
                //    p2.Percentx = 10;
                //}
                //else if (p2.X == Game.Length - 1)
                //{
                //    p2.Percentx = -10;
                //}
                //else
                //{
                //    p2.Percentx = 0;
                //}

                //if (p2.Y == 0)
                //{
                //    p2.Percenty = -10;
                //}
                //else if (p2.Y == Game.Length - 1)
                //{
                //    p2.Percenty = 10;
                //}
                //else
                //{
                //    p2.Percenty = 0;
                //}

            }
        }
Example #17
0
 public void Survived(Player p)
 {
     CheckExistanceSurvive(p.Id);
     _surviveMap[p.Id] += 1;
     _id_Victory.Add(p.Id);
 }