Ejemplo n.º 1
0
        public Item Dequip( Inventory inv, bool discard )
        {
            if( equipped == null ) {
                return null;
            }

            if (!discard) inv.AddItem( equipped, 1 );

            Item i = equipped;
            equipped = null;
            return i;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            _.init( this );
            main_assembly = System.Reflection.Assembly.GetExecutingAssembly(); // tell the library where to find map scripts
            global = new SullyGlobalScripts(this);

            SkillType.initSkillTypes();
            Klass.initClasses();
            PartyData.InitializePartyData();

            Element.initElements();
            Status.initStatuses();

            Skill.initSkills();
            Item.initItems();

            Enemy.initEnemies();

            init_audio();

            mcg = new McGrenderStack();
            mcg.AddLayer( "menu" );
            mcg.AddLayer( "textbox" );
            mcg.AddLayer( "battle_background" );
            mcg.AddLayer( "battle_sprites" );
            mcg.AddLayer( "battle_ui" );
            this.setMcGrender( mcg );

            this.game_input_handler = () => {

                if( this.mainMenu.CanSummonMenu() && action.menu.pressed ) {
                    this.mainMenu.SummonMenu();
                }

                if( this.mainMenu.IsInMenu() ) {
                    this.mainMenu.HandleInput( dir, action );
                }

                if( mainMenu.IsInMenu() ) {
                    return false;
                }

                return true;
            };

            Battle.LoadBackgrounds( Content );

            boxcolors = new Color[3];
            boxcolors[0] = new Color( 0, 0, 0 );
            boxcolors[1] = new Color( 112, 112, 112 );
            boxcolors[2] = new Color( 144, 144, 144 );

            menuColor = new Color( 128,0,128 );

            inventory = new Inventory();
            saves = new SaveManager(this);

            Random random = new Random();
            foreach( String key in Item.masterItemList.Keys ) {
                inventory.AddItem( Item.masterItemList[key], random.Next( 1, 98 ) );
            }

            saves = new SaveManager(this);

            base.Initialize();
        }
Ejemplo n.º 3
0
        public Inventory GetWearableEquipmentSet( Klass klass, EquipSlotType slot )
        {
            Inventory ret = new Inventory();

            foreach( ItemSlot sl in this.equipment ) {
                if( sl.item.equip_slot == slot && sl.item.equip_classes.Contains( klass ) ) {
                    ret.AddItem( sl.item, sl.quant );
                }
            }

            if( slot != EquipSlotType.RightHand && slot != EquipSlotType.Body ) { // can't unequip from RH or Body slots
                ret.AddItem( Item.none, 1 );
            }

            return ret;
        }