예제 #1
0
파일: Effects.cs 프로젝트: quajak/StartGame
 private void RemoveEffect(MainGameWindow main)
 {
     main.Turn        -= Main_Turn;
     main.PlayerMoved -= Main_PlayerMoved;
     player.troop.statuses.Remove(this);
     main.UpdatePlayerView();
 }
예제 #2
0
파일: Effects.cs 프로젝트: quajak/StartGame
        public Fire(int Turns, int Damage, Point Position, Point SpawnPosition, Map Map, MainGameWindow main) : base("Fire", SpawnPosition, Resources.Fire, Map, Turns, main, render: false)
        {
            //Can it actually exist?
            if (Map.map.Get(Position).type.FType == FieldType.water)
            {
                //Destroy it
                BaseDelete();
                Delete();
                return;
            }

            //Set position to actual position - to create effect that the mage created the fireball
            this.Position = Position;
            main.RenderMap();

            damage = Damage;
            this.main.PlayerMoved += Main_PlayerMoved;

            //Check if put on position of entity
            List <Troop> f = Map.troops.Where(t => t.Position == Position).ToList();

            if (f.Count != 0)
            {
                Player player     = main.players.First(p => p.troop == f[0]);
                string playerName = player.Name;
                main.WriteConsole($"{playerName} has been put on fire!");
                f[0].statuses.Add(new FireStatus(turns + 2, damage, main, player));
                if (playerName == main.humanPlayer.Name)
                {
                    main.UpdatePlayerView();
                }
            }
        }
예제 #3
0
파일: Effects.cs 프로젝트: quajak/StartGame
 public DebuffStatus(int Turns, int Strength, MainGameWindow main, Player player) : base("Debuff", Turns, player)
 {
     strength        = Strength;
     this.main       = main;
     this.main.Turn += Main_Turn;
     player.actionPoints.rawMaxValue -= strength;
     player.troop.statuses.Add(this);
     main.UpdatePlayerView();
 }
예제 #4
0
파일: Effects.cs 프로젝트: quajak/StartGame
        private void Main_Turn(object sender, MainGameWindow.TurnData e)
        {
            MainGameWindow main = sender as MainGameWindow;

            if (e.active.Name != player.Name)
            {
                return;
            }

            //Handle turn countdown
            if (turns == null)
            {
                return;
            }

            turns--;
            if (turns == 0)
            {
                player.actionPoints.rawMaxValue += strength;
                player.troop.statuses.Remove(this);
                main.UpdatePlayerView();
                this.main.Turn -= Main_Turn;
            }
        }