Exemple #1
0
        protected void refresh_item_stats(int[] stat_values)
        {
            if (unit != null && current_item_data.is_weapon)
            {
                //var stats = new BattlerStats(unit.id, redirect()); //Debug
                var stats = new Calculations.Stats.BattlerStats(
                    unit.id, current_item_data.Id);

                stat_values[0] = stats.dmg();
                stat_values[1] = stats.crt();
                stat_values[2] = stats.hit();
                stat_values[3] = unit.atk_spd(1, current_item_data);
                //stat_values[3] = unit.avo(); //Debug
            }
        }
Exemple #2
0
        public void refresh(Game_Unit unit, Item_Data itemData)
        {
            DescriptionOffset     = Vector2.Zero;
            DescriptionScrollWait = 120;
            ShowingDescription    = true;
            if (unit == null || itemData == null || itemData.non_equipment)
            {
                QuickDescrip.text = "";
            }
            else
            {
                var item = itemData.to_equipment;
                if (item.is_weapon && !(item as Data_Weapon).is_staff())
                {
                    var weapon = (item as Data_Weapon);
                    Type_Icon.index = weapon.main_type().IconIndex;
                    Stats[0].SetFont(
                        weapon.Rank == Weapon_Ranks.None ? Config.UI_FONT : Config.UI_FONT + "L",
                        Config.UI_FONT);
                    Stats[0].text = weapon.rank;

                    var stats = new Calculations.Stats.BattlerStats(unit.id, weapon.Id);

                    Stats[1].text = stats.dmg().ToString();
                    Stats[2].text = stats.crt().ToString();
                    Stats[3].text = stats.hit().ToString();
                    Stats[4].text = unit.atk_spd(1, itemData).ToString();

                    refresh_equippable(unit, weapon);

                    ShowingDescription = false;
                }
                else
                {
                    QuickDescrip.text = string.Join(" ", item.Quick_Desc.Split('\n'));
                }
            }
            DescriptionLength = QuickDescrip.text_width;
        }
        protected override void refresh()
        {
            BlockedWeaponInputs = 0;

            Map_Sprite.texture = ((Scene_Title)Global.scene).get_team_map_sprite(team(), actor.map_sprite_name);
            if (Map_Sprite.texture != null)
            {
                Map_Sprite.offset = new Vector2(
                    (Map_Sprite.texture.Width / Map_Sprite.frame_count) / 2,
                    (Map_Sprite.texture.Height / Map_Sprite.facing_count) - 8);
            }
            Map_Sprite.mirrored = Constants.Team.flipped_map_sprite(team());

            if (State != Test_Battle_States.Confirm)
            {
                Test_Battle_Character_Data test_battler = this.test_battler;
                if (same_unit)
                {
                    if (test_battler == Global.test_battler_1)
                    {
                        test_battler = Global.test_battler_2;
                    }
                    else
                    {
                        test_battler = Global.test_battler_1;
                    }
                }

                Global.game_map.add_actor_unit(Constants.Team.PLAYER_TEAM, Vector2.Zero, test_battler.Actor_Id, "");
                Game_Unit unit = Global.game_map.last_added_unit;
                // Actor data
                Data.Clear();
                for (int i = 0; i < max_index; i++)
                {
                    Data.Add(new TextSprite());
                    Data[i].loc = new Vector2(32, 24 + 16 * i);
                    Data[i].SetFont(Config.UI_FONT, Global.Content, "Blue");
                    Data[i].stereoscopic = Config.TESTBATTLE_DATA_DEPTH;
                }
                if (test_battler.Generic)
                {
                    Data[0].text = "Generic";
                    Data[1].text = actor.class_name;
                    Data[5].text = test_battler.Build.ToString();
                    Data[6].text = test_battler.Gender.ToString();
                }
                else
                {
                    Data[0].text = "Actor";
                    Data[1].text = actor.name;
                    if (same_unit)
                    {
                        for (int i = 2; i < max_index; i++)
                        {
                            Data[i].SetColor(Global.Content, "Grey");
                        }
                        if (State == Test_Battle_States.Unit_2)
                        {
                            Data[1].SetColor(Global.Content, "Grey");
                        }
                    }
                    Data[5].text = actor.tier.ToString() + ", " + actor.class_name;
                }
                Data[2].loc.X += 16;
                if (Global.data_weapons.ContainsKey(test_battler.Weapon_Id))
                {
                    Data[2].text          = Global.data_weapons[test_battler.Weapon_Id].Name;
                    Item_Icons[0].texture = Global.Content.Load <Texture2D>(@"Graphics/Icons/" + Global.data_weapons[test_battler.Weapon_Id].Image_Name);
                    Item_Icons[0].index   = Global.data_weapons[test_battler.Weapon_Id].Image_Index;
                }
                else
                {
                    Data[2].text          = "no weapon";
                    Item_Icons[0].texture = null;
                    Item_Icons[0].index   = 0;
                }
                if (actor.weapon == null)
                {
                    Data[2].SetColor(Global.Content, "Grey");
                }
                Data[3].text = test_battler.Level.ToString();
                Data[4].text = test_battler.Prepromote_Levels.ToString();
                // Stats
                for (int i = 0; i < Stats.Length - 1; i++)
                {
                    Stats[i].text = actor.stat(i).ToString();
                    Stats[i].SetColor(Global.Content, actor.get_capped(i) ? "Green" : "Blue");
                }
                Stats[Stats.Length - 1].text = actor.rating().ToString();
                // Combat Stats
                for (int i = 0; i < Combat_Stats.Length; i++)
                {
                    Combat_Stats[i].SetColor(Global.Content, actor.weapon == null ? "Grey" : "Blue");
                }
                // Force equips the weapon and gets the stats for it, whether it's valid or not, then requips the old weapon
                int weapon_id = unit.actor.weapon_id;
                unit.actor.weapon_id = test_battler.Weapon_Id;

                var stats = new Calculations.Stats.BattlerStats(unit.id);
                Combat_Stats[0].text = stats.hit().ToString();
                Combat_Stats[1].text = stats.dmg().ToString();
                Combat_Stats[2].text = stats.crt().ToString();
                Combat_Stats[3].text = stats.avo().ToString();
                Combat_Stats[4].text = stats.dodge().ToString();
                Combat_Stats[5].text = unit.atk_spd(this.distance).ToString();
                //Combat_Stats[6].text = "1"; //Yeti
                int min_range = unit.min_range();
                int max_range = unit.max_range();
                if (min_range == max_range && min_range == 0)
                {
                    Combat_Stats[6].text = "--";
                }
                else
                {
                    Combat_Stats[6].text = min_range != max_range?min_range.ToString() + "-" + max_range.ToString() : min_range.ToString();   //Yeti
                }
                unit.actor.weapon_id = weapon_id;
            }
            else
            {
                Global.game_map.add_actor_unit(
                    Constants.Team.PLAYER_TEAM, Vector2.Zero,
                    Global.test_battler_1.Actor_Id, "");
                Game_Unit unit1 = Global.game_map.last_added_unit;
                Global.game_map.add_actor_unit(
                    Constants.Team.ENEMY_TEAM, Vector2.Zero,
                    Global.test_battler_2.Actor_Id, "");
                Game_Unit unit2 = Global.game_map.last_added_unit;

                int distance = this.distance;
                //Global.game_system.In_Arena = true;
                List <int?> stats = Combat.combat_stats(unit1.id, unit2.id, distance);
                //Global.game_system.In_Arena = false;
                for (int i = 0; i < Battle_Stats.Length; i++)
                {
                    int mult = 1;
                    if ((i - 1) % 4 == 0 && stats[i] != null)
                    {
                        var unit = i < 4 ? unit1 : unit2;
                        mult *= i < 4 ? unit1.attacks_per_round(unit2, distance) :
                                unit2.attacks_per_round(unit1, distance);
                        if (unit.actor.weapon != null && !unit.is_brave_blocked()) //brave //Yeti
                        {
                            mult *= unit.actor.weapon.HitsPerAttack;
                        }
                    }
                    Battle_Stats[i].text = stats[i] == null ? "--" : stats[i].ToString() + (mult > 1 ? " x" + mult.ToString() : "");
                }
            }
        }