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; } } } } } }
private void refreshTickBuffs() { for (int i = 0; i < this.m_allBuffs.Count; i++) { Buff buff = this.m_allBuffs[i]; if ((!buff.Ended && (buff.DurationSeconds > 0f)) && ((buff.DamagePerSecond > 0.0) || (buff.HealingPerSecond > 0.0))) { float dt = Time.deltaTime * Time.timeScale; if (buff.TickTimer.tick(dt)) { if (buff.HealingPerSecond > 0.0) { double num3 = buff.HealingPerSecond * buff.DurationSeconds; double amount = num3 * (ConfigGameplay.BUFFS_TICK_INTERVAL / buff.DurationSeconds); CmdGainHp.ExecuteStatic(buff.Character, amount, false); } if (buff.DamagePerSecond > 0.0) { double num5 = buff.DamagePerSecond * buff.DurationSeconds; double baseAmount = num5 * (ConfigGameplay.BUFFS_TICK_INTERVAL / buff.DurationSeconds); CmdDealDamageToCharacter.ExecuteStatic(buff.SourceCharacter, buff.Character, baseAmount, false, DamageType.Magic, SkillType.NONE); } float num7 = buff.TickTimer.timeRemaining() - dt; buff.TickTimer.set(ConfigGameplay.BUFFS_TICK_INTERVAL + num7); } } } }
private void onPlayerCharacterDealedDamage(CharacterInstance sourceCharacter, CharacterInstance targetCharacter, Vector3 worldPos, double amount, bool critted, bool damageReduced, DamageType damageType, SkillType fromSkill) { ActiveDungeon activeDungeon = GameLogic.Binder.GameState.ActiveDungeon; if ((damageType == DamageType.Melee) && activeDungeon.hasDungeonModifier(DungeonModifierType.MonsterWeaponDeflect)) { double baseAmount = MathUtil.Clamp(Math.Round((double)(amount * ConfigDungeonModifiers.MonsterWeaponDeflect.DeflectionPct)), 0.0, double.MaxValue); if (baseAmount > 0.0) { CmdDealDamageToCharacter.ExecuteStatic(targetCharacter, sourceCharacter, baseAmount, false, damageType, SkillType.NONE); } } if ((damageType == DamageType.Magic) && activeDungeon.hasDungeonModifier(DungeonModifierType.MonsterSkillDeflect)) { double num2 = MathUtil.Clamp(Math.Round((double)(amount * ConfigDungeonModifiers.MonsterSkillDeflect.DeflectionPct)), 0.0, double.MaxValue); if (num2 > 0.0) { CmdDealDamageToCharacter.ExecuteStatic(targetCharacter, sourceCharacter, num2, false, damageType, SkillType.NONE); } } }
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); } } }