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 getPerkInstancesOfType(PerkType perkType, IBuffIconProvider iconProvider, ref List <KeyValuePair <PerkInstance, BuffSource> > outPerkInstances) { if (this.Type == perkType) { BuffSource source2 = new BuffSource(); source2.Object = this; source2.IconProvider = iconProvider; BuffSource source = source2; outPerkInstances.Add(new KeyValuePair <PerkInstance, BuffSource>(this, source)); } }
public Buff getBuffFromSource(CharacterInstance c, BuffSource source) { List <Buff> list = this.m_characterBuffLists[c]; for (int i = 0; i < list.Count; i++) { Buff buff = list[i]; if (buff.Source.Object == source.Object) { return(buff); } } return(null); }
public float getTotalBuffModifierFromSource(CharacterInstance c, BuffSource source) { if (source.Object == null) { return(0f); } float num = 0f; List <Buff> list = this.m_characterBuffLists[c]; for (int i = 0; i < list.Count; i++) { Buff buff = list[i]; if (buff.Source.Object == source.Object) { num += buff.TotalModifier; } } return(num); }
public int getNumberOfBuffsFromSource(CharacterInstance c, BuffSource source) { if (source.Object == null) { return(0); } int num = 0; List <Buff> list = this.m_characterBuffLists[c]; for (int i = 0; i < list.Count; i++) { Buff buff = list[i]; if (buff.Source.Object == source.Object) { num++; } } return(num); }
private void onPrimaryHeroDealtDamage(CharacterInstance sourceCharacter, CharacterInstance targetCharacter, Vector3 worldPos, double amount, bool critted, bool damageReduced, DamageType damageType, SkillType fromSkill) { Buff buff3; ActiveDungeon activeDungeon = GameLogic.Binder.GameState.ActiveDungeon; List <KeyValuePair <PerkInstance, BuffSource> > perkInstancesOfType = CharacterStatModifierUtil.GetPerkInstancesOfType(targetCharacter, PerkType.WoundedArmor); for (int i = 0; i < perkInstancesOfType.Count; i++) { KeyValuePair <PerkInstance, BuffSource> pair = perkInstancesOfType[i]; KeyValuePair <PerkInstance, BuffSource> pair2 = perkInstancesOfType[i]; GameLogic.Binder.BuffSystem.startBuffFromPerk(targetCharacter, PerkType.WoundedArmor, ConfigPerks.SHARED_DATA[PerkType.WoundedArmor].DurationSeconds, (double)pair.Key.Modifier, pair2.Value, null); } perkInstancesOfType = CharacterStatModifierUtil.GetPerkInstancesOfType(targetCharacter, PerkType.WoundedAttackSpeed); for (int j = 0; j < perkInstancesOfType.Count; j++) { KeyValuePair <PerkInstance, BuffSource> pair3 = perkInstancesOfType[j]; KeyValuePair <PerkInstance, BuffSource> pair4 = perkInstancesOfType[j]; GameLogic.Binder.BuffSystem.startBuffFromPerk(targetCharacter, PerkType.WoundedAttackSpeed, ConfigPerks.SHARED_DATA[PerkType.WoundedAttackSpeed].DurationSeconds, (double)pair3.Key.Modifier, pair4.Value, null); } perkInstancesOfType = CharacterStatModifierUtil.GetPerkInstancesOfType(targetCharacter, PerkType.WoundedDamage); for (int k = 0; k < perkInstancesOfType.Count; k++) { KeyValuePair <PerkInstance, BuffSource> pair5 = perkInstancesOfType[k]; KeyValuePair <PerkInstance, BuffSource> pair6 = perkInstancesOfType[k]; GameLogic.Binder.BuffSystem.startBuffFromPerk(targetCharacter, PerkType.WoundedDamage, ConfigPerks.SHARED_DATA[PerkType.WoundedDamage].DurationSeconds, (double)pair5.Key.Modifier, pair6.Value, null); } if ((sourceCharacter != null) && (damageType == DamageType.Ranged)) { float num4 = targetCharacter.getGenericModifierForPerkType(PerkType.RangedDamageDeflection); if (num4 > 0f) { double baseAmount = MathUtil.Clamp(Math.Round((double)(amount * num4)), 0.0, double.MaxValue); if (baseAmount > 0.0) { CmdDealDamageToCharacter.ExecuteStatic(targetCharacter, sourceCharacter, baseAmount, false, damageType, SkillType.NONE); } } } if (sourceCharacter != null) { float num6 = targetCharacter.getGenericModifierForPerkType(PerkType.DamageDeflection); if (num6 > 0f) { double num7 = MathUtil.Clamp(Math.Round((double)(amount * num6)), 0.0, double.MaxValue); if (num7 > 0.0) { CmdDealDamageToCharacter.ExecuteStatic(targetCharacter, sourceCharacter, num7, false, damageType, SkillType.NONE); } } } float num8 = targetCharacter.getGenericModifierForPerkType(PerkType.MassDamageDeflection); if (num8 > 0f) { double num9 = MathUtil.Clamp(Math.Round((double)(amount * num8)), 0.0, double.MaxValue); if (num9 > 0.0) { List <CharacterInstance> list2 = activeDungeon.ActiveRoom.getEnemyCharactersWithinRadius(targetCharacter.PhysicsBody.Transform.position, ConfigPerks.MassDamageDeflection.Radius, targetCharacter); for (int m = 0; m < list2.Count; m++) { CmdDealDamageToCharacter.ExecuteStatic(targetCharacter, list2[m], num9, false, damageType, SkillType.NONE); } } } if ((sourceCharacter != null) && activeDungeon.hasDungeonModifier(DungeonModifierType.MonsterStun)) { float num11 = !sourceCharacter.IsBoss ? ConfigDungeonModifiers.MonsterStun.MinionProcChance : ConfigDungeonModifiers.MonsterStun.BossProcChance; if (UnityEngine.Random.Range((float)0f, (float)1f) <= num11) { float num12 = !sourceCharacter.IsBoss ? ConfigDungeonModifiers.MonsterStun.MinionBuffDurationSeconds : ConfigDungeonModifiers.MonsterStun.BossBuffDurationSeconds; buff3 = new Buff(); buff3.Stuns = true; buff3.DurationSeconds = num12; Buff buff = buff3; GameLogic.Binder.BuffSystem.startBuff(targetCharacter, buff); } } if ((sourceCharacter != null) && activeDungeon.hasDungeonModifier(DungeonModifierType.MonsterFreeze)) { float num13 = !sourceCharacter.IsBoss ? ConfigDungeonModifiers.MonsterFreeze.MinionProcChance : ConfigDungeonModifiers.MonsterFreeze.BossProcChance; if (UnityEngine.Random.Range((float)0f, (float)1f) <= num13) { float num14 = !sourceCharacter.IsBoss ? ConfigDungeonModifiers.MonsterFreeze.MinionBuffDurationSeconds : ConfigDungeonModifiers.MonsterFreeze.BossBuffDurationSeconds; buff3 = new Buff(); BuffSource source = new BuffSource(); source.Object = ConfigDungeonModifiers.MODIFIERS[DungeonModifierType.MonsterFreeze]; buff3.Source = source; buff3.BaseStat1 = BaseStatProperty.AttacksPerSecond; buff3.BaseStat2 = BaseStatProperty.MovementSpeed; buff3.Modifier = ConfigPerks.GlobalFrostEffect.SpeedModifier; buff3.DurationSeconds = num14; Buff buff2 = buff3; GameLogic.Binder.BuffSystem.startBuff(targetCharacter, buff2); } } }
public void startOrRefreshBuffFromPerk(CharacterInstance c, PerkType perkType, float durationSeconds, double modifier, BuffSource source, [Optional, DefaultParameterValue(null)] CharacterInstance sourceCharacter) { Buff buff = this.getBuffFromSource(c, source); if (buff != null) { this.refreshBuff(buff, modifier, durationSeconds); } else { this.startBuffFromPerk(c, perkType, durationSeconds, modifier, source, sourceCharacter); } }
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); } }