Esempio n. 1
0
        private static void EngageMindControl(Player target, Player attacker, DbStaticForm targetForm, LogBox output)
        {
            //Player attacker = playerRepo.Players.FirstOrDefault(p => p.Id == attackerId);
            MindControlProcedures.AddMindControl(attacker, target, targetForm.Id);

            output.LocationLog += $"<br><b>{target.GetFullName()} was partially mind controlled by {attacker.GetFullName()} here.</b>";
            output.AttackerLog += $"<br><b>You have seized the mind of {target.GetFullName()}!  You can now force them into performing certain actions.</b>";
            output.VictimLog   += $"<br><b>You are now being partially mind controlled by {targetForm.FriendlyName}!</b>";

            TFEnergyProcedures.DeleteAllPlayerTFEnergiesOfFormSourceId(target.Id, targetForm.Id);
            // Remove any Self Restore entires.
            RemoveSelfRestore(target);

            // give curse debuff
            if (targetForm.Id == MindControlStatics.MindControl__MovementFormSourceId)
            {
                EffectProcedures.GivePerkToPlayer(MindControlStatics.MindControl__Movement_DebuffEffectSourceId, target);
            }
            else if (targetForm.Id == MindControlStatics.MindControl__StripFormSourceId)
            {
                EffectProcedures.GivePerkToPlayer(MindControlStatics.MindControl__Strip_DebuffEffectSourceId, target);
            }
            else if (targetForm.Id == MindControlStatics.MindControl__MeditateFormSourceId)
            {
                EffectProcedures.GivePerkToPlayer(MindControlStatics.MindControl__Strip_DebuffEffectSourceId, target);
            }
        }
Esempio n. 2
0
        public static ErrorBox AssertBasicMindControlConditions(Player master, Player victim, int formSourceId)
        {
            var output = new ErrorBox();

            output.HasError = true;

            // assert that world update is not in progress
            if (PvPStatics.AnimateUpdateInProgress)
            {
                output.Error    = "Animate portion of world update is in progress.";
                output.SubError = "Try again in a few seconds.";
                return(output);
            }

            // assert both commander and victim is animate
            if (master.Mobility != PvPStatics.MobilityFull || victim.Mobility != PvPStatics.MobilityFull)
            {
                output.Error = "Both you and your victim must be animate in order to invoke any mind control commands.";
                return(output);
            }

            // assert that the victim is not offline
            if (PlayerProcedures.PlayerIsOffline(victim))
            {
                output.Error    = "Your victim has gone offline.";
                output.SubError = "You can only issue commands to online players under your mind control.";
                return(output);
            }

            // assert that there is indeed a mind control between these two players
            var mcs = MindControlProcedures.GetMindControlsBetweenPlayers(master, victim);

            var mc = mcs.FirstOrDefault(m => m.FormSourceId == formSourceId);

            if (mc == null)
            {
                output.Error = "You are not mind controlling this person with this type of mind control.";
                return(output);
            }

            // assert that the player is the master of the mind control
            if (mc.MasterId != master.Id)
            {
                output.Error = "You are not mind controlling this person with this type of mind control.";
                return(output);
            }

            // assert that the mind control is not expired, if for whatever reason it has not been deleted
            if (mc.TurnsRemaining <= 0)
            {
                output.Error = "This mind control has expired.";
                return(output);
            }

            // assert that this mind control has not reached its limit
            if (mc.TimesUsedThisTurn >= GetCommandLimitOfType(formSourceId))
            {
                output.Error    = "You've issued this command too many times this turn.";
                output.SubError = "Wait until next turn to issue your next command.";
                return(output);
            }

            // assert that the victim is not mind controlled
            if (victim.InDuel > 0)
            {
                output.Error = "Your victim is in a duel and cannot obey this command.";
                return(output);
            }

            // assert that the victim is not mind controlled
            if (victim.InQuest > 0)
            {
                output.Error = "Your victim is in a quest and cannot obey this command.";
                return(output);
            }

            output.HasError = false;
            return(output);
        }