2using System.Collections.Generic;
4using System.Runtime.Serialization;
19 public Dictionary<int, Element>
dict =
new Dictionary<int, Element>();
25 [JsonProperty(PropertyName =
"A")]
37 list =
new List<int>();
58 for (
int i = 0; i <
list.Count; i += 5)
61 if (orCreateElement !=
null)
63 orCreateElement.vBase +=
list[i + 1];
64 orCreateElement.vExp +=
list[i + 2];
65 orCreateElement.vPotential +=
list[i + 3];
66 orCreateElement.vTempPotential =
list[i + 4];
67 orCreateElement.owner =
this;
74 int num = ((!invert) ? 1 : (-1));
76 foreach (KeyValuePair<int, int>
item in map)
79 int value =
item.Value;
82 if (orCreateElement.
source.category ==
"skill")
87 orCreateElement.vSource += num2;
88 if (applyFeat && orCreateElement is
Feat)
90 (orCreateElement as
Feat).Apply(num2,
this);
99 int num = ((!invert) ? 1 : (-1));
102 foreach (KeyValuePair<int, int>
item in material.elementMap)
104 int value =
item.Value;
110 if (!orCreateElement.
source.IsMaterialEncAppliable(t))
112 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vExp == 0 && orCreateElement.
vPotential == 0)
119 orCreateElement.vSource += num2;
120 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vExp == 0 && orCreateElement.
vPotential == 0)
130 foreach (KeyValuePair<int, int>
item in map)
138 for (
int i = 0; i < ints.Length; i += 2)
149 if (value.
HasTag(
"primary"))
151 value.vTempPotential = (value.ValueWithoutLink - ((mode != 2) ? 7 : 0)) * 5;
175 return element.
Value;
199 feat.Apply(feat.Value,
this);
215 return element.Value > 0;
223 public bool Has(
string alias)
239 num +=
Value(1516) * -4;
240 num +=
Value(1517) * 4;
243 num +=
Value(1524) * -4;
244 num +=
Value(1525) * 4;
255 public void Learn(
int ele,
int v = 1)
261 public void Train(
int ele,
int a = 10)
267 public void ModExp(
int ele,
int a,
bool chain =
false)
278 int value = (element.UsePotential ? element.Potential : 100);
281 float num = (float)a * (
float)Mathf.Clamp(value, 10, 1000) / (float)(100 + Mathf.Max(0, element.
ValueWithoutLink) * 25);
289 if (!chain && element.
source.parentFactor > 0f &&
Card !=
null && !element.
source.aliasParent.IsEmpty())
294 ModExp(element2.
id, (
int)Math.Max(1f, (
float)a * element.
source.parentFactor / 100f), chain:
true);
299 int num2 = element.vExp - element.
ExpToNext;
300 int vBase = element.
vBase;
303 element.vExp = Mathf.Clamp(num2 / 2, 0, element.
ExpToNext / 2);
306 element.vTempPotential -= element.vTempPotential / 4 +
EClass.
rnd(5) + 5;
309 element.vTempPotential = 0;
314 element.vTempPotential += -element.vTempPotential / 4 +
EClass.
rnd(5) + 5;
317 element.vTempPotential = 0;
321 else if (element.
vExp < 0)
328 int vBase2 = element.
vBase;
363 orCreateElement.vBase = v;
364 orCreateElement.vExp = 0;
365 orCreateElement.vPotential = potential;
367 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vPotential == 0 && orCreateElement.
vExp == 0)
371 return orCreateElement;
377 int num = v - (orCreateElement.vBase + orCreateElement.
vSource);
382 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vPotential == 0 && orCreateElement.
vExp == 0)
404 orCreateElement.vBase += v;
411 if (orCreateElement.
vBase == 0 && orCreateElement.
vSource == 0 && orCreateElement.
vLink == 0 && orCreateElement.
vPotential == 0 && orCreateElement.
vExp == 0)
415 return orCreateElement;
425 orCreateElement.vPotential += v;
428 orCreateElement.vPotential = 1000;
430 return orCreateElement;
436 orCreateElement.vTempPotential += v;
439 orCreateElement.vTempPotential = 1000;
442 return orCreateElement;
452 orCreateElement.vLink += v;
458 return orCreateElement;
464 int num = cost.cost * ((cost.type ==
Act.
CostType.SP) ? 20 : 5) * (100 + c.
Evalue(1208) * 30) / 100 + 10;
465 num = num * costMod / 100;
466 if (!e.
source.aliasParent.IsEmpty())
469 num = ((num2 < 0) ? (num * 100 / (100 - num2 * 25)) : (num * (100 + num2 * 5) / 100));
485 return dict.TryGetValue(
id);
495 element.owner =
this;
496 dict.Add(
id, element);
513 if (!
dict.TryGetValue(
id, out value))
537 if (newParent !=
null)
550 public List<Element>
ListElements(Func<Element, bool> shoudList =
null, Comparison<Element> comparison =
null)
552 List<Element>
list =
new List<Element>();
553 List<Element> eles =
dict.Values.ToList();
562 foreach (
Element item2
in eles)
564 if (shoudList ==
null || shoudList(item2))
569 if (comparison !=
null)
571 list.Sort(comparison);
576 if (container ==
null)
583 foreach (
Element item3
in eles)
585 if (value.
id == item3.
id)
591 if (flag && value.
Value != 0)
628 List<Element>
list =
new List<Element>();
629 foreach (KeyValuePair<int, Element>
item in c.elements.dict)
646 container.
dict.Clear();
647 foreach (KeyValuePair<int, Element>
item in dict)
649 Element element = container.CreateElement(
item.Key);
650 element.vBase =
item.Value.vBase;
651 element.vExp =
item.Value.vExp;
652 element.vSource =
item.Value.vSource;
674 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)
676 List<Element>
list =
new List<Element>();
687 element.owner =
this;
710 item.AddEncNote(n,
Card, mode, funcText, onAddNote);
716 Transform transform = n.AddExtra<Transform>(
"noteRace");
717 UINote n2 = transform.Find(
"note1").GetComponent<
UINote>();
718 UINote n3 = transform.Find(
"note2").GetComponent<
UINote>();
721 n3.AddHeader(
"HeaderNoteSmall",
"attributes");
725 n2.AddHeader(
"HeaderNoteSmall",
"skills");
729 n2.AddHeader(
"HeaderNoteSmall",
"feats");
ElementContainerCard elements
SourceMaterial.Row material
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)