Example #1
0
 public void UpdateView( AllAbilities allAbilities )
 {
     if( ourContext != FFTPatch.Context )
     {
         ourContext = FFTPatch.Context;
         cbAbility = null;
     }
     abilitiesListBox.SelectedIndexChanged -= abilitiesListBox_SelectedIndexChanged;
     abilitiesListBox.DataSource = allAbilities.Abilities;
     abilitiesListBox.SelectedIndexChanged += abilitiesListBox_SelectedIndexChanged;
     abilitiesListBox.SelectedIndex = 0;
     abilityEditor.Ability = abilitiesListBox.SelectedItem as Ability;
 }
Example #2
0
        static AllAbilities()
        {
            PSPAbilities = new Ability[512];
            PSXAbilities = new Ability[512];
            psxEventAbilites = new Ability[512];
            pspEventAbilites = new Ability[512];

            PSPNames = PatcherLib.PSPResources.Lists.AbilityNames;
            PSXNames = PatcherLib.PSXResources.Lists.AbilityNames;

            for( int i = 0; i < 512; i++ )
            {
                PSPAbilities[i] = new Ability( PSPNames[i], (UInt16)i );
                PSXAbilities[i] = new Ability( PSXNames[i], (UInt16)i );
                pspEventAbilites[i] = new Ability( PSPNames[i], (UInt16)i );
                psxEventAbilites[i] = new Ability( PSXNames[i], (UInt16)i );
            }

            pspEventAbilites[510] = new Ability( "<Random>", 510 );
            pspEventAbilites[511] = new Ability( "Nothing", 511 );
            psxEventAbilites[510] = new Ability( "<Random>", 510 );
            psxEventAbilites[511] = new Ability( "Nothing", 511 );
        }
Example #3
0
 public void CopySpecificTo( Ability destination )
 {
     CopySpecific( this, destination );
 }
Example #4
0
 public static void CopySpecific( Ability source, Ability destination )
 {
     if( (source.IsNormal ^ destination.IsNormal) ||
         (source.IsItem ^ destination.IsItem) ||
         (source.IsThrowing ^ destination.IsThrowing) ||
         (source.IsJumping ^ destination.IsJumping) ||
         (source.IsCharging ^ destination.IsCharging) ||
         (source.IsArithmetick ^ destination.IsArithmetick) ||
         (source.IsOther ^ destination.IsOther) )
     {
         throw new InvalidOperationException( "Cannot convert between ability types" );
     }
     if( destination.IsNormal )
     {
         source.Attributes.CopyTo( destination.Attributes );
         destination.Effect = source.Effect;
     }
     if( destination.IsItem )
     {
         destination.ItemOffset = source.ItemOffset;
     }
     if( destination.IsThrowing )
     {
         destination.Throwing = source.Throwing;
     }
     if( destination.IsJumping )
     {
         destination.JumpHorizontal = source.JumpHorizontal;
         destination.JumpVertical = source.JumpVertical;
     }
     if( destination.IsCharging )
     {
         destination.ChargeCT = source.ChargeCT;
         destination.ChargeBonus = source.ChargeBonus;
     }
     if( destination.IsArithmetick )
     {
         destination.ArithmetickSkill = source.ArithmetickSkill;
     }
     if( destination.IsOther )
     {
         destination.OtherID = source.OtherID;
     }
 }
Example #5
0
 public void CopyCommonTo( Ability destination )
 {
     CopyCommon( this, destination );
 }
Example #6
0
 public static void CopyCommon( Ability source, Ability destination )
 {
     destination.JPCost = source.JPCost;
     destination.LearnRate = source.LearnRate;
     destination.LearnWithJP = source.LearnWithJP;
     destination.Action = source.Action;
     destination.LearnOnHit = source.LearnOnHit;
     destination.Blank1 = source.Blank1;
     destination.AbilityType = source.AbilityType;
     destination.Unknown1 = source.Unknown1;
     destination.Unknown2 = source.Unknown2;
     destination.Unknown3 = source.Unknown3;
     destination.Unknown4 = source.Unknown4;
     destination.Blank2 = source.Blank2;
     destination.Blank3 = source.Blank3;
     destination.Blank4 = source.Blank4;
     destination.Blank5 = source.Blank5;
     source.AIFlags.CopyTo( destination.AIFlags );
 }
Example #7
0
 public void CopyAllTo( Ability destination )
 {
     CopyAll( this, destination );
 }
Example #8
0
 public static void CopyAll( Ability source, Ability destination )
 {
     CopySpecific( source, destination );
     CopyCommon( source, destination );
 }
Example #9
0
 public Ability( string name, UInt16 offset, IList<byte> first, IList<byte> second, Ability defaults )
     : this( name, offset, first, second )
 {
     Default = defaults;
     if( IsNormal )
     {
         Attributes.Default = Default.Attributes;
     }
     AIFlags.Default = Default.AIFlags;
 }
Example #10
0
 private void copyAll( object sender, EventArgs args )
 {
     cbAbility = abilitiesListBox.SelectedItem as Ability;
 }
Example #11
0
        public AllAbilities( IList<byte> bytes, IList<byte> effectsBytes, IList<byte> itemEffects, IList<byte> reactionEffects )
        {
            AllEffects = new AllAbilityEffects( this );
            this.defaultBytes = FFTPatch.Context == Context.US_PSP ? PSPResources.Binaries.Abilities : PSXResources.Binaries.Abilities;

            IDictionary<UInt16, Effect> effects = FFTPatch.Context == Context.US_PSP ? Effect.PSPEffects : Effect.PSXEffects;
            IList<byte> defaultEffects = FFTPatch.Context == Context.US_PSP ? PSPResources.Binaries.AbilityEffects : PSXResources.Binaries.AbilityEffects;
            IList<byte> defaultItemEffects = FFTPatch.Context == Context.US_PSP ? PSPResources.Binaries.ItemAbilityEffects : PSXResources.Binaries.ItemAbilityEffects;
            IList<byte> defaultReaction = FFTPatch.Context == Context.US_PSP ? PSPResources.Binaries.ReactionAbilityEffects : PSXResources.Binaries.ReactionAbilityEffects;

            Abilities = new Ability[512];
            DefaultAbilities = new Ability[512];
            for( UInt16 i = 0; i < 512; i++ )
            {
                IList<byte> defaultFirst = defaultBytes.Sub( i * 8, i * 8 + 7 );
                IList<byte> first = bytes.Sub( i * 8, i * 8 + 7 );
                IList<byte> second;
                IList<byte> defaultSecond;
                Effect effect = null;
                Effect defaultEffect = null;

                if( i <= 0x16F )
                {
                    second = bytes.Sub( 0x1000 + 14 * i, 0x1000 + 14 * i + 13 );
                    defaultSecond = defaultBytes.Sub( 0x1000 + 14 * i, 0x1000 + 14 * i + 13 );
                    effect = effects[PatcherLib.Utilities.Utilities.BytesToUShort( effectsBytes[i * 2], effectsBytes[i * 2 + 1] )];
                    defaultEffect = effects[PatcherLib.Utilities.Utilities.BytesToUShort( defaultEffects[i * 2], defaultEffects[i * 2 + 1] )];
                }
                else if( i <= 0x17D )
                {
                    second = bytes.Sub( 0x2420 + i - 0x170, 0x2420 + i - 0x170 );
                    defaultSecond = defaultBytes.Sub( 0x2420 + i - 0x170, 0x2420 + i - 0x170 );
                    effect = effects[(ushort)(PatcherLib.Utilities.Utilities.BytesToUShort(itemEffects[(i - 368) * 2], itemEffects[(i - 368) * 2 + 1]) & ~Ability.ItemEffectPrefixValue)];
                    defaultEffect = effects[(ushort)(PatcherLib.Utilities.Utilities.BytesToUShort(defaultItemEffects[(i - 368) * 2], defaultItemEffects[(i - 368) * 2 + 1]) & ~Ability.ItemEffectPrefixValue)];
                }
                else if( i <= 0x189 )
                {
                    second = bytes.Sub( 0x2430 + i - 0x17E, 0x2430 + i - 0x17E );
                    defaultSecond = defaultBytes.Sub( 0x2430 + i - 0x17E, 0x2430 + i - 0x17E );
                }
                else if( i <= 0x195 )
                {
                    second = bytes.Sub( 0x243C + (i - 0x18A) * 2, 0x243C + (i - 0x18A) * 2 + 1 );
                    defaultSecond = defaultBytes.Sub( 0x243C + (i - 0x18A) * 2, 0x243C + (i - 0x18A) * 2 + 1 );
                }
                else if( i <= 0x19D )
                {
                    second = bytes.Sub( 0x2454 + (i - 0x196) * 2, 0x2454 + (i - 0x196) * 2 + 1 );
                    defaultSecond = defaultBytes.Sub( 0x2454 + (i - 0x196) * 2, 0x2454 + (i - 0x196) * 2 + 1 );
                }
                else if( i <= 0x1A5 )
                {
                    second = bytes.Sub( 0x2464 + i - 0x19E, 0x2464 + i - 0x19E );
                    defaultSecond = defaultBytes.Sub( 0x2464 + i - 0x19E, 0x2464 + i - 0x19E );
                }
                else
                {
                    if (i >= 422 && i <= 453)
                    {
                        effect = effects[PatcherLib.Utilities.Utilities.BytesToUShort( reactionEffects[(i - 422) * 2], reactionEffects[(i - 422) * 2 + 1] )];
                        defaultEffect = effects[PatcherLib.Utilities.Utilities.BytesToUShort( defaultReaction[(i - 422) * 2], defaultReaction[(i - 422) * 2 + 1] )];
                    }
                    second = bytes.Sub( 0x246C + i - 0x1A6, 0x246C + i - 0x1A6 );
                    defaultSecond = defaultBytes.Sub( 0x246C + i - 0x1A6, 0x246C + i - 0x1A6 );
                }

                Abilities[i] = new Ability( ((i == 0) ? "Attack" : Names[i]), i, first, second, new Ability( ((i == 0) ? "Attack" : Names[i]), i, defaultFirst, defaultSecond ) );
                if( effect != null && defaultEffect != null )
                {
                    Abilities[i].Effect = effect;
                    Abilities[i].Default.Effect = defaultEffect;
                }
            }
        }
Example #12
0
        public SkillSet( byte value, IList<byte> bytes )
            : this( DummySkillSets[value].Name, value )
        {
            List<bool> actions = new List<bool>( 16 );
            actions.AddRange( PatcherLib.Utilities.Utilities.BooleansFromByteMSB( bytes[0] ) );
            actions.AddRange( PatcherLib.Utilities.Utilities.BooleansFromByteMSB( bytes[1] ) );
            List<bool> theRest = new List<bool>( PatcherLib.Utilities.Utilities.BooleansFromByteMSB( bytes[2] ) );

            Actions = new Ability[16];
            TheRest = new Ability[6];

            for( int i = 0; i < 16; i++ )
            {
                Actions[i] = AllAbilities.DummyAbilities[(actions[i] ? (bytes[3 + i] + 0x100) : (bytes[3 + i]))];
            }
            for( int i = 0; i < 6; i++ )
            {
                TheRest[i] = AllAbilities.DummyAbilities[(theRest[i] ? (bytes[19 + i] + 0x100) : (bytes[19 + i]))];
            }
        }
Example #13
0
        public AllAbilities( IList<byte> bytes, IList<byte> effectsBytes )
        {
            AllEffects = new AllAbilityEffects( this );
            byte[] defaultBytes = FFTPatch.Context == Context.US_PSP ? PSPResources.AbilitiesBin : PSXResources.AbilitiesBin;
            Dictionary<UInt16, Effect> effects = FFTPatch.Context == Context.US_PSP ? Effect.PSPEffects : Effect.PSXEffects;
            byte[] defaultEffects = FFTPatch.Context == Context.US_PSP ? PSPResources.AbilityEffectsBin : PSXResources.AbilityEffectsBin;

            Abilities = new Ability[512];
            DefaultAbilities = new Ability[512];
            for( UInt16 i = 0; i < 512; i++ )
            {
                IList<byte> defaultFirst = defaultBytes.Sub( i * 8, i * 8 + 7 );
                IList<byte> first = bytes.Sub( i * 8, i * 8 + 7 );
                IList<byte> second;
                IList<byte> defaultSecond;
                Effect effect = null;
                Effect defaultEffect = null;

                if( i <= 0x16F )
                {
                    second = bytes.Sub( 0x1000 + 14 * i, 0x1000 + 14 * i + 13 );
                    defaultSecond = defaultBytes.Sub( 0x1000 + 14 * i, 0x1000 + 14 * i + 13 );
                    effect = effects[PatcherLib.Utilities.Utilities.BytesToUShort( effectsBytes[i * 2], effectsBytes[i * 2 + 1] )];
                    defaultEffect = effects[PatcherLib.Utilities.Utilities.BytesToUShort( defaultEffects[i * 2], defaultEffects[i * 2 + 1] )];
                }
                else if( i <= 0x17D )
                {
                    second = bytes.Sub( 0x2420 + i - 0x170, 0x2420 + i - 0x170 );
                    defaultSecond = defaultBytes.Sub( 0x2420 + i - 0x170, 0x2420 + i - 0x170 );
                }
                else if( i <= 0x189 )
                {
                    second = bytes.Sub( 0x2430 + i - 0x17E, 0x2430 + i - 0x17E );
                    defaultSecond = defaultBytes.Sub( 0x2430 + i - 0x17E, 0x2430 + i - 0x17E );
                }
                else if( i <= 0x195 )
                {
                    second = bytes.Sub( 0x243C + (i - 0x18A) * 2, 0x243C + (i - 0x18A) * 2 + 1 );
                    defaultSecond = defaultBytes.Sub( 0x243C + (i - 0x18A) * 2, 0x243C + (i - 0x18A) * 2 + 1 );
                }
                else if( i <= 0x19D )
                {
                    second = bytes.Sub( 0x2454 + (i - 0x196) * 2, 0x2454 + (i - 0x196) * 2 + 1 );
                    defaultSecond = defaultBytes.Sub( 0x2454 + (i - 0x196) * 2, 0x2454 + (i - 0x196) * 2 + 1 );
                }
                else if( i <= 0x1A5 )
                {
                    second = bytes.Sub( 0x2464 + i - 0x19E, 0x2464 + i - 0x19E );
                    defaultSecond = defaultBytes.Sub( 0x2464 + i - 0x19E, 0x2464 + i - 0x19E );
                }
                else
                {
                    second = bytes.Sub( 0x246C + i - 0x1A6, 0x246C + i - 0x1A6 );
                    defaultSecond = defaultBytes.Sub( 0x246C + i - 0x1A6, 0x246C + i - 0x1A6 );
                }

                Abilities[i] = new Ability( Names[i], i, first, second, new Ability( Names[i], i, defaultFirst, defaultSecond ) );
                if( i <= 0x16F )
                {
                    Abilities[i].Effect = effect;
                    Abilities[i].Default.Effect = defaultEffect;
                }
            }
        }
Example #14
0
        static AllAbilities()
        {
            PSPAbilities = new Ability[512];
            PSXAbilities = new Ability[512];
            psxEventAbilites = new Ability[512];
            pspEventAbilites = new Ability[512];

            PSPNames = PatcherLib.Utilities.Utilities.GetStringsFromNumberedXmlNodes(
                PSPResources.Abilities,
                "/Abilities/Ability[@value='{0}']/@name",
                512 );
            PSXNames = PatcherLib.Utilities.Utilities.GetStringsFromNumberedXmlNodes(
                PSXResources.Abilities,
                "/Abilities/Ability[@value='{0}']/@name",
                512 );
            for( int i = 0; i < 512; i++ )
            {
                PSPAbilities[i] = new Ability( PSPNames[i], (UInt16)i );
                PSXAbilities[i] = new Ability( PSXNames[i], (UInt16)i );
                pspEventAbilites[i] = new Ability( PSPNames[i], (UInt16)i );
                psxEventAbilites[i] = new Ability( PSXNames[i], (UInt16)i );
            }

            pspEventAbilites[510] = new Ability( "<Random>", 510 );
            pspEventAbilites[511] = new Ability( "Nothing", 511 );
            psxEventAbilites[510] = new Ability( "<Random>", 510 );
            psxEventAbilites[511] = new Ability( "Nothing", 511 );

        }