Beispiel #1
0
        public void AddTeam(Team team)
        {
            Teams.Add(team);

            IEnumerator<BaseCombatant> combatants = team.GetCombatantEnumerator();
            while (combatants.MoveNext())
                AddCombatant(combatants.Current);
        }
Beispiel #2
0
        public bool RemoveTeam(Team team)
        {
            if (!Teams.Remove(team))
                return false;

            IEnumerator<BaseCombatant> combatants = team.GetCombatantEnumerator();
            while (combatants.MoveNext())
                RemoveCombatant(combatants.Current);

            return true;
        }
Beispiel #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;
        }