예제 #1
0
        public Status_Page_2()
        {
            var nodes = new List <StatusUINode>();

            // Skills Window
            Skills_Window              = new System_Color_Window();
            Skills_Window.loc          = new Vector2(8, 96);
            Skills_Window.width        = 144;
            Skills_Window.height       = 96;
            Skills_Window.stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH;

            // WLvls Window
            int max_wlvl_index = 0;

            if (Global.weapon_types.Any(x => x.DisplayedInStatus))
            {
                max_wlvl_index = Global.weapon_types
                                 .Where(x => x.DisplayedInStatus)
                                 .Max(x => x.StatusIndex);
            }
            // @Debug: this doesn't really do what it's supposed to,
            // and the window height will be set in set_images() anyway
            int wlvl_rows = (max_wlvl_index / WLVL_COLUMNS) + 1;

            WLvls_Window              = new System_Color_Window();
            WLvls_Window.loc          = new Vector2(168, 96);
            WLvls_Window.width        = 144;
            WLvls_Window.height       = (wlvl_rows + 1) * 16; // 96; //Debug
            WLvls_Window.stereoscopic = Config.STATUS_RIGHT_WINDOW_DEPTH;

            // Skill Bg
            Skill_Bg              = new Status_Support_Background();
            Skill_Bg.loc          = Skills_Window.loc + new Vector2(8, 8 + ACTOR_SKILLS * 16);
            Skill_Bg.stereoscopic = Config.STATUS_RIGHT_WINDOW_DEPTH;

            // Skills
            for (int i = 0; i < ACTOR_SKILLS; i++)
            {
                int j = i;

                Vector2 loc = Skills_Window.loc +
                              new Vector2(8, 8 + (Config.SKILL_ICON_SIZE - 16) / 2 +
                                          i * Config.SKILL_ICON_SIZE);

                nodes.Add(new StatusSkillUINode(
                              string.Format("Skill{0}", i + 1),
                              (Game_Unit unit) =>
                {
                    if (unit.actor.skills.Count <= j)
                    {
                        return(new SkillState());
                    }
                    var skill = Global.data_skills[unit.actor.skills[j]];

                    float charge = -1f;
                    if (Game_Unit.MASTERIES.Contains(skill.Abstract))
                    {
                        charge = unit.mastery_charge_percent(skill.Abstract);
                    }
                    return(new SkillState
                    {
                        Skill = skill,
                        Charge = charge
                    });
                }));
                nodes.Last().loc         = loc;
                nodes.Last().draw_offset = new Vector2(
                    0, -(Config.SKILL_ICON_SIZE - 16) / 2);
                nodes.Last().stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH;
#if DEBUG
                // Charges skill gauges
                Func <Game_Unit, DirectionFlags, bool> skill_cheat = (unit, dir) =>
                {
                    if (unit.actor.skills.Count > j)
                    {
                        var skill = Global.data_skills[unit.actor.skills[j]];
                        if (Game_Unit.MASTERIES.Contains(skill.Abstract))
                        {
                            int charge = 0;
                            if (dir.HasFlag(DirectionFlags.Right))
                            {
                                charge = 1;
                            }
                            else if (dir.HasFlag(DirectionFlags.Left))
                            {
                                charge = -1;
                            }

                            unit.charge_masteries(skill.Abstract,
                                                  charge * Game_Unit.MASTERY_RATE_NEW_TURN);
                            return(charge != 0);
                        }
                    }
                    return(false);
                };
                nodes.Last().set_cheat(skill_cheat);
#endif
            }
            for (int i = 0; i < ITEM_SKILLS; i++)
            {
                int j = i;

                Vector2 loc = Skills_Window.loc +
                              new Vector2(8 + (Config.SKILL_ICON_SIZE - 16) / 2 +
                                          i * Config.SKILL_ICON_SIZE, 72 + 2);

                nodes.Add(new StatusSkillIconUINode(
                              string.Format("Item Skill{0}", i + 1),
                              (Game_Unit unit) =>
                {
                    if (unit.actor.item_skills.Count <= j)
                    {
                        return(new SkillState());
                    }
                    var skill = Global.data_skills[unit.actor.item_skills[j]];

                    float charge = -1f;
                    if (Game_Unit.MASTERIES.Contains(skill.Abstract))
                    {
                        charge = unit.mastery_charge_percent(skill.Abstract);
                    }
                    return(new SkillState
                    {
                        Skill = skill,
                        Charge = charge
                    });
                }));
                nodes.Last().loc         = loc;
                nodes.Last().draw_offset = new Vector2(
                    0, -(Config.SKILL_ICON_SIZE - 16) / 2);
                nodes.Last().stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH;
            }
            // WLvls
            foreach (var weapon_type in Global.weapon_types)
            {
                if (!weapon_type.DisplayedInStatus)
                {
                    continue;
                }

                nodes.Add(weapon_type_icon(weapon_type, weapon_type.StatusIndex));
            }

            StatusPageNodes = new UINodeSet <StatusUINode>(nodes);

            init_design();
        }
예제 #2
0
        public Status_Page_1()
        {
            var nodes = new List <StatusUINode>();

            // Stats Window
            Stats_Window              = new System_Color_Window();
            Stats_Window.loc          = new Vector2(8, 80);
            Stats_Window.width        = 144;
            Stats_Window.height       = 112;
            Stats_Window.stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH;
            // Stats
            for (int i = 0; i < 6; i++)
            {
                string help_label;
                string label;

                var stat_label = (Stat_Labels)i + 1;

                Vector2 loc = Stats_Window.loc + new Vector2(8, i * 16 + 8);
                PrimaryStatState.label((Stat_Labels)i + 1, out label, out help_label);

                Func <Game_Unit, PrimaryStatState> stat_formula = (Game_Unit unit) =>
                {
                    return(new PrimaryStatState(unit, stat_label));
                };

                Func <Game_Unit, Color> label_color = null;
                if (Window_Status.show_stat_colors(stat_label))
                {
                    label_color = (Game_Unit unit) =>
                    {
                        if (unit.average_stat_hue_shown)
                        {
                            return(unit.actor.stat_color(stat_label));
                        }
                        return(Color.White);
                    };
                }

                nodes.Add(new StatusPrimaryStatUINode(
                              help_label, label, stat_formula, label_color, 40));
                nodes.Last().loc          = loc;
                nodes.Last().stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH;
#if DEBUG
                nodes.Last().set_cheat(stat_cheat(stat_label));
#endif

                if (stat_label == Stat_Labels.Pow)
                {
                    PowNode = nodes.Last() as StatusStatUINode;
                }
            }

            // Move
            nodes.Add(new StatusPrimaryStatUINode(
                          "Move",
                          "Move",
                          (Game_Unit unit) =>
            {
                if (unit.immobile)
                {
                    return new PrimaryStatState
                    {
                        Stat     = 0,
                        Bonus    = 0,
                        Cap      = unit.stat_cap(Stat_Labels.Mov),
                        NullStat = true,
                    }
                }
                ;
                return(new PrimaryStatState
                {
                    Stat = unit.base_mov,
                    Bonus = unit.mov - unit.base_mov,
                    Cap = unit.stat_cap(Stat_Labels.Mov),
                });
            }, null, 40));
            nodes.Last().loc          = Stats_Window.loc + new Vector2(72, 0 * 16 + 8);
            nodes.Last().stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH;
#if DEBUG
            nodes.Last().set_cheat(stat_cheat(Stat_Labels.Mov));
#endif
            // Con
            nodes.Add(new StatusPrimaryStatUINode(
                          "Con",
                          "Con",
                          (Game_Unit unit) =>
            {
                return(new PrimaryStatState
                {
                    Stat = unit.actor.stat(Stat_Labels.Con),
                    Bonus = Math.Min(unit.stat_bonus(Stat_Labels.Con),
                                     unit.actor.cap_base_difference(Stat_Labels.Con)),
                    Cap = unit.stat_cap(Stat_Labels.Con),
                    IsCapped = unit.actor.get_capped(Stat_Labels.Con)
                });
            }, null, 40));
            nodes.Last().loc          = Stats_Window.loc + new Vector2(72, 1 * 16 + 8);
            nodes.Last().stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH;
#if DEBUG
            nodes.Last().set_cheat(stat_cheat(Stat_Labels.Con));
#endif
            // Aid
            nodes.Add(new StatusAidUINode(
                          "Aid",
                          "Aid",
                          (Game_Unit unit) =>
            {
                return(unit.aid().ToString());
            },
                          (Game_Unit unit) =>
            {
                if (unit.actor.actor_class.Class_Types.Contains(ClassTypes.FDragon))
                {
                    return(3);
                }
                else if (unit.actor.actor_class.Class_Types.Contains(ClassTypes.Flier))
                {
                    return(2);
                }
                else if (unit.actor.actor_class.Class_Types.Contains(ClassTypes.Cavalry))
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }, 40));
            nodes.Last().loc          = Stats_Window.loc + new Vector2(72, 2 * 16 + 8);
            nodes.Last().stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH;
            // Trv
            nodes.Add(new StatusTravelerUINode(
                          "Trv",
                          "Trv",
                          (Game_Unit unit) =>
            {
                if (unit.is_rescued)
                {
                    return(Global.game_map.units[unit.rescued].actor.name);
                }
                else if (unit.is_rescuing)
                {
                    return(Global.game_map.units[unit.rescuing].actor.name);
                }
                return("---");
            },
                          (Game_Unit unit) =>
            {
                if (!unit.is_rescuing)
                {
                    return(0);
                }
                return(Global.game_map.units[unit.rescuing].team);
            }, 24));
            nodes.Last().loc          = Stats_Window.loc + new Vector2(72, 3 * 16 + 8);
            nodes.Last().stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH;
            // Type
            nodes.Add(new StatusClassTypesUINode(
                          "Type",
                          "Type",
                          (Game_Unit unit) =>
            {
                return(unit.actor.class_types);
            }, 24));
            nodes.Last().loc          = Stats_Window.loc + new Vector2(72, 4 * 16 + 8);
            nodes.Last().stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH;
            // Rating
            nodes.Add(new StatusLabeledTextUINode(
                          "Rating",
                          "Rating",
                          (Game_Unit unit) =>
            {
                return(unit.rating().ToString());
            }, 32));
            nodes.Last().loc          = Stats_Window.loc + new Vector2(72, 5 * 16 + 8);
            nodes.Last().Size         = new Vector2(64, 16);
            nodes.Last().stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH;

            // Items Window
            Items_Window              = new System_Color_Window();
            Items_Window.loc          = new Vector2(168, 80);
            Items_Window.width        = 144;
            Items_Window.height       = Global.ActorConfig.NumItems * 16 + 16;
            Items_Window.stereoscopic = Config.STATUS_RIGHT_WINDOW_DEPTH;

            // Skill Bg
            SiegeBg     = new Status_Support_Background();
            SiegeBg.loc = Items_Window.loc + new Vector2(
                8, 8 + (Global.ActorConfig.NumItems - 1) * 16);
            SiegeBg.stereoscopic = Config.STATUS_RIGHT_WINDOW_DEPTH;
            SiegeBg.visible      = false;

            // Items
            for (int i = 0; i < Global.ActorConfig.NumItems; i++)
            {
                int j = i;

                Vector2 loc = Items_Window.loc + new Vector2(8, i * 16 + 8);

                nodes.Add(new StatusItemUINode(
                              string.Format("Item{0}", i + 1),
                              (Game_Unit unit) =>
                {
                    return(new ItemState
                    {
                        Item = unit.actor.items[j],
                        Drops = unit.drops_item && j == unit.actor.num_items - 1,
                        Equipped = unit.actor.equipped - 1 == j
                    });
                }));
                nodes.Last().loc          = loc;
                nodes.Last().stereoscopic = Config.STATUS_RIGHT_WINDOW_DEPTH;
                Func <Game_Unit, DirectionFlags, bool> item_cheat = (unit, dir) =>
                {
                    // Uses
                    if (dir.HasFlag(DirectionFlags.Up) || dir.HasFlag(DirectionFlags.Down))
                    {
                        if (unit.actor.items[j].non_equipment ||
                            unit.actor.items[j].infinite_uses)
                        {
                            return(false);
                        }
                        int uses = unit.actor.items[j].Uses;
                        if (dir.HasFlag(DirectionFlags.Up))
                        {
                            uses++;
                        }
                        else
                        {
                            uses--;
                        }
                        uses = Math.Max(Math.Min(
                                            uses, unit.actor.items[j].max_uses), 1);
                        if (uses == unit.actor.items[j].Uses)
                        {
                            return(false);
                        }
                        unit.actor.items[j].Uses = uses;
                        return(true);
                    }
                    else
                    {
                        // Change item
                        if (unit.actor.items[j].is_weapon)
                        {
                            List <int> weapon_keys = Global.data_weapons.Keys.ToList();
                            int        index       = weapon_keys.IndexOf(unit.actor.items[j].Id);
                            if (dir.HasFlag(DirectionFlags.Right))
                            {
                                index++;
                            }
                            else if (dir.HasFlag(DirectionFlags.Left))
                            {
                                index--;
                            }
                            else
                            {
                                return(false);
                            }
                            index = (index + weapon_keys.Count) % weapon_keys.Count;
                            unit.actor.items[j].Id = weapon_keys[index];
                            unit.actor.setup_items(false);
                        }
                        else
                        {
                            List <int> item_keys = Global.data_items.Keys.ToList();
                            int        index     = item_keys.IndexOf(unit.actor.items[j].Id);
                            if (dir.HasFlag(DirectionFlags.Right))
                            {
                                index++;
                            }
                            else if (dir.HasFlag(DirectionFlags.Left))
                            {
                                index--;
                            }
                            else
                            {
                                return(false);
                            }
                            index = (index + item_keys.Count) % item_keys.Count;
                            unit.actor.items[j].Id = item_keys[index];
                        }
                        if (unit.actor.items[j].infinite_uses)
                        {
                            unit.actor.items[j].Uses = -1;
                        }
                        else
                        {
                            if (unit.actor.items[j].Uses == -1)
                            {
                                unit.actor.items[j].Uses = 1;
                            }
                        }
                        return(true);
                    }
                };
#if DEBUG
                nodes.Last().set_cheat(item_cheat);
#endif
            }

            // Siege engine
            Vector2 siege_loc = Items_Window.loc +
                                new Vector2(8, (Global.ActorConfig.NumItems - 1) * 16 + 8 + 2);

            nodes.Add(new StatusSiegeItemUINode(
                          string.Format("Item{0}", Global.ActorConfig.NumItems + 1),
                          (Game_Unit unit) =>
            {
                Item_Data siege = new Item_Data();
                if (!unit.actor.is_full_items && unit.is_on_siege())
                {
                    siege = unit.items[Siege_Engine.SiegeInventoryIndex];
                }

                return(new ItemState
                {
                    Item = siege,
                    Drops = false,
                    Equipped = false
                });
            }));
            nodes.Last().loc          = siege_loc;
            nodes.Last().stereoscopic = Config.STATUS_RIGHT_WINDOW_DEPTH;


            StatusPageNodes = new UINodeSet <StatusUINode>(nodes);

            init_design();
        }
예제 #3
0
        public Status_Page_3()
        {
            var nodes = new List <StatusUINode>();

            // Bonuses Window
            Bonuses_Window              = new System_Color_Window();
            Bonuses_Window.loc          = new Vector2(8, 80);
            Bonuses_Window.width        = 144;
            Bonuses_Window.height       = 112;
            Bonuses_Window.stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH;
            // Status Label
            nodes.Add(new StatusTextUINode(
                          "Cond",
                          (Game_Unit unit) => "Status"));
            nodes.Last().loc = Bonuses_Window.loc + new Vector2(16, 8);
            (nodes.Last() as StatusTextUINode).set_color("Yellow");
            nodes.Last().Size         = new Vector2(32, 16);
            nodes.Last().stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH;

            // Statuses
            for (int i = 0; i < ACTOR_STATUSES; i++)
            {
                int j = i;

                Vector2 loc = Bonuses_Window.loc + new Vector2(48 + i * 16, 8);

                nodes.Add(new StatusStateUINode(
                              string.Format("Status{0}", i + 1),
                              (Game_Unit unit) =>
                {
                    if (unit.actor.states.Count <= j)
                    {
                        return(new Tuple <int, int>(-1, 0));
                    }

                    int id    = unit.actor.states[j];
                    int turns = unit.actor.state_turns_left(id);

                    return(new Tuple <int, int>(id, turns));
                }));
                nodes.Last().loc          = loc;
                nodes.Last().stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH;
            }

            // Bond
            nodes.Add(new StatusLabeledTextUINode(
                          "Bond",
                          "Bond",
                          (Game_Unit unit) =>
            {
                if (unit.actor.bond > 0)
                {
                    return(Global.game_actors[unit.actor.bond].name);
                }
                else
                {
                    return("-----");
                }
            }, 52, true));
            nodes.Last().loc = Bonuses_Window.loc + new Vector2(32 + 4, 2 * 16 + 4);
            (nodes.Last() as StatusTextUINode).set_color("White");
            nodes.Last().Size         = new Vector2(80, 16);
            nodes.Last().stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH;
            // Bonuses
            for (int i = 0; i < 6; i++)
            {
                string help_label;
                string label;
                Func <Game_Unit, string> stat_formula;
                switch (i)
                {
                // Atk
                case 0:
                default:
                    help_label   = "BAtk";
                    label        = "Atk";
                    stat_formula = (Game_Unit unit) =>
                                   unit.support_bonus(Combat_Stat_Labels.Dmg, true).ToString();
                    break;

                // Hit
                case 1:
                    help_label   = "BHit";
                    label        = "Hit";
                    stat_formula = (Game_Unit unit) =>
                                   unit.support_bonus(Combat_Stat_Labels.Hit, true).ToString();
                    break;

                // Crit
                case 2:
                    help_label   = "BCrt";
                    label        = "Crit";
                    stat_formula = (Game_Unit unit) =>
                                   unit.support_bonus(Combat_Stat_Labels.Crt, true).ToString();
                    break;

                // Def
                case 3:
                    help_label   = "BDef";
                    label        = "Def";
                    stat_formula = (Game_Unit unit) =>
                                   unit.support_bonus(Combat_Stat_Labels.Def, true).ToString();
                    break;

                // Avoid
                case 4:
                    help_label   = "BAvo";
                    label        = "Avoid";
                    stat_formula = (Game_Unit unit) =>
                                   unit.support_bonus(Combat_Stat_Labels.Avo, true).ToString();
                    break;

                // Dodge
                case 5:
                    help_label   = "BDod";
                    label        = "Dodge";
                    stat_formula = (Game_Unit unit) =>
                                   unit.support_bonus(Combat_Stat_Labels.Dod, true).ToString();
                    break;
                }

                Vector2 loc = Bonuses_Window.loc +
                              new Vector2(20 + (i / 3) * 56, 56 + (i % 3) * 16);

                nodes.Add(new StatusStatUINode(help_label, label, stat_formula));
                nodes.Last().loc          = loc;
                nodes.Last().stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH;
            }
            // Bonus Bg
            Bonus_Bg              = new Status_Bonus_Background();
            Bonus_Bg.loc          = Bonuses_Window.loc + new Vector2(8, 24);
            Bonus_Bg.stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH;

            // Supports Window
            Supports_Window              = new System_Color_Window();
            Supports_Window.loc          = new Vector2(168, 80);
            Supports_Window.width        = 144;
            Supports_Window.height       = 112;
            Supports_Window.stereoscopic = Config.STATUS_RIGHT_WINDOW_DEPTH;
            // Affinity
            nodes.Add(new StatusAffinityUINode(
                          "Affin",
                          (Game_Unit unit) => unit.actor.affin));
            nodes.Last().loc          = Supports_Window.loc + new Vector2(40, 8);
            nodes.Last().stereoscopic = Config.STATUS_RIGHT_WINDOW_DEPTH;
            // Supports
            Supports              = new Status_Support_List();
            Supports.loc          = Supports_Window.loc + new Vector2(32, 24);
            Supports.stereoscopic = Config.STATUS_RIGHT_WINDOW_DEPTH;
            // Support Bg
            Support_Bg              = new Status_Support_Background();
            Support_Bg.loc          = Supports_Window.loc + new Vector2(8, 24);
            Support_Bg.stereoscopic = Config.STATUS_RIGHT_WINDOW_DEPTH;

            StatusPageNodes = new UINodeSet <StatusUINode>(nodes);

            init_design();
        }