public static SkillsEnum[] ExpandSkills(SkillsEnum skills)
        {
            switch (skills)
            {
            case SkillsEnum.Melee: return(new[] { SkillsEnum.OneHanded, SkillsEnum.TwoHanded, SkillsEnum.Polearm });

            case SkillsEnum.Ranged: return(new[] { SkillsEnum.Bow, SkillsEnum.Throwing, SkillsEnum.Crossbow });

            case SkillsEnum.Movement: return(new[] { SkillsEnum.Riding, SkillsEnum.Athletics });

            case SkillsEnum.Support: return(new[] { SkillsEnum.Scouting, SkillsEnum.Trade, SkillsEnum.Steward, SkillsEnum.Medicine, SkillsEnum.Engineering });

            case SkillsEnum.Personal: return(new[] { SkillsEnum.Crafting, SkillsEnum.Tactics, SkillsEnum.Roguery, SkillsEnum.Charm, SkillsEnum.Leadership });

            case SkillsEnum.All: return(new[] { SkillsEnum.OneHanded, SkillsEnum.TwoHanded, SkillsEnum.Polearm, SkillsEnum.Bow, SkillsEnum.Throwing,
                                                SkillsEnum.Crossbow, SkillsEnum.Riding, SkillsEnum.Athletics, SkillsEnum.Crafting, SkillsEnum.Tactics,
                                                SkillsEnum.Scouting, SkillsEnum.Roguery, SkillsEnum.Charm, SkillsEnum.Trade, SkillsEnum.Steward,
                                                SkillsEnum.Medicine, SkillsEnum.Engineering, SkillsEnum.Leadership });

            case SkillsEnum.None: return(new SkillsEnum[] { });

            default:
                return(new[] { skills });
            }
        }
Beispiel #2
0
 public static bool IsDuration(SkillsEnum skill)
 {
     if (skill == SkillsEnum.TNT)
     {
         return(false);
     }
     return(true);
 }
Beispiel #3
0
 public SkillRunner GetOrCreateSkillRunner(SkillsEnum skill)
 {
     if (m_skillRunners[(int)skill] == null)
     {
         m_skillRunners[(int)skill] = new SkillRunner(skill);
     }
     return(m_skillRunners[(int)skill]);
 }
Beispiel #4
0
 public override void Install(Dictionary <string, object> parameters)
 {
     if (parameters != null && parameters.ContainsKey("SkillsEnum"))
     {
         m_skill = (SkillsEnum)parameters["SkillsEnum"];
     }
     Add("SkillRunner", Singleton <SkillCollectionRunner> .Instance.GetOrCreateSkillRunner(m_skill));
 }
Beispiel #5
0
 public static IPlayerSkill GeneratePlayerSkill(SkillsEnum skill)
 {
     return(skill switch
     {
         SkillsEnum.MoveForward => new MoveForward(),
         SkillsEnum.MoveByRotation => new MoveByRotation(),
         SkillsEnum.MoveByJump => new MoveByJump(),
         _ => new MoveForward()
     });
Beispiel #6
0
    public void ShowUnlock(SkillsEnum skill)
    {
        base.transform.DestroyChildrenImmediate();
        Dictionary <string, object> dictionary = new Dictionary <string, object>();

        dictionary.Add("SkillsEnum", skill);
        GameObject gameObject = Singleton <PropertyManager> .Instance.Instantiate(m_skillUnlockPrefab, Vector3.zero, Quaternion.identity, dictionary);

        gameObject.transform.SetParent(base.transform, worldPositionStays: false);
    }
Beispiel #7
0
    public void BuyMore(SkillsEnum skill)
    {
        if (PlayerData.Instance.Gems.Value < Cost.Value)
        {
            NotEnoughGems();
            BindingManager.Instance.NotEnoughGemsOverlay.SetActive(value: true);
        }
        else
        {
            Singleton <FundRunner> .Instance.RemoveGems(Cost.Value, skill.ToString(), "skills");

            AddAmount(PersistentSingleton <GameSettings> .Instance.SkillPurchaseAmount);
        }
    }
Beispiel #8
0
    public void ShowInfo(SkillsEnum skill)
    {
        if (m_prevSkill != skill)
        {
            base.transform.DestroyChildrenImmediate();
            Dictionary <string, object> dictionary = new Dictionary <string, object>();
            dictionary.Add("SkillsEnum", skill);
            m_prevInfo = Singleton <PropertyManager> .Instance.Instantiate(m_skillInfoPrefab, Vector3.zero, Quaternion.identity, dictionary);

            m_prevInfo.transform.SetParent(base.transform, worldPositionStays: false);
        }
        else
        {
            m_prevInfo.gameObject.SetActive(value: true);
        }
        m_prevSkill = skill;
    }
Beispiel #9
0
        private int GetSkillModifier(SkillsEnum skill)
        {
            int skillModifier = this.proficiencyBonus;

            switch (skill)
            {
            case SkillsEnum.Acrobatics:
            case SkillsEnum.SleightOfHand:
            case SkillsEnum.Stealth:
                skillModifier += this.abilityScores.DexMod;
                break;

            case SkillsEnum.Arcana:
            case SkillsEnum.History:
            case SkillsEnum.Investigation:
            case SkillsEnum.Nature:
            case SkillsEnum.Religion:
                skillModifier += this.abilityScores.IntMod;
                break;

            case SkillsEnum.AnimalHandling:
            case SkillsEnum.Insight:
            case SkillsEnum.Medicine:
            case SkillsEnum.Perception:
            case SkillsEnum.Survival:
                skillModifier += this.abilityScores.WisMod;
                break;

            case SkillsEnum.Athletics:
                skillModifier += this.abilityScores.StrMod;
                break;

            case SkillsEnum.Deception:
            case SkillsEnum.Intimidation:
            case SkillsEnum.Performance:
            case SkillsEnum.Persuasion:
                skillModifier += this.abilityScores.ChaMod;
                break;
            }

            return(skillModifier);
        }
Beispiel #10
0
    public List <RewardEnum> GetUnlockedSkills()
    {
        List <RewardEnum> list = new List <RewardEnum>();
        int value = PlayerData.Instance.HeroStates[0].LifetimeLevel.Value;
        int i;

        for (i = 0; i < 5; i++)
        {
            if (PersistentSingleton <Economies> .Instance.Skills.Find(delegate(SkillConfig s)
            {
                string name = s.Name;
                SkillsEnum skillsEnum = (SkillsEnum)i;
                return(name == skillsEnum.ToString());
            }).LevelReq <= value)
            {
                switch (i)
                {
                case 0:
                    list.Add(RewardEnum.AddToSkillAutoMine);
                    break;

                case 3:
                    list.Add(RewardEnum.AddToSkillGoldfinger);
                    break;

                case 4:
                    list.Add(RewardEnum.AddToSkillTNT);
                    break;

                case 2:
                    list.Add(RewardEnum.AddToSkillTapBoost);
                    break;

                case 1:
                    list.Add(RewardEnum.AddToSkillTeamBoost);
                    break;
                }
            }
        }
        return(list);
    }
        public static GameObject GenerateSkillGameObject(GameObject skillGameObject, SkillsEnum skillNum)
        {
            skillGameObject = Object.Instantiate(skillGameObject);
            var container = skillGameObject.GetComponent <SkillContainer>();

            switch (skillNum)
            {
            case SkillsEnum.MoveForward:
                container.UpdateSkillInContainer(new MoveForward());
                break;

            case SkillsEnum.MoveByRotation:
                container.UpdateSkillInContainer(new MoveByRotation());
                break;

            case SkillsEnum.MoveByJump:
                container.UpdateSkillInContainer(new MoveByJump());
                break;
            }

            return(skillGameObject);
        }
Beispiel #12
0
        public static (bool success, string description) FocusSkill(Hero adoptedHero, int amount, SkillsEnum skills, bool auto)
        {
            var skill = GetSkill(adoptedHero, skills, auto, s => adoptedHero.HeroDeveloper.GetFocus(s) < 5);

            if (skill == null)
            {
                return(false, $"Couldn't find a valid skill to add focus points to!");
            }

            amount = Math.Min(amount, 5 - adoptedHero.HeroDeveloper.GetFocus(skill));
            adoptedHero.HeroDeveloper.AddFocus(skill, amount, checkUnspentFocusPoints: false);
            return(true,
                   $"You have gained {amount} focus point{(amount > 1 ? "s" : "")} in {skill}, you now have {adoptedHero.HeroDeveloper.GetFocus(skill)}!");
        }
Beispiel #13
0
 public static SkillState GetOrCreateSkillState(SkillsEnum skill)
 {
     PlayerData.Instance.SkillStates.EnsureSize((int)skill, (int _) => new SkillState());
     return(PlayerData.Instance.SkillStates[(int)skill]);
 }
 public static SkillObject GetSkill(SkillsEnum skill) =>
 skill switch
 {
Beispiel #15
0
 public SkillRewardAction(RewardData reward, RarityEnum rarity, SkillsEnum skill, string friendId)
     : base(reward, rarity, friendId)
 {
     Skill = skill;
 }
Beispiel #16
0
        public static (bool success, string description) ImproveSkill(Hero hero, int amount, SkillsEnum skills, bool auto)
        {
            var skill = GetSkill(hero, skills, auto, so
                                 => BLTAdoptAHeroModule.CommonConfig.UseRawXP && hero.GetSkillValue(so) < BLTAdoptAHeroModule.CommonConfig.RawXPSkillCap ||
                                 hero.HeroDeveloper.GetFocusFactor(so) > 0);

            if (skill == null)
            {
                return(false, $"Couldn't find a skill to improve");
            }
            float prevSkill = hero.HeroDeveloper.GetPropertyValue(skill);
            int   prevLevel = hero.GetSkillValue(skill);

            hero.HeroDeveloper.AddSkillXp(skill, amount,
                                          isAffectedByFocusFactor: !BLTAdoptAHeroModule.CommonConfig.UseRawXP);
            // Force this immediately instead of waiting for the daily campaign tick
            #if e159 || e1510
            CharacterDevelopmentCampaignBehaivor.DevelopCharacterStats(hero);
            #else
            Campaign.Current?.GetCampaignBehavior <CharacterDevelopmentCampaignBehavior>()?.DevelopCharacterStats(hero);
            #endif

            float newXp        = hero.HeroDeveloper.GetPropertyValue(skill);
            float realGainedXp = newXp - prevSkill;
            int   newLevel     = hero.GetSkillValue(skill);
            int   gainedLevels = newLevel - prevLevel;
            return(realGainedXp < 1f
                ? (false, $"{skill.Name} capped, get more focus points")
                : gainedLevels > 0
                    ? (true, $"{Naming.Inc}{gainedLevels} lvl {GetShortSkillName(skill)}{Naming.To}{newLevel}")
                    : (true,
                       $"{Naming.Inc}{realGainedXp:0} xp {GetShortSkillName(skill)}{Naming.To}{newXp}"));
        }
 public static AbilityEnum Category(this SkillsEnum e) => categories[e];
Beispiel #18
0
    public SkillRunner(SkillsEnum skill)
    {
        SceneLoader instance = SceneLoader.Instance;

        Skill         = skill;
        m_skillState  = SkillStateFactory.GetOrCreateSkillState(skill);
        m_skillConfig = PersistentSingleton <Economies> .Instance.Skills.Find((SkillConfig s) => s.Name == Skill.ToString());

        Cost.Value     = PersistentSingleton <GameSettings> .Instance.SkillPurchaseCosts[(int)Skill];
        LevelReq.Value = m_skillConfig.LevelReq;
        LifetimeUsed   = m_skillState.LifetimeUsed;
        Locked         = (from lvl in Singleton <HeroTeamRunner> .Instance.GetOrCreateHeroRunner(0).LifetimeLevel
                          select lvl < m_skillConfig.LevelReq).TakeUntilDestroy(instance).ToReactiveProperty();
        Amount          = m_skillState.Amount.CombineLatest(Locked, (int amount, bool locked) => (!locked) ? amount : 0).TakeUntilDestroy(instance).ToReactiveProperty();
        UnlockTriggered = (from pair in Locked.Pairwise()
                           where pair.Previous && !pair.Current
                           select pair into _
                           select Skill).TakeUntilDestroy(instance).ToReadOnlyReactiveProperty();
        m_skillState.CooldownTimeStamp.Subscribe(delegate
        {
            if (!Locked.Value)
            {
                UpdateCooldown();
            }
        }).AddTo(instance);
        CanAffordPurchase = (from gems in PlayerData.Instance.Gems
                             select gems >= Cost.Value).TakeUntilDestroy(instance).ToReactiveProperty();
        MaxDuration = (from duration in Singleton <CumulativeBonusRunner> .Instance.BonusMult[(int)(8 + Skill)]
                       select SkillsEnumHelper.IsDuration(Skill) ? duration.ToInt() : 0 into duration
                       select m_skillConfig.DurationSeconds + duration).TakeUntilDestroy(instance).ToReadOnlyReactiveProperty();
        TickerService.MasterTicks.Subscribe(delegate(long ticks)
        {
            if (m_skillState.ElapsedTime.Value < 1728000000000L)
            {
                m_skillState.ElapsedTime.Value += ticks;
                UpdateCooldown();
            }
        }).AddTo(instance);
        SecondsLeft = m_skillState.ElapsedTime.CombineLatest(MaxDuration, (long elapsed, int dur) => Mathf.Max(0, dur - (int)(elapsed / 10000000))).DistinctUntilChanged().TakeUntilDestroy(instance)
                      .ToReactiveProperty();
        Active = (from secs in SecondsLeft
                  select secs > 0).TakeUntilDestroy(instance).ToReactiveProperty();
        (from act in Active.Pairwise()
         where !act.Current && act.Previous
         select act).Subscribe(delegate
        {
            m_skillState.CooldownTimeStamp.Value = ServerTimeService.NowTicks();
        }).AddTo(instance);
        (from act in Active.Pairwise()
         where act.Current && act.Previous
         select act).Subscribe(delegate
        {
            if (PersistentSingleton <GameAnalytics> .Instance != null)
            {
                PersistentSingleton <GameAnalytics> .Instance.SkillUsed.Value = Skill;
            }
        }).AddTo(instance);
        Cooldown = (from secs in CooldownSeconds
                    select secs > 0).CombineLatest(Active, (bool cooldown, bool active) => cooldown && !active).TakeUntilDestroy(instance).ToReactiveProperty();
        UniRx.IObservable <bool> observable = Active.CombineLatest(Cooldown, (bool active, bool cooldown) => !active && !cooldown).CombineLatest(Locked, (bool noTimer, bool locked) => noTimer && !locked);
        Available     = observable.TakeUntilDestroy(instance).ToReactiveProperty();
        OutOfStock    = observable.CombineLatest(Amount, (bool poss, int amount) => poss && amount <= 0).TakeUntilDestroy(instance).ToReactiveProperty();
        LocalizedName = new ReactiveProperty <string>(PersistentSingleton <LocalizationService> .Instance.Text("Skill.Name." + Skill.ToString()));
        LocalizedDesc = new ReactiveProperty <string>(PersistentSingleton <LocalizationService> .Instance.Text("Skill.Name.Desc." + Skill.ToString()));
        (from order in Singleton <PrestigeRunner> .Instance.PrestigeTriggered
         select order == PrestigeOrder.PrestigeStart).Subscribe(delegate
        {
            m_skillState.CooldownTimeStamp.Value = 0L;
            m_skillState.ElapsedTime.Value       = 1728000000000L;
        }).AddTo(instance);
        (from amount in Amount.Pairwise()
         where amount.Current > amount.Previous
         select amount).Subscribe(delegate
        {
            ResetCooldown();
        }).AddTo(instance);
        UpdateCooldown();
        AdAvailable = Singleton <AdRunner> .Instance.AdReady.TakeUntilDestroy(instance).ToReadOnlyReactiveProperty();

        (from ad in Singleton <AdRunner> .Instance.AdPlacementFinished
         where ad.ToString() == Skill.ToString()
         select ad).Subscribe(delegate
        {
            SkillAdFinished();
        }).AddTo(instance);
        (from ad in Singleton <AdRunner> .Instance.AdPlacementSkipped
         where ad.ToString() == Skill.ToString()
         select ad).Subscribe(delegate
        {
            SkillAdSkipped();
        }).AddTo(instance);
        (from ad in Singleton <AdRunner> .Instance.AdPlacementFailed
         where ad.ToString() == Skill.ToString()
         select ad).Subscribe(delegate
        {
            SkillAdSkipped();
        }).AddTo(instance);
    }