public void Should_throw_exception_if_player_is_mind_controlled_with_forced_march() { player = new PlayerBuilder() .With(n => n.Id, 9) .With(p => p.User, new UserBuilder().BuildAndSave()) .With(p => p.Money, 1000) .With(p => p.Mobility, PvPStatics.MobilityFull) .With(p => p.Location, LocationsStatics.STREET_270_WEST_9TH_AVE) .With(p => p.LastCombatTimestamp, DateTime.UtcNow.AddHours(-3)) .BuildAndSave(); var effectSourceMarch = new EffectSourceBuilder() .With(e => e.Id, MindControlStatics.MindControl__Movement_DebuffEffectSourceId) .BuildAndSave(); var effectMarch = new EffectBuilder() .With(e => e.EffectSource, effectSourceMarch) .BuildAndSave(); player.Effects.Add(effectMarch); var cmd = new TakeBus { playerId = player.Id, destination = LocationsStatics.STREET_160_SUNNYGLADE_DRIVE }; Assert.That(() => Repository.Execute(cmd), Throws.TypeOf <DomainException>().With.Message .EqualTo("You can't ride the bus while under the Forced March! mind control spell.")); }
public void should_not_shout_if_hushed() { var player = new PlayerBuilder() .With(p => p.User, new UserBuilder() .With(u => u.Id, "abcde") .BuildAndSave()) .With(p => p.Location, LocationsStatics.STREET_200_MAIN_STREET) .With(p => p.ShoutsRemaining, 1) .BuildAndSave(); var effectSourceHushed = new EffectSourceBuilder() .With(e => e.Id, CharacterPrankProcedures.HUSHED_EFFECT) .BuildAndSave(); var effectHushed = new EffectBuilder() .With(e => e.EffectSource, effectSourceHushed) .BuildAndSave(); player.Effects.Add(effectHushed); var cmd = new Shout { Message = "Hello world!", UserId = player.User.Id }; Assert.That(() => Repository.Execute(cmd), Throws.TypeOf <DomainException>().With.Message.EqualTo("You have been hushed and cannot currently shout.")); }
public void psychotic_players_should_not_lock_permanently() { var botVictim = new PlayerBuilder() .With(p => p.Id, 55) .With(p => p.FirstName, "Victim") .With(p => p.LastName, "McGee") .With(p => p.GameMode, (int)GameModeStatics.GameModes.PvP) .With(p => p.BotId, AIStatics.PsychopathBotId) .With(p => p.Level, 7) .BuildAndSave(); var effectSourcePsychotic = new EffectSourceBuilder() .With(e => e.Id, JokeShopProcedures.PSYCHOTIC_EFFECT) .BuildAndSave(); var effectPsychotic = new EffectBuilder() .With(e => e.EffectSource, effectSourcePsychotic) .With(e => e.Duration, 1) .With(e => e.Owner, botVictim) .BuildAndSave(); botVictim.Effects.Add(effectPsychotic); var cmd = new PlayerBecomesItem { AttackerId = attacker.Id, VictimId = botVictim.Id, NewFormId = formSource.Id }; Assert.That(DomainRegistry.Repository.Execute(cmd), Has.Property("AttackerLog") .EqualTo("<br><b>You fully transformed Victim McGee into a A new Item!</b>!") .And.Property("VictimLog") .EqualTo("<br><b>You have been fully transformed into a A new Item!!</b>!") .And.Property("LocationLog") .EqualTo("<br><b>Victim McGee was completely transformed into a A new Item!</b> here.")); var victimPostTF = DataContext.AsQueryable <Player>().FirstOrDefault(p => p.Id == botVictim.Id); Assert.That(victimPostTF, Is.Not.Null); Assert.That(victimPostTF.Mobility, Is.EqualTo(PvPStatics.MobilityInanimate)); Assert.That(victimPostTF.FormSource.Id, Is.EqualTo(formSource.Id)); Assert.That(victimPostTF.Item.ItemSource.Id, Is.EqualTo(itemSource.Id)); var newItem = DataContext.AsQueryable <Item>().FirstOrDefault(i => i.FormerPlayer != null && i.FormerPlayer.Id == botVictim.Id); Assert.That(newItem, Is.Not.Null); Assert.That(newItem.Owner.Id, Is.EqualTo(attacker.Id)); Assert.That(newItem.PvPEnabled, Is.EqualTo((int)GameModeStatics.GameModes.Protection)); Assert.That(newItem.IsPermanent, Is.False); Assert.That(newItem.Level, Is.EqualTo(botVictim.Level)); Assert.That(newItem.dbLocationName, Is.Empty); Assert.That(newItem.ItemSource.FriendlyName, Is.EqualTo(itemSource.FriendlyName)); Assert.That(newItem.ConsentsToSoulbinding, Is.False); }
public void should_throw_exception_if_player_is_mind_controlled() { var mindControl = new VictimMindControlBuilder() .With(v => v.FormSourceId, MindControlStatics.MindControl__MovementFormSourceId) .With(v => v.TurnsRemaining, 3) .BuildAndSave(); var mindControlList = new List <VictimMindControl> { mindControl }; new PlayerBuilder() .With(p => p.Id, 51) .With(p => p.User, new UserBuilder() .With(u => u.Id, "abcde") .With(u => u.Stats, stats) .BuildAndSave()) .With(p => p.Location, LocationsStatics.STREET_200_MAIN_STREET) .With(p => p.VictimMindControls, mindControlList) .BuildAndSave(); var effectSourceMarch = new EffectSourceBuilder() .With(e => e.Id, MindControlStatics.MindControl__Movement_DebuffEffectSourceId) .BuildAndSave(); var effectMarch = new EffectBuilder() .With(e => e.EffectSource, effectSourceMarch) .BuildAndSave(); player.Effects.Add(effectMarch); var cmd = new Move { PlayerId = 51, destination = destination }; Assert.That(() => Repository.Execute(cmd), Throws.TypeOf <DomainException>().With.Message.EqualTo( "You try to move but discover you cannot! Some other mage has partial control of your mind, disabling your ability to move on your own!")); }