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")
97 orCreateElement.vSource += (int)num2;
98 if (applyFeat && orCreateElement is
Feat)
100 (orCreateElement as
Feat).Apply((
int)num2,
this);
109 int num = ((!invert) ? 1 : (-1));
112 foreach (KeyValuePair<int, int>
item in material.elementMap)
114 int value =
item.Value;
120 if (!orCreateElement.
source.IsMaterialEncAppliable(t))
122 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vExp == 0 && orCreateElement.
vPotential == 0)
129 orCreateElement.vSource += num2;
130 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vExp == 0 && orCreateElement.
vPotential == 0)
140 foreach (KeyValuePair<int, int>
item in map)
148 for (
int i = 0; i < ints.Length; i += 2)
159 if (value.
HasTag(
"primary"))
161 value.vTempPotential = (value.ValueWithoutLink - ((mode != 2) ? 7 : 0)) * 5;
185 return element.
Value;
209 feat.Apply(feat.Value,
this);
225 return element.Value > 0;
233 public bool Has(
string alias)
249 num +=
Value(1516) * -4;
250 num +=
Value(1517) * 4;
253 num +=
Value(1524) * -4;
254 num +=
Value(1525) * 4;
265 public void Learn(
int ele,
int v = 1)
271 public void Train(
int ele,
int a = 10)
277 public void ModExp(
int ele,
float a,
bool chain =
false)
302 if (!chain && element.
source.parentFactor > 0f &&
Card !=
null && !element.
source.aliasParent.IsEmpty())
307 ModExp(element2.
id, Mathf.Clamp(a * element.
source.parentFactor / 100f, 1f, 1000f), chain:
true);
311 element.vExp += (int)a;
314 int num = element.vExp - element.
ExpToNext;
315 int vBase = element.
vBase;
318 element.vExp = Mathf.Clamp(num / 2, 0, element.
ExpToNext / 2);
321 element.vTempPotential -= element.vTempPotential / 4 +
EClass.
rnd(5) + 5;
324 element.vTempPotential = 0;
329 element.vTempPotential += -element.vTempPotential / 4 +
EClass.
rnd(5) + 5;
332 element.vTempPotential = 0;
336 else if (element.
vExp < 0)
343 int vBase2 = element.
vBase;
378 orCreateElement.vBase = v;
379 orCreateElement.vExp = 0;
380 orCreateElement.vPotential = potential;
382 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vPotential == 0 && orCreateElement.
vExp == 0)
386 return orCreateElement;
392 int num = v - (orCreateElement.vBase + orCreateElement.
vSource);
397 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vPotential == 0 && orCreateElement.
vExp == 0)
419 orCreateElement.vBase += v;
426 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vPotential == 0 && orCreateElement.
vExp == 0)
430 return orCreateElement;
440 orCreateElement.vPotential += v;
443 orCreateElement.vPotential = 1000;
445 return orCreateElement;
451 orCreateElement.vTempPotential += v;
454 orCreateElement.vTempPotential = 1000;
457 return orCreateElement;
467 orCreateElement.vLink += v;
473 return orCreateElement;
479 int num = cost.cost * ((cost.type ==
Act.
CostType.SP) ? 20 : 5) * (100 + c.
Evalue(1208) * 30) / 100 + 10;
480 num = num * costMod / 100;
481 if (!e.
source.aliasParent.IsEmpty())
484 num = ((num2 < 0) ? (num * 100 / (100 - num2 * 25)) : (num * (100 + num2 * 5) / 100));
500 return dict.TryGetValue(
id);
510 element.owner =
this;
511 dict.Add(
id, element);
528 if (!
dict.TryGetValue(
id, out value))
552 if (newParent !=
null)
565 public List<Element>
ListElements(Func<Element, bool> shoudList =
null, Comparison<Element> comparison =
null)
567 List<Element>
list =
new List<Element>();
568 List<Element> eles =
dict.Values.ToList();
577 foreach (
Element item2
in eles)
579 if (shoudList ==
null || shoudList(item2))
584 if (comparison !=
null)
586 list.Sort(comparison);
591 if (container ==
null)
598 foreach (
Element item3
in eles)
600 if (value.
id == item3.
id)
606 if (flag && value.
Value != 0)
643 List<Element>
list =
new List<Element>();
644 foreach (KeyValuePair<int, Element>
item in c.elements.dict)
661 container.
dict.Clear();
662 foreach (KeyValuePair<int, Element>
item in dict)
664 Element element = container.CreateElement(
item.Key);
665 element.vBase =
item.Value.vBase;
666 element.vExp =
item.Value.vExp;
667 element.vSource =
item.Value.vSource;
689 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)
691 List<Element>
list =
new List<Element>();
702 element.owner =
this;
725 item.AddEncNote(n,
Card, mode, funcText, onAddNote);
731 Transform transform = n.AddExtra<Transform>(
"noteRace");
732 UINote n2 = transform.Find(
"note1").GetComponent<
UINote>();
733 UINote n3 = transform.Find(
"note2").GetComponent<
UINote>();
736 n3.AddHeader(
"HeaderNoteSmall",
"attributes");
740 n2.AddHeader(
"HeaderNoteSmall",
"skills");
744 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()
virtual long GetSourceValue(long v, int lv, SourceValueType type)
int GetMaterialSourceValue(Thing t, int v)
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)