Example #1
0
 public Ground(Ground copy)
     : base(copy)
 {
     Width = copy.Width;
     Height = copy.Height;
     CellSet = new Cell[Height, Width];
     for (int y = 0; y < Height; ++y)
     {
         for (int x = 0; x < Width; ++x)
         {
             SetCell(x, y, new Cell(copy.GetCell(x, y)));
         }
     }
 }
Example #2
0
        protected override Dictionary<String, Object> OnValidate()
        {
            if (!TypeTextBox.TextBox.TextIsValid())
            {
                CallInformationDialogBox(InformationDialogBox.EType.Error, new String[] { InformationDialogBox.Instance.GetTypeErrorStr() });
                return base.OnValidate();
            }

            Ground ground = new Ground();
            ground.SetType(TypeTextBox.TextBox.Text, true);
            ground.Init(WidthUDBox.GetCurrentValue(), HeightUDBox.GetCurrentValue());
            ground.FillWithTile(0, Create.Tile(MapMan.DEFAULT_GROUND_TILE));
            ground.ToScript();

            Map = new Map();
            Map.SetType(TypeTextBox.TextBox.Text, true);

            return new Dictionary<String, Object>
            {
                { "Map", Map }
            };
        }
Example #3
0
        /// <summary>
        /// Constructs a default CombatMap from a given Map
        /// </summary>
        /// <param name="map">Base map of combat</param>
        public CombatMap(Map map)
            : base()
        {
            Ground = new Ground(map.Ground);

            SetPhysicsIsRunning(false);
            ActivateLightEngine(false);

            //!\\ TMP //!\\
            foreach (WorldObject wObj in map.GetObjects())
            {
                if (wObj is Player || wObj is Door || wObj is NPC || wObj is Platform)
                    continue;

                ((WorldObject)wObj.Clone()).SetMap(this, wObj.Position.X, wObj.Position.Y);
            }

            Grid = new GridShape(CELL_SIZE, (uint)Width * (uint)(GameData.TILE_SIZE / CELL_SIZE), (uint)Height * (uint)(GameData.TILE_SIZE / CELL_SIZE));
            AddObjectToDraw(DrawOrder.Grid, Grid);

            Combat = new Combat(this);
            Combat.OnCombatantJoining += new CombatCombatantEventHandler(Combat_OnCombatantJoiningCombat);
            Combat.OnCombatantLeaving += new CombatCombatantEventHandler(Combat_OnCombatantLeavingCombat);

            #region tests
            Team t1 = new Team();

            for (int k = 0; k < 1; ++k)
            {
                PlayerCombatant p1 = new PlayerCombatant(Create.Player("Vlad"));
                p1.Name = "Player 1";
                p1.Move(new Vector2I(10 + k, 15 + k));
                p1.Status[BaseCaracteristic.Hp, BaseStatistic.Attribute.Max] = 300;
                p1.Status[BaseCaracteristic.Sp, BaseStatistic.Attribute.Max] = 10;
                p1.Status[BaseCaracteristic.Mp, BaseStatistic.Attribute.Max] = 3;
                p1.Status[Caracteristic.Intelligence] = 2;

                for (int i = 0; i < 19; ++i)
                {
                    Spell sp = Create.Spell("LightningTest");
                    sp.Name = "LightningTest " + i;
                    p1.SpellPanoply.AddSpell(sp);
                }

                t1.AddCombatant(p1);
            }

            Combat.InfoPanel.AddBox(new CombatantInfoPanelBox());

            PlayerCombatant p2 = new PlayerCombatant(Create.Player("Vlad"));
            p2.Name = "Player 2";
            p2.Status[BaseCaracteristic.Hp, BaseStatistic.Attribute.Max] = 30000;
            p2.Status[BaseCaracteristic.Sp, BaseStatistic.Attribute.Max] = 100;
            p2.Status[BaseCaracteristic.Mp, BaseStatistic.Attribute.Max] = 60;
            for (int i = 0; i < 2; ++i)
            {
                Spell sp = Create.Spell("LightningTest");
                sp.Name = "LightningTest " + i;
                p2.SpellPanoply.AddSpell(sp);
            }
            p2.Move(new Vector2I(8, 10));
            t1.AddCombatant(p2);

            MapEffectManager.Instance.AddEffect(new TextMapEffect("2044", Color.Blue), new Vector2f(200, 200));

            Combat.AddTeam(t1);
            #endregion

            Pathfinding = new Game.Pathfinding.Pathfinding();
            Pathfinding.InitNodeSet(this);

            AlphaMode = false;
        }