Пример #1
0
    public static AdventurerSpecial GetClassSpecial(AdventurerClass advClass)
    {
        AdventurerSpecial special = AdventurerSpecial.None;

        switch (advClass)
        {
        case AdventurerClass.Bowman:
            special = AdventurerSpecial.SilencingShot;
            break;

        case AdventurerClass.Footman:
            special = AdventurerSpecial.ShieldWall;
            break;

        case AdventurerClass.Sage:
            special = AdventurerSpecial.Barrier;
            break;

        case AdventurerClass.Wizard:
            special = AdventurerSpecial.Feedback;
            break;

        case AdventurerClass.Sovereign:
            special = GameDataManager.Instance.dataStore.sovereignSkill;
            break;

        case AdventurerClass.Avatar:
            special = AdventurerSpecial.LoseBattle;
            break;
        }
        return(special);
    }
Пример #2
0
 public GameDataManager_DataStore()
 {
     lastScene                 = SceneIDType.OverworldScene;
     yourTownName              = "Citysburg";
     fakeTownNames             = new string[] { "Town A", "Town No. 2", "Tertiary Town" };
     pendingUpgrade_Docks      = false;
     pendingUpgrade_Mason      = false;
     pendingUpgrade_Sawmill    = false;
     pendingUpgrade_Smith      = false;
     unlock_sovSpe_CalledShots = false;
     unlock_sovSpe_HammerSmash = false;
     unlock_sovSpe_Protect     = false;
     adventureLevel            = 0;
     buildingLv_Docks          = 0;
     buildingLv_Mason          = 0;
     buildingLv_Sawmill        = 0;
     buildingLv_Smith          = 0;
     buildingLv_WizardsTower   = 1;
     nextRandomAdventureAnte   = 2;
     resBricks                 = 0;
     resBricks_max             = 999; // we actually recalc these immediately, lol
     resBricks_maxUpgrades     = 0;
     resMetal              = 0;
     resMetal_max          = 999;
     resMetal_maxUpgrades  = 0;
     resPlanks             = 0;
     resPlanks_max         = 999;
     resPlanks_maxUpgrades = 0;
     resMana     = 0;
     resMana_max = manaCap;
     pendingUpgradeTimer_Docks    = 0;
     pendingUpgradeTimer_Mason    = 0;
     pendingUpgradeTimer_Sawmill  = 0;
     pendingUpgradeTimer_Smith    = 0;
     lastInspectedAdventurerIndex = 0;
     partyAdventurer0Index        = 0;
     partyAdventurer1Index        = 1;
     partyAdventurer2Index        = 2;
     sovereignFirstName           = "Dude";
     sovereignLastName            = "Huge";
     housingLevel        = 0;
     housingUnitUpgrades = new bool[housingLevelCap];
     houseAdventurers    = new Adventurer[housingLevelCap];
     for (int i = 0; i < houseAdventurers.Length; i++)
     {
         houseAdventurers[i] = new Adventurer();
     }
     sovereignAdventurer     = new Adventurer();
     sovereignTactic         = BattlerAction.GetBehindMe;
     sovereignSkill          = AdventurerSpecial.None;
     sovereignMugshot        = AdventurerMugshot.Sovereign0;
     progressionFlags        = 0;
     buyable0                = null;
     buyable1                = null;
     unlockedMysticPromotes  = MysticPromotes.None;
     unlockedWarriorPromotes = WarriorPromotes.None;
     peddlerIsPresent        = false;
     peddlerPrice            = 25;
 }
Пример #3
0
    public static string GetSpecialName(AdventurerSpecial special)
    {
        string name = "Out of range special name";

        if (specialNames == null)
        {
            TextAsset a = Resources.Load <TextAsset>("special_names");
            specialNames = a.text.Split('\n');
        }
        if ((int)special < specialNames.Length)
        {
            name = specialNames[(int)special];
        }
        return(name);
    }
Пример #4
0
    public static string GetSpecialDescription(AdventurerSpecial special)
    {
        string    desc;
        TextAsset a = Resources.Load <TextAsset>(specialDescsResourcePath + special.ToString());

        if (a != null)
        {
            desc = a.text;
        }
        else
        {
            desc = special.ToString() + Resources.Load <TextAsset>(specialDescsResourcePath + badSpecialName).text;
        }
        return(desc);
    }
Пример #5
0
 // Update is called once per frame
 void Update()
 {
     if (cachedSovereignName != GameDataManager.Instance.dataStore.sovereignName)
     {
         cachedSovereignName     = GameDataManager.Instance.dataStore.sovereignName;
         sovereignNameLabel.text = strings[0] + GameDataManager.Instance.dataStore.sovereignName;
     }
     if (cachedSovereignMugshot != GameDataManager.Instance.dataStore.sovereignMugshot)
     {
         cachedSovereignMugshot  = GameDataManager.Instance.dataStore.sovereignMugshot;
         sovereignMugshot.sprite = GameDataManager.Instance.dataStore.sovereignAdventurer.GetMugshotGraphic();
     }
     if (cachedSovereignTactic != GameDataManager.Instance.dataStore.sovereignTactic)
     {
         cachedSovereignTactic    = GameDataManager.Instance.dataStore.sovereignTactic;
         sovereignTacticDesc.text = Adventurer.GetAttackDescription(GameDataManager.Instance.dataStore.sovereignTactic);
     }
     if (cachedSovereignSpecial != GameDataManager.Instance.dataStore.sovereignSkill)
     {
         cachedSovereignSpecial    = GameDataManager.Instance.dataStore.sovereignSkill;
         sovereignSpecialDesc.text = Adventurer.GetSpecialDescription(GameDataManager.Instance.dataStore.sovereignSkill);
     }
     if (cachedSovereignTitle != GameDataManager.Instance.dataStore.sovereignAdventurer.fullTitle)
     {
         cachedSovereignTitle    = GameDataManager.Instance.dataStore.sovereignAdventurer.fullTitle;
         sovereignTitleArea.text = cachedSovereignTitle;
     }
     if (cachedSovereignWpn != GameDataManager.Instance.dataStore.sovWpn_Set)
     {
         UpdateTextFieldWithWpnInfo(GameDataManager.Instance.dataStore.sovWpn_Set, ref cachedSovereignWpn, ref strings, ref sovereignWpnArea);
     }
     if (rowPlacementButton != null && rowPlacementButton.interactable != (GameDataManager.Instance.dataStore.sovereignEquippedWeaponType == WpnType.Knives))
     {
         rowPlacementButton.interactable = (GameDataManager.Instance.dataStore.sovereignEquippedWeaponType == WpnType.Knives);
     }
     if (cachedSovereignRowState != GameDataManager.Instance.dataStore.sovereignOnBackRow)
     {
         cachedSovereignRowState = GameDataManager.Instance.dataStore.sovereignOnBackRow;
         if (cachedSovereignRowState)
         {
             rowPlacementArea.text = strings[35];
         }
         else
         {
             rowPlacementArea.text = strings[34];
         }
     }
 }
Пример #6
0
    // Update is called once per frame
    void Update()
    {
        if (adventurer == null)
        {
            if (GameDataManager.Instance.dataStore.houseAdventurers[houseAdventurerIndex] != null && GameDataManager.Instance.dataStore.housingLevel > houseAdventurerIndex)
            {
                adventurer = GameDataManager.Instance.dataStore.houseAdventurers[houseAdventurerIndex];
            }
        }
        if (adventurer != null && adventurer.initialized)
        {
            if (panelBG != null)
            {
                if (housePopup != null)
                {
                    if (housePopup.inspectedAdventurer == adventurer)
                    {
                        panelBG.color = activeColor;
                    }
                    else
                    {
                        panelBG.color = defaultColor;
                    }
                }
                else if (swapPopup != null)
                {
                    if (swapPopup.partyMemberIndexInMainArray == houseAdventurerIndex)
                    {
                        panelBG.color = activeColor;
                    }
                    else if (houseAdventurerIndex == GameDataManager.Instance.dataStore.partyAdventurer0Index || houseAdventurerIndex == GameDataManager.Instance.dataStore.partyAdventurer1Index || houseAdventurerIndex == GameDataManager.Instance.dataStore.partyAdventurer2Index)
                    {
                        panelBG.color = Color.clear;
                    }
                    else
                    {
                        panelBG.color = defaultColor;
                    }
                }
            }
            if (selfButton != null)
            {
                if (housePopup != null)
                {
                    selfButton.interactable = (housePopup.inspectedAdventurer != adventurer);
                }
                else if (swapPopup != null)
                {
                    selfButton.interactable = swapPopup.partyMemberIndexInMainArray == houseAdventurerIndex || (houseAdventurerIndex != GameDataManager.Instance.dataStore.partyAdventurer0Index && houseAdventurerIndex != GameDataManager.Instance.dataStore.partyAdventurer1Index && houseAdventurerIndex != GameDataManager.Instance.dataStore.partyAdventurer2Index);
                }
            }
            if (interior != null)
            {
                if (!interior.activeInHierarchy)
                {
                    interior.SetActive(true);
                }
            }

            if (adventurerName.text != adventurer.fullName)
            {
                adventurerName.text = adventurer.fullName;
            }
            if (adventurerTitle.text != adventurer.title)
            {
                adventurerTitle.text = adventurer.title;
            }
            if (cachedAdventurerMugshot != adventurer.mugshot)
            {
                cachedAdventurerMugshot = adventurer.mugshot;
                mugshot.sprite          = adventurer.GetMugshotGraphic();
            }
            if (adventurerStats != null)
            {
                if (cachedAdventurerStats[0] != adventurer.HP || cachedAdventurerStats[1] != adventurer.Martial || cachedAdventurerStats[2] != adventurer.Magic || cachedAdventurerStats[3] != adventurer.Speed)
                {
                    cachedAdventurerStats = new int[] { adventurer.HP, adventurer.Martial, adventurer.Magic, adventurer.Speed };
                    adventurerStats.text  = strings[0] + cachedAdventurerStats[0].ToString() + strings[1] + cachedAdventurerStats[1].ToString() + strings[2] +
                                            cachedAdventurerStats[2].ToString() + strings[3] + cachedAdventurerStats[3].ToString();
                }
            }
            if (adventurerSpecial != null)
            {
                if (cachedAdventurerSpecial != adventurer.special)
                {
                    cachedAdventurerSpecial = adventurer.special;
                    adventurerSpecial.text  = Adventurer.GetSpecialDescription(cachedAdventurerSpecial);
                }
            }
            if (adventurerAttacks != null)
            {
                if (cachedAdventurerAttacks[0] != adventurer.attacks[0] || cachedAdventurerAttacks[1] != adventurer.attacks[1])
                {
                    cachedAdventurerAttacks = adventurer.attacks.Clone() as BattlerAction[];
                    string[] attacksStrings = { "", "" };
                    for (int i = 0; i < cachedAdventurerAttacks.Length && i < 2; i++)
                    {
                        if (cachedAdventurerAttacks[i] != BattlerAction.None)
                        {
                            attacksStrings[i] = Adventurer.GetAttackName(cachedAdventurerAttacks[i]);
                        }
                        else
                        {
                            attacksStrings[i] = "";
                        }
                    }
                    adventurerAttacks.text = attacksStrings[0] + System.Environment.NewLine + attacksStrings[1];
                }
            }
        }
        else if (interior != null && interior.activeInHierarchy)
        {
            interior.SetActive(false);
        }
    }
Пример #7
0
    // Update is called once per frame
    void Update()
    {
        if (GameDataManager.Instance.dataStore.housingLevel != houseLvCached)
        {
            RecalcScrollRectSize();
        }
        if (outbuildingButton != null)
        {
            if (housingUnitUpgraded && outbuildingButton.IsActive())
            {
                outbuildingButton.gameObject.SetActive(false);
            }
            else if (!housingUnitUpgraded && !outbuildingButton.IsActive())
            {
                outbuildingButton.gameObject.SetActive(true);
            }
        }
        if (promoteButton != null)
        {
            bool v = false;
            if (inspectedAdventurer.advClass == AdventurerClass.Warrior)
            {
                for (int i = 1; i > 1 << 31;)
                {
                    if (GameDataManager.Instance.WarriorPromoteUnlocked((WarriorPromotes)i))
                    {
                        v = true;
                        break;
                    }
                    i = i << 1;
                }
            }
            else if (inspectedAdventurer.advClass == AdventurerClass.Mystic)
            {
                for (int i = 1; i > 1 << 31;)
                {
                    if (GameDataManager.Instance.MysticPromoteUnlocked((MysticPromotes)i))
                    {
                        v = true;
                        break;
                    }
                    i = i << 1;
                }
            }
            if (promoteButton.activeSelf != v)
            {
                promoteButton.SetActive(v);
            }
        }
        if (inspectedAdventurer.fullName != cachedName)
        {
            cachedName     = inspectedAdventurer.fullName;
            nameLabel.text = strings[4] + inspectedAdventurer.fullName;
        }
        if (cachedAdventurerMugshot != inspectedAdventurer.mugshot)
        {
            cachedAdventurerMugshot = inspectedAdventurer.mugshot;
            mugshot.sprite          = inspectedAdventurer.GetMugshotGraphic();
        }
        if (inspectedAdventurer.title != titleLabel.text)
        {
            titleLabel.text = inspectedAdventurer.title;
        }
        if (adventurerHPCached != inspectedAdventurer.HP || adventurerMartialCached != inspectedAdventurer.Martial ||
            adventurerMagicCached != inspectedAdventurer.Magic || adventurerSpeedCached != inspectedAdventurer.Speed)
        {
            adventurerHPCached      = inspectedAdventurer.HP;
            adventurerMartialCached = inspectedAdventurer.Martial;
            adventurerMagicCached   = inspectedAdventurer.Magic;
            adventurerSpeedCached   = inspectedAdventurer.Speed;
            statsLabel.text         = strings[0] + adventurerHPCached.ToString() + strings[1] + adventurerMartialCached.ToString() + strings[2] + adventurerMagicCached.ToString() + strings[3] + adventurerSpeedCached.ToString();
        }
        bool attacksChanged = false;

        if (adventurerAttacksCached == null || adventurerAttacksCached.Length != inspectedAdventurer.attacks.Length)
        {
            attacksChanged = true;
        }
        else
        {
#pragma warning disable 162 // VS reports a false-alarm unreachable code warning on the next line because of the compound loop conditional, so we silence that - and, yes, it is a false alarm
            for (int i = 0; (i < adventurerAttacksCached.Length && i < inspectedAdventurer.attacks.Length); i++)
#pragma warning restore 162 // because we _do_ want to know if unreachable code is detected, it's just not actually present there
            {
                attacksChanged = true;
                break;
            }
        }
        if (attacksChanged)
        {
            string[] attacksStrings = { "", "", "" };
            adventurerAttacksCached = inspectedAdventurer.attacks;
            for (int i = 0; i < adventurerAttacksCached.Length && i < 3; i++)
            {
                if (inspectedAdventurer.attacks[i] != BattlerAction.None)
                {
                    attacksStrings[i] = Adventurer.GetAttackName(inspectedAdventurer.attacks[i]);
                }
                else
                {
                    attacksStrings[i] = "";
                }
            }
            attacksLabel.text = attacksStrings[0] + '\n' + attacksStrings[1] + '\n' + attacksStrings[2];
        }
        if (adventurerSpecialCached != inspectedAdventurer.special)
        {
            adventurerSpecialCached = inspectedAdventurer.special;
            specialLabel.text       = Adventurer.GetSpecialDescription(adventurerSpecialCached);
        }
        if (awakenButton != null)
        {
            if (inspectedAdventurer.isElite)
            {
                if ((inspectedAdventurer.awakened == awakenButton.gameObject.activeSelf))
                {
                    awakenButton.gameObject.SetActive(!inspectedAdventurer.awakened);
                    awakenedLabel.gameObject.SetActive(!awakenButton.gameObject.activeSelf);
                }
            }
            else if (awakenButton.gameObject.activeSelf || awakenedLabel.gameObject.activeSelf)
            {
                awakenButton.gameObject.SetActive(false);
                awakenedLabel.gameObject.SetActive(false);
            }
        }
        if (biography.text != inspectedAdventurer.bioText)
        {
            biography.text = inspectedAdventurer.bioText;
        }
    }
Пример #8
0
 public void RecalcStatsAndReloadMoves()
 {
     CalcStats();
     attacks = GetClassAttacks(advClass);
     special = GetClassSpecial(advClass);
 }
Пример #9
0
 public void SetSovereignSpecial(AdventurerSpecial special)
 {
     dataStore.sovereignSkill = special;
     dataStore.sovereignAdventurer.special = special;
 }