public override void Execute() { RetCode rc; Debug.Assert(DobjArtifact != null && IobjArtifact != null && Prep != null && Enum.IsDefined(typeof(ContainerType), Prep.ContainerType)); Debug.Assert(DobjArtifact.IsCarriedByContainer(IobjArtifact) && DobjArtifact.GetCarriedByContainerContainerType() == Prep.ContainerType); ArtTypes = new ArtifactType[] { ArtifactType.DisguisedMonster, ArtifactType.DeadBody, ArtifactType.BoundMonster, ArtifactType.Weapon, ArtifactType.MagicWeapon }; DobjArtAc = DobjArtifact.GetArtifactCategory(ArtTypes, false); if (DobjArtAc == null) { DobjArtAc = DobjArtifact.GetCategories(0); } if (DobjArtAc != null && DobjArtAc.Type != ArtifactType.DisguisedMonster && DobjArtifact.Weight <= 900 && !DobjArtifact.IsUnmovable01() && (DobjArtAc.Type != ArtifactType.DeadBody || DobjArtAc.Field1 == 1) && DobjArtAc.Type != ArtifactType.BoundMonster) { OmitWeightCheck = DobjArtifact.IsCarriedByMonster(ActorMonster, true); DobjArtifactCount = 0; DobjArtifactWeight = DobjArtifact.Weight; if (DobjArtifact.GeneralContainer != null) { rc = DobjArtifact.GetContainerInfo(ref _dobjArtifactCount, ref _dobjArtifactWeight, ContainerType.In, true); Debug.Assert(gEngine.IsSuccess(rc)); rc = DobjArtifact.GetContainerInfo(ref _dobjArtifactCount, ref _dobjArtifactWeight, ContainerType.On, true); Debug.Assert(gEngine.IsSuccess(rc)); } ActorMonsterInventoryWeight = 0; rc = ActorMonster.GetFullInventoryWeight(ref _actorMonsterInventoryWeight, recurse: true); Debug.Assert(gEngine.IsSuccess(rc)); if (!gEngine.EnforceMonsterWeightLimits || OmitWeightCheck || (DobjArtifactWeight <= ActorMonster.GetWeightCarryableGronds() && DobjArtifactWeight + ActorMonsterInventoryWeight <= ActorMonster.GetWeightCarryableGronds() * ActorMonster.CurrGroupCount)) { DobjArtifact.SetCarriedByMonster(ActorMonster); Debug.Assert(gCharMonster != null); if (gCharMonster.IsInRoom(ActorRoom)) { if (ActorRoom.IsLit()) { MonsterName = ActorMonster.EvalPlural(ActorMonster.GetTheName(true), ActorMonster.GetArticleName(true, true, false, true, Globals.Buf01)); gOut.Print("{0} removes {1} from {2} {3}.", MonsterName, DobjArtifact.GetArticleName(), gEngine.EvalContainerType(Prep.ContainerType, "inside", "on", "under", "behind"), OmitWeightCheck ? IobjArtifact.GetArticleName(buf: Globals.Buf01) : IobjArtifact.GetTheName(buf: Globals.Buf01)); } else { MonsterName = string.Format("An unseen {0}", ActorMonster.CheckNBTLHostility() ? "offender" : "entity"); gOut.Print("{0} picks up {1}.", MonsterName, "a weapon"); } } // when a weapon is picked up all monster affinities to that weapon are broken FumbleMonsterList = gEngine.GetMonsterList(m => m.Weapon == -DobjArtifact.Uid - 1 && m != ActorMonster); foreach (var monster in FumbleMonsterList) { monster.Weapon = -1; } } } if (NextState == null) { NextState = Globals.CreateInstance <IErrorState>(x => { x.ErrorMessage = string.Format("{0}: NextState == null", Name); }); } }