protected Hero(string name, Sect sect)
        {
            Name     = name;
            sectHero = sect;
            switch (sectHero)
            {
            case Sect.Shaolin:
                basicAttack = 50;
                break;

            case Sect.HeavenlyKings:
                basicAttack = 55;
                break;

            case Sect.Emei:
                basicAttack = 40;
                break;

            case Sect.TheyYen:
                basicAttack = 45;
                break;

            default:
                Console.WriteLine("No Sect for choose");
                break;
            }
        }
示例#2
0
		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="name">The entry Name.</param>
		/// <param name="length">The stream length.</param>
		/// <param name="dataOffset">Data offset.</param>
		/// <param name="sectors">The sectors.</param>
		/// <param name="fat">The FAT.</param>
		public StreamEntry(string name, long length, Sect dataOffset, SectorCollection sectors, Sect[] fat) : base(name)
		{
			_length = length;
			_data = new byte[length];

			if(!dataOffset.IsEndOfChain)
			{
				int left = (int)length;
				MemoryStream stream = new MemoryStream(_data);
				Sect sect = dataOffset;

				do
				{
					try
					{
						StorageSector sector = (StorageSector)sectors[sect];

						int toWrite = Math.Min(sector.Data.Length, left);
						Debug.Assert(toWrite <= 512);
						stream.Write(sector.Data, 0, toWrite);
						left -= toWrite;

						sect = fat[sect.ToInt()];
					}
					catch(Exception err)
					{
						Debug.WriteLine("Stream name is " + name);
						Debug.WriteLine(err.Message);
						Debug.WriteLine(err.StackTrace);

						return;
					}
				} while(!sect.IsEndOfChain);

				Debug.Assert(left == 0);
				Debug.Assert(stream.Length == stream.Position);
			}
		}
示例#3
0
        public void SetImageChain(int index = -1)
        {
            if (this._ImageChainSize == 0)
            {
                return;                            // Call InitializeImageChain first!
            }
            this.getImageForSize(ref _BitmapDrawnScaled, this._ImageChainSize, index);
            this._SectScaled = SectHolder.FromImage(_BitmapDrawnScaled, true);

            SingleImage.MatchOutputToInput(this._SectScaled, ref this._SectScaledFiltered);

            var im_size = this._SectScaledFiltered.getPrefferedSize();
            int w       = im_size.Width - 1;
            int h       = im_size.Height - 1;

            // init to 0 on black, 5 on white
            for (int y = 0; y < im_size.Height; y++)
            {
                for (int x = 0; x < im_size.Width; x++)
                {
                    this._SectScaledFiltered[y, x] = (this._SectScaled[y, x] < 0.5f) ? 0 : DECAY_DISTANCE;
                }
            }

            /// A *
            for (int i = 0; i < DECAY_DISTANCE; i++)
            {
                for (int y = 0; y < im_size.Height; y++)
                {
                    for (int x = 0; x < im_size.Width; x++)
                    {
                        float val = this._SectScaledFiltered[y, x];
                        if (y > 0)
                        {
                            val = Math.Min(val, this._SectScaledFiltered[y - 1, x] + 1);
                        }
                        if (y < h)
                        {
                            val = Math.Min(val, this._SectScaledFiltered[y + 1, x] + 1);
                        }
                        if (x > 0)
                        {
                            val = Math.Min(val, this._SectScaledFiltered[y, x - 1] + 1);
                        }
                        if (x < h)
                        {
                            val = Math.Min(val, this._SectScaledFiltered[y, x + 1] + 1);
                        }
                        this._SectScaledFiltered[y, x] = val;
                    }
                }
            }

            // Convert
            for (int y = 0; y < im_size.Height; y++)
            {
                for (int x = 0; x < im_size.Width; x++)
                {
                    this._SectScaledFiltered[y, x] =

                        (float)Math.Sqrt
                            (this._SectScaledFiltered[y, x] / DECAY_DISTANCE);
                }
            }
        }
示例#4
0
        private void Init(Stream stream)
        {
            // stream size sanity checker
            // compound files are always blocks of 512 bytes
            Debug.Assert((stream.Length % 512) == 0);

            // read in the first sector
            StorageSector sector = new StorageSector(stream);
            // interpret sector as header sector
            HeaderSector header = new HeaderSector(sector.GetStream());

            // read in all remaining sectors
            SectorCollection sectors = new SectorCollection((int)(stream.Length / Constants.SECTOR_SIZE));

            while (stream.Position != stream.Length)
            {
                sector = new StorageSector(stream);
                sectors.Add(sector);
            }

            // build the fat index
            List <Sect> index = new List <Sect>((int)(Constants.MAX_SECT * header.SectFatCount));

            // read first 109 fat entries
            for (int i = 0; i < header.SectFat.Length; ++i)
            {
                Sect fatSect = header.SectFat[i];
                if (!fatSect.IsFree)
                {
                    FatSector fat = new FatSector(((StorageSector)sectors[fatSect]).GetStream());
                    index.AddRange(fat.SectFat);
                    sectors[fatSect] = fat;
                }
            }

            // read remaining fat entries
            int  difCount;
            Sect difIndex;

            for (difIndex = header.SectDifStart, difCount = 0;
                 !difIndex.IsEndOfChain && difCount < header.SectDifCount;
                 ++difCount)
            {
                DifSector dif = new DifSector(((StorageSector)sectors[difIndex]).GetStream());
                sectors[difIndex] = dif;

                for (int i = 0; i < dif.SectFat.Length; ++i)
                {
                    Sect fatSect = dif.SectFat[i];

                    if (!fatSect.IsFree)
                    {
                        FatSector fat = new FatSector(((StorageSector)sectors[fatSect]).GetStream());
                        index.AddRange(fat.SectFat);
                        sectors[fatSect] = fat;
                    }
                }

                difIndex = dif.NextDif;
            }
            Debug.Assert(difCount == header.SectDifCount);

            // read in mini fat sectors
            Debug.Assert(index.Count == (header.SectFatCount * Constants.MAX_SECT));
            Debug.Assert(index.Capacity == index.Count);

            Sect[] fatSects = index.ToArray();

            Sect miniFatSect;
            int  miniFatCount;

            for (miniFatSect = header.SectMiniFatStart, miniFatCount = 0;
                 !miniFatSect.IsEndOfChain && miniFatCount < header.SectMiniFatCount;
                 miniFatSect = fatSects[miniFatSect.ToInt()], ++miniFatCount)
            {
                MiniFatSector miniFat = new MiniFatSector(((StorageSector)sectors[miniFatSect]).GetStream());
                sectors[miniFatSect] = miniFat;
            }

            Debug.Assert(miniFatCount == header.SectMiniFatCount);

            // read in directory sectors
            DirectorySectorEntryCollection dirs = new DirectorySectorEntryCollection();

            for (Sect dirSect = header.SectDirStart;
                 !dirSect.IsEndOfChain;
                 dirSect = fatSects[dirSect.ToInt()])
            {
                DirectorySector dir = new DirectorySector(((StorageSector)sectors[dirSect]).GetStream());

                foreach (DirectorySectorEntry entry in dir.Entries)
                {
                    dirs.Add(entry);
                }

                sectors[dirSect] = dir;
            }

            _directory = new Directory(dirs, sectors, fatSects);
        }
 public abstract Hero CreateHero(string name, Sect sect);
示例#6
0
 public WaterHero(string name, Sect sect) : base(name, sect)
 {
 }
示例#7
0
 public FireHero(string name, Sect sect) : base(name, sect)
 {
 }
示例#8
0
        protected override void Seed(BoonbookContext context)
        {
            //  This method will be called after migrating to the latest version.

            // Player Stuff.
            var User = new Role {
                Name = "User"
            };
            var Admin = new Role {
                Name = "Administrator"
            };
            var Harpy = new Role {
                Name = "Harpy"
            };
            var Talon = new Role {
                Name = "Talon"
            };

            context.Roles.AddOrUpdate(User, Admin, Harpy, Talon);

            var Kevin = new Player
            {
                Username     = "******",
                MesNumber    = "US2010123456",
                FirstName    = "Kevin",
                LastName     = "Whiteside",
                PasswordHash = "SuperPass123",
                Email        = "*****@*****.**",
                Roles        = new List <Role> {
                    Admin, Harpy
                }
            };
            var Paula = new Player
            {
                Username     = "******",
                MesNumber    = "US2010123456",
                FirstName    = "Paula",
                LastName     = "Wilkinson",
                PasswordHash = "An4chsRule",
                Email        = "*****@*****.**",
                Roles        = new List <Role> {
                    User
                }
            };
            var Austin = new Player
            {
                Username     = "******",
                MesNumber    = "US2010123456",
                FirstName    = "Austin",
                LastName     = "Bonecutter",
                PasswordHash = "p4ssword",
                Email        = "*****@*****.**",
                Roles        = new List <Role> {
                    User, Talon
                }
            };

            context.Players.AddOrUpdate(Kevin, Paula, Austin);

            // Character Stuff.
            var Toreador = new Clan {
                Name = "Toreador", PillarClan = true
            };
            var Ravnos = new Clan {
                Name = "Ravnos"
            };
            var Setite = new Clan {
                Name = "Followers of Set"
            };

            context.Clans.AddOrUpdate(Toreador, Ravnos, Setite);

            var Elder = new SocialClass {
                Name = "Elder"
            };
            var Ancilla = new SocialClass {
                Name = "Ancilla"
            };
            var Neonate = new SocialClass {
                Name = "Neonate"
            };

            context.SocialClasses.AddOrUpdate(Elder, Ancilla, Neonate);

            var Camarilla = new Sect {
                Name = "Camarilla"
            };
            var Anarch = new Sect {
                Name = "Anarch Movement"
            };

            context.Sects.AddOrUpdate(Camarilla, Anarch);

            var Gabriel = new Character
            {
                Name        = "Dr. Gabriel Tennyson",
                Clan        = Toreador,
                Sect        = Camarilla,
                SocialClass = Elder,
                Player      = Kevin,
                StartDate   = DateTime.Now.AddMonths(-14).AddDays(-3)
            };
            var DrSyd = new Character
            {
                Name        = "Dr. Sydney Baker",
                Clan        = Ravnos,
                Sect        = Anarch,
                SocialClass = Neonate,
                Player      = Paula,
                StartDate   = DateTime.Now.AddMonths(-4).AddDays(-215)
            };
            var Culebra = new Character
            {
                Name        = "Miguel Culebra",
                Clan        = Setite,
                Sect        = Camarilla,
                SocialClass = Ancilla,
                Player      = Austin,
                StartDate   = DateTime.Now.AddMonths(-54).AddDays(55)
            };

            context.Characters.AddOrUpdate(Gabriel, DrSyd, Culebra);

            // Boon Stuff.
            var Trivial = new BoonLevel {
                Name = "Trivial"
            };
            var Blood = new BoonLevel {
                Name = "Blood"
            };

            context.BoonLevels.AddOrUpdate(Trivial);

            var testBoon = new Boon
            {
                Registrar         = Gabriel,
                Creditor          = DrSyd,
                Debtor            = Culebra,
                Level             = Trivial,
                RegistrationDate  = DateTime.Now,
                RegistrationCause = "Not going all Anarch on that snakey ass.",
                Stipulations      = "Debtor cannot sneeze in front of Creditor while boon is held."
            };
            var secondBoon = new Boon
            {
                Registrar         = Culebra,
                Creditor          = Gabriel,
                Debtor            = DrSyd,
                Level             = Blood,
                RegistrationDate  = DateTime.Now,
                RegistrationCause = "Teaching both Elder Daimonion powers.",
                Stipulations      = "Boon can only be transferred during the full moon of each month. "
            };

            context.Boons.AddOrUpdate(testBoon, secondBoon);
        }
 public override Hero CreateHero(string name, Sect sect)
 {
     return(new FireHero(name, sect));
 }
示例#10
0
        drawSections()
        {
            Alignment objAlign = default(Alignment);

            try {
                objAlign = fWall1.ACTIVEALIGN;

                if ((objAlign == null))
                {
                    MessageBox.Show("Select Alignment");
                    return;
                }
            }
            catch (System.Exception) {
                MessageBox.Show("Select Alignment");
                return;
            }
            bool exists = false;

            TinSurface objSurfaceEXIST = Surf.getTinSurface("EXIST", out exists);
            TinSurface objSurfaceCPNT  = Surf.getTinSurface("CPNT-ON", out exists);

            //ObjectId objSectionStyleEXISTId = Sect.getSectionStyleId("EXIST");
            //ObjectId objSectionStyleCPNTId = Sect.getSectionStyleId("CPNT");
            //GroupPlotStyle objGroupPlotStyle = Sect.getGroupPlotStyle("WALL");
            //SampleLineStyle objSampleLineStyle = Sect.getSampleLineStyle("Standard");
            //SectionLabelSetStyle objSampleLabelSetStyle = Sect.getSampleLineLabelStyle("Standard");

            double dblLen = objAlign.Length;

            Sect.removeSampleLineGroups(objAlign.ObjectId);

            string strLayer = string.Format("{0}-SEC", objAlign.Name);

            Layer.manageLayers(strLayer);

            ObjectId idSLG = Sect.addSampleLineGroupAndSampleLines(objAlign.ObjectId, "SLG-1");

            idSLG.removeSampledSurfaces();

            ObjectIdCollection idSurfaces = new ObjectIdCollection();

            idSurfaces.Add(objSurfaceCPNT.ObjectId);
            idSurfaces.Add(objSurfaceEXIST.ObjectId);

            idSLG.addSurfaceToSample(idSurfaces);

            Sect.addSections(objAlign.ObjectId, idSLG, 20.0, 20.0);

            SampleLine objSampleLine = default(SampleLine);

            Autodesk.Civil.DatabaseServices.Section objSection = default(Autodesk.Civil.DatabaseServices.Section);

            ObjectIdCollection idsSampleLine = idSLG.getSampleLineIDs();

            using (var tr = BaseObjs.startTransactionDb()) {
                foreach (ObjectId idSampleLine in idsSampleLine)
                {
                    objSampleLine = (SampleLine)tr.GetObject(idSampleLine, OpenMode.ForRead);
                    foreach (ObjectId idSection in objSampleLine.GetSectionIds())
                    {
                        objSection       = (Section)tr.GetObject(idSection, OpenMode.ForWrite);
                        objSection.Layer = strLayer;
                    }
                }
                tr.Commit();
            }

            Autodesk.Civil.DatabaseServices.Styles.SectionViewStyle objSectionViewStyle = default(Autodesk.Civil.DatabaseServices.Styles.SectionViewStyle);

            try {
                objSectionViewStyle = Sect_Style.getSectionViewStyle("WALL");
            }
            catch (System.Exception) {
                objSectionViewStyle = Sect_Style.getSectionViewStyle("Standard");
            }

            SectionViewBandSetStyle objSectionViewBandStyleSet = Sect_Style.getSectionViewBandSetStyle("Standard");

            double dblOffX = 0;
            double dblOffY = 0;

            bool boolFirstPass = true;

            //Dim objStationRange As New StationRange
            //With objStationRange
            //    .UseSampleIncrements = True
            //    .SampleAtHighLowPoints = False
            //    .SampleAtHorizontalGeometryPoints = False
            //    .SampleAtSuperelevationCriticalStations = False
            //    .SampleAtRangeEnd = True
            //    .SampleAtRangeStart = True
            //    .StartRangeAtAlignmentStart = True
            //    .EndRangeAtAlignmentEnd = True
            //    .StartRange = 0.0
            //    .EndRange = dblLen - 1
            //    .IncrementTangent = 50.0
            //    .SwathWidthLeft = 20.0
            //    .SwathWidthRight = 20.0
            //    .SampleLineDefaultDirection = DirectionFromType.DirectionFromBaseAlignment
            //End With

            //objStationRange.SampleLineStyle = objSampleLineStyle

            //objSLG.SampleLines.AddByStationRange("SL-1", SampleLineDuplicateActionType.SampleLineDuplicateActionOverwrite, objStationRange)

            PromptStatus ps        = default(PromptStatus);
            Point3d      pnt3dBase = default(Point3d);

            try {
                BaseObjs.acadActivate();
                pnt3dBase = UserInput.getPoint("Select Insertion Point for Sections", out ps, osMode: 0);
            }
            catch (System.Exception) {
                return;
            }

            SectionView objSectionView = null;
            Point3d     pnt3dIns       = default(Point3d);

            using (var tr1 = BaseObjs.startTransactionDb()) {
                int j = 0;
                for (int i = 0; i < idsSampleLine.Count; i += 5)
                {
                    objSampleLine = (SampleLine)tr1.GetObject(idsSampleLine[i], OpenMode.ForRead);

                    //dblPntIns(0) = pnt3dBase.X + i / 5 * dblOffX

                    int k = -1;

                    while (j < idsSampleLine.Count)
                    {
                        k++;

                        pnt3dIns = new Point3d(pnt3dBase.X + i / 5 * dblOffX, pnt3dBase.Y + k * dblOffY, 0.0);

                        try {
                            ObjectId idSectionView = SectionView.Create("SV" + Convert.ToString(j), idsSampleLine[i], pnt3dIns);
                            objSectionView             = (SectionView)tr1.GetObject(idSectionView, OpenMode.ForWrite);
                            objSectionView.OffsetLeft  = 20.0;
                            objSectionView.OffsetRight = 20.0;
                            objSectionView.StyleId     = objSectionViewStyle.ObjectId;
                        }
                        catch (Autodesk.AutoCAD.Runtime.Exception) {
                        }

                        if (boolFirstPass)
                        {
                            dblOffX       = System.Math.Abs(objSectionView.OffsetLeft) + objSectionView.OffsetRight + 30;
                            dblOffY       = (objSectionView.ElevationMax - objSectionView.ElevationMin) + 20;
                            boolFirstPass = false;
                        }

                        j++;

                        if (k == 4)
                        {
                            break;
                        }
                    }
                }

                tr1.Commit();
            }
        }