Example #1
0
        public PostBattleState(BattleState battle)
        {
            _exp = battle.Exp;
            _ap = battle.AP;
            _gil = battle.Gil;
            _items = new List<InventoryRecord>();

            _exp_multiplier = new int[] { 100, 100, 100 };

            for (int i = 0; i < 3; i++)
                if (battle.Allies[i] != null)
                    foreach (Materia m in battle.Allies[i].Materia)
                        if (m != null)
                        {
                            if (m.ID == "gilplus")
                                switch (m.Level)
                                {
                                    case 0:
                                        _gil_multiplier += 50;
                                        break;
                                    case 1:
                                        _gil_multiplier += 100;
                                        break;
                                    case 2:
                                        _gil_multiplier += 200;
                                        break;
                                }
                            if (m.ID == "expplus")
                                switch (m.Level)
                                {
                                    case 0:
                                        _exp_multiplier[i] += 50;
                                        break;
                                    case 1:
                                        _exp_multiplier[i] += 75;
                                        break;
                                    case 2:
                                        _exp_multiplier[i] += 100;
                                        break;
                                }
                        }

            CollectItems(battle.Items);

            _state = State.BeforeGain;
        }
Example #2
0
        internal PostBattleState(int exp, int ap, int gil, List<IItem> items)
        {
            _exp = exp;
            _ap = ap;
            _gil = gil;
            _items = new List<InventoryRecord>();

            _exp_multiplier = new int[] { 100, 100, 100 };
            _gil_multiplier = 100;

            for (int i = 0; i < 3; i++)
                if (Globals.Party[i] != null)
                    foreach (Materia m in Globals.Party[i].Materia)
                        if (m != null)
                        {
                            if (m.ID == "gilplus")
                                switch (m.Level)
                                {
                                    case 0:
                                        _gil_multiplier += 50;
                                        break;
                                    case 1:
                                        _gil_multiplier += 100;
                                        break;
                                    case 2:
                                        _gil_multiplier += 200;
                                        break;
                                }
                            if (m.ID == "expplus")
                                switch (m.Level)
                                {
                                    case 0:
                                        _exp_multiplier[i] += 50;
                                        break;
                                    case 1:
                                        _exp_multiplier[i] += 75;
                                        break;
                                    case 2:
                                        _exp_multiplier[i] += 100;
                                        break;
                                }
                        }

            CollectItems(items);

            _state = State.BeforeGain;
        }
Example #3
0
        private static void Init()
        {
            _random = new Random();

            InitializeLua();

            Application.Init();
            if (!GLib.Thread.Supported)
                GLib.Thread.Init();
            Gdk.Threads.Init();

            Gdk.Threads.Enter();

            _window = new Gtk.Window(Globals.WINDOW_NAME);
            _window.SetDefaultSize(Globals.WIDTH, Globals.HEIGHT);
            _window.AppPaintable = true;
            _window.DoubleBuffered = false;
            _window.DeleteEvent += OnWinDelete;
            _window.KeyPressEvent += OnKeyPress;
            _window.KeyReleaseEvent += OnKeyRelease;
            //_window.ConfigureEvent += OnWindowConfigure;

            DrawingArea da = new DrawingArea();
            da.ExposeEvent += OnExposed;

            Gdk.Color col = new Gdk.Color(0, 0, 0);
            _window.ModifyBg(StateType.Normal, col);
            da.ModifyBg(StateType.Normal, col);

            GLib.Timeout.Add(33, new GLib.TimeoutHandler(Graphics.TimedDraw));

            _window.Add(da);
            _window.ShowAll();

            Gdk.Threads.Leave();

            Graphics.Init();    // depends on _window being initialized
            Item.Init();
            Enemy.Init();       // depends on Globals ctor
            Weapon.Init();      // depends on Globals ctor
            Armor.Init();       // depends on Globals ctor
            Accessory.Init();   // depends on Globals ctor
            Materia.Init();     // depends on Globals ctor
            Character.Init();   // depends on [Weapons|Armor|Materia].Init()
            Globals.Init();     // depends on Character.Init()
            MenuScreen.Init();  // depends on Globals.Init()
            Inventory.Init();   // depends on a whole lot of things
            Spell.Init();       // depends on Globals ctor
            Materiatory.Init(); // depends on Materia.Init()

            int time = Int32.Parse(Globals.SaveGame.SelectSingleNode("//time").InnerText);
            _clock = new Clock(time); // depends on Globals ctor

            // Go to Main Menu
            _state = MainMenu;

            // Go to new Battle
            //GoToBattleState();

            // Go to Post-Battle
            //List<IItem> i = new List<IItem>();
            //i.Add(Item.ItemTable["powersource"]);
            //i.Add(Item.ItemTable["powersource"]);
            //i.Add(Item.ItemTable["potion"]);
            //PostBattle = new PostBattleState(234, 12, 1200, i);
            //_state = PostBattle;

            _state.Init();

            if (Globals.Party[0] == null && Globals.Party[1] == null && Globals.Party[2] == null)
                throw new GamedataException("No character in party!");

            // Level-up demo
            //using (StreamWriter w = new StreamWriter(@"c:\scripts\test.txt"))
            //{
            //    while (Character.Cloud.Level < 98)
            //    {
            //        Character.Cloud.GainExperience(Character.Cloud.ToNextLevel + 10);
            //        w.WriteLine(Character.Cloud.ToString());
            //    }
            //    w.Flush();
            //}
        }
Example #4
0
 public override void KeyPressHandle(Key k)
 {
     switch (_state)
     {
         case State.BeforeGain:
             GiveExperience();
             _state = State.AfterGain;
             break;
         case State.AfterGain:
             _screen = MenuScreen.HoardScreen;
             MenuScreen.HoardScreen.ChangeControl(HoardItemLeft.Instance);
             _state = State.BeforeGive;
             break;
         case State.BeforeGive:
             GiveGil();
             _state = State.AfterGive;
             break;
         case State.AfterGive:
             _screen.Control.ControlHandle(k);
             break;
     }
 }
Example #5
0
 private static void SwitchState(State s)
 {
     _state.Dispose();
     _state = s;
     s.Init();
 }