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 = Mathf.Max(30, (value.
ValueWithoutLink - ((mode != 2) ? 8 : 0)) * 7);
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 element.vPotential = 1;
276 public void Train(
int ele,
int a = 10)
282 public void ModExp(
int ele,
float a,
bool chain =
false)
307 if (!chain && element.
source.parentFactor > 0f &&
Card !=
null && !element.
source.aliasParent.IsEmpty())
312 ModExp(element2.
id, Mathf.Clamp(a * element.
source.parentFactor / 100f, 1f, 1000f), chain:
true);
316 element.vExp += (int)a;
319 int num = element.vExp - element.
ExpToNext;
320 int vBase = element.
vBase;
323 element.vExp = Mathf.Clamp(num / 2, 0, element.
ExpToNext / 2);
326 element.vTempPotential -= element.vTempPotential / 4 +
EClass.
rnd(5) + 5;
329 element.vTempPotential = 0;
334 element.vTempPotential += -element.vTempPotential / 4 +
EClass.
rnd(5) + 5;
337 element.vTempPotential = 0;
341 else if (element.
vExp < 0)
348 int vBase2 = element.
vBase;
383 orCreateElement.vBase = v;
384 orCreateElement.vExp = 0;
385 orCreateElement.vPotential = potential;
387 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vPotential == 0 && orCreateElement.
vExp == 0)
391 return orCreateElement;
397 int num = v - (orCreateElement.vBase + orCreateElement.
vSource);
402 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vPotential == 0 && orCreateElement.
vExp == 0)
418 element.owner =
null;
425 orCreateElement.vBase += v;
432 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vPotential == 0 && orCreateElement.
vExp == 0)
436 return orCreateElement;
446 orCreateElement.vPotential += v;
449 orCreateElement.vPotential = 1000;
451 return orCreateElement;
457 orCreateElement.vTempPotential += v;
460 orCreateElement.vTempPotential = 1000;
463 return orCreateElement;
473 orCreateElement.vLink += v;
479 return orCreateElement;
485 int num = cost.cost * ((cost.type ==
Act.
CostType.SP) ? 20 : 5) * (100 + c.
Evalue(1208) * 30) / 100 + 10;
486 num = num * costMod / 100;
487 if (!e.
source.aliasParent.IsEmpty())
494 num = ((num2 < 0) ? (num * 100 / (100 - num2 * 25)) : (num * (100 + num2 * 5) / 100));
510 return dict.TryGetValue(
id);
520 element.owner =
this;
521 dict.Add(
id, element);
538 if (!
dict.TryGetValue(
id, out value))
562 if (newParent !=
null)
575 public List<Element>
ListElements(Func<Element, bool> shoudList =
null, Comparison<Element> comparison =
null)
577 List<Element>
list =
new List<Element>();
578 List<Element> eles =
dict.Values.ToList();
587 foreach (
Element item2
in eles)
589 if (shoudList ==
null || shoudList(item2))
594 if (comparison !=
null)
596 list.Sort(comparison);
601 if (container ==
null)
608 foreach (
Element item3
in eles)
610 if (value.
id == item3.
id)
616 if (flag && value.
Value != 0)
653 List<Element>
list =
new List<Element>();
654 foreach (KeyValuePair<int, Element>
item in c.elements.dict)
671 container.
dict.Clear();
672 foreach (KeyValuePair<int, Element>
item in dict)
674 Element element = container.CreateElement(
item.Key);
675 element.vBase =
item.Value.vBase;
676 element.vExp =
item.Value.vExp;
677 element.vSource =
item.Value.vSource;
699 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)
701 List<Element>
list =
new List<Element>();
712 element.owner =
this;
735 item.AddEncNote(n,
Card, mode, funcText, onAddNote);
741 Transform transform = n.AddExtra<Transform>(
"noteRace");
742 UINote n2 = transform.Find(
"note1").GetComponent<
UINote>();
743 UINote n3 = transform.Find(
"note2").GetComponent<
UINote>();
746 n3.AddHeader(
"HeaderNoteSmall",
"attributes");
750 n2.AddHeader(
"HeaderNoteSmall",
"skills");
754 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 PotentialAsStock
virtual bool UsePotential
Element GetParent(Card c)
int SortVal(bool charaSheet=false)
ElementContainerFaction charaElements
static void SetSeed(int a=-1)