예제 #1
0
파일: Forest.cs 프로젝트: stryph4/RPG
        public static void ExploreForest(Combatant hero)
        {
            int explore = random.Next(0, 101);

            if (explore >= 50 && explore <= 90)
            {
                StoredCombatants.Enemy = new BigSlime("Big Slime", "Enemy");
                CombatWindow combat = new CombatWindow();
                MessageBox.Show("You encountered a Big Slime!");
                CombatMethods.inCombat = true;
                combat.ShowDialog();
            }
            if (explore < 50)
            {
                StoredCombatants.Enemy = new Slime("Slime", "Enemy");
                CombatWindow combat = new CombatWindow();
                MessageBox.Show("You encountered a Slime!");
                CombatMethods.inCombat = true;
                combat.ShowDialog();
            }
            if (explore > 90 && explore < 99)
            {
                int chest = random.Next(0, 11);
                if (chest < 3)
                {
                    int gold = random.Next(10, 20);
                    MessageBox.Show($"You found a chest containing {gold} gold!");
                    hero.Gold += gold;
                    return;
                }
                else if (chest >= 4 && chest <= 7)
                {
                    MessageBox.Show($"You found a chest containing a potion!");


                    return;
                }
                else
                {
                    MessageBox.Show($"You found a chest containing an ether!");
                    if (hero.Inventory.ContainsKey("Ether"))
                    {
                        hero.Inventory["Ether"] += 1;
                    }
                    else
                    {
                        hero.Inventory["Ether"] = 1;
                    }
                    return;
                }
            }
            if (explore >= 99)
            {
                MessageBox.Show($"You found an experience shrine, and have been granted a free level!");
                hero.Experience += hero.ExperienceToLevel;
                CharacterMethods.LevelUp(hero);
                return;
            }
        }
예제 #2
0
 public void BeginCombat()
 {
     // TODO display message before combat opens
     // Grab reference to the combat window and make player busy
     combatWindow = windowManager.Open((int)Windows.CombatWindow - 1, false) as CombatWindow;
     combatWindow.endCombatCallback += CombatOver;
     combatWindow.BeginCombat(playerActor);
     isPlayerBusy(true);
 }
예제 #3
0
        protected override void OnInit(Point2D position, object[] args)
        {
            view         = Session.Screen.CombatView;
            view.Visible = true;
            view.Click  += OnClick;
            view.Give   += OnGive;

            meter         = Session.Screen.CombatMeter;
            meter.Visible = true;

            window         = Session.Screen.CombatWindow;
            window.Visible = true;
        }
예제 #4
0
파일: Attack.cs 프로젝트: BigWeather/OSDC
 public override void execute(MapObject source, MapObject target)
 {
     // TODO: Do center correctly!
     if (IntoTheNewWorld.Instance.isPlayer(source) || IntoTheNewWorld.Instance.isPlayer(target))
     {
         CombatWindow combatWindow = new CombatWindow(new Vector2(1280 / 2, 720 / 2), 0, source, target);
         combatWindow.background = IntoTheNewWorld.Instance.windowBackground;
         combatWindow.decorations = IntoTheNewWorld.Instance.windowDecorations;
         IntoTheNewWorld.Instance.Show(combatWindow);
     }
     else
     {
         string dummy;
         CombatWindow.resolveCombat(source, target, false, out dummy); // NOTE: false doesn't mean the defender won't flee, just that it's not automatic.
     }
 }
예제 #5
0
        public GameScreen()
        {
            escapeWindow         = new EscapeWindow(RootWidget);
            escapeWindow.Visible = false;
            escapeWindow.Closed += () => escapeWindow.Visible = false;
            escapeWindow.Logout += Close;
            escapeWindow.Exit   += App.Exit;

            Container = new Container(Root);
            // HACK: to display character selection screen nicely
            Container.Resize(800, 600);
            Container.Visible = false;

            MapView         = new MapView(Root);
            MapView.Visible = false;

            Calendar         = new Calendar(Root);
            Calendar.Visible = false;

            MenuGrid         = new MenuGrid(Root);
            MenuGrid.Visible = false;

            HudMenu         = new HudMenu(Root);
            HudMenu.Visible = false;

            Belt         = new Belt(Root);
            Belt.Visible = false;

            Chat = new ChatWindow(Root);
            Chat.Resize(300, 200);
            Chat.Visible = false;

            CombatMeter         = new CombatMeter(Root);
            CombatMeter.Visible = false;

            CombatView         = new CombatView(Root);
            CombatView.Visible = false;

            CombatWindow = new CombatWindow(Root);
            CombatWindow.Move(100, 100);
            CombatWindow.Visible = false;

            Aim         = new AimWidget(Root);
            Aim.Visible = false;

            RegisterHotkeys();
        }