コード例 #1
0
 private void HandlerMouse_LeftButton_GeneralArea(MouseState mouse)
 {
     // try to drop selected item
     if (_itemSelected != null)
     {
         Tile tileUnderAgent = _currentMap.GetTile(_selectedCreature.PositionGet());
         if (!tileUnderAgent.MyInventory.Full() &&
             _selectedCreature.GetStatBasic(Creature.StatBasic.AP, true) >= _selectedCreature.GetAPActionCost(APCostTypes.ItemDrop))
         {
             // drop item
             //tileUnderAgent.MyInventory.ItemAddToList(_selectedItem);
             ActionItemDrop action = new ActionItemDrop(_selectedCreature, _itemSelected);
             _myGame.ExecuteAction(action);
             _itemSelected = null;
         }
     }
     // try to select tenant
     else
     {
         Coords selectedHex = ClickedHex(new Vector2(mouse.X, mouse.Y), _myDrawer.ScreenAnchor);
         _selectedCreature = _currentMap.TenancyMap[selectedHex.X, selectedHex.Y];
         if (_selectedCreature != null)
         {
             _selectedCreature.MyMoveRangeCalculator.Update();
         }
     }
 }
コード例 #2
0
        /// <summary>
        /// Writes the character info in the character info box.
        /// </summary>
        private void DrawCharInfo(SpriteBatch spriteBatch)
        {
            if (_myInterface.IsBoxOpen(InterfaceBattle.Buttons.CharacterInfo) && _myInterface.SelectedCreature != null)
            {
                Rectangle box = _myInterface.GetBox(InterfaceBattle.Buttons.CharacterInfo);

                Vector2 loc = new Vector2(box.Left + Constants.TextDisplayItemBoxDefaultXOffset,
                                          box.Top + Constants.TextDisplayDefaultVerticalSpacing);
                spriteBatch.DrawString(_font, ("Name: " + _myInterface.SelectedCreature.ToString()), loc, Constants.ColorCharacterName);

                Creature subject = _myInterface.SelectedCreature;
                int      delta   = Constants.FontDefaultSize + Constants.TextDisplayDefaultVerticalSpacing;

                loc.Y += delta;
                spriteBatch.DrawString(_font, ("Level: " + _myInterface.SelectedCreature.Level), loc, Constants.ColorCharacterProperties);

                for (int i = 0; i < (sbyte)Creature.StatBasic.COUNT; ++i)
                {
                    loc.Y += delta;
                    spriteBatch.DrawString(_font, (((Creature.StatBasic)i).ToString() + ": " + subject.GetStatBasic((Creature.StatBasic)i, true) + "/"
                                                   + subject.GetStatBasic((Creature.StatBasic)i, false)), loc, Constants.ColorCharacterProperties);
                }

                for (int i = 0; i < (sbyte)Creature.StatMain.COUNT; ++i)
                {
                    loc.Y += delta;
                    spriteBatch.DrawString(_font, (((Creature.StatMain)i).ToString() + ": " + subject.GetStatMain((Creature.StatMain)i, true) +
                                                   "(" + subject.GetStatMain((Creature.StatMain)i, false) + ")"), loc, Constants.ColorCharacterProperties);
                }
            }
        }
コード例 #3
0
        public void EndTurn()
        {
            SortedDictionary <UInt32, Creature> menagerie = _currentMap.Menagerie;

            // end turn
            _scheduler.EndTurn();

            if (_myInterface.SelectedCreature != null)
            {
                _myInterface.SelectedCreature.MyMoveRangeCalculator.Update();
            }

            // this crap should be in the scheduler
            foreach (KeyValuePair <UInt32, Creature> kvp in menagerie)
            {
                //fix later
                Creature current = kvp.Value;
                current.SetStatBasic(Creature.StatBasic.AP, true, current.GetStatBasic(Creature.StatBasic.AP, false));
                current.MyMoveRangeCalculator.Update();
            }
            for (sbyte i = 0; i < _currentMap.TeamCount; ++i)
            {
                Team currentTeam = _currentMap.TeamRosterGetTeamFrom(i);
                if (currentTeam != _playerTeam)
                {
                    foreach (Creature c in currentTeam.Members)
                    {
                        c.CreatureBrain.Update();
                    }
                }
            }
        }