2using System.Collections.Generic;
4using System.Runtime.Serialization;
20 public Dictionary<int, Element>
dict =
new Dictionary<int, Element>();
26 [JsonProperty(PropertyName =
"A")]
38 list =
new List<int>();
59 for (
int i = 0; i <
list.Count; i += 5)
62 if (orCreateElement !=
null)
64 orCreateElement.vBase +=
list[i + 1];
65 orCreateElement.vExp +=
list[i + 2];
66 orCreateElement.vPotential +=
list[i + 3];
67 orCreateElement.vTempPotential =
list[i + 4];
68 orCreateElement.owner =
this;
75 int num = ((!invert) ? 1 : (-1));
77 foreach (KeyValuePair<int, int>
item in map)
80 int value =
item.Value;
83 if (orCreateElement.
source.category ==
"skill")
88 orCreateElement.vSource += num2;
89 if (applyFeat && orCreateElement is
Feat)
91 (orCreateElement as
Feat).Apply(num2,
this);
100 int num = ((!invert) ? 1 : (-1));
103 foreach (KeyValuePair<int, int>
item in material.elementMap)
105 int value =
item.Value;
111 if (!orCreateElement.
source.IsMaterialEncAppliable(t))
113 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vExp == 0 && orCreateElement.
vPotential == 0)
120 orCreateElement.vSource += num2;
121 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vExp == 0 && orCreateElement.
vPotential == 0)
131 foreach (KeyValuePair<int, int>
item in map)
139 for (
int i = 0; i < ints.Length; i += 2)
150 if (value.
HasTag(
"primary"))
152 value.vTempPotential = (value.ValueWithoutLink - ((mode != 2) ? 7 : 0)) * 5;
176 return element.
Value;
200 feat.Apply(feat.Value,
this);
216 return element.Value > 0;
224 public bool Has(
string alias)
240 num +=
Value(1516) * -4;
241 num +=
Value(1517) * 4;
244 num +=
Value(1524) * -4;
245 num +=
Value(1525) * 4;
256 public void Learn(
int ele,
int v = 1)
262 public void Train(
int ele,
int a = 10)
268 public void ModExp(
int ele,
int a,
bool chain =
false)
279 int value = (element.UsePotential ? element.Potential : 100);
282 float num = (float)a * (
float)Mathf.Clamp(value, 10, 1000) / (float)(100 + Mathf.Max(0, element.
ValueWithoutLink) * 25);
290 if (!chain && element.
source.parentFactor > 0f &&
Card !=
null && !element.
source.aliasParent.IsEmpty())
295 ModExp(element2.
id, (
int)Math.Max(1f, (
float)a * element.
source.parentFactor / 100f), chain:
true);
300 int num2 = element.vExp - element.
ExpToNext;
301 int vBase = element.
vBase;
304 element.vExp = Mathf.Clamp(num2 / 2, 0, element.
ExpToNext / 2);
307 element.vTempPotential -= element.vTempPotential / 4 +
EClass.
rnd(5) + 5;
310 element.vTempPotential = 0;
315 element.vTempPotential += -element.vTempPotential / 4 +
EClass.
rnd(5) + 5;
318 element.vTempPotential = 0;
322 else if (element.
vExp < 0)
329 int vBase2 = element.
vBase;
364 orCreateElement.vBase = v;
365 orCreateElement.vExp = 0;
366 orCreateElement.vPotential = potential;
368 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vPotential == 0 && orCreateElement.
vExp == 0)
372 return orCreateElement;
378 int num = v - (orCreateElement.vBase + orCreateElement.
vSource);
383 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vPotential == 0 && orCreateElement.
vExp == 0)
405 orCreateElement.vBase += v;
412 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vPotential == 0 && orCreateElement.
vExp == 0)
416 return orCreateElement;
426 orCreateElement.vPotential += v;
429 orCreateElement.vPotential = 1000;
431 return orCreateElement;
437 orCreateElement.vTempPotential += v;
440 orCreateElement.vTempPotential = 1000;
443 return orCreateElement;
453 orCreateElement.vLink += v;
459 return orCreateElement;
465 int num = cost.cost * ((cost.type ==
Act.
CostType.SP) ? 20 : 5) * (100 + c.
Evalue(1208) * 30) / 100 + 10;
466 num = num * costMod / 100;
467 if (!e.
source.aliasParent.IsEmpty())
470 num = ((num2 < 0) ? (num * 100 / (100 - num2 * 25)) : (num * (100 + num2 * 5) / 100));
486 return dict.TryGetValue(
id);
496 element.owner =
this;
497 dict.Add(
id, element);
514 if (!
dict.TryGetValue(
id, out value))
538 if (newParent !=
null)
551 public List<Element>
ListElements(Func<Element, bool> shoudList =
null, Comparison<Element> comparison =
null)
553 List<Element>
list =
new List<Element>();
554 List<Element> eles =
dict.Values.ToList();
563 foreach (
Element item2
in eles)
565 if (shoudList ==
null || shoudList(item2))
570 if (comparison !=
null)
572 list.Sort(comparison);
577 if (container ==
null)
584 foreach (
Element item3
in eles)
586 if (value.
id == item3.
id)
592 if (flag && value.
Value != 0)
629 List<Element>
list =
new List<Element>();
630 foreach (KeyValuePair<int, Element>
item in c.elements.dict)
647 container.
dict.Clear();
648 foreach (KeyValuePair<int, Element>
item in dict)
650 Element element = container.CreateElement(
item.Key);
651 element.vBase =
item.Value.vBase;
652 element.vExp =
item.Value.vExp;
653 element.vSource =
item.Value.vSource;
675 public void AddNote(
UINote n, Func<Element, bool> isValid =
null, Action onAdd =
null,
NoteMode mode =
NoteMode.Default,
bool addRaceFeat =
false, Func<Element, string, string> funcText =
null, Action<UINote, Element> onAddNote =
null)
677 List<Element>
list =
new List<Element>();
688 element.owner =
this;
720 bool flag = e.
source.tag.Contains(
"common");
721 string categorySub = e.
source.categorySub;
723 bool flag3 = (e.
source.tag.Contains(
"neg") ? (e.Value > 0) : (e.
Value < 0));
724 int num = Mathf.Abs(e.
Value);
726 bool flag5 =
Card !=
null && Card.IsWeapon && e is
Ability;
729 string[] textArray = e.
source.GetTextArray(
"textAlt");
730 int num2 = Mathf.Clamp(e.
Value / 10 + 1, (e.
Value < 0 || textArray.Length <= 2) ? 1 : 2, textArray.Length - 1);
731 text =
"altEnc".lang(textArray[0].IsEmpty(e.
Name), textArray[num2], EClass.debug.showExtra ? (e.Value +
" " + e.
Name) :
"");
732 flag3 = num2 <= 1 || textArray.Length <= 2;
737 text =
"isProc".lang(e.
Name);
740 else if (categorySub ==
"resist")
742 text = (
"isResist" + (flag3 ?
"Neg" :
"")).lang(e.
Name);
744 else if (categorySub ==
"eleAttack")
746 text =
"isEleAttack".lang(e.
Name);
748 else if (!e.
source.textPhase.IsEmpty() && e.Value > 0)
750 text = e.
source.GetText(
"textPhase");
754 string name = e.
Name;
755 bool flag6 = e.source.category ==
"skill" || (e.source.category ==
"attribute" && !e.
source.textPhase.IsEmpty());
756 bool flag7 = e.source.category ==
"enchant";
757 if (e.
source.tag.Contains(
"multiplier"))
759 flag6 = (flag7 =
false);
762 flag2 = !(flag6 || flag7);
763 text = (flag6 ?
"textEncSkill" : (flag7 ?
"textEncEnc" :
"textEnc")).lang(name, num + (e.
source.tag.Contains(
"ratio") ?
"%" :
""), ((e.
Value > 0) ?
"encIncrease" :
"encDecrease").lang());
772 if (!flag && !flag2 && !e.
source.tag.Contains(
"flag"))
774 text = text +
" [" +
"*".Repeat(Mathf.Clamp(num * e.
source.mtp / num4 + num3, 1, 5)) + ((num * e.
source.mtp / num4 + num3 > 5) ?
"+" :
"") +
"]";
778 text =
"(debug)" + text;
780 FontColor color = (flag ? FontColor.Default : (flag3 ? FontColor.Bad :
FontColor.Good));
783 text = text +
" " + (e.IsFactionWideElement ?
"_factionWide" :
"_partyWide").lang();
798 if (funcText !=
null)
800 text = funcText(e, text);
802 UIItem uIItem = n.AddText(
"NoteText_enc", text, color);
811 foreach (
int key
in thing.
source.elementMap.Keys)
829 uIItem.
image1.SetActive(enable:
true);
830 uIItem.image1.sprite = sprite;
833 onAddNote?.Invoke(n, e);
840 uIItem2.button1.tooltip.onShowTooltip = delegate(
UITooltip t)
846 Image image = uIItem2.
image2;
847 int value = (e.Potential - 80) / 20;
848 image.enabled = e.Potential != 80;
850 image.color = ((e.Potential - 80 >= 0) ?
Color.white :
new Color(1f, 0.7f, 0.7f));
856 Transform transform = n.AddExtra<Transform>(
"noteRace");
857 UINote n2 = transform.Find(
"note1").GetComponent<
UINote>();
858 UINote n3 = transform.Find(
"note2").GetComponent<
UINote>();
861 n3.AddHeader(
"HeaderNoteSmall",
"attributes");
865 n2.AddHeader(
"HeaderNoteSmall",
"skills");
869 n2.AddHeader(
"HeaderNoteSmall",
"feats");
int GetInt(int id, int? defaultInt=null)
ElementContainerCard elements
SourceMaterial.Row material
SocketData GetRuneEnc(int idEle)
override bool IsPCFaction
ElementContainer faithElements
List< Sprite > spritesPotential
static SourceManager sources
static float rndf(float a)
static int GetSortVal(Element a)
List< Element > ListElements(Func< Element, bool > shoudList=null, Comparison< Element > comparison=null)
void Train(int ele, int a=10)
void ApplyPotential(int mode=0)
Dictionary< int, Element > dict
void AddNoteAll(UINote n)
List< Element > ListLearnable(Chara c)
void Learn(int ele, int v=1)
void AddNote(UINote n, Func< Element, bool > isValid=null, Action onAdd=null, NoteMode mode=NoteMode.Default, bool addRaceFeat=false, Func< Element, string, string > funcText=null, Action< UINote, Element > onAddNote=null)
void ApplyMaterialElementMap(Thing t, bool invert=false)
Element ModLink(int id, int v)
int ValueWithoutLink(string alias)
Element ModPotential(int ele, int v)
Element SetBase(int id, int v, int potential=0)
virtual void OnTrain(int ele)
Element ModTempPotential(int ele, int v, int threshMsg=0)
Element GetOrCreateElement(int id)
void ImportElementMap(Dictionary< int, int > map)
virtual int ValueBonus(Element e)
void OnSerializing(StreamingContext context)
ElementContainer ImportElementMap(int[] ints)
List< Element > ListRune()
void CopyTo(ElementContainer container)
int ValueWithoutLink(int ele)
void ModExp(int ele, int a, bool chain=false)
Element ModBase(int ele, int v)
virtual void OnLevelDown(Element e, int lastValue)
List< Element > ListBestSkills()
virtual bool IsMeleeWeapon
Element GetElement(int id)
int GetFeatRef(int ele, int idx=0)
virtual void OnChangeValue()
void OnDeserialized(StreamingContext context)
void ApplyElementMap(int uid, SourceValueType type, Dictionary< int, int > map, int lv, bool invert=false, bool applyFeat=false)
List< Element > ListBestAttributes()
virtual void OnModTempPotential(Element e, int v, int threshMsg)
virtual void OnLearn(int ele)
void SetTo(int id, int v)
bool Has(SourceElement.Row row)
Element SetBase(string alias, int v, int potential=0)
List< Element > ListGeneFeats()
virtual void OnLevelUp(Element e, int lastValue)
Element GetOrCreateElement(Element ele)
void SetParent(ElementContainer newParent=null)
Element CreateElement(int id)
int GetSpellExp(Chara c, Element e, int costMod=100)
Element GetElement(string alias)
Element GetOrCreateElement(string alias)
virtual void OnChangeValue()
int GetMaterialSourceValue(Thing t, int v)
virtual int GetSourceValue(int v, int lv, SourceValueType type)
virtual int GetSourcePotential(int v)
int GetSortVal(UIList.SortMode m)
void CheckLevelBonus(ElementContainer owner, UINote n=null)
static Element Create(int id, int v=0)
virtual bool CanLink(ElementContainer owner)
virtual Act.Cost GetCost(Chara c)
void WriteNote(UINote n, ElementContainer owner=null, Action< UINote > onWriteNote=null)
Element GetParent(Card c)
int SortVal(bool charaSheet=false)
ElementContainerFaction charaElements
static void SetSeed(int a=-1)
static SkinColorProfile CurrentColors