Beispiel #1
0
        private void CheckAloneFighter()
        {
            for (int i = 0; i < m_Areas.Count; ++i)
            {
                IPooledEnumerable eable   = JoinMap.GetMobilesInBounds(m_Areas[i]);
                List <Mobile>     players = new List <Mobile>();

                foreach (Mobile mob in eable)
                {
                    if (Contestants.Contains(mob))
                    {
                        players.Add(mob);
                    }
                }

                eable.Free();

                if (players.Count == 1) //Alone
                {
                    Mobile m = players[0];
                    m.MoveToWorld(WinLocation, WinMap);
                    m.PublicOverheadMessage(MessageType.Regular, 38, true, "Skipping to next round...");
                    m.Blessed = true;
                    Fighting.Remove(m);
                    Winners.Add(m);
                    UpdateScores(null, m);
                    AddFighters(false);
                }
            }
        }
Beispiel #2
0
 public JoinMapTest()
 {
     _sut = new JoinMap(leftTable: typeof(Left),
                        joinTable: typeof(Join),
                        rightTable: typeof(Right),
                        leftColumn: nameof(Join.LeftId),
                        rightColumn: nameof(Join.RightId));
 }
Beispiel #3
0
        internal void SpawnReferee(Rectangle2D area)
        {
            int     minX    = area.Start.X;
            int     maxX    = area.End.X - 2;
            int     minY    = area.Start.Y;
            int     maxY    = area.End.Y - 2;
            int     Z       = JoinMap.GetAverageZ(area.X, area.Y);
            Referee referee = new Referee();

            referee.MoveToWorld(new Point3D(Utility.RandomMinMax(minX, maxX), Utility.RandomMinMax(minY, maxY), Z), JoinMap);
            referee.PublicOverheadMessage(MessageType.Regular, 906, true, "Get a move on!");
            referee.IsInEvent = true;
        }
Beispiel #4
0
    void Start()
    {
        controlls = playerInput.GetActions <JoinMap>();
        for (int i = 0; i < players.Length; i++)
        {
            players[i].handle = PlayerHandleManager.GetNewPlayerHandle();
            foreach (var item in players[i].GetComponent <Player>().renderers)
            {
                item.material = colourpool[i];
            }
        }

        players[1].handle = PlayerHandleManager.GetNewPlayerHandle();
        players[2].handle = PlayerHandleManager.GetNewPlayerHandle();
        players[3].handle = PlayerHandleManager.GetNewPlayerHandle();
    }
Beispiel #5
0
        private Rectangle2D GetArea(Mobile m)
        {
            for (int i = 0; i < m_Areas.Count; i++)
            {
                IPooledEnumerable eable = JoinMap.GetMobilesInBounds(m_Areas[i]);

                foreach (Mobile mob in eable)
                {
                    if (mob == m)
                    {
                        return(m_Areas[i]);
                    }
                }

                eable.Free();
            }
            return(new Rectangle2D());
        }
Beispiel #6
0
        public void SpawnMobile(Mobile m)
        {
            for (int i = 0; i < m_Areas.Count; ++i)
            {
                int mobCount            = 0;
                IPooledEnumerable eable = JoinMap.GetMobilesInBounds(m_Areas[i]);

                foreach (Mobile mob in eable)
                {
                    if (Contestants.Contains(mob) && mob.Alive)
                    {
                        mobCount++;
                    }
                }

                eable.Free();

                if (mobCount <= 1)     //Found an available area
                {
                    if (mobCount == 1) //Start area fight timer
                    {
                        Timer t;
                        m_MatchTimers.TryGetValue(m_Areas[i], out t);

                        if (t != null)
                        {
                            t.Stop();
                            m_MatchTimers.Remove(m_Areas[i]);
                        }

                        t = Contestants.Count > 2 ? new MatchTimer(this, m_Areas[i], false) : new MatchTimer(this, m_Areas[i], true);
                        t.Start();
                        m_MatchTimers.Add(m_Areas[i], t);
                    }

                    m.MoveToWorld(new Point3D(m_Areas[i].Start, JoinMap.GetAverageZ(m_Areas[i].X, m_Areas[i].Y)), JoinMap);
                    m.LocalOverheadMessage(MessageType.Regular, 38, true, string.Format("Fight will begin in {0} seconds!", FightDelayInSecs));
                    Fighting.Add(m);
                    FixPlayer(m);
                    new StartFightTimer(this, m).Start();
                    break;
                }
            }
        }
Beispiel #7
0
        // Helper method to compute expression joins
        private JoinedMapResult CreateJoinedMap(Resource property, GraphExpression expression)
        {
            var joinSegment             = new LabelledTreeNode <object, Term>(Root).AddChild(property, expression.Root);
            var joineMapComparisonSites = new List <JoinAddressPair> {
                new JoinAddressPair {
                    TreeAddress1 = new List <Term> {
                        property
                    }, TreeAddress2 = new List <Term>()
                }
            };
            IMap joinedMap = new JoinMap(new BgpMap(joinSegment), expression.Map, joineMapComparisonSites);

            var comparisonSites = new List <JoinAddressPair> {
                JoinAddressPair.RootComparison
            };

            return(new JoinedMapResult {
                Map = joinedMap, AddressPairList = comparisonSites
            });
        }
        public void JoinMathematiciansToNationality()
        {
            var map1      = new BgpMap(new LabelledTreeNode <object, Term>(null));
            var map2      = new BgpMap(new LabelledTreeNode <object, Term>(null));
            var nationMap = new ChangeSourceMap(map2, new GraphSource(TestUris.NationsRepouri));

            var joinSites = new List <JoinAddressPair> {
                new JoinAddressPair {
                    TreeAddress1 = new List <Term> {
                        Biografy.Nationality
                    },
                    TreeAddress2 = new List <Term> {
                    }
                }
            };

            var map = new JoinMap(map1, nationMap, joinSites);

            var results = map.Evaluate <MockEvaluator>(new GraphSource(TestUris.MathematiciansRepoUri));

            Assert.Equal(8, results.Count());
        }
Beispiel #9
0
        public void HandleDeath(Mobile m)
        {
            if (!m_Started)
            {
                return;
            }

            List <Mobile> opponents = new List <Mobile>();
            List <Mobile> referees  = new List <Mobile>();

            Rectangle2D area = GetArea(m);

            // Rob - remove and stop the Match or EndMatch timer
            if (m_MatchTimers.ContainsKey(area))
            {
                Timer t = m_MatchTimers[area];
                t.Stop();
                m_MatchTimers.Remove(area);
            }
            // end Rob
            IPooledEnumerable eable = JoinMap.GetMobilesInBounds(area);

            foreach (Mobile mob in eable)
            {
                if (mob != m && Contestants.Contains(mob))
                {
                    opponents.Add(mob);
                }
                else if (mob is Referee)
                {
                    referees.Add(mob);
                }
            }

            eable.Free();

            for (int i = 0; i < opponents.Count && opponents.Count <= 1; ++i)
            {
                Mobile mob = opponents[i];
                UpdateScores(m, mob);
                mob.MoveToWorld(WinLocation, WinMap);
                FixPlayer(mob);
                mob.Blessed = true;
                Fighting.Remove(mob);
                Winners.Add(mob);

                //Rob -re-add gear in case gear was removed
                if (ForceEnd == ForceEndType.ItemRemoval && NeedRestock.Contains(mob))
                {
                    SupplySystem.RemoveEventGear(mob);
                    SupplySystem.SupplyGear(mob, EventSupplier);
                    NeedRestock.Remove(mob);
                    mob.SendAsciiMessage("You have been resupplied!");
                }
            }

            NeedRestock.Remove(m); // loser doesn't need a restock
            // end - Rob

            for (int i = 0; i < referees.Count; ++i)
            {
                Mobile mob = referees[i];
                mob.Delete();
            }

            Timer.DelayCall(TimeSpan.FromSeconds(1), new TimerStateCallback(ResurrectPlayer), m);

            HandleCorpse(m);

            Fighting.Remove(m);
            RemovePlayer(m, true, false);

            m.LastKiller = null;

            AddFighters(false);
        }