2using System.Collections.Generic;
4using System.Runtime.Serialization;
19 public Dictionary<int, Element>
dict =
new Dictionary<int, Element>();
25 [JsonProperty(PropertyName =
"A")]
39 list =
new List<int>();
60 for (
int i = 0; i <
list.Count; i += 5)
63 if (orCreateElement !=
null)
65 orCreateElement.vBase +=
list[i + 1];
66 orCreateElement.vExp +=
list[i + 2];
67 orCreateElement.vPotential +=
list[i + 3];
68 orCreateElement.vTempPotential =
list[i + 4];
69 orCreateElement.owner =
this;
76 int num = ((!invert) ? 1 : (-1));
78 foreach (KeyValuePair<int, int>
item in map)
81 int value =
item.Value;
84 if (orCreateElement.
source.category ==
"skill")
89 orCreateElement.vSource += num2;
90 if (applyFeat && orCreateElement is
Feat)
92 (orCreateElement as
Feat).Apply(num2,
this);
101 int num = ((!invert) ? 1 : (-1));
104 foreach (KeyValuePair<int, int>
item in material.elementMap)
106 int value =
item.Value;
112 if (!orCreateElement.
source.IsMaterialEncAppliable(t))
114 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vExp == 0 && orCreateElement.
vPotential == 0)
121 orCreateElement.vSource += num2;
122 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vExp == 0 && orCreateElement.
vPotential == 0)
132 foreach (KeyValuePair<int, int>
item in map)
140 for (
int i = 0; i < ints.Length; i += 2)
151 if (value.
HasTag(
"primary"))
153 value.vTempPotential = (value.ValueWithoutLink - ((mode != 2) ? 7 : 0)) * 5;
177 return element.
Value;
201 feat.Apply(feat.Value,
this);
217 return element.Value > 0;
225 public bool Has(
string alias)
241 num +=
Value(1516) * -4;
242 num +=
Value(1517) * 4;
245 num +=
Value(1524) * -4;
246 num +=
Value(1525) * 4;
257 public void Learn(
int ele,
int v = 1)
263 public void Train(
int ele,
int a = 10)
269 public void ModExp(
int ele,
int a,
bool chain =
false)
284 int value = (element.UsePotential ? element.Potential : 100);
287 float num = (float)a * (
float)Mathf.Clamp(value, 10, 1000) / (float)(100 + Mathf.Max(0, element.
ValueWithoutLink) * 25);
295 if (!chain && element.
source.parentFactor > 0f &&
Card !=
null && !element.
source.aliasParent.IsEmpty())
300 ModExp(element2.
id, (
int)Math.Max(1f, (
float)a * element.
source.parentFactor / 100f), chain:
true);
305 int num2 = element.vExp - element.
ExpToNext;
306 int vBase = element.
vBase;
309 element.vExp = Mathf.Clamp(num2 / 2, 0, element.
ExpToNext / 2);
312 element.vTempPotential -= element.vTempPotential / 4 +
EClass.
rnd(5) + 5;
315 element.vTempPotential = 0;
320 element.vTempPotential += -element.vTempPotential / 4 +
EClass.
rnd(5) + 5;
323 element.vTempPotential = 0;
327 else if (element.
vExp < 0)
334 int vBase2 = element.
vBase;
369 orCreateElement.vBase = v;
370 orCreateElement.vExp = 0;
371 orCreateElement.vPotential = potential;
373 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vPotential == 0 && orCreateElement.
vExp == 0)
377 return orCreateElement;
383 int num = v - (orCreateElement.vBase + orCreateElement.
vSource);
388 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vPotential == 0 && orCreateElement.
vExp == 0)
410 orCreateElement.vBase += v;
417 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vPotential == 0 && orCreateElement.
vExp == 0)
421 return orCreateElement;
431 orCreateElement.vPotential += v;
434 orCreateElement.vPotential = 1000;
436 return orCreateElement;
442 orCreateElement.vTempPotential += v;
445 orCreateElement.vTempPotential = 1000;
448 return orCreateElement;
458 orCreateElement.vLink += v;
464 return orCreateElement;
470 int num = cost.cost * ((cost.type ==
Act.
CostType.SP) ? 20 : 5) * (100 + c.
Evalue(1208) * 30) / 100 + 10;
471 num = num * costMod / 100;
472 if (!e.
source.aliasParent.IsEmpty())
475 num = ((num2 < 0) ? (num * 100 / (100 - num2 * 25)) : (num * (100 + num2 * 5) / 100));
491 return dict.TryGetValue(
id);
501 element.owner =
this;
502 dict.Add(
id, element);
519 if (!
dict.TryGetValue(
id, out value))
543 if (newParent !=
null)
556 public List<Element>
ListElements(Func<Element, bool> shoudList =
null, Comparison<Element> comparison =
null)
558 List<Element>
list =
new List<Element>();
559 List<Element> eles =
dict.Values.ToList();
568 foreach (
Element item2
in eles)
570 if (shoudList ==
null || shoudList(item2))
575 if (comparison !=
null)
577 list.Sort(comparison);
582 if (container ==
null)
589 foreach (
Element item3
in eles)
591 if (value.
id == item3.
id)
597 if (flag && value.
Value != 0)
634 List<Element>
list =
new List<Element>();
635 foreach (KeyValuePair<int, Element>
item in c.elements.dict)
652 container.
dict.Clear();
653 foreach (KeyValuePair<int, Element>
item in dict)
655 Element element = container.CreateElement(
item.Key);
656 element.vBase =
item.Value.vBase;
657 element.vExp =
item.Value.vExp;
658 element.vSource =
item.Value.vSource;
680 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)
682 List<Element>
list =
new List<Element>();
693 element.owner =
this;
716 item.AddEncNote(n,
Card, mode, funcText, onAddNote);
722 Transform transform = n.AddExtra<Transform>(
"noteRace");
723 UINote n2 = transform.Find(
"note1").GetComponent<
UINote>();
724 UINote n3 = transform.Find(
"note2").GetComponent<
UINote>();
727 n3.AddHeader(
"HeaderNoteSmall",
"attributes");
731 n2.AddHeader(
"HeaderNoteSmall",
"skills");
735 n2.AddHeader(
"HeaderNoteSmall",
"feats");
ElementContainerCard elements
SourceMaterial.Row material
int GetDaysTogetherBonus()
override bool IsPCFaction
ElementContainer faithElements
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)
Element GetParent(Card c)
int SortVal(bool charaSheet=false)
ElementContainerFaction charaElements
static void SetSeed(int a=-1)