Example #1
0
        public static void SetWeaponTriangle(
            Weapon_Triangle_Arrow wta1,
            Weapon_Triangle_Arrow wta2,
            Game_Unit attacker,
            Combat_Map_Object target,
            TactileLibrary.Data_Weapon weapon1,
            TactileLibrary.Data_Weapon weapon2,
            int distance)
        {
            //@Yeti: use in all the places weapon triangle arrow is used
            Game_Unit targetUnit = null;

            if (target.is_unit())
            {
                targetUnit = target as Game_Unit;
            }

            ResetWeaponTriangle(wta1, wta2);
            WeaponTriangle tri = WeaponTriangle.Nothing;

            if (targetUnit != null)
            {
                tri = Combat.weapon_triangle(attacker, targetUnit, weapon1, weapon2, distance);
            }
            if (tri != WeaponTriangle.Nothing)
            {
                wta1.value = tri;
                if (wta2 != null && weapon2 != null)
                {
                    wta2.value = Combat.reverse_wta(tri);
                }
            }

            float effectiveness = weapon1.effective_multiplier(attacker, targetUnit, false);

            wta1.set_effectiveness((int)effectiveness,
                                   targetUnit != null && targetUnit.halve_effectiveness());

            if (wta2 != null && weapon2 != null)
            {
                effectiveness = weapon2.effective_multiplier(targetUnit, attacker, false);
                wta2.set_effectiveness((int)effectiveness, attacker.halve_effectiveness());
            }
        }
Example #2
0
        protected void refresh_battle_stats(bool just_stats)
        {
            if (!just_stats)
            {
                foreach (Item_Icon_Sprite icon in Weapon_Icons)
                {
                    icon.texture = null;
                }
                foreach (TextSprite name in Weapon_Names)
                {
                    name.text = "";
                }

                TactileLibrary.Data_Weapon weapon1 = null;
                TactileLibrary.Data_Weapon weapon2 = null;
                WTAs[0].value = 0;
                if (Global.scene.scene_type == "Scene_Dance" || Global.scene.scene_type == "Scene_Promotion")
                {
                    int item_index = -1;
                    if (Global.scene.scene_type == "Scene_Dance")
                    {
                        item_index = Global.game_state.dance_item;
                    }
                    else if (Global.scene.scene_type == "Scene_Promotion")
                    {
                        item_index = Global.game_state.item_used;
                    }
                    if (item_index > -1)
                    {
                        TactileLibrary.Item_Data      item_data = battler_1.actor.items[item_index];
                        TactileLibrary.Data_Equipment item1     = item_data.to_equipment;
                        Weapon_Icons[0].texture  = Global.Content.Load <Texture2D>(@"Graphics/Icons/" + item1.Image_Name);
                        Weapon_Icons[0].index    = item1.Image_Index;
                        Weapon_Names[0].offset.X = Font_Data.text_width(item1.full_name()) / 2;
                        Weapon_Names[0].text     = item1.full_name();
                    }

                    if (battler_2 != null)
                    {
                        WTAs[1].value = 0;
                        weapon2       = battler_2.actor.weapon;
                        if (weapon2 != null)
                        {
                            Weapon_Icons[1].texture  = Global.Content.Load <Texture2D>(@"Graphics/Icons/" + weapon2.Image_Name);
                            Weapon_Icons[1].index    = weapon2.Image_Index;
                            Weapon_Names[1].offset.X = Font_Data.text_width(weapon2.full_name()) / 2;
                            Weapon_Names[1].text     = weapon2.full_name();
                        }
                    }
                }
                else
                {
                    weapon1 = battler_1.actor.weapon;
                    Weapon_Icons[0].texture = Global.Content.Load <Texture2D>(@"Graphics/Icons/" + weapon1.Image_Name);
                    Weapon_Icons[0].index   = weapon1.Image_Index;
                    if (!(Data is Staff_Data) || ((Staff_Data)Data).attack_staff)
                    {
                        Weapon_Icons[0].flash = weapon1.effective_multiplier(battler_1, battler_2) > 1;
                    }
                    Weapon_Names[0].offset.X = Font_Data.text_width(weapon1.full_name()) / 2;
                    Weapon_Names[0].text     = weapon1.full_name();


                    if (battler_2 != null)
                    {
                        WTAs[1].value = 0;
                        weapon2       = battler_2.actor.weapon;
                        if (weapon2 != null)
                        {
                            Weapon_Icons[1].texture = Global.Content.Load <Texture2D>(@"Graphics/Icons/" + weapon2.Image_Name);
                            Weapon_Icons[1].index   = weapon2.Image_Index;
                            if (!(Data is Staff_Data) || ((Staff_Data)Data).attack_staff)
                            {
                                Weapon_Icons[1].flash = weapon2.effective_multiplier(battler_2, battler_1) > 1;
                            }
                            Weapon_Names[1].offset.X = Font_Data.text_width(weapon2.full_name()) / 2;
                            Weapon_Names[1].text     = weapon2.full_name();
                            // Attack Multiplier
                            if (!weapon1.is_staff())
                            {
                            }  // Mults[1].value = Mults[1].get_multi(battler_2, battler_1, weapon2); //Debug
                        }
                        if (!weapon1.is_staff())
                        {
                            // Weapon triangle arrows
                            WeaponTriangle tri = Combat.weapon_triangle(battler_1, battler_2, weapon1, weapon2, Data.Distance);
                            if (tri != WeaponTriangle.Nothing)
                            {
                                WTAs[0].value = tri;
                                if (weapon2 != null)
                                {
                                    WTAs[1].value = Combat.reverse_wta(tri);
                                }
                            }
                            // Attack Multiplier
                            //Mults[0].value = Mults[0].get_multi(battler_1, battler_2, weapon1); //Debug
                        }
                    }
                }
            }
            for (int i = 0; i < Stat_Imgs.Count; i++)
            {
                if (Stats[i] == null)
                {
                    Stat_Imgs[i].text = "--";
                }
                else if (Stats[i] < 0)
                {
                    Stat_Imgs[i].text = "--";
                }
                else
                {
                    Stat_Imgs[i].text = Stats[i].ToString();
                }
            }
        }