public override bool ShouldShowUnseenArtifacts(IRoom room, IArtifact artifact) { Debug.Assert(artifact != null); var ac = artifact.GetArtifactCategory(ArtTypes, false); if (ac != null) { if (ac.IsWeapon01()) { return(!artifact.IsReadyableByCharacter() || artifact.IsCarriedByCharacter()); } else if (ac.Type == ArtifactType.Wearable) { return(artifact.IsCarriedByCharacter()); } else { return(true); } } else { return(true); } }
public override bool ShouldShowUnseenArtifacts(IRoom room, IArtifact artifact) { Debug.Assert(room != null); Debug.Assert(artifact != null); return(room.IsLit() && (artifact.LightSource != null ? artifact.IsCarriedByCharacter() : true)); }
public virtual void ProcessLightSource() { if (gGameState.Ls > 0) { LsArtifact = gADB[gGameState.Ls]; Debug.Assert(LsArtifact != null && LsArtifact.LightSource != null); if ((DropAll || LsArtifact == DobjArtifact) && LsArtifact.IsCarriedByCharacter()) { gEngine.LightOut(LsArtifact); } } }
public override bool ShouldShowUnseenArtifacts(IRoom room, IArtifact artifact) { Debug.Assert(artifact != null); return(artifact.IsCarriedByCharacter()); }
public override void PlayerExecute() { Debug.Assert(gDobjArtifact != null); var ac = gDobjArtifact.BoundMonster; if (ac != null) { var monsterUid = ac.GetMonsterUid(); var keyUid = ac.GetKeyUid(); var guardUid = ac.Field3; Monster = monsterUid > 0 ? gMDB[monsterUid] : null; Key = keyUid > 0 ? gADB[keyUid] : null; Guard = guardUid > 0 ? gMDB[guardUid] : null; Debug.Assert(Monster != null); PlayerProcessEvents(PpeBeforeGuardMonsterCheck); if (GotoCleanup) { goto Cleanup; } if (Guard != null && Guard.IsInRoom(gActorRoom)) { gOut.Print("{0} won't let you!", Guard.GetTheName(true)); goto Cleanup; } if (keyUid == -1) { gOut.Print("There's no obvious way to do that."); goto Cleanup; } if (Key != null && !Key.IsCarriedByCharacter() && !Key.IsWornByCharacter() && !Key.IsInRoom(gActorRoom)) { gOut.Print("You don't have the key."); goto Cleanup; } PrintMonsterFreed(); Monster.SetInRoom(gActorRoom); gDobjArtifact.SetInLimbo(); } else { PrintCantVerbObj(gDobjArtifact); NextState = Globals.CreateInstance <IStartState>(); goto Cleanup; } Cleanup: if (NextState == null) { NextState = Globals.CreateInstance <IMonsterStartState>(); } }
public override void Execute() { RetCode rc; Debug.Assert(Direction == 0 || Enum.IsDefined(typeof(Direction), Direction)); Globals.PlayerMoved = true; gCommandParser.LastHimNameStr = ""; gCommandParser.LastHerNameStr = ""; gCommandParser.LastItNameStr = ""; gCommandParser.LastThemNameStr = ""; gGameState.R3 = gGameState.Ro; gGameState.Ro = gGameState.R2; if (MoveMonsters) { gEngine.MoveMonsters(); } ProcessEvents(EventType.AfterMoveMonsters); Debug.Assert(gCharMonster != null); gCharMonster.Location = gGameState.Ro; if (gGameState.Ls > 0 && gGameState.Ro != gGameState.R3) { LsArtifact = gADB[gGameState.Ls]; Debug.Assert(LsArtifact != null); if (!LsArtifact.IsCarriedByCharacter()) { rc = LsArtifact.RemoveStateDesc(LsArtifact.GetProvidingLightDesc()); Debug.Assert(gEngine.IsSuccess(rc)); gGameState.Ls = 0; } } NewRoom = gRDB[gGameState.Ro]; Debug.Assert(NewRoom != null); if (NewRoom.LightLvl > 0 && gGameState.Ls > 0) { gEngine.CheckToExtinguishLightSource(); } ProcessEvents(EventType.AfterExtinguishLightSourceCheck); if (NextState == null) { NextState = Globals.CreateInstance <IStartState>(); } Globals.NextState = NextState; }
public override bool ShouldShowUnseenArtifacts(IRoom room, IArtifact artifact) { Debug.Assert(artifact != null); return(artifact.Wearable != null?artifact.IsCarriedByCharacter() || artifact.IsWornByCharacter() : true); }
public virtual bool ShouldShowUnseenArtifacts(IRoom room, IArtifact artifact) { if (Command is IGiveCommand) { Debug.Assert(artifact != null); return(artifact.IsCarriedByCharacter()); } else if (Command is IRequestCommand) { return(false); } else if (Command is IDropCommand) { Debug.Assert(artifact != null); return(artifact.IsWornByCharacter()); } else if (Command is IExamineCommand) { Debug.Assert(artifact != null); return(Enum.IsDefined(typeof(ContainerType), Command.ContainerType) && !artifact.IsWornByCharacter()); } else if (Command is IGetCommand) { return(false); } else if (Command is ILightCommand) { Debug.Assert(room != null); Debug.Assert(artifact != null); return(room.IsLit() && (artifact.LightSource != null ? artifact.IsCarriedByCharacter() : true)); } else if (Command is IPutCommand) { Debug.Assert(artifact != null); return(artifact.IsCarriedByCharacter()); } else if (Command is IReadyCommand readyCommand) { Debug.Assert(artifact != null); var ac = artifact.GetArtifactCategory(readyCommand.ArtTypes, false); if (ac != null) { if (ac.Type == ArtifactType.Wearable) { return(artifact.IsCarriedByCharacter()); } else { return(!artifact.IsReadyableByCharacter() || artifact.IsCarriedByCharacter()); } } else { return(true); } } else if (Command is IRemoveCommand) { Debug.Assert(artifact != null); return(Command.CommandParser.ObjData == Command.CommandParser.IobjData || artifact.IsWornByCharacter()); } else if (Command is IUseCommand useCommand) { Debug.Assert(artifact != null); var ac = artifact.GetArtifactCategory(useCommand.ArtTypes, false); if (ac != null) { if (ac.IsWeapon01()) { return(!artifact.IsReadyableByCharacter() || artifact.IsCarriedByCharacter()); } else if (ac.Type == ArtifactType.Wearable) { return(artifact.IsCarriedByCharacter()); } else { return(true); } } else { return(true); } } else if (Command is IWearCommand) { Debug.Assert(artifact != null); return(artifact.Wearable != null?artifact.IsCarriedByCharacter() || artifact.IsWornByCharacter() : true); } else { return(true); } }