Esempio n. 1
0
        /// <summary>
        /// Generates Main Army
        /// </summary>
        private void genArmy()
        {
            if (sel_class.SelectedValue == "Fighter")
                GameState.CurrentState.mainChar = new Fighter(txt_name.Text);
            else if (sel_class.SelectedValue == "Archer")
                GameState.CurrentState.mainChar = new Archer(txt_name.Text);
            else if (sel_class.SelectedValue == "Healer")
                GameState.CurrentState.mainChar = new Healer(txt_name.Text);
            else if (sel_class.SelectedValue == "Caster")
                GameState.CurrentState.mainChar = new Caster(txt_name.Text);
            else if (sel_class.SelectedValue == "Scout")
                GameState.CurrentState.mainChar = new Scout(txt_name.Text);
            else
                GameState.CurrentState.mainChar = new Fighter(txt_name.Text);

            GameState.CurrentState.mainChar.toLvl(5);

            Army a = new Army();

            Unit u = new Unit(GameState.CurrentState.mainChar);

            Fighter f1 = new Fighter("Patrick");
            f1.toLvl(3);

            Archer a1 = new Archer("Violaine");
            a1.toLvl(4);

            Character.Stats.Traits gat=new Character.Stats.Traits();
            gat.norm();
            gat.dex=10;

            Item ga=new Item("Art Bow", Item.Item_Type.WEAPON, 20, gat);
            a1.equipWeapon(ga);

            Caster cc = new Caster("Brendan");
            cc.levelUp();

            Healer h1 = new Healer("Sophie");

            Scout s1 = new Scout("Steven");

            u.set(3, 2, f1);
            u.set(3, 3, a1);
            u.set(0, 3, cc);
            u.set(1, 1, h1);
            a.Standby.Add(s1);

            a.Units.Add(u);

            a.setOrgAll("main");

            Item i = new Item("Heal Potion", Item.Item_Type.CONSUMABLE, 100, new Character.Stats.Traits(), new Item.OtherEffect(10, 0));

            a.Inventory.Items.Add(i);

            GameState.CurrentState.mainArmy = a;
        }
Esempio n. 2
0
        private void LoadMenus()
        {
            lbl_moneyAmount.Text = army.Money.ToString();

            menu_name.clear();
            menu_level.clear();
            menu_class.clear();
            menu_price.clear();

            charLs.Clear();

            foreach (Content.Recruit rc in Content.Instance.recruitLs)
            {
                if (GameState.CurrentState.turn < rc.req.turns)
                    continue;
                if (GameState.CurrentState.getCaptureNum("main") < rc.req.captures)
                    continue;

                if(GameState.CurrentState.isCaptured(rc.req.city, "main"))
                {
                    Character c = new Fighter("");

                    if (rc.info.cClass == "Fighter")
                        c = new Fighter(rc.info.name);
                    else if (rc.info.cClass == "Archer")
                        c = new Archer(rc.info.name);
                    else if (rc.info.cClass == "Healer")
                        c = new Healer(rc.info.name);
                    else if (rc.info.cClass == "Caster")
                        c = new Caster(rc.info.name);
                    else if (rc.info.cClass == "Scout")
                        c = new Scout(rc.info.name);

                    for (int i = 1; i < rc.info.level; i++)
                        c.levelUp();

                    charLs.Add(c.clone());

                    menu_name.add(new Link(rc.info.name));
                    menu_level.add(new Link(rc.info.level.ToString()));
                    menu_class.add(new Link(rc.info.cClass));
                    menu_price.add(new Link(rc.info.price.ToString()));
                }

            }

            if(menu_name.Count == 0)
            {
                lbl_noHire.Visible = true;

                lbl_enter.Visible = false;
                lbl_enterAction.Visible = false;
                lbl_v.Visible = false;
                lbl_vAction.Visible = false;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Generates a Character that is of the given class
        /// </summary>
        /// <param name="ctype">Class of the generated Character</param>
        /// <param name="name">Name of the Character</param>
        /// <returns>Character of the given class or null if class type incorrect</returns>
        public static Character genClass(Class_Type ctype, String name)
        {
            Character c;

            if (ctype == Class_Type.ARCHER)
                c = new Archer(name);
            else if (ctype == Class_Type.CASTER)
                c = new Caster(name);
            else if (ctype == Class_Type.FIGHTER)
                c = new Fighter(name);
            else if (ctype == Class_Type.HEALER)
                c = new Healer(name);
            else if (ctype == Class_Type.SCOUT)
                c = new Scout(name);
            else
                c = null;

            return c;
        }
        public static Character xmlToChar(XmlElement e)
        {
            Character c;
            String name = e.GetAttribute("name");
            Character.Class_Type type = (Character.Class_Type)Enum.Parse(typeof(Character.Class_Type), e.GetAttribute("type"));

            if (type == Character.Class_Type.FIGHTER)
                c = new Fighter(name);
            else if (type == Character.Class_Type.ARCHER)
                c = new Archer(name);
            else if (type == Character.Class_Type.CASTER)
                c = new Caster(name);
            else if (type == Character.Class_Type.HEALER)
                c = new Healer(name);
            else if (type == Character.Class_Type.SCOUT)
                c = new Scout(name);
            else
                c = new Fighter(name);

            c.Lvl = int.Parse(e.GetAttribute("lvl"));
            c.Exp = int.Parse(e.GetAttribute("exp"));

            c.Organization=e.GetAttribute("org");

            c.stats = stat(e["Stat"]);

            if (e.GetAttribute("main") == "main")
                GameState.CurrentState.mainChar = c;

            return c;
        }