Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="kick"></param>
        /// <returns></returns>
        public override FightActionResultEnum FightQuit(CharacterEntity character, bool kick = false)
        {
            if (LoopState == FightLoopStateEnum.STATE_WAIT_END || LoopState == FightLoopStateEnum.STATE_ENDED)
            {
                return(FightActionResultEnum.RESULT_NOTHING);
            }

            switch (State)
            {
            case FightStateEnum.STATE_PLACEMENT:
                if (character.IsLeader)
                {
                    foreach (var teamFighter in character.Team.Fighters)
                    {
                        if (base.TryKillFighter(teamFighter, teamFighter, true, true) == FightActionResultEnum.RESULT_END)
                        {
                            return(FightActionResultEnum.RESULT_END);
                        }
                    }

                    return(FightActionResultEnum.RESULT_END);
                }

                character.Fight.Dispatch(WorldMessage.FIGHT_FLAG_UPDATE(OperatorEnum.OPERATOR_REMOVE, character.Team.LeaderId, character));
                character.Fight.Dispatch(WorldMessage.GAME_MAP_INFORMATIONS(OperatorEnum.OPERATOR_REMOVE, character));
                character.EndFight(true);
                character.Dispatch(WorldMessage.FIGHT_LEAVE());

                return(FightActionResultEnum.RESULT_NOTHING);

            case FightStateEnum.STATE_FIGHTING:
                if (character.IsSpectating)
                {
                    character.EndFight(true);
                    character.Dispatch(WorldMessage.FIGHT_LEAVE());

                    return(FightActionResultEnum.RESULT_NOTHING);
                }

                if (TryKillFighter(character, character, true, true) != FightActionResultEnum.RESULT_END)
                {
                    character.EndFight();
                    character.Dispatch(WorldMessage.FIGHT_LEAVE());

                    return(FightActionResultEnum.RESULT_DEATH);
                }

                return(FightActionResultEnum.RESULT_END);
            }

            return(FightActionResultEnum.RESULT_NOTHING);
        }