Exemple #1
0
        public void Test_MoonPhaseReference()
        {
            World world = new World(SaveDirectory);

            MoonPhaseReferences moonPhaseReferences = new MoonPhaseReferences(world.DataOvlRef);

            for (byte nDay = 1; nDay <= 28; nDay++)
            {
                for (byte nHour = 0; nHour < 24; nHour++)
                {
                    TimeOfDay tod = new TimeOfDay(world.State.GetDataChunk(GameState.DataChunkName.CURRENT_YEAR),
                                                  world.State.GetDataChunk(GameState.DataChunkName.CURRENT_MONTH),
                                                  world.State.GetDataChunk(GameState.DataChunkName.CURRENT_DAY),
                                                  world.State.GetDataChunk(GameState.DataChunkName.CURRENT_HOUR),
                                                  world.State.GetDataChunk(GameState.DataChunkName.CURRENT_MINUTE));

                    tod.Day  = nDay;
                    tod.Hour = nHour;

                    MoonPhaseReferences.MoonPhases moonPhase = moonPhaseReferences.GetMoonGateMoonPhase(tod);

                    float fMoonAngle = moonPhaseReferences.GetMoonAngle(tod);
                    Assert.True(fMoonAngle >= 0 && fMoonAngle < 360);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="ultima5Directory">ultima 5 data and save game directory</param>
        public World(string ultima5Directory) : base()
        {
            _u5Directory = ultima5Directory;

            DataOvlRef = new DataOvlReference(_u5Directory);

            SmallMapRef = new SmallMapReferences(DataOvlRef);

            // build the overworld map
            OverworldMap = new LargeMap(_u5Directory, LargeMap.Maps.Overworld, _tileOverrides);

            // build the underworld map
            UnderworldMap = new LargeMap(_u5Directory, LargeMap.Maps.Underworld, _tileOverrides);

            SpriteTileReferences = new TileReferences(DataOvlRef.StringReferences);

            InvRef = new InventoryReferences();

            LargeMapRef = new LargeMapLocationReferences(DataOvlRef);

            AllSmallMaps = new SmallMaps(SmallMapRef, _u5Directory, SpriteTileReferences, _tileOverrides);

            MoonPhaseRefs = new MoonPhaseReferences(DataOvlRef);

            State = new GameState(_u5Directory, DataOvlRef);

            // build all combat maps from the Combat Map References
            foreach (CombatMapReference.SingleCombatMapReference combatMapRef in _combatMapRef.MapReferenceList)
            {
                CombatMap combatMap = new CombatMap(_u5Directory, combatMapRef, _tileOverrides);
            }

            // build a "look" table for all tiles
            LookRef = new Look(_u5Directory);

            // build the sign tables
            SignRef = new Signs(_u5Directory);

            TalkScriptsRef = new TalkScripts(_u5Directory, DataOvlRef);

            // build the NPC tables
            NpcRef = new NonPlayerCharacterReferences(_u5Directory, SmallMapRef, TalkScriptsRef, State);

            ShoppeKeeperDialogueReference = new ShoppeKeeperDialogueReference(_u5Directory, DataOvlRef, NpcRef, State.PlayerInventory);

            // sadly I have to initialize this after the NPCs are created because there is a circular dependency
            State.InitializeVirtualMap(SmallMapRef, AllSmallMaps, LargeMapRef, OverworldMap, UnderworldMap, NpcRef, SpriteTileReferences, State, NpcRef, InvRef);

            if (State.Location != SmallMapReferences.SingleMapReference.Location.Britannia_Underworld)
            {
                State.TheVirtualMap.LoadSmallMap(SmallMapRef.GetSingleMapByLocation(State.Location, State.Floor), State.CharacterRecords, true);
            }
            else
            {
                State.TheVirtualMap.LoadLargeMap(LargeMap.Maps.Overworld);
            }
        }
Exemple #3
0
        public Moonstones(DataOvlReference dataOvlRef, MoonPhaseReferences moonPhaseReferences, Moongates moongates)
            : base(dataOvlRef, null)
        {
            _moongates           = moongates;
            _moonPhaseReferences = moonPhaseReferences;

            // go through each of the moon phases one by one and create a moonstone
            foreach (MoonPhaseReferences.MoonPhases phase in Enum.GetValues(typeof(MoonPhaseReferences.MoonPhases)))
            {
                // there is no "no moon" moonstone
                if (phase == MoonPhaseReferences.MoonPhases.NoMoon)
                {
                    continue;
                }
                Items[phase] = new Moonstone(phase,
                                             dataOvlRef.StringReferences.GetString(DataOvlReference.ZstatsStrings.MOONSTONE_SPACE).TrimEnd(),
                                             dataOvlRef.StringReferences.GetString(DataOvlReference.ZstatsStrings.MOONSTONE_SPACE).TrimEnd(),
                                             dataOvlRef.StringReferences.GetString(DataOvlReference.ThingsIFindStrings.A_STRANGE_ROCK_BANG_N)
                                             .TrimEnd(), moongates, null);
                //invRefs.GetInventoryReference(InventoryReferences.InventoryReferenceType.Item, phase.ToString()));
            }
        }
Exemple #4
0
        public void Test_TestCorrectMoons()
        {
            World world = new World(SaveDirectory);

            MoonPhaseReferences moonPhaseReferences = new MoonPhaseReferences(world.DataOvlRef);

            TimeOfDay tod = new TimeOfDay(world.State.GetDataChunk(GameState.DataChunkName.CURRENT_YEAR),
                                          world.State.GetDataChunk(GameState.DataChunkName.CURRENT_MONTH),
                                          world.State.GetDataChunk(GameState.DataChunkName.CURRENT_DAY),
                                          world.State.GetDataChunk(GameState.DataChunkName.CURRENT_HOUR),
                                          world.State.GetDataChunk(GameState.DataChunkName.CURRENT_MINUTE));

            // tod.Day = 2;
            // tod.Hour = 4;
            tod.Day  = 25;
            tod.Hour = 4;

            MoonPhaseReferences.MoonPhases trammelPhase =
                moonPhaseReferences.GetMoonPhasesByTimeOfDay(tod, MoonPhaseReferences.MoonsAndSun.Trammel);
            MoonPhaseReferences.MoonPhases feluccaPhase =
                moonPhaseReferences.GetMoonPhasesByTimeOfDay(tod, MoonPhaseReferences.MoonsAndSun.Felucca);
            Debug.Assert(trammelPhase == MoonPhaseReferences.MoonPhases.GibbousWaning);
            Debug.Assert(feluccaPhase == MoonPhaseReferences.MoonPhases.LastQuarter);
        }