Beispiel #1
0
        private static void StartFighting(CharacterInstance ch, CharacterInstance victim)
        {
            if (ch.CurrentFighting != null)
            {
                return;
            }

            if (ch.AffectedBy.IsSet((int)AffectedByTypes.Sleep))
            {
                // TODO affect_strip(ch, gsn_sleep);
            }

            if (victim.NumberFighting > GetMaximumFight())
            {
                ch.SendTo("There are too many people fighting for you to join in.");
                return;
            }

            var fight = new FightingData
            {
                Who        = victim,
                Experience = (int)(ch.CalculateXP(victim) * 0.85),
                Alignment  = ch.CalculateAlign(victim)
            };

            if (!ch.IsNpc() && victim.IsNpc())
            {
                fight.TimesKilled = handler.times_killed(ch, victim);
            }

            ch.NumberFighting  = 1;
            ch.CurrentFighting = fight;

            if (ch.IsNpc())
            {
                ch.CurrentPosition = PositionTypes.Fighting;
            }
            else
            {
                if (StyleToPositionTable.TryGetValue(ch.CurrentStyle, out var position))
                {
                    ch.CurrentPosition = position;
                }
                else
                {
                    ch.CurrentPosition = PositionTypes.Fighting;
                }
            }

            victim.NumberFighting++;
            if (victim.Switched != null && victim.Switched.IsAffected(AffectedByTypes.Possess))
            {
                victim.Switched.SendTo("You are disturbed!");
                // TODO do_return(victim.Switched, "");
            }
        }