Beispiel #1
0
        public float getCharacterTypeXpModifier(GameLogic.CharacterType characterType)
        {
            float num = 0f;

            for (int i = 0; i < this.Perks.PerkInstances.Count; i++)
            {
                PerkInstance instance = this.Perks.PerkInstances[i];
                float        num3     = instance.getCharacterTypeXpModifier(characterType);
                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.getCharacterTypeXpModifier(characterType);
                num += num5;
                if (num5 != 0f)
                {
                    num += this.getEvolveBonusForPerk(instance2.Type);
                }
            }
            return(num);
        }
Beispiel #2
0
        public float getBaseStatModifier(BaseStatProperty prop)
        {
            float num = 0f;

            for (int i = 0; i < this.Perks.PerkInstances.Count; i++)
            {
                PerkInstance instance = this.Perks.PerkInstances[i];
                float        num3     = instance.getBaseStatModifier(prop);
                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.getBaseStatModifier(prop);
                num += num5;
                if (num5 != 0f)
                {
                    num += this.getEvolveBonusForPerk(instance2.Type);
                }
            }
            return(num);
        }
Beispiel #3
0
        public float getSkillDamageModifier(SkillType skillType)
        {
            float num = 0f;

            for (int i = 0; i < this.Perks.PerkInstances.Count; i++)
            {
                PerkInstance instance = this.Perks.PerkInstances[i];
                float        num3     = instance.getSkillDamageModifier(skillType);
                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.getSkillDamageModifier(skillType);
                num += num5;
                if (num5 != 0f)
                {
                    num += this.getEvolveBonusForPerk(instance2.Type);
                }
            }
            return(num);
        }
Beispiel #4
0
        protected void FixedUpdate()
        {
            ActiveDungeon activeDungeon = GameLogic.Binder.GameState.ActiveDungeon;

            if ((activeDungeon != null) && (activeDungeon.CurrentGameplayState == GameplayState.ACTION))
            {
                CharacterInstance primaryPlayerCharacter = activeDungeon.PrimaryPlayerCharacter;
                if (!primaryPlayerCharacter.IsDead)
                {
                    float num = Time.deltaTime * Time.timeScale;
                    if (primaryPlayerCharacter.getPerkInstanceCount(PerkType.PassiveDamage) > 0)
                    {
                        List <KeyValuePair <PerkInstance, BuffSource> > perkInstancesOfType = CharacterStatModifierUtil.GetPerkInstancesOfType(primaryPlayerCharacter, PerkType.PassiveDamage);
                        for (int i = 0; i < perkInstancesOfType.Count; i++)
                        {
                            KeyValuePair <PerkInstance, BuffSource> pair = perkInstancesOfType[i];
                            PerkInstance key = pair.Key;
                            key.Timer -= num;
                            if (key.Timer <= 0f)
                            {
                                List <CharacterInstance> list2 = activeDungeon.ActiveRoom.getEnemyCharactersWithinRadius(primaryPlayerCharacter.PhysicsBody.Transform.position, ConfigPerks.MassDamageDeflection.Radius, primaryPlayerCharacter);
                                for (int j = 0; j < list2.Count; j++)
                                {
                                    CharacterInstance targetCharacter = list2[j];
                                    double            baseAmount      = targetCharacter.MaxLife(false) * primaryPlayerCharacter.getGenericModifierForPerkType(PerkType.PassiveDamage);
                                    CmdDealDamageToCharacter.ExecuteStatic(primaryPlayerCharacter, targetCharacter, baseAmount, false, DamageType.Magic, SkillType.NONE);
                                }
                                key.Timer = ConfigPerks.PassiveDamage.Interval;
                            }
                        }
                    }
                }
            }
        }
Beispiel #5
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);
         }
     }
 }
Beispiel #6
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);
     }
 }
Beispiel #7
0
 protected void addQuickLookupPerkInstance(PerkInstance pi, [Optional, DefaultParameterValue(true)] bool triggerRefresh)
 {
     this.QuickLookupPerkInstances.Add(pi);
     if (triggerRefresh)
     {
         this.refreshQuickLookup();
     }
 }
Beispiel #8
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);
         }
     }
 }
        public void increaseTotalModifier(float amount)
        {
            this.TotalModifier += amount;
            PerkInstance sharedPerkInstance = this.SharedPerkInstance;

            if (sharedPerkInstance != null)
            {
                sharedPerkInstance.Modifier += amount;
            }
        }
Beispiel #10
0
 private void loadItemCsv(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)
         {
             Item res  = new Item();
             int  num2 = 0;
             res.Id            = strArray[num2++, i];
             res.Name          = _.L(strArray[num2++, i], null, false);
             res.Type          = base.parseEnumType <ItemType>(strArray[num2++, i]);
             res.Accessories   = base.parseOrderedEnumStringDict <AccessoryType>(strArray[num2++, i]);
             res.SpriteId      = strArray[num2++, i];
             res.BodyMaterials = base.parseStringList(strArray[num2++, i]);
             res.Rarity        = base.parseInt(strArray[num2++, i]);
             List <PerkType> list = base.parseEnumList <PerkType>(strArray[num2++, i]);
             for (int j = 0; j < list.Count; j++)
             {
                 PerkType     perkType     = list[j];
                 float        bestModifier = ConfigPerks.GetBestModifier(perkType);
                 PerkInstance item         = new PerkInstance();
                 item.Type     = perkType;
                 item.Modifier = bestModifier;
                 res.FixedPerks.PerkInstances.Add(item);
             }
             res.FromChest = base.parseEnumType <ChestType>(strArray[num2++, i]);
             res.postDeserializeInitialization();
             base.addResource(res.Id, res);
             this.m_orderedItemIds.Add(res.Id);
             this.m_sortedItems.Add(res);
             if (res.FromChest != ChestType.NONE)
             {
                 LootTableItem item3 = new LootTableItem();
                 item3.Id = res.Id;
                 LootTableItem item2 = item3;
                 this.m_dynamicChestLootTables[res.FromChest].Items.Add(item2);
             }
         }
     }
 }
Beispiel #11
0
        public float getCharacterTypeDamageModifier(GameLogic.CharacterType characterType)
        {
            float num = 0f;

            for (int i = 0; i < this.SelectedRunestones.Count; i++)
            {
                if (this.SelectedRunestones[i].Source == RunestoneSelectionSource.Player)
                {
                    string    id = this.SelectedRunestones[i].Id;
                    SkillType skillTypeForRunestone = ConfigRunestones.GetSkillTypeForRunestone(id);
                    if ((skillTypeForRunestone != SkillType.NONE) && this.Player.ActiveCharacter.isSkillActive(skillTypeForRunestone))
                    {
                        ConfigRunestones.SharedData runestoneData = ConfigRunestones.GetRunestoneData(id);
                        if (runestoneData.PerkInstance != null)
                        {
                            PerkInstance perkInstance = runestoneData.PerkInstance;
                            num += perkInstance.getCharacterTypeDamageModifier(characterType);
                        }
                    }
                }
            }
            return(num);
        }
Beispiel #12
0
        public int getSkillExtraCharges(SkillType skillType)
        {
            int num = 0;

            for (int i = 0; i < this.SelectedRunestones.Count; i++)
            {
                if (this.SelectedRunestones[i].Source == RunestoneSelectionSource.Player)
                {
                    string    id = this.SelectedRunestones[i].Id;
                    SkillType skillTypeForRunestone = ConfigRunestones.GetSkillTypeForRunestone(id);
                    if ((skillTypeForRunestone != SkillType.NONE) && this.Player.ActiveCharacter.isSkillActive(skillTypeForRunestone))
                    {
                        ConfigRunestones.SharedData runestoneData = ConfigRunestones.GetRunestoneData(id);
                        if (runestoneData.PerkInstance != null)
                        {
                            PerkInstance perkInstance = runestoneData.PerkInstance;
                            num += perkInstance.getSkillExtraCharges(skillType);
                        }
                    }
                }
            }
            return(num);
        }
Beispiel #13
0
 protected abstract IBuffIconProvider getBuffIconProvideForPerkInstance(PerkInstance perkInstance);
Beispiel #14
0
 public PerkInstance(PerkInstance another)
 {
     this.Type     = another.Type;
     this.Modifier = another.Modifier;
 }
Beispiel #15
0
 protected void refreshQuickLookup()
 {
     this.m_quickLookup_perkType.Clear();
     for (int i = 0; i < ConfigPerks.ALL_PERKS.Count; i++)
     {
         PerkType            perkType = ConfigPerks.ALL_PERKS[i];
         PerkTypeQuickLookup lookup   = new PerkTypeQuickLookup();
         int num2 = 0;
         for (int n = 0; n < this.QuickLookupPerkInstances.Count; n++)
         {
             PerkInstance instance = this.QuickLookupPerkInstances[n];
             num2 += instance.getPerkInstanceCount(perkType);
         }
         lookup.PerkInstanceCount = num2;
         float num4 = 0f;
         for (int num5 = 0; num5 < this.QuickLookupPerkInstances.Count; num5++)
         {
             float num6 = this.QuickLookupPerkInstances[num5].getGenericModifierForPerkType(perkType);
             num4 += num6;
         }
         lookup.GenericModifierForPerkType = num4;
         this.m_quickLookup_perkType.Add(perkType, lookup);
     }
     this.m_quickLookup_baseStatModifier.Clear();
     for (int j = 0; j < ConfigGameplay.ALL_BASE_STAT_PROPERTY_TYPES.Count; j++)
     {
         BaseStatProperty prop = ConfigGameplay.ALL_BASE_STAT_PROPERTY_TYPES[j];
         float            num8 = 0f;
         for (int num9 = 0; num9 < this.QuickLookupPerkInstances.Count; num9++)
         {
             float num10 = this.QuickLookupPerkInstances[num9].getBaseStatModifier(prop);
             num8 += num10;
         }
         this.m_quickLookup_baseStatModifier.Add(prop, num8);
     }
     this.m_quickLookup_skillType.Clear();
     for (int k = 0; k < ConfigSkills.ALL_HERO_SKILLS.Count; k++)
     {
         SkillType            skillType = ConfigSkills.ALL_HERO_SKILLS[k];
         SkillTypeQuickLookup lookup2   = new SkillTypeQuickLookup();
         float num12 = 0f;
         for (int num13 = 0; num13 < this.QuickLookupPerkInstances.Count; num13++)
         {
             float num14 = this.QuickLookupPerkInstances[num13].getSkillDamageModifier(skillType);
             num12 += num14;
         }
         lookup2.SkillDamageModifier = num12;
         int num15 = 0;
         for (int num16 = 0; num16 < this.QuickLookupPerkInstances.Count; num16++)
         {
             PerkInstance instance5 = this.QuickLookupPerkInstances[num16];
             num15 += instance5.getSkillExtraCharges(skillType);
         }
         lookup2.SkillExtraCharges = num15;
         bool flag = false;
         for (int num17 = 0; num17 < this.QuickLookupPerkInstances.Count; num17++)
         {
             PerkInstance instance6 = this.QuickLookupPerkInstances[num17];
             if (instance6.hasSkillInvulnerability(skillType))
             {
                 flag = true;
                 break;
             }
         }
         lookup2.SkillInvulnerability = flag;
         float num18 = 0f;
         for (int num19 = 0; num19 < this.QuickLookupPerkInstances.Count; num19++)
         {
             float num20 = this.QuickLookupPerkInstances[num19].getSkillCooldownModifier(skillType);
             num18 += num20;
         }
         lookup2.SkillCooldownModifier = num18;
         this.m_quickLookup_skillType.Add(skillType, lookup2);
     }
     this.m_quickLookup_characterType.Clear();
     for (int m = 0; m < ConfigGameplay.ALL_CHARACTER_TYPES_INCLUDING_UNSPECIFIED.Count; m++)
     {
         CharacterType            characterType = ConfigGameplay.ALL_CHARACTER_TYPES_INCLUDING_UNSPECIFIED[m];
         CharacterTypeQuickLookup lookup3       = new CharacterTypeQuickLookup();
         float num22 = 0f;
         for (int num23 = 0; num23 < this.QuickLookupPerkInstances.Count; num23++)
         {
             float num24 = this.QuickLookupPerkInstances[num23].getCharacterTypeDamageModifier(characterType);
             num22 += num24;
         }
         lookup3.CharacterTypeDamageModifier = num22;
         float num25 = 0f;
         for (int num26 = 0; num26 < this.QuickLookupPerkInstances.Count; num26++)
         {
             float num27 = this.QuickLookupPerkInstances[num26].getCharacterTypeArmorModifier(characterType);
             num25 += num27;
         }
         lookup3.CharacterTypeArmorModifier = num25;
         float num28 = 0f;
         for (int num29 = 0; num29 < this.QuickLookupPerkInstances.Count; num29++)
         {
             float num30 = this.QuickLookupPerkInstances[num29].getCharacterTypeXpModifier(characterType);
             num28 += num30;
         }
         lookup3.CharacterTypeXpModifier = num28;
         float num31 = 0f;
         for (int num32 = 0; num32 < this.QuickLookupPerkInstances.Count; num32++)
         {
             float num33 = this.QuickLookupPerkInstances[num32].getCharacterTypeCoinModifier(characterType);
             num31 += num33;
         }
         lookup3.CoinModifier = num31;
         this.m_quickLookup_characterType.Add(characterType, lookup3);
     }
 }
 private void loadPetCharacterCsv(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)
         {
             continue;
         }
         Character e    = new Character();
         int       num2 = 0;
         e.Id   = strArray[num2++, i];
         e.Name = _.L(strArray[num2++, i], null, false);
         num2++;
         e.FlavorText      = _.L(strArray[num2++, i], null, false);
         e.Type            = GameLogic.CharacterType.Pet;
         e.Prefab          = base.parseEnumType <CharacterPrefab>(strArray[num2++, i]);
         e.Rarity          = base.parseInt(strArray[num2++, i]);
         e.AvatarSpriteId  = strArray[num2++, i];
         e.CoreAiBehaviour = base.parseEnumType <AiBehaviourType>(strArray[num2++, i]);
         KeyValuePair <string, float>   pair      = base.parseStringFloatPair(strArray[num2++, i]);
         KeyValuePair <string, float>   pair2     = base.parseStringFloatPair(strArray[num2++, i]);
         KeyValuePair <string, float>   pair3     = base.parseStringFloatPair(strArray[num2++, i]);
         KeyValuePair <string, float>   pair4     = base.parseStringFloatPair(strArray[num2++, i]);
         KeyValuePair <string, float>[] pairArray = new KeyValuePair <string, float>[] { pair, pair2, pair3, pair4 };
         e.FixedPerks = new GatedPerkContainer();
         for (int j = 0; j < pairArray.Length; j++)
         {
             if (string.IsNullOrEmpty(pairArray[j].Key) || (j >= ConfigGameplay.PET_PERK_MILESTONE_LEVELS.Count))
             {
                 break;
             }
             int      num4               = ConfigGameplay.PET_PERK_MILESTONE_LEVELS[j];
             PerkType perkType           = base.parseEnumType <PerkType>(pairArray[j].Key);
             ConfigPerks.SharedData data = ConfigPerks.SHARED_DATA[perkType];
             float bestModifier          = (data.LinkedToRunestone == null) ? pairArray[j].Value : ConfigRunestones.GetRunestoneData(data.LinkedToRunestone).PerkInstance.Modifier;
             if (bestModifier == 0f)
             {
                 bestModifier = ConfigPerks.GetBestModifier(perkType);
             }
             GatedPerkContainer.Entry item = new GatedPerkContainer.Entry();
             item.RankReq = num4;
             PerkInstance instance = new PerkInstance();
             instance.Type     = perkType;
             instance.Modifier = bestModifier;
             item.PerkInstance = instance;
             e.FixedPerks.Entries.Add(item);
         }
         e.RangedProjectileType        = base.parseEnumType <ProjectileType>(strArray[num2++, i]);
         e.MainHeroDamagePerHitPct     = base.parseFloat(strArray[num2++, i]);
         e.AttackContactTimeNormalized = base.parseFloat(strArray[num2++, i]);
         e.BaseStats = new Dictionary <string, double>();
         e.BaseStats.Add(BaseStatProperty.AttacksPerSecond.ToString(), base.parseDouble(strArray[num2++, i]));
         e.BaseStats.Add(BaseStatProperty.AttackRange.ToString(), base.parseDouble(strArray[num2++, i]));
         e.BaseStats.Add(BaseStatProperty.CriticalHitChancePct.ToString(), base.parseDouble(strArray[num2++, i]));
         e.BaseStats.Add(BaseStatProperty.CriticalHitMultiplier.ToString(), base.parseDouble(strArray[num2++, i]));
         e.BaseStats.Add(BaseStatProperty.CleaveDamagePct.ToString(), base.parseDouble(strArray[num2++, i]));
         e.BaseStats.Add(BaseStatProperty.CleaveRange.ToString(), base.parseDouble(strArray[num2++, i]));
         e.BaseStats.Add(BaseStatProperty.MovementSpeed.ToString(), base.parseDouble(strArray[num2++, i]));
         e.BaseStats.Add(BaseStatProperty.Threat.ToString(), base.parseDouble(strArray[num2++, i]));
         e.BaseStats.Add(BaseStatProperty.Life.ToString(), 999.0);
         e.BaseStats.Add(BaseStatProperty.DamagePerHit.ToString(), 0.0);
         e.BaseStats.Add(BaseStatProperty.UniversalArmorBonus.ToString(), 0.0);
         e.BaseStats.Add(BaseStatProperty.SkillDamage.ToString(), 0.0);
         e.BaseStats.Add(BaseStatProperty.UniversalXpBonus.ToString(), 0.0);
         this.postProcess(e);
     }
 }
 protected override IBuffIconProvider getBuffIconProvideForPerkInstance(PerkInstance perkInstance)
 {
     return(this.m_perkInstanceToAugMap[perkInstance]);
 }