Esempio n. 1
0
 public void initialize(string upgradeId, RunestoneMilestone upgradeMilestone, int levelRequirement, bool stripedRow, bool isUnlocked)
 {
     this.UpgradeMilestone = upgradeMilestone;
     this.LevelReq.text    = "Rank " + levelRequirement;
     this.Icon.enabled     = true;
     if (this.UpgradeMilestone.Perk != null)
     {
         PerkInstance           perk     = this.UpgradeMilestone.Perk;
         PerkType               perkType = perk.Type;
         ConfigPerks.SharedData data     = ConfigPerks.SHARED_DATA[perkType];
         this.Icon.sprite      = PlayerView.Binder.SpriteResources.getSprite("Menu", data.SmallSprite);
         this.Description.text = MenuHelpers.GetFormattedPerkDescription(perkType, perk.Modifier, data.DurationSeconds, data.Threshold, 0f, true);
     }
     else
     {
         this.Icon.sprite      = null;
         this.Description.text = "CHANGE ME";
     }
     this.Background.color = !stripedRow ? ConfigUi.LIST_CELL_REGULAR_COLOR : ConfigUi.LIST_CELL_STRIPED_COLOR;
     if (isUnlocked)
     {
         this.CanvasGroup.alpha = 1f;
         this.Icon.material     = null;
     }
     else
     {
         this.CanvasGroup.alpha = 0.5f;
         this.Icon.material     = PlayerView.Binder.DisabledUiMaterial;
     }
 }
 public PerkEffectHeader(string Tag = null)
     : base(Tag)
 {
     Type     = new PerkType();
     Rank     = new Byte();
     Priority = new Byte();
 }
        public BossCasterAiBehaviour(CharacterInstance character)
        {
            base.Character            = character;
            this.m_parameters         = ParseParameters(character.Character.BossAiParameters);
            this.m_targetingBehaviour = new MonsterTargetingAiBehaviour(character);
            switch (character.Character.CoreAiBehaviour)
            {
            case AiBehaviourType.MonsterRanged:
                this.m_attackBehaviour = new PursuitAndRangedAttackAiBehaviour(character);
                break;

            case AiBehaviourType.MonsterRangedToMelee:
                this.m_attackBehaviour = new PursuitAndRangedMeleeAttackAiBehaviour(character);
                break;

            case AiBehaviourType.MonsterPuffer:
                this.m_attackBehaviour = new StationarySkillUseAiBehaviour(character, SkillType.PoisonPuff);
                break;

            default:
                this.m_attackBehaviour = new PursuitAndMeleeAttackAiBehaviour(character);
                break;
            }
            for (int i = 0; i < this.m_parameters.PerkTypes.Count; i++)
            {
                PerkType     perkType = this.m_parameters.PerkTypes[i];
                PerkInstance item     = new PerkInstance();
                item.Type     = perkType;
                item.Modifier = ConfigPerks.GetBestModifier(perkType);
                character.BossPerks.PerkInstances.Add(item);
            }
            this.m_skillTimer.set(ConfigSkills.SHARED_DATA[this.m_parameters.SkillType].BossFirstCastDelay);
        }
    public void Loadout(WeaponType weapon, PerkType perk1, byte perk2)
    {
        ResetPerks();
        if (weapon == WeaponType.Assault)
        {
            SetActiveGun(WeaponType.Assault);
        }
        if (weapon == WeaponType.Railgun)
        {
            SetActiveGun(WeaponType.Railgun);
        }
        if (weapon == WeaponType.Shotgun)
        {
            SetActiveGun(WeaponType.Shotgun);
        }

        loadoutInfo            = new LoadoutInfo();
        loadoutInfo.weaponType = ActiveWeapon;
        loadoutInfo.weaponPerk = perk1;
        SemiGunTeam1.reloading = false;
        SemiGunTeam2.reloading = false;
        AutoGunTeam1.reloading = false;
        AutoGunTeam2.reloading = false;
        ShotgunTeam1.reloading = false;
        ShotgunTeam2.reloading = false;
        RefillAmmoFull();
    }
Esempio n. 5
0
        public bool Selected; // Used in the template customization screen

        public Perk(string name, PerkType type, Role role, string shortDesc, string longDesc = null, Action onApply = null)
        {
            Name      = name;
            ShortDesc = shortDesc;
            LongDesc  = longDesc ?? $"{shortDesc} (Longer description to be added.)";
            OnApply   = onApply ?? (() => { });
        }
Esempio n. 6
0
        public void enforcePerkLegality(Player player)
        {
            int num = ConfigPerks.NUM_RANDOM_PERKS_PER_ITEM_RARITY[this.Rarity];

            while (this.Perks.PerkInstances.Count > num)
            {
                this.Perks.PerkInstances.RemoveAt(this.Perks.PerkInstances.Count - 1);
            }
            while (this.Perks.PerkInstances.Count < num)
            {
                this.Perks.PerkInstances.Add(ConfigPerks.RollNewRandomItemPerkInstance(this.Item.Type, this.Perks, player));
            }
            for (int i = 0; i < this.Perks.PerkInstances.Count; i++)
            {
                ItemType itemType           = this.Item.Type;
                PerkType type               = this.Perks.PerkInstances[i].Type;
                ConfigPerks.SharedData data = ConfigPerks.SHARED_DATA[type];
                if (!ConfigPerks.ItemTypeSupportsPerk(itemType, type))
                {
                    this.Perks.PerkInstances[i] = ConfigPerks.RollNewRandomItemPerkInstance(itemType, this.Perks, player);
                }
                else if (!player.hasUnlockedSkill(data.LinkedToSkill))
                {
                    this.Perks.PerkInstances[i] = ConfigPerks.RollNewRandomItemPerkInstance(itemType, this.Perks, player);
                }
                else if (this.Perks.PerkInstances[i].Modifier < data.ModifierMin)
                {
                    this.Perks.PerkInstances[i].Modifier = data.ModifierMin;
                }
                else if (this.Perks.PerkInstances[i].Modifier > data.ModifierMax)
                {
                    this.Perks.PerkInstances[i].Modifier = data.ModifierMax;
                }
            }
        }
Esempio n. 7
0
        public int getPerkInstanceCount(PerkType perkType)
        {
            int num = 0;

            num += this.Perks.getPerkInstanceCount(perkType);
            return(num + this.Item.FixedPerks.getPerkInstanceCount(perkType));
        }
Esempio n. 8
0
        public float getGenericModifierForPerkType(PerkType perkType)
        {
            float num = 0f;

            for (int i = 0; i < this.Perks.PerkInstances.Count; i++)
            {
                PerkInstance instance = this.Perks.PerkInstances[i];
                float        num3     = instance.getGenericModifierForPerkType(perkType);
                num += num3;
                if (num3 != 0f)
                {
                    num += this.getEvolveBonusForPerk(instance.Type);
                }
            }
            for (int j = 0; j < this.Item.FixedPerks.PerkInstances.Count; j++)
            {
                PerkInstance instance2 = this.Item.FixedPerks.PerkInstances[j];
                float        num5      = instance2.getGenericModifierForPerkType(perkType);
                num += num5;
                if (num5 != 0f)
                {
                    num += this.getEvolveBonusForPerk(instance2.Type);
                }
            }
            return(num);
        }
Esempio n. 9
0
 private void loadCsv(string csvFilePath)
 {
     string[,] strArray = CsvUtils.Deserialize(ResourceUtil.LoadSafe <TextAsset>(csvFilePath, false).text);
     for (int i = 0; i < strArray.GetLength(1); i++)
     {
         if (strArray[0, i] != null)
         {
             PlayerSkillUpgrade res = new PlayerSkillUpgrade();
             int num2 = 0;
             res.Id    = strArray[num2++, i];
             res.Price = base.parseDouble(strArray[num2++, i]);
             PerkType item = base.parseEnumType <PerkType>(strArray[num2++, i]);
             float    num3 = base.parseFloat(strArray[num2++, i]);
             if (item != PerkType.NONE)
             {
                 PerkInstance instance = new PerkInstance();
                 instance.Type     = item;
                 instance.Modifier = num3;
                 res.PerkInstance  = instance;
                 if (!this.m_usedPerkTypesList.Contains(item))
                 {
                     this.m_usedPerkTypesList.Add(item);
                 }
             }
             base.addResource(res.Id, res);
             this.m_orderedList.Add(res);
         }
     }
 }
Esempio n. 10
0
 public void getPerkInstancesOfType(PerkType perkType, IBuffIconProvider iconProvider, ref List <KeyValuePair <PerkInstance, BuffSource> > outPerkInstances)
 {
     for (int i = 0; i < this.PerkInstances.Count; i++)
     {
         this.PerkInstances[i].getPerkInstancesOfType(perkType, iconProvider, ref outPerkInstances);
     }
 }
Esempio n. 11
0
 public void startBuffFromPerk(CharacterInstance c, PerkType perkType, float durationSeconds, double modifier, BuffSource source, [Optional, DefaultParameterValue(null)] CharacterInstance sourceCharacter)
 {
     if (!c.IsDead)
     {
         if (source.IconProvider != null)
         {
         }
         ConfigPerks.SharedData data = ConfigPerks.SHARED_DATA[perkType];
         Buff buff2 = new Buff();
         buff2.Source                 = source;
         buff2.SourceCharacter        = sourceCharacter;
         buff2.FromPerk               = perkType;
         buff2.BaseStat1              = data.BuffBaseStat1;
         buff2.BaseStat2              = data.BuffBaseStat2;
         buff2.Stuns                  = data.Stuns;
         buff2.Modifier               = (float)modifier;
         buff2.ModifierBuildupTick    = data.ModifierBuildupTick;
         buff2.DurationSeconds        = durationSeconds;
         buff2.AllSkillsCooldownBonus = !data.AllSkillsCooldownBonus ? 0f : ((float)modifier);
         buff2.DamagePerSecond        = !data.DamagePerSecond ? 0.0 : modifier;
         buff2.ViewScaleModifier      = data.ViewScaleModifier;
         buff2.HudSprite              = (source.IconProvider == null) ? null : source.IconProvider.getSpriteId();
         buff2.HudShowStacked         = data.ShowStackedInHud;
         buff2.HudShowModifier        = data.ShowModifierInHud;
         buff2.HudHideTimer           = data.HideTimerInHud;
         Buff buff = buff2;
         this.startBuff(c, buff);
     }
 }
Esempio n. 12
0
    public void perkSelected(int a_PerkIndex)
    {
        if (m_SelectingStartingPerks)
        {
            m_PerkTypeSelection      = m_StartingPerks[a_PerkIndex].m_type;
            m_SelectingStartingPerks = false;
            m_levelUpUI.setClassSelectUI(false);
            m_levelUpUI.setPerkSelectUI(true);
            m_StartingPerks[a_PerkIndex].Activate();
            m_levelUpUI.hideUI();
            return;
        }

        m_ShownPerks[a_PerkIndex].Activate();

        m_ShownPerks[a_PerkIndex].m_TimesUpgraded++;

        m_AmtPerkUpgrades++;

        if (m_AmtPerkUpgrades != m_XpManager.m_playerLevel)
        {
            genPerkList();
            m_ShowingUI = true;
            return;
        }
        m_levelUpUI.hideUI();
        m_ShowingUI = false;
        m_UpgradeAvailableText.SetActive(false);
        Time.timeScale = 1.0f;
    }
Esempio n. 13
0
        /// <summary>
        /// Adds a perk requirement for this recipe.
        /// </summary>
        /// <param name="perk">The perk which is required.</param>
        /// <param name="requiredLevel">The level required.</param>
        /// <returns>A recipe builder with the configured options</returns>
        public RecipeBuilder RequirementPerk(PerkType perk, int requiredLevel)
        {
            var requirement = new RecipePerkRequirement(perk, requiredLevel);

            _activeRecipe.Requirements.Add(requirement);
            return(this);
        }
Esempio n. 14
0
 public float getLongestDurationForPerkType(PerkType perkType)
 {
     if (this.Type == perkType)
     {
         return(ConfigPerks.SHARED_DATA[perkType].DurationSeconds);
     }
     return(0f);
 }
Esempio n. 15
0
 public float getHighestThresholdForPerkType(PerkType perkType)
 {
     if (this.Type == perkType)
     {
         return(ConfigPerks.SHARED_DATA[perkType].Threshold);
     }
     return(0f);
 }
Esempio n. 16
0
        /// <summary>
        /// Creates a new ability.
        /// </summary>
        /// <param name="featType">The type of feat to link this ability to.</param>
        /// <param name="effectiveLevelPerkType">The type of perk used for determining effective level.</param>
        /// <returns>An ability builder with the configured options</returns>
        public AbilityBuilder Create(Feat featType, PerkType effectiveLevelPerkType)
        {
            _activeAbility = new AbilityDetail();
            _activeAbility.EffectiveLevelPerkType = effectiveLevelPerkType;
            _abilities[featType] = _activeAbility;

            return(this);
        }
Esempio n. 17
0
 public int getPerkInstanceCount(PerkType perkType)
 {
     if (this.Type == perkType)
     {
         return(1);
     }
     return(0);
 }
Esempio n. 18
0
 public float getGenericModifierForPerkType(PerkType perkType)
 {
     if (this.Type == perkType)
     {
         return(this.Modifier);
     }
     return(0f);
 }
Esempio n. 19
0
 public void getPerkInstancesOfType(PerkType perkType, IBuffIconProvider iconProvider, ref List <KeyValuePair <PerkInstance, BuffSource> > outPerkInstances)
 {
     for (int i = 0; i < this.QuickLookupPerkInstances.Count; i++)
     {
         PerkInstance perkInstance = this.QuickLookupPerkInstances[i];
         perkInstance.getPerkInstancesOfType(perkType, this.getBuffIconProvideForPerkInstance(perkInstance), ref outPerkInstances);
     }
 }
Esempio n. 20
0
 private void onCharacterSkillActivated(CharacterInstance character, SkillType skillType, float buildupTime, SkillExecutionStats executionStats)
 {
     if (character.IsPrimaryPlayerCharacter)
     {
         for (int i = 0; i < this.sm_postSkillUsePerks[SkillType.NONE].Count; i++)
         {
             PerkType perkType = this.sm_postSkillUsePerks[0][i];
             List <KeyValuePair <PerkInstance, BuffSource> > perkInstancesOfType = CharacterStatModifierUtil.GetPerkInstancesOfType(character, perkType);
             for (int k = 0; k < perkInstancesOfType.Count; k++)
             {
                 KeyValuePair <PerkInstance, BuffSource> pair = perkInstancesOfType[k];
                 PerkInstance key = pair.Key;
                 KeyValuePair <PerkInstance, BuffSource> pair2 = perkInstancesOfType[k];
                 BuffSource source = pair2.Value;
                 GameLogic.Binder.BuffSystem.startBuffFromPerk(character, perkType, ConfigPerks.SHARED_DATA[perkType].DurationSeconds, (double)key.Modifier, source, null);
             }
         }
         for (int j = 0; j < ConfigSkills.ACTIVE_HERO_SKILLS.Count; j++)
         {
             if (skillType == ((SkillType)ConfigSkills.ACTIVE_HERO_SKILLS[j]))
             {
                 for (int m = 0; m < this.sm_postSkillUsePerks[skillType].Count; m++)
                 {
                     PerkType type2 = this.sm_postSkillUsePerks[skillType][m];
                     List <KeyValuePair <PerkInstance, BuffSource> > list2 = CharacterStatModifierUtil.GetPerkInstancesOfType(character, type2);
                     for (int n = 0; n < list2.Count; n++)
                     {
                         KeyValuePair <PerkInstance, BuffSource> pair3 = list2[n];
                         PerkInstance instance2 = pair3.Key;
                         KeyValuePair <PerkInstance, BuffSource> pair4 = list2[n];
                         BuffSource source2 = pair4.Value;
                         GameLogic.Binder.BuffSystem.startBuffFromPerk(character, type2, ConfigPerks.SHARED_DATA[type2].DurationSeconds, (double)instance2.Modifier, source2, null);
                     }
                 }
             }
         }
         if ((skillType == SkillType.Leap) && (character.getPerkInstanceCount(PerkType.SkillUpgradeLeap3) > 0))
         {
             character.NextAttackIsGuaranteedCritical = true;
         }
         if (GameLogic.Binder.GameState.ActiveDungeon.hasDungeonModifier(DungeonModifierType.HeroPostSkillIncreasedSkillDamage))
         {
             Buff buff2 = new Buff();
             buff2.BaseStat1       = BaseStatProperty.SkillDamage;
             buff2.Modifier        = ConfigDungeonModifiers.HeroPostSkillIncreasedSkillDamage.Modifier;
             buff2.DurationSeconds = ConfigDungeonModifiers.HeroPostSkillIncreasedSkillDamage.BuffDurationSeconds;
             BuffSource source3 = new BuffSource();
             source3.Object       = ConfigDungeonModifiers.HeroPostSkillIncreasedSkillDamage.BuffSource;
             buff2.Source         = source3;
             buff2.HudSprite      = "sprite_knight_player_256";
             buff2.HudShowStacked = true;
             buff2.HudHideTimer   = true;
             Buff buff = buff2;
             GameLogic.Binder.BuffSystem.startBuff(character, buff);
         }
     }
 }
Esempio n. 21
0
        public static IPerkHandler GetPerkHandler(PerkType perkType)
        {
            if (!_perkHandlers.ContainsKey(perkType))
            {
                throw new KeyNotFoundException("PerkType '" + perkType + "' is not registered. Did you make the perk script?");
            }

            return(_perkHandlers[perkType]);
        }
Esempio n. 22
0
 public DungeonBoostProperties(DungeonBoost.DungeonBoostProperties another)
 {
     this.ActivationType        = another.ActivationType;
     this.BuffPerkType          = another.BuffPerkType;
     this.DoDestroyOnActivation = another.DoDestroyOnActivation;
     this.Radius      = another.Radius;
     this.ShopEntryId = another.ShopEntryId;
     this.Type        = another.Type;
 }
Esempio n. 23
0
        private void ReapplyBackgroundBonus(PerkType perkType)
        {
            var player = GetPC();

            if (IsGrantedByBackground(perkType))
            {
                BackgroundService.ApplyBackgroundBonuses(player);
            }
        }
Esempio n. 24
0
        public int getPerkInstanceCount(PerkType perkType)
        {
            int num = 0;

            for (int i = 0; i < this.PerkInstances.Count; i++)
            {
                num += this.PerkInstances[i].getPerkInstanceCount(perkType);
            }
            return(num);
        }
Esempio n. 25
0
        public float getGenericModifierForPerkType(PerkType perkType)
        {
            float num = 0f;

            for (int i = 0; i < this.PerkInstances.Count; i++)
            {
                num += this.PerkInstances[i].getGenericModifierForPerkType(perkType);
            }
            return(num);
        }
Esempio n. 26
0
 public Perk(int id, String name, String desc)
 {
     Id       = id;
     Name     = name == null ? "" : name;
     Desc     = desc == null ? "" : desc;
     MaxLevel = 1;
     Type     = PerkData.Enabled;
     Levels   = new List <LevelData>();
     EnsureLevel(0);
 }
Esempio n. 27
0
 public void getPerkInstancesOfType(int rank, PerkType perkType, IBuffIconProvider iconProvider, ref List <KeyValuePair <PerkInstance, BuffSource> > outPerkInstances)
 {
     for (int i = 0; i < this.Entries.Count; i++)
     {
         if (rank >= this.Entries[i].RankReq)
         {
             this.Entries[i].PerkInstance.getPerkInstancesOfType(perkType, iconProvider, ref outPerkInstances);
         }
     }
 }
Esempio n. 28
0
    public static void updatePerk(PerkType type, float value)
    {
        int prevValue = (int)perks[type];

        perks[type] += (value / Mathf.Max(perks[type], 1f));
//		Messenger.showMessage("Навык " + type.getName() + " = " + (int)((perks[type] - (int)perks[type]) * 100) + "%");
        if ((int)perks[type] > prevValue)
        {
            Messenger.showMessage("Навык " + type.getName() + " увеличен до " + getPerkLevel(type));
        }
    }
Esempio n. 29
0
 bool PerkCheck(PerkType perkInput) //Checks whether or not you already have the perk you are attempting to buy.
 {
     for (int i = 0; i < curPerks.Count; i++)
     {
         if (curPerks[i].Perk == perkInput)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 30
0
 public bool containsPerkOfType(PerkType perkType)
 {
     for (int i = 0; i < this.Entries.Count; i++)
     {
         if (this.Entries[i].PerkInstance.Type == perkType)
         {
             return(true);
         }
     }
     return(false);
 }
 public void AddPerkToPerksList(string perkName, string description, PerkType type)
 {
     Perks.AddPerk(perkName, description, type);
     UpdatePerks();
 }
Esempio n. 32
0
 public Perk(int id, String name, String desc)
 {
     Id = id;
     Name = name == null ? "" : name;
     Desc = desc == null ? "" : desc;
     MaxLevel = 1;
     Type = PerkData.Enabled;
     Levels = new List<LevelData>();
     EnsureLevel(0);
 }