Exemplo n.º 1
0
        public TeachInfoMenu(int itemNum)
        {
            Bounds = Rect.FromPoints(new Loc(16, 24), new Loc(GraphicsManager.ScreenWidth - 16, GraphicsManager.ScreenHeight - 72));

            ItemData       itemData = DataManager.Instance.GetItem(itemNum);
            ItemIndexState effect   = itemData.ItemStates.GetWithDefault <ItemIndexState>();

            SkillData   skillEntry   = DataManager.Instance.GetSkill(effect.Index);
            ElementData elementEntry = DataManager.Instance.GetElement(skillEntry.Data.Element);

            SkillName    = new MenuText(skillEntry.GetColoredName(), Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth * 2, GraphicsManager.MenuBG.TileHeight));
            SkillCharges = new MenuText(Text.FormatKey("MENU_SKILLS_TOTAL_CHARGES", skillEntry.BaseCharges), Bounds.Start + new Loc((Bounds.End.X - Bounds.X) / 2, GraphicsManager.MenuBG.TileHeight));

            SkillElement  = new MenuText(Text.FormatKey("MENU_SKILLS_ELEMENT", elementEntry.GetIconName()), Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth * 2, GraphicsManager.MenuBG.TileHeight + VERT_SPACE));
            SkillCategory = new MenuText(Text.FormatKey("MENU_SKILLS_CATEGORY", skillEntry.Data.Category.ToLocal()), Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth * 2, GraphicsManager.MenuBG.TileHeight + VERT_SPACE * 2));

            BasePowerState powerState = skillEntry.Data.SkillStates.GetWithDefault <BasePowerState>();

            SkillPower   = new MenuText(Text.FormatKey("MENU_SKILLS_POWER", (powerState != null ? powerState.Power.ToString() : "---")), Bounds.Start + new Loc((Bounds.End.X - Bounds.X) / 2, GraphicsManager.MenuBG.TileHeight + VERT_SPACE));
            SkillHitRate = new MenuText(Text.FormatKey("MENU_SKILLS_HIT_RATE", (skillEntry.Data.HitRate > -1 ? skillEntry.Data.HitRate + "%" : "---")), Bounds.Start + new Loc((Bounds.End.X - Bounds.X) / 2, GraphicsManager.MenuBG.TileHeight + VERT_SPACE * 2));

            SkillTargets = new MenuText(Text.FormatKey("MENU_SKILLS_RANGE", skillEntry.HitboxAction.GetDescription()), Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth * 2, GraphicsManager.MenuBG.TileHeight + VERT_SPACE * 3));


            Description = new DialogueText(skillEntry.Desc.ToLocal(), Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth * 2, GraphicsManager.MenuBG.TileHeight + VERT_SPACE * 4),
                                           Bounds.End.X - GraphicsManager.MenuBG.TileWidth * 4 - Bounds.X, LINE_SPACE, false);

            MenuDiv = new MenuDivider(Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth, GraphicsManager.MenuBG.TileHeight + VERT_SPACE * 3 + LINE_SPACE),
                                      Bounds.End.X - Bounds.X - GraphicsManager.MenuBG.TileWidth * 2);
        }
Exemplo n.º 2
0
        //public IEnumerator<YieldInstruction> ArriveOnTile(Character character)

        //public IEnumerator<YieldInstruction> ArriveOnTile(Character character, bool checkItem, bool wantItem, bool noTrap)



        private IEnumerator <YieldInstruction> ProcessUseItem(GroundChar character, int invSlot, bool held)
        {
            InvItem invItem = null;

            if (held)
            {
                Character activeChar = DataManager.Instance.Save.ActiveTeam.Players[invSlot];
                invItem = activeChar.EquippedItem;
            }
            else
            {
                invItem = DataManager.Instance.Save.ActiveTeam.GetInv(invSlot);
            }

            ItemData itemEntry = (ItemData)invItem.GetData();

            switch (itemEntry.UsageType)
            {
            case ItemData.UseType.Learn:
            {
                ItemIndexState effect = itemEntry.ItemStates.GetWithDefault <ItemIndexState>();
                int            skill  = effect.Index;

                Character player = (Character)character.Data;
                int       learn  = -1;
                yield return(CoroutineManager.Instance.StartCoroutine(DungeonScene.TryLearnSkill(player, skill, (int slot) => { learn = slot; }, () => { })));

                if (learn > -1)
                {
                    yield return(CoroutineManager.Instance.StartCoroutine(DungeonScene.LearnSkillWithFanfare(player, skill, learn)));
                }
                else
                {
                    yield break;
                }
            }
            break;
            }

            if (held)
            {
                Character activeChar = DataManager.Instance.Save.ActiveTeam.Players[invSlot];
                activeChar.EquippedItem = new InvItem();
            }
            else
            {
                DataManager.Instance.Save.ActiveTeam.RemoveFromInv(invSlot);
            }
        }
Exemplo n.º 3
0
        public static bool CanLearnSkill(Character character, Character user, int slot, bool held)
        {
            BaseMonsterForm entry   = DataManager.Instance.GetMonster(character.BaseForm.Species).Forms[character.BaseForm.Form];
            int             itemNum = -1;

            if (slot == BattleContext.FLOOR_ITEM_SLOT)
            {
                //item on the ground
                int     mapSlot = ZoneManager.Instance.CurrentMap.GetItem(user.CharLoc);
                MapItem mapItem = ZoneManager.Instance.CurrentMap.Items[mapSlot];
                itemNum = mapItem.Value;
            }
            else
            {
                if (held)
                {
                    itemNum = DataManager.Instance.Save.ActiveTeam.Players[slot].EquippedItem.ID;
                }
                else
                {
                    itemNum = DataManager.Instance.Save.ActiveTeam.GetInv(slot).ID;
                }
            }

            ItemData       itemData = DataManager.Instance.GetItem(itemNum);
            ItemIndexState effect   = itemData.ItemStates.GetWithDefault <ItemIndexState>();

            //check for already knowing the skill
            for (int ii = 0; ii < character.BaseSkills.Count; ii++)
            {
                if (character.BaseSkills[ii].SkillNum == effect.Index)
                {
                    return(false);
                }
            }

            if (!DataManager.Instance.DataIndices[DataManager.DataType.Skill].Entries[effect.Index].Released)
            {
                return(false);
            }

            return(entry.CanLearnSkill(effect.Index));
        }