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,
float a,
bool chain =
false)
294 if (!chain && element.
source.parentFactor > 0f &&
Card !=
null && !element.
source.aliasParent.IsEmpty())
299 ModExp(element2.
id, Mathf.Clamp(a * element.
source.parentFactor / 100f, 1f, 1000f), chain:
true);
303 element.vExp += (int)a;
306 int num = element.vExp - element.
ExpToNext;
307 int vBase = element.
vBase;
310 element.vExp = Mathf.Clamp(num / 2, 0, element.
ExpToNext / 2);
313 element.vTempPotential -= element.vTempPotential / 4 +
EClass.
rnd(5) + 5;
316 element.vTempPotential = 0;
321 element.vTempPotential += -element.vTempPotential / 4 +
EClass.
rnd(5) + 5;
324 element.vTempPotential = 0;
328 else if (element.
vExp < 0)
335 int vBase2 = element.
vBase;
370 orCreateElement.vBase = v;
371 orCreateElement.vExp = 0;
372 orCreateElement.vPotential = potential;
374 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vPotential == 0 && orCreateElement.
vExp == 0)
378 return orCreateElement;
384 int num = v - (orCreateElement.vBase + orCreateElement.
vSource);
389 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vPotential == 0 && orCreateElement.
vExp == 0)
411 orCreateElement.vBase += v;
418 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vPotential == 0 && orCreateElement.
vExp == 0)
422 return orCreateElement;
432 orCreateElement.vPotential += v;
435 orCreateElement.vPotential = 1000;
437 return orCreateElement;
443 orCreateElement.vTempPotential += v;
446 orCreateElement.vTempPotential = 1000;
449 return orCreateElement;
459 orCreateElement.vLink += v;
465 return orCreateElement;
471 int num = cost.cost * ((cost.type ==
Act.
CostType.SP) ? 20 : 5) * (100 + c.
Evalue(1208) * 30) / 100 + 10;
472 num = num * costMod / 100;
473 if (!e.
source.aliasParent.IsEmpty())
476 num = ((num2 < 0) ? (num * 100 / (100 - num2 * 25)) : (num * (100 + num2 * 5) / 100));
492 return dict.TryGetValue(
id);
502 element.owner =
this;
503 dict.Add(
id, element);
520 if (!
dict.TryGetValue(
id, out value))
544 if (newParent !=
null)
557 public List<Element>
ListElements(Func<Element, bool> shoudList =
null, Comparison<Element> comparison =
null)
559 List<Element>
list =
new List<Element>();
560 List<Element> eles =
dict.Values.ToList();
569 foreach (
Element item2
in eles)
571 if (shoudList ==
null || shoudList(item2))
576 if (comparison !=
null)
578 list.Sort(comparison);
583 if (container ==
null)
590 foreach (
Element item3
in eles)
592 if (value.
id == item3.
id)
598 if (flag && value.
Value != 0)
635 List<Element>
list =
new List<Element>();
636 foreach (KeyValuePair<int, Element>
item in c.elements.dict)
653 container.
dict.Clear();
654 foreach (KeyValuePair<int, Element>
item in dict)
656 Element element = container.CreateElement(
item.Key);
657 element.vBase =
item.Value.vBase;
658 element.vExp =
item.Value.vExp;
659 element.vSource =
item.Value.vSource;
681 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)
683 List<Element>
list =
new List<Element>();
694 element.owner =
this;
717 item.AddEncNote(n,
Card, mode, funcText, onAddNote);
723 Transform transform = n.AddExtra<Transform>(
"noteRace");
724 UINote n2 = transform.Find(
"note1").GetComponent<
UINote>();
725 UINote n3 = transform.Find(
"note2").GetComponent<
UINote>();
728 n3.AddHeader(
"HeaderNoteSmall",
"attributes");
732 n2.AddHeader(
"HeaderNoteSmall",
"skills");
736 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)
void ModExp(int ele, float a, bool chain=false)
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)
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)
virtual bool UsePotential
Element GetParent(Card c)
int SortVal(bool charaSheet=false)
ElementContainerFaction charaElements
static void SetSeed(int a=-1)