//0x0013 1 byte Level Mod(used in damage formula) public void Read(BinaryReader br, int i) { Name = Memory.Strings.Read(Strings.FileID.KERNEL, id, i); br.BaseStream.Seek(2, SeekOrigin.Current); //0x0000 2 bytes Offset to GF attack name MagicID = (Magic_ID)br.ReadUInt16(); //0x0002 2 bytes Magic ID(decides what animation to play) Attack_Type = (Attack_Type)br.ReadByte(); //0x0004 1 byte Attack type GF_Power = br.ReadByte(); //0x0005 1 byte GF power(used in damage formula) Status_Attack = br.ReadByte(); //0x0006 1 byte Status attack enabler Unknown0 = br.ReadByte(); //0x0007 1 byte Unknown Status_flags = br.ReadByte(); //0x0008 1 byte Status flags ? Unknown1 = br.ReadBytes(2); //0x0009 2 bytes Unknown Element = (Element)br.ReadByte(); //0x000B 1 byte Element Statuses1 = (Statuses1)br.ReadUInt32(); //0x000C 1 byte Status 1 //0x000D 1 byte Status 2 //0x000E 1 byte Status 3 //0x000F 1 byte Status 4 Statuses0 = (Statuses0)br.ReadUInt16(); //0x0010 1 byte Status 5 //0x0011 1 byte Unknown Power_Mod = br.ReadByte(); //0x0012 1 byte Power Mod(used in damage formula) Level_Mod = br.ReadByte(); //0x0013 1 byte Level Mod(used in damage formula) }
/// <summary> /// <para> /// This Generates a Crisis Level. Run this each turn in battle. Though in real game it /// runs when the menu pops up. /// </para> /// <para>-1 means no limit break. >=0 has a limit break.</para> /// </summary> /// <returns>-1 - 4</returns> /// <remarks>https://finalfantasy.fandom.com/wiki/Crisis_Level</remarks> /// <remarks>TODO: Need to confirm the formula is correct via reverse</remarks> public sbyte GenerateCrisisLevel() { ushort current = CurrentHP(); ushort max = MaxHP(); //if ((ID == Characters.Seifer_Almasy && CurrentHP() < (max * 84 / 100))) //{ int HPMod = CharacterStats.Crisis * 10 * current / max; int DeathBonus = Memory.State.DeadPartyMembers() * 200 + 1600; int StatusBonus = (int)(Statuses0.Count() * 10); // I think this is status of all party members int RandomMod = Memory.Random.Next(0, 255) + 160; int crisislevel = (StatusBonus + DeathBonus - HPMod) / RandomMod; // better random number? if (crisislevel == 5) { CurrentCrisisLevel = 0; return(CurrentCrisisLevel); } else if (crisislevel == 6) { CurrentCrisisLevel = 1; return(CurrentCrisisLevel); } else if (crisislevel == 7) { CurrentCrisisLevel = 2; return(CurrentCrisisLevel); } else if (crisislevel >= 8) { CurrentCrisisLevel = 3; return(CurrentCrisisLevel); } //} return(CurrentCrisisLevel = -1); }
public byte LevelMod; //0x0083 1 byte Level Mod(used in damage formula) public void Read(BinaryReader br, int i) { Name = Memory.Strings.Read(Strings.FileID.KERNEL, id, i * 2); Description = Memory.Strings.Read(Strings.FileID.KERNEL, id, i * 2 + 1); br.BaseStream.Seek(4, SeekOrigin.Current); MagicID = (Magic_ID)br.ReadUInt16(); //0x0004 2 bytes[[Magic ID Attack_type = (Attack_Type)br.ReadByte(); //0x0006 1 byte Attack type GF_power = br.ReadByte(); //0x0007 1 byte GF power(used in damage formula) Unknown0 = br.ReadBytes(2); //0x0008 2 bytes Unknown Attack_flags = (Attack_Flags)(br.ReadByte()); //0x000A 1 byte Attack Flags Unknown1 = br.ReadBytes(2); //0x000B 2 bytes Unknown Element = (Element)br.ReadByte(); //0x000D 1 byte[[Element Statuses0 = (Statuses0)br.ReadUInt16(); //0x000E 2 bytes[[Statuses 0 Statuses1 = (Statuses1)br.ReadUInt32(); //0x0010 4 bytes[[Statuses 1 GFHP_modifier = br.ReadByte(); //0x0014 1 byte GF HP Modifier(used in GF HP formula) Unknown2 = br.ReadBytes(6); //0x0015 6 bytes Unknown Status_attack = br.ReadByte(); //0x001B 1 byte Status attack enabler Ability = new byte[21][]; for (i = 0; i < 21; i++) { Ability[i] = br.ReadBytes(2); } GF_Compatibility = new Dictionary <Saves.GFs, decimal>(16); for (i = 0; i < 16; i++) { GF_Compatibility.Add((Saves.GFs)i, (100 - Convert.ToDecimal(br.ReadByte())) / 5); //doomtrain shows this is a decimal number. i got formula from code. } Unknown3 = br.ReadBytes(2); //0x0080 2 bytes Unknown PowerMod = br.ReadByte(); //0x0082 1 byte Power Mod(used in damage formula) LevelMod = br.ReadByte(); //0x0083 1 byte Level Mod(used in damage formula) }
/// <summary> /// needs tested. should return the current crisis level. randomly -1 means no limit break. >=0 has a limit break. /// </summary> /// <returns>-1 - 4</returns> /// <remarks>https://finalfantasy.fandom.com/wiki/Crisis_Level</remarks> public sbyte CrisisLevel() { ushort current = CurrentHP(); ushort max = MaxHP(); if (Critical() || (ID == Characters.Seifer_Almasy && CurrentHP() < (max * 84 / 100))) { int HPMod = CharacterStats.Crisis * 10 * current / max; int DeathBonus = Memory.State.DeadPartyMembers() * 200 + 1600; int StatusBonus = (int)(Statuses0.Count() * 10); int RandomMod = random.Next(0, 255) + 160; int crisislevel = (StatusBonus + DeathBonus - HPMod) / RandomMod; if (crisislevel == 5) { return(0); } else if (crisislevel == 6) { return(1); } else if (crisislevel == 7) { return(2); } else if (crisislevel >= 8) { return(3); } } return(-1); }
public Statuses1 Statuses1; //0x10 4 bytes status_1; //statuses 8-31 public void Read(BinaryReader br, int i) { Name = Memory.Strings.Read(Strings.FileID.KERNEL, id, i); br.BaseStream.Seek(2, SeekOrigin.Current); MagicID = (Magic_ID)br.ReadUInt16(); //0x02 2 bytes Magic ID CameraChange = br.ReadByte(); //0x04 1 byte Camera Change Unknown0 = br.ReadByte(); //0x05 1 byte Unknown Attack_type = (Attack_Type)br.ReadByte(); //0x06 1 byte Attack type Attack_power = br.ReadByte(); //0x07 1 byte Attack power Attack_flags = (Attack_Flags)(br.ReadByte()); //0x08 1 byte Attack flags Unknown1 = br.ReadByte(); //0x09 1 byte Unknown Element = (Element)br.ReadByte(); //0x0A 1 byte Element Unknown2 = br.ReadByte(); //0x0B 1 byte Unknown StatusAttack = br.ReadByte(); //0x0C 1 byte Status attack enabler Attack_parameter = br.ReadByte(); //0x0D 1 byte Attack Parameter //Statuses = new BitArray(br.ReadBytes(6)); Statuses0 = (Statuses0)br.ReadUInt16(); //0x0E 2 bytes status_0; //statuses 0-7 Statuses1 = (Statuses1)br.ReadUInt32(); //0x10 4 bytes status_1; //statuses 8-31 }
public Statuses1 Statuses1; //0x0014 4 bytes status_1; //statuses 8-39 public void Read(BinaryReader br, int i) { Name = Memory.Strings.Read(Strings.FileID.KERNEL, id, i * 2); Description = Memory.Strings.Read(Strings.FileID.KERNEL, id, i * 2 + 1); br.BaseStream.Seek(4, SeekOrigin.Current); MagicID = (Magic_ID)br.ReadUInt16(); //0x0004 2 bytes Magic ID Attack_Type = (Attack_Type)br.ReadByte(); //0x0006 1 byte Attack Type Unknown0 = br.ReadByte(); //0x0007 1 byte Unknown Attack_Power = br.ReadByte(); //0x0008 1 byte Attack power Unknown1 = br.ReadByte(); //0x0009 1 byte Unknown Target = (Target)br.ReadByte(); //0x000A 1 byte Target info Attack_Flags = (Attack_Flags)br.ReadByte(); //0x000B 1 byte Attack Flags Hit_Count = br.ReadByte(); //0x000C 1 byte Hit count Element = (Element)br.ReadByte(); //0x000D 1 byte Element Attack Element_Percent = br.ReadByte(); //0x000E 1 byte Element Attack % Status_Attack = br.ReadByte(); //0x000F 1 byte Status Attack Enabler Unknown2 = br.ReadBytes(2); //0x0010 2 bytes Unknown Statuses0 = (Statuses0)br.ReadUInt16(); //0x0012 2 bytes status_0; //statuses 0-7 Statuses1 = (Statuses1)br.ReadUInt32(); //0x0014 4 bytes status_1; //statuses 8-39 }
//0x0017 1 bytes Element public void Read(BinaryReader br, int i) { br.BaseStream.Seek(4, SeekOrigin.Current); Name = Memory.Strings.Read(Strings.FileID.KERNEL, id, i * 2); //0x0000 2 bytes Offset to item name Description = Memory.Strings.Read(Strings.FileID.KERNEL, id, i * 2 + 1); //0x0002 2 bytes Offset to item description MagicID = (Magic_ID)br.ReadUInt16(); //0x0004 2 bytes Magic ID Attack_Type = (Attack_Type)br.ReadByte(); //0x0006 1 byte Attack type Attack_Power = br.ReadByte(); //0x0007 1 byte Attack power Unknown0 = br.ReadByte(); //0x0008 1 byte Unknown Target = (Target)br.ReadByte(); //0x0009 1 byte Target info Unknown1 = br.ReadByte(); //0x000A 1 byte Unknown Attack_Flags = (Attack_Flags)br.ReadByte(); //0x000B 1 byte Attack flags Unknown2 = br.ReadByte(); //0x000C 1 bytes Unknown Status_Attack = br.ReadByte(); //0x000D 1 byte Status Attack Enabler Statuses0 = (Statuses0)br.ReadUInt16(); //0x000E 2 bytes status_0; //statuses 0-7 Statuses1 = (Statuses1)br.ReadUInt32(); //0x0010 4 bytes status_1; //statuses 8-39 Attack_Param = br.ReadByte(); //0x0014 1 byte Attack Param Unknown3 = br.ReadByte(); //0x0015 1 byte Unknown Hit_Count = br.ReadByte(); //0x0016 1 bytes Hit Count Element = (Element)br.ReadByte(); //0x0017 1 bytes Element }
public byte[] Unknown4; //0x003A 2 bytes Unknown public void Read(BinaryReader br, int i) { Name = Memory.Strings.Read(Strings.FileID.KERNEL, id, i * 2); Description = Memory.Strings.Read(Strings.FileID.KERNEL, id, i * 2 + 1); br.BaseStream.Seek(4, SeekOrigin.Current); MagicID = (Magic_ID)br.ReadUInt16(); Unknown = br.ReadByte(); Attack_type = (Attack_Type)br.ReadByte(); Spellpower = br.ReadByte(); Unknown2 = br.ReadByte(); Default_target = (Target)br.ReadByte(); Attack_flags = (Attack_Flags)br.ReadByte(); Draw_resist = br.ReadByte(); Hit_count = br.ReadByte(); Element = (Element)br.ReadByte(); Unknown3 = br.ReadByte(); Statuses1 = (Statuses1)br.ReadUInt32(); Statuses0 = (Statuses0)br.ReadUInt16(); Status_attack = br.ReadByte(); HP_J = br.ReadByte(); STR_J = br.ReadByte(); VIT_J = br.ReadByte(); MAG_J = br.ReadByte(); SPR_J = br.ReadByte(); SPD_J = br.ReadByte(); EVA_J = br.ReadByte(); HIT_J = br.ReadByte(); LUCK_J = br.ReadByte(); Elem_J_atk = br.ReadByte(); Elem_J_atk_val = br.ReadByte(); Elem_J_def = br.ReadByte(); Elem_J_def_val = br.ReadByte(); Stat_J_atk_val = br.ReadByte(); Stat_J_def_val = br.ReadByte(); Stat_J_atk = br.ReadBytes(2); Stat_J_def = br.ReadBytes(2); GF_Compatibility = br.ReadBytes(16); Unknown4 = br.ReadBytes(2); }