//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)
            }
예제 #2
0
            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>
    /// Calculates the stats of a unit via a random range
    /// </summary>
    public virtual void CalculateStats()
    {
        switch (m_characterType)
        {
        case Class_Type.knight:

            ///Decide attack type
            m_attackType = Attack_Type.Physical;
            ///Calculate attributes
            m_endurance    = Random.Range(7, 10);
            m_dexterity    = Random.Range(4, 6);
            m_strength     = Random.Range(5, 7);
            m_intelligence = Random.Range(2, 4);

            break;

        case Class_Type.berserker:

            ///Decide attack type
            m_attackType = Attack_Type.Physical;
            ///Calculate attributes
            m_endurance    = Random.Range(5, 7);
            m_dexterity    = Random.Range(4, 5);
            m_strength     = Random.Range(7, 10);
            m_intelligence = Random.Range(2, 3);

            break;

        case Class_Type.thief:

            ///Decide attack type
            m_attackType = Attack_Type.Physical;
            ///Calculate attributes
            m_endurance    = Random.Range(3, 5);
            m_dexterity    = Random.Range(7, 10);
            m_strength     = Random.Range(4, 6);
            m_intelligence = Random.Range(2, 3);

            break;

        default:
            Debug.Log("Error: Character type not correct");
            break;
        }



        ///Calculate Stats from attributes

        m_maxHealth      = m_endurance * 5;
        m_currentHealth  = m_maxHealth;
        m_movementSpeed  = m_dexterity / 2;
        m_attackSpeed    = m_dexterity / 2;
        m_physicalDamage = m_strength / 2;
        m_spellDamage    = m_intelligence / 2;
        m_physicalResist = m_endurance * 10;
        m_spellResist    = m_intelligence * 10;
    }
예제 #4
0
            public bool Melee;                  //0x000B	1 byte Melee Weapon?

            public void Read(BinaryReader br, int string_id = 0)
            {
                Name = Memory.Strings.Read(Strings.FileID.KERNEL, id, string_id);
                br.BaseStream.Seek(2, SeekOrigin.Current);
                Renzokuken   = (Renzokeken_Level)br.ReadByte();   //0x0002	1 byte Renzokuken finishers
                Unknown0     = br.ReadByte();                     //0x0003	1 byte Unknown
                Character    = (Saves.Characters)br.ReadByte();   //0x0004	1 byte Character ID
                Attack_type  = (Attack_Type)br.ReadByte();        //0x0005	1 bytes Attack Type
                Attack_power = br.ReadByte();                     //0x0006	1 byte Attack Power
                HIT          = br.ReadByte();                     //0x0007	1 byte Attack Parameter
                STR          = br.ReadByte();                     //0x0008	1 byte STR Bonus
                Tier         = br.ReadByte();                     //0x0009	1 byte Weapon Tier
                CRIT         = br.ReadByte();                     //0x000A	1 byte Crit Bonus
                Melee        = br.ReadByte() == 0 ? false : true; //0x000B	1 byte Melee Weapon?
            }
 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
            }
예제 #7
0
            //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
            }
예제 #8
0
            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);
            }
    /// <summary>
    /// Removes the specified amount of health from the characters health.
    /// </summary>
    /// <param name="damage"> The damage that is taken. </param>
    public void TakeDamage(float damage, Attack_Type _at)
    {
        ///Calculate the resistance that the character takes from that type of attack
        float res = 1;

        if (_at.ToString() == "Physical")
        {
            res = m_physicalResist / 100;
        }
        else if (_at.ToString() == "Magical")
        {
            res = m_spellResist / 100;
        }
        else if (_at.ToString() == "World")
        {
            res = 1;
        }
        else
        {
            Debug.Log("Input incorrect. Actual input was: " + _at.ToString());
        }
        ///Remove the amount of resistance from the damage
        damage         *= res;
        m_currentHealth = Mathf.Clamp(m_currentHealth - damage, 0, m_currentHealth);
        //     Debug.Log(this.gameObject.name + " took " + damage +  _at.ToString() + " damage." );
        if (m_currentHealth <= 0)
        {
            Die();
        }

        Renderer[] _renderers = GetComponentsInChildren <Renderer>();

        foreach (Renderer rend in _renderers)
        {
            StartCoroutine("Flash", rend);
            // rend.material.color = _col;
        }
    }