From 41bce64ffcc4c0c55200cf208ff70b6ffb3b7e5b Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sat, 26 May 2018 13:11:47 -0400 Subject: [PATCH] Core/Spells: Fixes OverflowException for ChainTargets --- Source/Game/DataStorage/Structs/S_Records.cs | 2 +- Source/Game/Spells/Spell.cs | 4 ++-- Source/Game/Spells/SpellInfo.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Game/DataStorage/Structs/S_Records.cs b/Source/Game/DataStorage/Structs/S_Records.cs index 1a9f44100..52b515584 100644 --- a/Source/Game/DataStorage/Structs/S_Records.cs +++ b/Source/Game/DataStorage/Structs/S_Records.cs @@ -287,7 +287,7 @@ namespace Game.DataStorage public uint EffectAuraPeriod; public float EffectBonusCoefficient; public float EffectChainAmplitude; - public uint EffectChainTargets; + public int EffectChainTargets; public int EffectDieSides; public uint EffectItemType; public uint EffectMechanic; diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index 00c9e61f6..27b1d0725 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -1019,7 +1019,7 @@ namespace Game.Spells if (effect == null) return; - uint maxTargets = effect.ChainTargets; + int maxTargets = effect.ChainTargets; Player modOwner = m_caster.GetSpellModOwner(); if (modOwner) modOwner.ApplySpellMod(m_spellInfo.Id, SpellModOp.JumpTargets, ref maxTargets, this); @@ -1033,7 +1033,7 @@ namespace Game.Spells m_applyMultiplierMask |= (byte)effMask; List targets = new List(); - SearchChainTargets(targets, maxTargets - 1, target, targetType.GetObjectType(), targetType.GetCheckType(), effect.ImplicitTargetConditions, targetType.GetTarget() == Targets.UnitChainhealAlly); + SearchChainTargets(targets, (uint)maxTargets - 1, target, targetType.GetObjectType(), targetType.GetCheckType(), effect.ImplicitTargetConditions, targetType.GetTarget() == Targets.UnitChainhealAlly); // Chain primary target is added earlier CallScriptObjectAreaTargetSelectHandlers(targets, effIndex, targetType); diff --git a/Source/Game/Spells/SpellInfo.cs b/Source/Game/Spells/SpellInfo.cs index df26ac583..c8bcd4ce0 100644 --- a/Source/Game/Spells/SpellInfo.cs +++ b/Source/Game/Spells/SpellInfo.cs @@ -4395,7 +4395,7 @@ namespace Game.Spells public SpellImplicitTargetInfo TargetB; public SpellRadiusRecord RadiusEntry; public SpellRadiusRecord MaxRadiusEntry; - public uint ChainTargets; + public int ChainTargets; public uint ItemType; public uint TriggerSpell; public FlagArray128 SpellClassMask;