예제 #1
0
        static void OnHit(NPCInst attacker, NPCInst target, int damage)
        {
            if (!IsActive || ActiveMode.Phase < GamePhase.Fight)
            {
                return;
            }

            if (target.HP <= 0 &&
                attacker.Client is ArenaClient attClient && target.Client is ArenaClient tarClient &&
                attClient.GMTeamID >= 0 && tarClient.GMTeamID >= 0)
            {
                if (attClient.GMTeamID != tarClient.GMTeamID)
                {
                    attClient.GMScore++;
                    attClient.GMKills++;
                    attClient.TDMTeam.Score++;
                    attClient.SendPointsMessage(+1);

                    tarClient.GMDeaths++;

                    if (attClient.TDMTeam.Score >= ScoreLimit)
                    {
                        ActiveMode.FadeOut();
                    }
                }
                else // teamkill
                {
                    attClient.GMScore--;
                    attClient.TDMTeam.Score--;
                    attClient.SendPointsMessage(-1);

                    tarClient.GMDeaths++;
                }
            }
        }
예제 #2
0
 public static void StartNextScenario()
 {
     if (IsActive)
     {
         ActiveMode.FadeOut();
     }
     else
     {
         InitScenario(GameScenario.Get(NextScenarioIndex));
     }
 }
예제 #3
0
        public static GameMode InitScenario(GameScenario scenario)
        {
            if (scenario == null)
            {
                return(null);
            }

            if (IsActive)
            {
                NextScenarioIndex = GameScenario.Scenarios.IndexOf(scenario);
                ActiveMode.FadeOut();
                return(null);
            }

            Log.Logger.Log("Init game scenario " + scenario.Name);

            if (++NextScenarioIndex >= GameScenario.Count)
            {
                NextScenarioIndex = 0;
            }

            var mode = scenario.GetMode();

            ActiveMode = mode;

            var world = new WorldInst(null)
            {
                Path = scenario.WorldPath
            };

            world.Create();

            SetWorldGlobals(world, scenario);
            mode.World = world;

            if (!string.IsNullOrWhiteSpace(scenario.SpawnWorld))
            {
                var spawnWorld = new WorldInst(null)
                {
                    Path = scenario.SpawnWorld
                };
                spawnWorld.Create();

                SetWorldGlobals(spawnWorld, scenario);
                mode.SpawnWorld = spawnWorld;
            }

            mode.Start(scenario);

            return(mode);
        }