Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <summary>
- /// Gets the elements.
- /// </summary>
- /// <param name="ragemode">if set to <c>true</c> [ragemode].</param>
- /// <param name="transformed">if set to <c>true</c> [transformed].</param>
- /// <returns></returns>
- public Dictionary<StatType, float> GetElements(bool ragemode, bool transformed)
- {
- var normaldict = new Dictionary<StatType, short>();
- var ragedict = new Dictionary<StatType, short>();
- //Elements
- foreach (var element in Constants.ElementList)
- {
- GetElement(normaldict, ragedict, element, ragemode);
- }
- //Determine total elements.
- int normaltotal = 0;
- foreach (var element in normaldict)
- {
- normaltotal += element.Value;
- }
- int ragetotal = 0;
- foreach (var element in ragedict)
- {
- ragetotal += element.Value;
- }
- //Determine physical element.
- //Get equip type
- EquipType type = GetWeaponType(transformed);
- //Get type data and assign it.
- var typedata = EquipDataManager.GetEquipData(type.ToString());
- if (normaltotal != Constants.MaxUpgradeLevel)
- {
- if (normaldict.ContainsKey(typedata.DamageType))
- {
- short value = normaldict[typedata.DamageType];
- value += (byte)(Constants.MaxUpgradeLevel - normaltotal);
- normaldict.Remove(typedata.DamageType);
- normaldict.Add(typedata.DamageType, value);
- }
- else
- {
- normaldict.Add(typedata.DamageType, (byte) (Constants.MaxUpgradeLevel - normaltotal));
- }
- }
- if (ragetotal != Constants.MaxUpgradeLevel)
- {
- if (ragedict.ContainsKey(typedata.DamageType))
- {
- short value = ragedict[typedata.DamageType];
- value += (byte)(Constants.MaxUpgradeLevel - ragetotal);
- ragedict.Remove(typedata.DamageType);
- ragedict.Add(typedata.DamageType, value);
- }
- else
- {
- ragedict.Add(typedata.DamageType, (byte)(Constants.MaxUpgradeLevel - ragetotal));
- }
- }
- //Low Rank Status
- foreach (var statuseffect in Constants.LowRankStatusEffects)
- {
- GetElement(normaldict, ragedict, statuseffect, ragemode);
- }
- //High Rank Status
- foreach (var statuseffect in Constants.HighRankStatusEffects)
- {
- GetElement(normaldict, ragedict, statuseffect, ragemode);
- }
- //Make the total dict.
- var totaldict = new Dictionary<StatType, short>();
- //Assign the values of normaldict, checking for ragedict as well.
- foreach (var element in normaldict)
- {
- if (ragedict.ContainsKey(element.Key))
- {
- totaldict.Add(element.Key, (short) (element.Value + ragedict[element.Key]));
- }
- else
- {
- totaldict.Add(element.Key, element.Value);
- }
- }
- //Add what's missing in ragedict.
- foreach (var element in ragedict)
- {
- if (totaldict.ContainsKey(element.Key))
- {
- continue;
- }
- totaldict.Add(element.Key, element.Value);
- }
- //Assign actual values.
- var floatdict = new Dictionary<StatType, float>();
- foreach (var element in totaldict)
- {
- floatdict.Add(element.Key, element.Value / (float) Constants.MaxUpgradeLevel);
- }
- return floatdict;
- }
- /// <summary>
- /// Gets the element.
- /// </summary>
- /// <param name="normaldict">The normaldict.</param>
- /// <param name="ragedict">The ragedict.</param>
- /// <param name="type">The type.</param>
- /// <param name="ragemode">if set to <c>true</c> [ragemode].</param>
- private void GetElement(Dictionary<StatType, short> normaldict, Dictionary<StatType, short> ragedict, StatType type, bool ragemode)
- {
- var value = GetStat(type);
- if (value > 0)
- {
- normaldict.Add(type, value);
- }
- //Don't do shit with rage if it isn't in rage mode.
- if (!ragemode)
- {
- return;
- }
- value = GetRageStat(type);
- if (value > 0)
- {
- ragedict.Add(type, value);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement