Esempio n. 1
0
        public static void Write(Stream stream, Epd epd)
        {
            BinaryMapping.WriteObject <Header>(stream, epd.header);
            BinaryMapping.WriteObject <GeneralParameters>(stream, epd.generalParameters);
            BinaryWriter w = new BinaryWriter(stream);

            foreach (char[] anim in epd.AnimationList)
            {
                w.Write(anim);
            }

            stream.Write((uint)0);
            stream.Write((uint)0);

            BinaryMapping.WriteObject <OtherParameters>(stream, epd.otherParameters);

            foreach (TechniqueParameters param in epd.techniqueParameters)
            {
                BinaryMapping.WriteObject <TechniqueParameters>(stream, param);
            }

            foreach (DropParameters param in epd.dropParameters)
            {
                BinaryMapping.WriteObject <DropParameters>(stream, param);
            }

            foreach (ExtraParameters param in epd.extraParameters)
            {
                BinaryMapping.WriteObject <ExtraParameters>(stream, param);
            }
        }
Esempio n. 2
0
        public static StatusAilment GetStatusAilment(Epd epd)
        {
            StatusAilment stat = new StatusAilment();

            stat.bFly = BitsUtil.Int.GetBit((int)epd.generalParameters.StatusAilmentsFlag, 0);
            stat.bSmallDamageReaction     = BitsUtil.Int.GetBit((int)epd.generalParameters.StatusAilmentsFlag, 1);
            stat.bSmallDamageReactionOnly = BitsUtil.Int.GetBit((int)epd.generalParameters.StatusAilmentsFlag, 2);
            stat.bHitback     = BitsUtil.Int.GetBit((int)epd.generalParameters.StatusAilmentsFlag, 3);
            stat.bPoison      = BitsUtil.Int.GetBit((int)epd.generalParameters.StatusAilmentsFlag, 10);
            stat.bSlow        = BitsUtil.Int.GetBit((int)epd.generalParameters.StatusAilmentsFlag, 11);
            stat.bStop        = BitsUtil.Int.GetBit((int)epd.generalParameters.StatusAilmentsFlag, 12);
            stat.bBind        = BitsUtil.Int.GetBit((int)epd.generalParameters.StatusAilmentsFlag, 13);
            stat.bFaint       = BitsUtil.Int.GetBit((int)epd.generalParameters.StatusAilmentsFlag, 14);
            stat.bFreeze      = BitsUtil.Int.GetBit((int)epd.generalParameters.StatusAilmentsFlag, 15);
            stat.bBurn        = BitsUtil.Int.GetBit((int)epd.generalParameters.StatusAilmentsFlag, 16);
            stat.bConfuse     = BitsUtil.Int.GetBit((int)epd.generalParameters.StatusAilmentsFlag, 17);
            stat.bBlind       = BitsUtil.Int.GetBit((int)epd.generalParameters.StatusAilmentsFlag, 18);
            stat.bDeath       = BitsUtil.Int.GetBit((int)epd.generalParameters.StatusAilmentsFlag, 19);
            stat.bZeroGravity = BitsUtil.Int.GetBit((int)epd.generalParameters.StatusAilmentsFlag, 20);
            stat.bMini        = BitsUtil.Int.GetBit((int)epd.generalParameters.StatusAilmentsFlag, 21);
            stat.bMagnet      = BitsUtil.Int.GetBit((int)epd.generalParameters.StatusAilmentsFlag, 22);
            stat.bDegen       = BitsUtil.Int.GetBit((int)epd.generalParameters.StatusAilmentsFlag, 23);
            stat.bSleep       = BitsUtil.Int.GetBit((int)epd.generalParameters.StatusAilmentsFlag, 24);

            return(stat);
        }
Esempio n. 3
0
        public static EffectivenessFlag GetEffectivenessFlag(Epd epd)
        {
            EffectivenessFlag flag = new EffectivenessFlag();
            int val = (int)epd.otherParameters.EffectivenessFlag;

            flag.Poison = (uint)BitsUtil.Int.GetBits(val, 0, 2);
            flag.Stop   = (uint)BitsUtil.Int.GetBits(val, 2, 2);
            flag.Bind   = (uint)BitsUtil.Int.GetBits(val, 4, 2);
            flag.Faint  = (uint)BitsUtil.Int.GetBits(val, 6, 2);
            flag.Blind  = (uint)BitsUtil.Int.GetBits(val, 8, 2);
            flag.Mini   = (uint)BitsUtil.Int.GetBits(val, 10, 2);

            return(flag);
        }
Esempio n. 4
0
        public static Epd Read(Stream stream)
        {
            Epd epd = new Epd();

            epd.header            = BinaryMapping.ReadObject <Header>(stream);
            epd.generalParameters = BinaryMapping.ReadObject <GeneralParameters>(stream);
            BinaryReader r = new BinaryReader(stream);

            for (int i = 0; i < 18; i++)
            {
                char[] animName = r.ReadChars(4);
                epd.AnimationList.Add(animName);
            }
            stream.Seek(8, SeekOrigin.Current);


            epd.otherParameters = BinaryMapping.ReadObject <OtherParameters>(stream);

            stream.Seek(epd.otherParameters.TechniqueParameterOffset, SeekOrigin.Begin);
            for (int t = 0; t < epd.otherParameters.TechniqueParameterCount; t++)
            {
                epd.techniqueParameters.Add(BinaryMapping.ReadObject <TechniqueParameters>(stream));
            }

            stream.Seek(epd.otherParameters.DropItemsOffset, SeekOrigin.Begin);
            for (int t = 0; t < epd.otherParameters.DropItemsCount; t++)
            {
                epd.dropParameters.Add(BinaryMapping.ReadObject <DropParameters>(stream));
            }

            stream.Seek(epd.otherParameters.ExtraParametersOffset, SeekOrigin.Begin);
            for (int t = 0; t < epd.otherParameters.ExtraParametersCount; t++)
            {
                epd.extraParameters.Add(BinaryMapping.ReadObject <ExtraParameters>(stream));
            }

            return(epd);
        }