Beispiel #1
0
        public override void OnTrigger(int playerId, PlayPointID id)
        {
            int addPoint = 0;
            var info     = ACDC.PlayPointData[(int)id];

            if (info != null)
            {
                addPoint = info.Point;
            }

            var player = mEntries.Where(x => x.GetPlayerId() == playerId).FirstOrDefault();

            if (player == null || player == default(Entry))
            {
                return;
            }
            player.SetScore(player.GetScore() + addPoint);

            if (id == PlayPointID.EnemyKill || id == PlayPointID.KillTheKing)
            {
                ++player.KillCount;
            }

            game_mode.OnTrigger(WorldId, playerId, id);

            LogHelper.LogInfo($"PlayPoint cur:{player.GetScore()}, add:{addPoint}");
        }
Beispiel #2
0
        public override void OnTrigger(byte worldId, int playerId, PlayPointID id)
        {
            if (IsKing(playerId))
            {
                if (id == PlayPointID.PlayerDeath)
                {
                    GameMode gameMode = World.Instance(worldId).GameMode;
                    Team     team     = gameMode.GetEntry(playerId).GetTeam();
                    if (kingPlayerList[team].Count >= MaxKillCount)
                    {
                        lastKilledKingPlayerId = playerId;
                        switch (team)
                        {
                        case Team.TeamA:
                            gameMode.EndGame(Team.TeamB, Team.TeamA, false, CloseType.Clear);
                            break;

                        case Team.TeamB:
                            gameMode.EndGame(Team.TeamA, Team.TeamB, false, CloseType.Clear);
                            break;
                        }
                        return;
                    }
                    int          nextKing = playerId;
                    var          players  = World.Instance(worldId).playerList;
                    List <Entry> entries  = gameMode.GetEntries().Where(x =>
                                                                        x.GetPlayerId() != playerId &&
                                                                        x.GetTeam() == team &&
                                                                        !kingPlayerList[team].Contains(x.GetPlayerId())).ToList();

                    if (entries.Count == 0)
                    {
                        entries = gameMode.GetEntries().Where(x => x.GetTeam() == team).ToList();
                    }

                    nextKing = GetNextKingPlayerId(entries.Select(x => x.GetPlayerId()).ToList());

                    Entry entry = gameMode.GetEntries().Where(x => x.GetPlayerId() == nextKing).FirstOrDefault();

                    gameMode.InvokeClientRpc(gameMode.SwitchKing, players.Keys.ToList(), entry.GetTeam(), playerId, entry.GetPlayerId());
                    SetKing(worldId, team, nextKing);
                }
                else if (id == PlayPointID.PlayerReborn)
                {
                    SetKingSpell(worldId, playerId);
                }
            }
        }
Beispiel #3
0
 public void OnTrigger(byte worldId, int playerId, PlayPointID id)
 {
 }
Beispiel #4
0
        private int _TakeDamage(int inDamagingPlayerId, SActor damagingPlayer, int damage)
        {
            GameMode gameMode       = World.Instance(WorldId).GameMode;
            var      lastBuffHealth = buff.HP;

            // 버프로 받은 HP가 있는 경우
            if (buff.HP > 0)
            {
                if (buff.HP >= damage)
                {
                    // 버프 HP만 감소
                    buff.HP -= damage;
                    return(damage);
                }
                else
                {
                    // 버프 HP 0 및 actor HP 감소
                    damage -= buff.HP;
                    buff.HP = 0;
                }
            }

            int applyDamage;
            var lastHealth = mHealth;

            mHealth -= damage;
            if (mHealth <= 0)
            {
                if (mHealth < 0)
                {
                    mHealth = 0;
                }

                // die 함수에서 mHealth 값을 수정하여 미리 적용 데미지를 구해놓는다.
                applyDamage = lastHealth - mHealth + lastBuffHealth;

                //score one for damaging player...
                //World.Instance(WorldId).GameMode.IncScore(inDamagingPlayerId, 1);

                //and you want to die
                //SetDoesWantToDie(true);
                TryDie(SpawnPoint, inDamagingPlayerId);

                // 리스폰
                //PlayerController PlayerController = NetworkManagerServer.sInstance.GetPlayerController((int)GetPlayerId());
                //if (PlayerController != null)
                //{
                //    PlayerController.HandleActorDied();
                //}

                bool isKing       = gameMode.game_mode.GetMode() == GameModeType.KillTheKing && (gameMode.game_mode as KillTheKing).IsKing(GetPlayerId());
                bool isKingKiller = false;
                if (damagingPlayer != null)
                {
                    isKingKiller = gameMode.game_mode.GetMode() == GameModeType.KillTheKing && (gameMode.game_mode as KillTheKing).IsKing(damagingPlayer.GetPlayerId());

                    PlayPointID pointId = isKing ? PlayPointID.KillTheKing : PlayPointID.EnemyKill;
                    gameMode.OnTrigger(damagingPlayer.GetPlayerId(), pointId);
                    //Log.Information($"give point for player({damagingPlayer.UserId}), pointId : {pointId}");

                    var entry = World.Instance(WorldId).GameMode.GetEntry(inDamagingPlayerId);
                    if (entry != null)
                    {
                        entry.Missions.Increment((int)MissionType.Mission_KillCount, 1);
                    }

                    ++World.Instance(WorldId).GameMode.statistics.attacked_death;
                }
                else if (inDamagingPlayerId == (int)ReservedPlayerId.Fall)
                {
                    ++World.Instance(WorldId).GameMode.statistics.fall_death;
                }
                else if (inDamagingPlayerId == (int)ReservedPlayerId.Train)
                {
                    ++World.Instance(WorldId).GameMode.statistics.train_death;
                }
                else
                {
                    ++World.Instance(WorldId).GameMode.statistics.other_death;
                }


                gameMode.OnTrigger(GetPlayerId(), PlayPointID.PlayerDeath);

                var player_list = World.Instance(WorldId).playerList.Keys.ToList();
                //Log.Information($"NoticeKillDeath {inDamagingPlayerId}, {GetPlayerId()}, players{string.Join(", ", player_list)}");
                InvokeClientRpc(NoticeKillDeath, player_list, inDamagingPlayerId, GetPlayerId(), isKingKiller, isKing);
            }
            else
            {
                applyDamage = lastHealth - mHealth + lastBuffHealth;

                var player = (SActor)World.Instance(WorldId).GameMode.GetActor(inDamagingPlayerId);
                if (player != null)
                {
                    World.Instance(WorldId).GameMode.OnTrigger(player.GetPlayerId(), PlayPointID.EnemyAttack);
                }
            }

            if (lastHealth != mHealth)
            {
                NetworkManagerServer.sInstance.SetStateDirty(GetNetworkId(), WorldId, (uint)ReplicationState.Health);
            }

            return(applyDamage);
        }
 public virtual void OnTrigger(int playerId, PlayPointID id)
 {
 }