예제 #1
0
파일: Goto.cs 프로젝트: elavanis/Mud
        private static IResult MoveToRoom(IMobileObject performer, IRoom newRoom)
        {
            if (performer is IPlayerCharacter god)
            {
                #region Leave
                if (god.God && !string.IsNullOrWhiteSpace(god.GotoLeaveMessage))
                {
                    ITranslationMessage translationMessage = new TranslationMessage(god.GotoLeaveMessage);
                    GlobalReference.GlobalValues.Notify.Room(performer, null, god.Room, translationMessage, null, true, false);
                }
                #endregion Leave

                #region Enter
                if (god.God && !string.IsNullOrWhiteSpace(god.GotoEnterMessage))
                {
                    ITranslationMessage translationMessage = new TranslationMessage(god.GotoEnterMessage);
                    GlobalReference.GlobalValues.Notify.Room(performer, null, god.Room, translationMessage, null, true, false);
                }
                #endregion Enter
            }

            performer.Room.RemoveMobileObjectFromRoom(performer);
            newRoom.AddMobileObjectToRoom(performer);
            performer.Room = newRoom;

            //take the result of the look, change it so they can't move again and return it.
            IResult result = GlobalReference.GlobalValues.CommandList.PcCommandsLookup["LOOK"].PerformCommand(performer, new Command());
            result.AllowAnotherCommand = false;
            return(result);
        }
예제 #2
0
 public ThrowDirt() : base(nameof(ThrowDirt), 200)
 {
     Effect = new Objects.Effect.Blindness();
     PerformerNotificationSuccess = new TranslationMessage("You grab a hand full of dirt and throw it into {target} eyes.");
     RoomNotificationSuccess      = new TranslationMessage("{performer} throws a hand full of dirt into {target} eyes temporarily blinding them.");
     TargetNotificationSuccess    = new TranslationMessage("{performer} throws dirt into your eyes blinding you.");
 }
예제 #3
0
        public async Task <ActionResult <TranslationMessage> > Translate(TranslationMessage message)
        {
            string translatedText = null;

            if (!string.IsNullOrWhiteSpace(message.DestinationLanguage) && message.SourceLanguage != message.DestinationLanguage)
            {
                // Translates the text.
                var response = await translatorClient.TranslateAsync(message.Text, message.SourceLanguage, message.DestinationLanguage);

                translatedText = response.Translation.Text;
            }
            else
            {
                // No destination language specified, use the original text.
                translatedText = message.Text;
            }

            var translationMessage = new TranslationMessage
            {
                Text                = message.Text,
                SourceLanguage      = message.SourceLanguage,
                TranslatedText      = translatedText,
                DestinationLanguage = message.DestinationLanguage
            };

            return(translationMessage);
        }
예제 #4
0
파일: Party.cs 프로젝트: elavanis/Mud
        private IResult Chat(IMobileObject performer, ICommand command)
        {
            IReadOnlyList <IMobileObject> partyMembers = GlobalReference.GlobalValues.Engine.Party.CurrentPartyMembers(performer);

            if (partyMembers == null)
            {
                return(new Result("You are not in a party so you can't not chat with them.", true));
            }

            StringBuilder stringBuilder = new StringBuilder();

            foreach (IParameter parameter in command.Parameters)
            {
                stringBuilder.Append(parameter.ParameterValue + " ");
            }

            string message = $"{performer.KeyWords[0]} party chats: {stringBuilder.ToString().Trim()}";
            ITranslationMessage translationMessage = new TranslationMessage(message, TagType.Communication);

            foreach (IMobileObject mob in partyMembers)
            {
                GlobalReference.GlobalValues.Notify.Mob(mob, translationMessage);
            }

            return(null);
        }
예제 #5
0
파일: Say.cs 프로젝트: elavanis/Mud
        public IResult PerformCommand(IMobileObject performer, ICommand command)
        {
            IResult result = base.PerfomCommand(performer, command);

            if (result != null)
            {
                return(result);
            }

            if (command.Parameters.Count > 0)
            {
                string statement = string.Join(" ", command.Parameters.Select(i => i.ParameterValue));

                string message = string.Format("{0} says {1}", GlobalReference.GlobalValues.StringManipulator.CapitalizeFirstLetter(performer.SentenceDescription), statement);
                ITranslationMessage translationMessage = new TranslationMessage(message, TagType.Communication);
                GlobalReference.GlobalValues.Notify.Room(performer, null, performer.Room, translationMessage, new List <IMobileObject>()
                {
                    performer
                }, false, true);

                return(new Result("", false));
            }
            else
            {
                return(new Result("What would you like to say?", true));
            }
        }
예제 #6
0
        private void HandleGroupExpAndGold(IMobileObject attacker, ICorpse corpse, INonPlayerCharacter npc, IReadOnlyList <IMobileObject> partyMembers)
        {
            int exp = npc.EXP / partyMembers.Count;

            ulong gold = 0;

            for (int i = corpse.Items.Count - 1; i >= 0; i--)
            {
                if (corpse.Items[i] is IMoney money)
                {
                    gold += money.Value;
                    corpse.Items.RemoveAt(i);
                }
            }
            gold = gold / (ulong)partyMembers.Count;

            string message = $"{attacker.KeyWords[0]} killed {this.KeyWords[0]}.  You receive {exp} exp and {GlobalReference.GlobalValues.MoneyToCoins.FormatedAsCoins(gold)}.";
            ITranslationMessage translationMessage = new TranslationMessage(message);

            foreach (IMobileObject mob in partyMembers)
            {
                if (mob is IPlayerCharacter pc2)
                {
                    pc2.Experience += exp;
                    pc2.Money      += gold;
                    GlobalReference.GlobalValues.Notify.Mob(pc2, translationMessage);
                }
            }
        }
예제 #7
0
        public BaseCureSpell(string spellName, int die, int sides, int manaCost = -1)
        {
            Effect         = new RecoverHealth();
            Parameter.Dice = GlobalReference.GlobalValues.DefaultValues.ReduceValues(die, sides);

            SpellName = spellName;

            SpellName = spellName;
            if (manaCost == -1)
            {
                ManaCost = sides * die / 20;
            }
            else
            {
                ManaCost = manaCost;
            }

            string roomMessage      = "{performer} says {0} and their hands begin to glow causing {target} to look better.";
            string targetMessage    = "{performer} says {0} and heals you.";
            string performerMessage = "You say {0} and heal {target}.";

            List <ITranslationPair> translate = new List <ITranslationPair>();
            ITranslationPair        pair      = new TranslationPair(Translator.Languages.Magic, spellName);

            translate.Add(pair);

            RoomNotificationSuccess      = new TranslationMessage(roomMessage, TagType.Info, translate);
            TargetNotificationSuccess    = new TranslationMessage(targetMessage, TagType.Info, translate);
            PerformerNotificationSuccess = new TranslationMessage(performerMessage, TagType.Info, translate);
        }
예제 #8
0
        private static IResult MoveToRoom(IMobileObject performer, IRoom newRoom)
        {
            IPlayerCharacter god = performer as IPlayerCharacter;

            if (god != null)
            {
                #region Leave
                if (god.God && !string.IsNullOrWhiteSpace(god.GotoLeaveMessage))
                {
                    ITranslationMessage translationMessage = new TranslationMessage(god.GotoLeaveMessage);
                    GlobalReference.GlobalValues.Notify.Room(performer, null, god.Room, translationMessage, null, true, false);
                }
                #endregion Leave

                #region Enter
                if (god.God && !string.IsNullOrWhiteSpace(god.GotoEnterMessage))
                {
                    ITranslationMessage translationMessage = new TranslationMessage(god.GotoEnterMessage);
                    GlobalReference.GlobalValues.Notify.Room(performer, null, god.Room, translationMessage, null, true, false);
                }
                #endregion Enter
            }

            performer.Room.RemoveMobileObjectFromRoom(performer);
            newRoom.AddMobileObjectToRoom(performer);
            performer.Room = newRoom;

            return(GlobalReference.GlobalValues.CommandList.PcCommandsLookup["LOOK"].PerformCommand(performer, new Command()));
        }
예제 #9
0
파일: Event.cs 프로젝트: crybx/mud
        public void DamageDealtAfterDefense(IMobileObject attacker, IMobileObject defender, int damageAmount)
        {
            string message = $"DamageDealtAfterDefense: Attacker-{attacker?.SentenceDescription ?? "unknown"} Defender-{defender.SentenceDescription} DamageAmount-{damageAmount}.";

            GlobalReference.GlobalValues.Logger.Log(attacker, LogLevel.DEBUGVERBOSE, message);

            RunEnchantments(attacker, EventType.DamageDealtAfterDefense, new EventParamerters()
            {
                Attacker = attacker, Defender = defender, DamageAmount = damageAmount
            });

            #region damage messages
            //attacker?.EnqueueMessage(GlobalReference.GlobalValues.TagWrapper.WrapInTag($"You hit {defender.SentenceDescription} for {damageAmount} damage.", TagType.DamageDelt));
            if (attacker != null)
            {
                GlobalReference.GlobalValues.Notify.Mob(attacker, defender, attacker, new TranslationMessage("You hit {target} for {0} damage.".Replace("{0}", damageAmount.ToString()), TagType.DamageDelt));
            }
            if (defender != null)
            {
                GlobalReference.GlobalValues.Notify.Mob(attacker, defender, defender, new TranslationMessage("{performer} hit you for {0} damage.".Replace("{0}", damageAmount.ToString()), TagType.DamageReceived));
            }
            //defender?.EnqueueMessage(GlobalReference.GlobalValues.TagWrapper.WrapInTag($"{CapitializeFirstLetter(attacker?.SentenceDescription ?? "unknown")} hit you for {damageAmount} damage.", TagType.DamageReceived));

            message = $"{CapitializeFirstLetter(attacker?.SentenceDescription ?? "unknown")} attacked {defender.SentenceDescription} for {damageAmount} damage.";
            ITranslationMessage translationMessage = new TranslationMessage(message);
            GlobalReference.GlobalValues.Notify.Room(attacker, defender, attacker.Room, translationMessage, new List <IMobileObject>()
            {
                attacker, defender
            });
            #endregion damage messages
        }
예제 #10
0
 public PoisonBreath() : base(nameof(PoisonBreath),
                              GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(60).Die,
                              GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(60).Sides,
                              DamageType.Poison)
 {
     PerformerNotificationSuccess = new TranslationMessage("Like a blur you rush {target} and  blow green gas in {target} face leaving them choking.");
     RoomNotificationSuccess      = new TranslationMessage("Like a blur {performer} rushes toward {target} as they blow a cloud of green gas in their face.");
     TargetNotificationSuccess    = new TranslationMessage("One second you are fighting {performer} at arms length and the next they are in your face.  with a slightly evil grin they blow a cloud of noxious gas in your face leaving you to choke on the fumes.");
 }
예제 #11
0
 public LightBurst() : base(nameof(LightBurst),
                            GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(80).Die,
                            GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(80).Sides,
                            DamageType.Radiant)
 {
     PerformerNotification = new TranslationMessage("{performer} test {target}");
     RoomNotification      = new TranslationMessage("{performer} test {target}");
     TargetNotification    = new TranslationMessage("{performer} test {target}");
 }
예제 #12
0
 public Smite() : base(nameof(Smite),
                       GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(100).Die,
                       GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(100).Sides,
                       DamageType.Force)
 {
     PerformerNotificationSuccess = new TranslationMessage("You look at {target} with great anger in your eyes.  A force radiates from you knocking them back.");
     RoomNotificationSuccess      = new TranslationMessage("{performer} looks at {target} with a great anger in their eyes.  {target} is knocked back by some type of invisible force.");
     TargetNotificationSuccess    = new TranslationMessage("{performer} looks at you with anger in his eyes.  Suddenly you are knocked back by a great force.");
 }
예제 #13
0
파일: AcidBolt.cs 프로젝트: elavanis/Mud
 public AcidBolt() : base(nameof(AcidBolt),
                          GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(20).Die,
                          GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(20).Sides,
                          DamageType.Acid)
 {
     PerformerNotificationSuccess = new TranslationMessage("Acid leaps from you hands and lands on {target} burning their skin.");
     RoomNotificationSuccess      = new TranslationMessage("Acid leaps from {performer} arms and lands {target} burning their skin.");
     TargetNotificationSuccess    = new TranslationMessage("Acid leaps from {performer} arms and lands on you burning your skin.");
 }
예제 #14
0
 public ThunderClap() : base(nameof(ThunderClap),
                             GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(10).Die,
                             GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(10).Sides,
                             DamageType.Thunder)
 {
     PerformerNotificationSuccess = new TranslationMessage("You clap your hands together at {target} and a large crack like thunder shakes them to the bone.");
     RoomNotificationSuccess      = new TranslationMessage("{performer} claps their hands at {target} and a large crack of thunder fills the air.");
     TargetNotificationSuccess    = new TranslationMessage("{performer} claps their hands in front of them the loud crack of thunder rattles your bones.");
 }
예제 #15
0
 public PyschicScream() : base(nameof(PyschicScream),
                               GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(50).Die,
                               GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(50).Sides,
                               DamageType.Cold)
 {
     PerformerNotificationSuccess = new TranslationMessage("Closing your eyes you and using your minds voice you scream at {target}.");
     RoomNotificationSuccess      = new TranslationMessage("{performer} closes their eyes and {target} begins to scream in terror covering their ears.");
     TargetNotificationSuccess    = new TranslationMessage("{performer} closes their eyes.  Suddenly you hear the sound screaming as if from a banshee.");
 }
예제 #16
0
        public void TranslationMessage_GetTranslatedMessage_NoList()
        {
            translationMessage = new TranslationMessage("wrapped{0}", TagType.Info);

            string result = translationMessage.GetTranslatedMessage(mob.Object);

            Assert.AreEqual("wrapped{0}", result);
            translationPair.Verify(e => e.GetTranslation(mob.Object), Times.Never);
        }
예제 #17
0
파일: KneeBreaker.cs 프로젝트: elavanis/Mud
 public KneeBreaker() : base(nameof(KneeBreaker),
                             GlobalReference.GlobalValues.DefaultValues.DiceForSkillLevel(80).Die,
                             GlobalReference.GlobalValues.DefaultValues.DiceForSkillLevel(80).Sides,
                             DamageType.Bludgeon)
 {
     PerformerNotificationSuccess = new TranslationMessage("Lift your foot high in the air you expertly bring it down on the knee of {target}.");
     RoomNotificationSuccess      = new TranslationMessage("{performer} lifts their foot high and brings it down on the knee of {target}.");
     TargetNotificationSuccess    = new TranslationMessage("{performer} lifts their foot and brings it down on your knee.");
 }
예제 #18
0
 public ThicketOfBlades() : base(nameof(ThicketOfBlades),
                                 GlobalReference.GlobalValues.DefaultValues.DiceForSkillLevel(90).Die,
                                 GlobalReference.GlobalValues.DefaultValues.DiceForSkillLevel(90).Sides,
                                 DamageType.Bludgeon)
 {
     PerformerNotificationSuccess = new TranslationMessage("Moving your blade so quick it becomes a blur of flashes that leave {target} with hundreds of cuts..");
     RoomNotificationSuccess      = new TranslationMessage("{performer} moves their blade so quickly it a blur of flashes that {target} is unable to defend against.");
     TargetNotificationSuccess    = new TranslationMessage("{performer} begins to move so fast their blade disappears and becomes a flashing light that feels like your running through a thicket of thorns.");
 }
예제 #19
0
 public PummelStrike() : base(nameof(PummelStrike),
                              GlobalReference.GlobalValues.DefaultValues.DiceForSkillLevel(70).Die,
                              GlobalReference.GlobalValues.DefaultValues.DiceForSkillLevel(70).Sides,
                              DamageType.Bludgeon)
 {
     PerformerNotificationSuccess = new TranslationMessage("Taking pummel of your weapon you strike it against {target}.");
     RoomNotificationSuccess      = new TranslationMessage("{performer} strikes their pummel against {target}.");
     TargetNotificationSuccess    = new TranslationMessage("{performer} hits you with their pummel.");
 }
예제 #20
0
 public SpittingCobra() : base(nameof(SpittingCobra),
                               GlobalReference.GlobalValues.DefaultValues.DiceForSkillLevel(30).Die,
                               GlobalReference.GlobalValues.DefaultValues.DiceForSkillLevel(30).Sides,
                               DamageType.Poison)
 {
     PerformerNotificationSuccess = new TranslationMessage("You spit the poison on {target}'s face.");
     RoomNotificationSuccess      = new TranslationMessage("{performer} spits some type of purple liquid on to {target}'s face.");
     TargetNotificationSuccess    = new TranslationMessage("{performer} spits a purple liquid onto your face.");
 }
예제 #21
0
 public SunShine() : base(nameof(SunShine),
                          GlobalReference.GlobalValues.DefaultValues.DiceForSkillLevel(60).Die,
                          GlobalReference.GlobalValues.DefaultValues.DiceForSkillLevel(60).Sides,
                          DamageType.Bludgeon)
 {
     PerformerNotificationSuccess = new TranslationMessage("Taking a step back you charge towards {target}.  Startled they widen their stance and brace for the impact allowing you slide between their legs and hit them where the sun don't shine causing them to howl in pain.");
     RoomNotificationSuccess      = new TranslationMessage("{performer} takes a step back and charges toward {target}.  Taken off guard {target} barely has time to widen their stance and brace for impact as {performer} slides beneath their legs. {target} howles in pain.");
     TargetNotificationSuccess    = new TranslationMessage("{performer} charges toward you.  You quickly attempt to brace for the impact but it never comes instead {performer} slides between your legs and hits you where the sun don't shine.");
 }
예제 #22
0
 public LightBurst() : base(nameof(LightBurst),
                            GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(80).Die,
                            GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(80).Sides,
                            DamageType.Radiant)
 {
     PerformerNotificationSuccess = new TranslationMessage("Circling your hands around an imaginary sphere you push out.  Turning away the imaginary sphere burst into light blinding {target}.");
     RoomNotificationSuccess      = new TranslationMessage("{performer} swirls their hands around an imaginary sphere.  They push the sphere towards {target} and quickly before light white blinding burst forth filling the room.");
     TargetNotificationSuccess    = new TranslationMessage("{performer} swirls their hands around an imaginary sphere and pushes it towards you while quickly turning away.  A moment later bright light burst forth.");
 }
예제 #23
0
파일: Freeze.cs 프로젝트: crybx/mud
 public Freeze() : base(nameof(Freeze),
                        GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(40).Die,
                        GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(40).Sides,
                        DamageType.Cold)
 {
     PerformerNotification = new TranslationMessage("{performer} test {target}");
     RoomNotification      = new TranslationMessage("{performer} test {target}");
     TargetNotification    = new TranslationMessage("{performer} test {target}");
 }
예제 #24
0
파일: RagingBull.cs 프로젝트: elavanis/Mud
 public RagingBull() : base(nameof(RagingBull),
                            GlobalReference.GlobalValues.DefaultValues.DiceForSkillLevel(1).Die,
                            GlobalReference.GlobalValues.DefaultValues.DiceForSkillLevel(1).Sides,
                            DamageType.Bludgeon)
 {
     PerformerNotificationSuccess = new TranslationMessage("You lower your head and charge towards {target} hitting them with all your might.");
     RoomNotificationSuccess      = new TranslationMessage("{performer} lowers their head and charges toward {target} hitting them with all their might.");
     TargetNotificationSuccess    = new TranslationMessage("{performer} briefly lowered their head before crashing into you.");
 }
예제 #25
0
 public PoisonBreath() : base(nameof(PoisonBreath),
                              GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(60).Die,
                              GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(60).Sides,
                              DamageType.Poison)
 {
     PerformerNotification = new TranslationMessage("{performer} test {target}");
     RoomNotification      = new TranslationMessage("{performer} test {target}");
     TargetNotification    = new TranslationMessage("{performer} test {target}");
 }
예제 #26
0
 public Rot() : base(nameof(Rot),
                     GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(90).Die,
                     GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(90).Sides,
                     DamageType.Necrotic)
 {
     PerformerNotification = new TranslationMessage("{performer} test {target}");
     RoomNotification      = new TranslationMessage("{performer} test {target}");
     TargetNotification    = new TranslationMessage("{performer} test {target}");
 }
예제 #27
0
 public Rot() : base(nameof(Rot),
                     GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(90).Die,
                     GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(90).Sides,
                     DamageType.Necrotic)
 {
     PerformerNotificationSuccess = new TranslationMessage("Waving your hand across your arm spots of rotting flesh begin to form.  Going back and your arm is healthy.  Suddenly {target} cries out in pain.  A cursory glance shows them a pale color with spots of decay.");
     RoomNotificationSuccess      = new TranslationMessage("{performer} waves his hand back and forth across his arm causing boils and rotting flesh to appear and disappear.  As the afflictions leave {performer} they appear on {target}.");
     TargetNotificationSuccess    = new TranslationMessage("{performer} waves his hand back and forth across his arm causing decay to first appear on his arm then disappear and reappear on you.");
 }
예제 #28
0
 public ThunderClap() : base(nameof(ThunderClap),
                             GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(10).Die,
                             GlobalReference.GlobalValues.DefaultValues.DiceForSpellLevel(10).Sides,
                             DamageType.Thunder)
 {
     PerformerNotification = new TranslationMessage("{performer} test {target}");
     RoomNotification      = new TranslationMessage("{performer} test {target}");
     TargetNotification    = new TranslationMessage("{performer} test {target}");
 }
예제 #29
0
 public ShoulderBash() : base(nameof(ShoulderBash),
                              GlobalReference.GlobalValues.DefaultValues.DiceForSkillLevel(10).Die,
                              GlobalReference.GlobalValues.DefaultValues.DiceForSkillLevel(10).Sides,
                              DamageType.Bludgeon)
 {
     PerformerNotificationSuccess = new TranslationMessage("Lowering your shoulder you bash into {target} knocking them back slightly.");
     RoomNotificationSuccess      = new TranslationMessage("{performer} moves in close to {target} before lowering their shoulder and bashing into {target} knocking them back slightly.");
     TargetNotificationSuccess    = new TranslationMessage("{performer} knocks their shoulder into you knocking you back slightly.");
 }
예제 #30
0
파일: Pierce.cs 프로젝트: elavanis/Mud
 public Pierce() : base(nameof(Pierce),
                        GlobalReference.GlobalValues.DefaultValues.DiceForSkillLevel(20).Die,
                        GlobalReference.GlobalValues.DefaultValues.DiceForSkillLevel(20).Sides,
                        DamageType.Pierce)
 {
     PerformerNotificationSuccess = new TranslationMessage("Taking your weapon you thrust it toward {target} piercing them.");
     RoomNotificationSuccess      = new TranslationMessage("{performer} quickly thrust their weapon at {target} piercing them.");
     TargetNotificationSuccess    = new TranslationMessage("{performer} takes the pointy end of their weapon and in a blink of an eye uses it to pierce you.");
 }