Esempio n. 1
0
        public void Research(bool onlyForeground, int tileStates)
        {
            for (int y = 0; y < StaticData.FieldHeight; y++)
            {
                for (int x = 0; x < StaticData.FieldWidth; x++)
                {
                    NWTile tile = (NWTile)GetTile(x, y);

                    if (onlyForeground)
                    {
                        if (tile.ForeBase != PlaceID.pid_Undefined)
                        {
                            tile.AddStates(tileStates);
                        }
                    }
                    else
                    {
                        tile.AddStates(tileStates);
                    }
                }
            }
        }
Esempio n. 2
0
        public void InitField()
        {
            try {
                NWLayer layer = Layer;
                if (fEntry != null && fEntry.Source == FieldSource.fsTemplate)
                {
                    LoadFromEntry(fEntry);
                    ProcessVariants();
                }
                else
                {
                    if (LandID == GlobalVars.Land_Armory || LandID == GlobalVars.Land_GrynrHalls)
                    {
                        UniverseBuilder.Build_Dungeon(this, AreaRect);
                    }
                    else
                    {
                        if (layer.EntryID != GlobalVars.Layer_Svartalfheim1 && layer.EntryID != GlobalVars.Layer_Svartalfheim2 && layer.EntryID != GlobalVars.Layer_Svartalfheim3)
                        {
                            Prepare(PlaceID.pid_Grass);
                        }
                    }
                }

                int defTS = 0;
                if (LandID == GlobalVars.Land_Bifrost || LandID == GlobalVars.Land_Crossroads)
                {
                    defTS = BaseTile.TS_VISITED;
                }

                for (int y = 0; y < StaticData.FieldHeight; y++)
                {
                    for (int x = 0; x < StaticData.FieldWidth; x++)
                    {
                        NWTile tile = (NWTile)GetTile(x, y);
                        tile.BackgroundExt = 0;
                        tile.ForegroundExt = 0;
                        tile.ScentAge      = 0;
                        tile.ScentTrail    = null;
                        tile.AddStates(defTS);
                    }
                }

                if (fLandEntry.Flags.Contains(LandFlags.lsHasForest))
                {
                    UniverseBuilder.Build_Forest(this);
                }
                if (fLandEntry.Flags.Contains(LandFlags.lsHasMountain))
                {
                    UniverseBuilder.Gen_RarelyMountains(this);
                }
                if (fLandEntry.Flags.Contains(LandFlags.lsHasItems))
                {
                    UniverseBuilder.Gen_Items(this, -1);
                }
                if (fLandEntry.Flags.Contains(LandFlags.lsIsCave))
                {
                    UniverseBuilder.Gen_CaveObjects(this);
                }

                if (LandID == GlobalVars.Land_Ocean)
                {
                    Prepare(PlaceID.pid_Water);
                }

                if (LandID == GlobalVars.Land_Vanaheim)
                {
                    UniverseBuilder.Build_Vanaheim(this);
                }
                if (LandID == GlobalVars.Land_Alfheim)
                {
                    UniverseBuilder.Build_Alfheim(this);
                }
                if (LandID == GlobalVars.Land_Wasteland)
                {
                    UniverseBuilder.Build_Wasteland(this);
                }
                if (LandID == GlobalVars.Land_Crossroads)
                {
                    UniverseBuilder.Build_Crossroads(this);
                }
                if (LandID == GlobalVars.Land_Village)
                {
                    UniverseBuilder.Build_Village(this);
                }
                if (LandID == GlobalVars.Land_MimerRealm)
                {
                    UniverseBuilder.Build_MimerRealm(this);
                }
                if (LandID == GlobalVars.Land_MimerWell)
                {
                    UniverseBuilder.Build_MimerWell(this);
                }
                if (LandID == GlobalVars.Land_GrynrHalls)
                {
                    UniverseBuilder.Build_GrynrHalls(this);
                }
                if (LandID == GlobalVars.Land_Bazaar)
                {
                    UniverseBuilder.Build_Bazaar(this);
                }
                if (LandID == GlobalVars.Land_Temple)
                {
                    UniverseBuilder.Build_VidurTemple(this);
                }
                if (LandID == GlobalVars.Land_GodsFortress)
                {
                    UniverseBuilder.Build_GodsFortress(this);
                }
                if (LandID == GlobalVars.Land_Valhalla)
                {
                    UniverseBuilder.Build_Valhalla(this);
                }
                if (LandID == GlobalVars.Land_Muspelheim)
                {
                    UniverseBuilder.Build_Muspelheim(this);
                }

                if (LandID == GlobalVars.Land_Ocean)
                {
                    UniverseBuilder.Build_Ocean(this);
                }
                else
                {
                    UniverseBuilder.Gen_Creatures(this, -1);
                    UniverseBuilder.Gen_Traps(this, -2);
                }
            } catch (Exception ex) {
                Logger.Write("NWField.InitField(" + DebugSign + "): " + ex.Message);
            }
        }