예제 #1
0
        /// <summary>
        /// How much Compatability is added to gf. neg is how much is removed from other gfs.
        /// </summary>
        /// <param name="gf">Which GF is effected</param>
        /// <param name="neg">How much Comptability is lost by all other GFs</param>
        /// <returns>Total compatability gained by selected character for this GF.</returns>
        /// <see cref="https://gamefaqs.gamespot.com/ps/197343-final-fantasy-viii/faqs/6110"/>
        public byte Compatibility(out GFs gf, out sbyte neg)
        {
            gf = 0; neg = 0;
            byte ret = 0;

            if (Type == _Type.GF_Compatability)
            {
                gf = (GFs)b2;
                switch (b3)
                {
                case 0x08:    //Weak C Item
                    ret = 0x01;
                    neg = (sbyte)(gf == GFs.All?0x00:-0x01);
                    break;

                case 0x10:    //Strong C Item
                    ret = 0x03;
                    neg = (sbyte)(gf == GFs.All ? 0x00 : -0x02);
                    break;

                case 0x65:     //LuvLuvG
                    ret = 0x14;
                    neg = (sbyte)(gf == GFs.All ? 0x00 : 0x00);
                    break;
                }
            }
            return(ret);
        }
예제 #2
0
 /// <summary>
 /// Summon GF
 /// </summary>
 /// <param name="gf"></param>
 public void SetSummon(GFs gf)
 {
     Saves.GFData gfdata = null;
     if (Memory.State?.GFs?.TryGetValue(gf, out gfdata) ?? false)
     {
         // found a gf.
     }
     SetSummon(gfdata);
 }
예제 #3
0
 /// <summary>
 /// Converts to GF value to GFflag using math.
 /// </summary>
 /// <param name="gf">gf value</param>
 /// <returns></returns>
 /// <remarks>assuming the values are always in the same order</remarks>
 public static GFflags ConvertGFEnumLog(GFs gf)
 {
     if (gf.Equals(GFs.Blank))
     {
         return(GFflags.None);
     }
     if (gf.Equals(GFs.All))
     {
         return((GFflags)0xFFFF);
     }
     return((GFflags) checked ((int)Math.Pow(2, (double)gf)));
 }
예제 #4
0
파일: Init.cs 프로젝트: jewinters/maelstrom
        public Init(IEnumerable <byte> data)
        {
            using (var stream = new MemoryStream(data.ToArray()))
                using (var reader = new BinaryReader(stream))
                {
                    for (int i = 0; i < 16; i++)
                    {
                        GFs.Add(new InitGF(reader.ReadBytes(68)));
                    }

                    OtherData = reader.ReadBytes((int)(stream.Length - stream.Position));
                }
        }
예제 #5
0
            private Damageable GetDamagable(Faces.ID id)
            {
                GFs        gf = id.ToGFs();
                Characters c  = id.ToCharacters();

                if (c == OpenVIII.Characters.Blank)
                {
                    return(GetDamagable(gf));
                }
                else
                {
                    return(GetDamagable(c));
                }
            }
예제 #6
0
            private void Fill()
            {
                Faces.ID id   = 0;
                int      skip = Page * Rows;

                for (int i = 0; i < Rows; i++)
                {
                    bool       gftest    = false;
                    bool       ctest     = false;
                    Characters character = Characters.Blank;
                    GFs        gf        = GFs.Blank;
                    while (!Enum.IsDefined(typeof(Faces.ID), id) ||
                           !((ctest = Item.TestCharacter(ref id, out character)) || (gftest = Item.TestGF(ref id, out gf))) ||
                           skip-- > 0)
                    {
                        if ((byte)++id > 32)
                        {
                            for (; i < Rows; i++)
                            {
                                ITEM[i, 0].Hide();
                                ITEM[i, 1].Hide();
                                ITEM[i, 2].Hide();
                                BLANKS[i]   = true;
                                Contents[i] = Faces.ID.Blank;
                            }
                            //Pages = Page + 1;
                            return;
                        }
                    }
                    ((IGMDataItem.Text)ITEM[i, 0]).Data = Memory.Strings.GetName(id);
                    ITEM[i, 0].Show();
                    int hp = (ctest || gftest) ? Memory.State[id]?.CurrentHP() ?? -1 : -1;
                    BLANKS[i]   = false;
                    Contents[i] = id;
                    if (hp > -1)
                    {
                        ((IGMDataItem.Integer)ITEM[i, 2]).Data = hp;
                        ITEM[i, 1].Show();
                        ITEM[i, 2].Show();
                    }
                    else
                    {
                        ITEM[i, 1].Hide();
                        ITEM[i, 2].Hide();
                    }

                    id++;
                }
                //Pages = Page + 2;
            }
예제 #7
0
 public void Read(BinaryReader br, GFs g)
 {
     ID          = g;
     Name        = br.ReadBytes(12);               //0x00 (0x00 terminated)
     Experience  = br.ReadUInt32();                //0x0C
     Unknown     = br.ReadByte();                  //0x10
     Exists      = br.ReadByte();                  //0x11
     HP          = br.ReadUInt16();                //0x12
     Complete    = new BitArray(br.ReadBytes(16)); //0x14 abilities (1 bit = 1 ability completed, 9 bits unused)
     APs         = br.ReadBytes(24);               //0x24 (1 byte = 1 ability of the GF, 2 bytes unused)
     NumberKills = br.ReadUInt16();                //0x3C of kills
     NumberKOs   = br.ReadUInt16();                //0x3E of KOs
     Learning    = br.ReadByte();                  //0x41 ability
     Forgotten   = br.ReadBytes(3);                //0x42 abilities (1 bit = 1 ability of the GF forgotten, 2 bits unused)
 }
예제 #8
0
            //public Damageable this[Damageable damageable]
            /// <summary>
            /// return -1 on error
            /// </summary>
            /// <param name="id"></param>
            /// <param name="character"></param>
            /// <param name="gf"></param>
            /// <returns></returns>
            public int CurrentHP(Faces.ID id = Faces.ID.Blank, Characters character = OpenVIII.Characters.Blank, GFs gf = OpenVIII.GFs.Blank)
            {
                if (character == OpenVIII.Characters.Blank)
                {
                    character = id.ToCharacters();
                }
                if (gf == OpenVIII.GFs.Blank)
                {
                    gf = id.ToGFs();
                }
                int hp = (Characters.ContainsKey(character) ? Characters[character].CurrentHP() : -1);

                hp = (hp < 0 && GFs.ContainsKey(gf) ? GFs[gf].CurrentHP() : hp);
                return(hp);
            }
예제 #9
0
                private void Fill()
                {
                    Faces.ID id   = 0;
                    int      skip = Page * rows;

                    for (int i = 0; i < rows; i++)
                    {
                        bool       gftest    = false;
                        bool       ctest     = false;
                        Characters character = Characters.Blank;
                        GFs        gf        = GFs.Blank;
                        while (!Enum.IsDefined(typeof(Faces.ID), id) ||
                               !((ctest = Item.TestCharacter(ref id, out character)) || (gftest = Item.TestGF(ref id, out gf))) ||
                               skip-- > 0)
                        {
                            if ((byte)++id > 32)
                            {
                                for (; i < rows; i++)
                                {
                                    ITEM[i, 0]  = null;
                                    ITEM[i, 1]  = null;
                                    ITEM[i, 2]  = null;
                                    BLANKS[i]   = true;
                                    Contents[i] = Faces.ID.Blank;
                                }
                                Pages = Page + 1;
                                return;
                            }
                        }
                        ITEM[i, 0] = new IGMDataItem_String(Memory.Strings.GetName(id), pos: SIZE[i]);
                        int hp = (ctest || gftest) ? Memory.State[id].CurrentHP() : -1;
                        BLANKS[i]   = false;
                        Contents[i] = id;
                        if (hp > -1)
                        {
                            ITEM[i, 1] = new IGMDataItem_Icon(Icons.ID.HP2, new Rectangle(SIZE[i].X + SIZE[i].Width - (20 * 7), SIZE[i].Y, 0, 0), 13);
                            ITEM[i, 2] = new IGMDataItem_Int(hp, pos: new Rectangle(SIZE[i].X + SIZE[i].Width - (20 * 4), SIZE[i].Y, 0, 0), spaces: 4);
                        }
                        else
                        {
                            ITEM[i, 1] = null;
                            ITEM[i, 2] = null;
                        }

                        id++;
                    }
                    Pages = Page + 2;
                }
예제 #10
0
 /// <summary>
 /// Read in values from safe data.
 /// </summary>
 /// <param name="br">Binary Reader to raw save data</param>
 /// <param name="g">Which GF we are reading in</param>
 public void Read(BinaryReader br, GFs g)
 {
     StatusImmune = true;
     ID           = g;
     Name         = br.ReadBytes(12);                    //0x00 (0x00 terminated)
     Experience   = br.ReadUInt32();                     //0x0C
     Unknown      = br.ReadByte();                       //0x10
     Exists       = br.ReadByte() == 1 ? true : false;   //0x11 //1 unlocked //0 locked
     _CurrentHP   = br.ReadUInt16();                     //0x12
     Complete     = new BitArray(br.ReadBytes(16));      //0x14 abilities (1 bit = 1 ability completed, 9 bits unused)
     APs          = br.ReadBytes(24);                    //0x24 (1 byte = 1 ability of the GF, 2 bytes unused)
     NumberKills  = br.ReadUInt16();                     //0x3C of kills
     NumberKOs    = br.ReadUInt16();                     //0x3E of KOs
     Learning     = (Kernel_bin.Abilities)br.ReadByte(); //0x41 ability
     Forgotten    = new BitArray(br.ReadBytes(3));       //0x42 abilities (1 bit = 1 ability of the GF forgotten, 2 bits unused)
 }
예제 #11
0
 private void Fill(Faces.ID e)
 {
     if ((e == Faces.ID.Blank && Target != Faces.ID.Blank) || All)
     {
         Target = e;
         foreach (IGMDataItem i in ITEM)
         {
             i?.Hide();
         }
     }
     else
     {
         if (Target == Faces.ID.Blank)
         {
             foreach (IGMDataItem i in ITEM)
             {
                 i?.Show();
             }
         }
         Target = e;
         Characters character = e.ToCharacters();
         GFs        gf        = e.ToGFs();
         if (character != Characters.Blank || (gf != GFs.Blank && gf != GFs.All))
         {
             ITEM[0, 0] = new IGMDataItem_String(Misc[Items.LV], new Rectangle(SIZE[0].X, SIZE[0].Y, 0, 0));
             ITEM[1, 0] = new IGMDataItem_String(Misc[Items.HP], new Rectangle(SIZE[1].X, SIZE[1].Y, 0, 0));
             ITEM[1, 2] = new IGMDataItem_String(Misc[Items.ForwardSlash], new Rectangle(SIZE[1].X + 155, SIZE[1].Y, 0, 0));
         }
         if (Memory.State.Characters != null && character != Characters.Blank)
         {
             ITEM[0, 1] = new IGMDataItem_Int(Memory.State.Characters[character].Level, new Rectangle(SIZE[0].X + 35, SIZE[0].Y, 0, 0), 13, numtype: Icons.NumType.sysFntBig, padding: 1, spaces: 6);
             ITEM[0, 2] = Memory.State.Party != null && Memory.State.Party.Contains(character)
                 ? new IGMDataItem_Icon(Icons.ID.InParty, new Rectangle(SIZE[0].X + 155, SIZE[0].Y, 0, 0), 6)
                 : null;
             ITEM[1, 1] = new IGMDataItem_Int(Memory.State.Characters[character].CurrentHP(character), new Rectangle(SIZE[1].X + 35, SIZE[1].Y, 0, 0), 13, numtype: Icons.NumType.sysFntBig, padding: 1, spaces: 6);
             ITEM[1, 3] = new IGMDataItem_Int(Memory.State.Characters[character].MaxHP(character), new Rectangle(SIZE[1].X + 155, SIZE[1].Y, 0, 0), 13, numtype: Icons.NumType.sysFntBig, padding: 1, spaces: 5);
         }
         if (Memory.State.GFs != null && (gf != GFs.Blank && gf != GFs.All))
         {
             ITEM[0, 1] = new IGMDataItem_Int(Memory.State.GFs[gf].Level, new Rectangle(SIZE[0].X + 35, SIZE[0].Y, 0, 0), 13, numtype: Icons.NumType.sysFntBig, padding: 1, spaces: 6);
             ITEM[0, 2] = null;
             ITEM[1, 1] = new IGMDataItem_Int(Memory.State.GFs[gf].CurrentHP(), new Rectangle(SIZE[1].X + 35, SIZE[1].Y, 0, 0), 13, numtype: Icons.NumType.sysFntBig, padding: 1, spaces: 6);
             ITEM[1, 3] = new IGMDataItem_Int(Memory.State.GFs[gf].MaxHP(), new Rectangle(SIZE[1].X + 155, SIZE[1].Y, 0, 0), 13, numtype: Icons.NumType.sysFntBig, padding: 1, spaces: 5);
         }
     }
 }
예제 #12
0
        public GFDamageModel()
        {
            GFs.Add(new GFModel("Quezacotl", 44, 0, 60, Element.Lightning));
            GFs.Add(new GFModel("Shiva", 43, 0, 62, Element.Ice));
            GFs.Add(new GFModel("Ifrit", 45, 2, 61, Element.Fire));
            GFs.Add(new GFModel("Siren", 35, 0, 55, Element.None));
            GFs.Add(new GFModel("Brothers", 46, 4, 60, Element.Earth));
            GFs.Add(new GFModel("Leviathan", 47, 10, 63, Element.Water));
            GFs.Add(new GFModel("Pandemona", 46, 14, 65, Element.Wind));
            GFs.Add(new GFModel("Alexander", 48, 20, 63, Element.Holy));
            GFs.Add(new GFModel("Doomtrain", 45, 10, 58, Element.Poison));
            GFs.Add(new GFModel("Bahamut", 55, 30, 70, Element.NoneBypassSpirit));
            GFs.Add(new GFModel("Tonberry", 60, 4, 45, Element.None));
            GFs.Add(new GFModel("Eden", 70, 250, 100, Element.NoneBypassSpirit));
            GFs.Add(new GFModel("Phoenix", 30, 50, 254, Element.Fire));

            MultiplierModel.Create(this, "Raldo Defence Mode", 0.67m);
            MultiplierModel.Create(this, "Invulnerable", 0);
            MultiplierModel.Create(this, "Elemental Multiplier", 1.5m);
        }
예제 #13
0
            public ConcurrentQueue <GFs> EarnAP(uint ap, out ConcurrentQueue <KeyValuePair <GFs, Kernel_bin.Abilities> > abilities)
            {
                ConcurrentQueue <GFs> ret = new ConcurrentQueue <GFs>();

                abilities = null;
                if (GFs == null)
                {
                    return(ret);
                }
                abilities = new ConcurrentQueue <KeyValuePair <GFs, Kernel_bin.Abilities> >();
                foreach (KeyValuePair <GFs, GFData> g in GFs.Where(i => i.Value != null && i.Value.Exists))
                {
                    if (!g.Value.EarnExp(ap, out Kernel_bin.Abilities ability))
                    {
                        continue;
                    }
                    if (ability != Kernel_bin.Abilities.None)
                    {
                        abilities.Enqueue(new KeyValuePair <GFs, Kernel_bin.Abilities>(g.Key, ability));
                    }
                    ret.Enqueue(g.Key);
                }
                return(ret);
            }
예제 #14
0
 private GFData GetDamageable(GFs id) => GFs.ContainsKey(id) ? GFs[id] : null;
예제 #15
0
 public static GFData Load(BinaryReader br, GFs @enum, Saves.Data data) => Load <GFData>(br, @enum, data);
예제 #16
0
 private void Fill(Faces.ID e)
 {
     if ((e == Faces.ID.Blank && Target != Faces.ID.Blank) || All)
     {
         Target = e;
         foreach (Menu_Base i in ITEM)
         {
             i?.Hide();
         }
     }
     else
     {
         if (Target == Faces.ID.Blank)
         {
             foreach (Menu_Base i in ITEM)
             {
                 i?.Show();
             }
         }
         Target = e;
         Characters character = e.ToCharacters();
         GFs        gf        = e.ToGFs();
         if (character != Characters.Blank || (gf != GFs.Blank && gf != GFs.All))
         {
             ITEM[0, 0] = new IGMDataItem.Text {
                 Data = Strings.Name.LV, Pos = new Rectangle(SIZE[0].X, SIZE[0].Y, 0, 0)
             };
             ITEM[1, 0] = new IGMDataItem.Text {
                 Data = Strings.Name.HP, Pos = new Rectangle(SIZE[1].X, SIZE[1].Y, 0, 0)
             };
             ITEM[1, 2] = new IGMDataItem.Text {
                 Data = Strings.Name.ForwardSlash, Pos = new Rectangle(SIZE[1].X + 155, SIZE[1].Y, 0, 0)
             };
         }
         if (Memory.State.Characters != null && character != Characters.Blank)
         {
             ITEM[0, 1] = new IGMDataItem.Integer {
                 Data = Memory.State.Characters[character].Level, Pos = new Rectangle(SIZE[0].X + 35, SIZE[0].Y, 0, 0), Palette = 13, NumType = Icons.NumType.SysFntBig, Padding = 1, Spaces = 6
             };
             ITEM[0, 2] = Memory.State.Party != null && Memory.State.Party.Contains(character)
                 ? new IGMDataItem.Icon {
                 Data = Icons.ID.InParty, Pos = new Rectangle(SIZE[0].X + 155, SIZE[0].Y, 0, 0), Palette = 6
             }
                 : null;
             ITEM[1, 1] = new IGMDataItem.Integer {
                 Data = Memory.State.Characters[character].CurrentHP(character), Pos = new Rectangle(SIZE[1].X + 35, SIZE[1].Y, 0, 0), Palette = 13, NumType = Icons.NumType.SysFntBig, Padding = 1, Spaces = 6
             };
             ITEM[1, 3] = new IGMDataItem.Integer {
                 Data = Memory.State.Characters[character].MaxHP(character), Pos = new Rectangle(SIZE[1].X + 155, SIZE[1].Y, 0, 0), Palette = 13, NumType = Icons.NumType.SysFntBig, Padding = 1, Spaces = 5
             };
         }
         if (Memory.State.GFs != null && (gf != GFs.Blank && gf != GFs.All))
         {
             ITEM[0, 1] = new IGMDataItem.Integer {
                 Data = Memory.State.GFs[gf].Level, Pos = new Rectangle(SIZE[0].X + 35, SIZE[0].Y, 0, 0), Palette = 13, NumType = Icons.NumType.SysFntBig, Padding = 1, Spaces = 6
             };
             ITEM[0, 2] = null;
             ITEM[1, 1] = new IGMDataItem.Integer {
                 Data = Memory.State.GFs[gf].CurrentHP(), Pos = new Rectangle(SIZE[1].X + 35, SIZE[1].Y, 0, 0), Palette = 13, NumType = Icons.NumType.SysFntBig, Padding = 1, Spaces = 6
             };
             ITEM[1, 3] = new IGMDataItem.Integer {
                 Data = Memory.State.GFs[gf].MaxHP(), Pos = new Rectangle(SIZE[1].X + 155, SIZE[1].Y, 0, 0), Palette = 13, NumType = Icons.NumType.SysFntBig, Padding = 1, Spaces = 5
             };
         }
     }
 }
예제 #17
0
 public GFData this[GFs id] => GetDamageable(id);
예제 #18
0
 public Damageable this[GFs id] => GetDamagable(id);
예제 #19
0
 public void RemoveJunctionedGF(GFs gf) =>
 rawJunctionedGFs ^= Saves.ConvertGFEnum.FirstOrDefault(x => x.Value == gf).Key;
예제 #20
0
 private Damageable GetDamagable(GFs id)
 {
     return(GFs.ContainsKey(id) ? GFs[id] : null);
 }
예제 #21
0
 public GFData(BinaryReader br, GFs g) => Read(br, g);
예제 #22
0
 public FF8String GetName(GFs gf, Saves.Data d = null) => GetName(gf.ToFacesID(), d);