Exemple #1
0
    void Start()
    {
        partymembers = generalinfo [0].partymembers;
        encounter    = -1;

        party = GetComponent <Data_Actor> ();
    }
        protected override void update_option_change(bool right, bool trigger)
        {
            Test_Battle_Character_Data test_battler = this.test_battler;

            switch (Index)
            {
            // Generic
            case 0:
                test_battler.Generic = !test_battler.Generic;
                if (test_battler.Generic)
                {
                    test_battler.Class_Id = Test_Battle_Character_Data.default_class_id;
                    test_battler.Build    = Generic_Builds.Strong;
                    test_battler.Level    = 1;
                    change_generic_actor();
                }
                else
                {
                    test_battler.Actor_Id = 1;
                    change_actor();
                }
                if (!same_unit)
                {
                    setup_actor(test_battler);
                }
                break;

            case 1:
                if (test_battler.Generic)
                {
                    // Class Id
                    test_battler.Class_Id = Classes[
                        (Classes.IndexOf(test_battler.Class_Id) + Classes.Count + (right ? 1 : -1)) % Classes.Count];
                    change_generic_actor();
                }
                else
                {
                    // Actor Id
                    test_battler.Actor_Id = Actors[
                        (Actors.IndexOf(test_battler.Actor_Id) + Actors.Count + (right ? 1 : -1)) % Actors.Count];
                    change_actor();
                }
                if (!same_unit)
                {
                    setup_actor(test_battler);
                }
                break;

            // Weapon
            case 2:
                if (trigger)
                {
                    test_battler.Weapon_Id = next_weapon_group(right, test_battler.Weapon_Id);
                    if (test_battler.Weapon_Id == 0)
                    {
                        test_battler.Weapon_Id = next_weapon_group(right, test_battler.Weapon_Id);
                    }
                }
                else
                {
                    test_battler.Weapon_Id = Weapons[
                        (Weapons.IndexOf(test_battler.Weapon_Id) + Weapons.Count +
                         (Global.Input.pressed(Inputs.Y) ? 5 : 1) * (right ? 1 : -1)) % Weapons.Count];
                }

                actor.clear_items();
                actor.gain_item(new Item_Data(Item_Data_Type.Weapon, test_battler.Weapon_Id, 1));
                test_battler.Items[0] = actor.items[0];
                validate_weapon(actor);
                break;

            // Level
            case 3:
                if (right)
                {
                    if (test_battler.Level < actor.level_cap())
                    {
                        test_battler.Level++;
                    }
                }
                else
                {
                    int min = 1;
                    if (!Global.ActorConfig.ResetLevelOnPromotion)
                    {
                        min = Math.Max(1,
                                       Global.ActorConfig.LevelsBeforeTier(test_battler.Tier));
                    }

                    if (test_battler.Generic)
                    {
                        if (test_battler.Level > min)
                        {
                            test_battler.Level--;
                        }
                    }
                    else
                    {
                        Data_Actor actor_data = Global.data_actors[test_battler.Actor_Id];
                        if (test_battler.Level > (actor.tier == Global.data_classes[actor_data.ClassId].Tier ?
                                                  Global.data_actors[test_battler.Actor_Id].Level : min))
                        {
                            test_battler.Level--;
                        }
                    }
                }
                setup_actor(test_battler);
                break;

            // Prepromote levels
            case 4:
                int minLevel, maxLevel;
                PrepromoteLevels(test_battler, out minLevel, out maxLevel);

                // Increase
                if (right)
                {
                    if (test_battler.Prepromote_Levels < maxLevel)
                    {
                        test_battler.Prepromote_Levels++;
                    }
                }
                // Decrease
                else
                {
                    if (test_battler.Prepromote_Levels > minLevel)
                    {
                        test_battler.Prepromote_Levels--;
                    }
                }

                setup_actor(test_battler);
                break;

            case 5:
                // Build
                if (test_battler.Generic)
                {
                    test_battler.Build = (Generic_Builds)(MathHelper.Clamp((int)test_battler.Build + (right ? 1 : -1),
                                                                           (int)Generic_Builds.Weak, (int)Generic_Builds.Strong));
                }
                // Tier
                else
                {
                    ChangeTier(test_battler, right);
                }
                setup_actor(test_battler);
                break;

            case 6:
                // Gender
                if (test_battler.Generic)
                {
                    test_battler.Gender = (int)(MathHelper.Clamp(test_battler.Gender + (right ? 1 : -1), 0, 5));
                    actor.gender        = test_battler.Gender;
                }
                break;
            }
            refresh();
        }