11 public static string GetName(
string alias)
13 return EClass.sources.elements.alias[alias].GetName();
19 return EClass.sources.elements.map[id];
25 return EClass.sources.elements.alias.TryGetValue(base.GetType().ToString(),
null);
35 if ((result = this._source) ==
null)
37 result = (this._source = (((this.id == 0) ? this.GetSource() :
Element.Get(this.
id)) ??
EClass.sources.elements.rows[0]));
45 public virtual int DisplayValue
55 public virtual int MinValue
69 return this.ValueWithoutLink + this.vLink + ((this.owner !=
null) ? this.owner.ValueBonus(
this) : 0);
75 public int ValueWithoutLink
79 return this.vBase + this.vSource;
85 public virtual int MinPotential
99 return this.vPotential + this.vTempPotential + this.vSourcePotential + this.MinPotential;
105 public virtual bool CanGainExp
109 return this.ValueWithoutLink > 0;
119 return this.source.tag.Contains(
"flag");
124 public virtual int GetSourcePotential(
int v)
130 public virtual Sprite GetSprite()
136 public int GetMaterialSourceValue(
Thing t,
int v)
144 return v * (100 + t.encLV * 10) / 100;
150 return Mathf.Min(v + t.encLV * 10, 60);
154 public virtual int GetSourceValue(
int v,
int lv, SourceValueType type)
156 if (type == SourceValueType.Chara)
158 return v * (100 + (lv - 1 +
EClass.rnd(lv / 2 + 1)) * this.source.lvFactor / 10) / 100 +
EClass.rnd(lv / 3) * this.source.lvFactor / 100;
160 if (type != SourceValueType.Fixed)
162 return v * ((this.source.encFactor == 0) ? 100 : (50 +
EClass.rnd(100) +
EClass.rnd((
int)Mathf.Sqrt((
float)(lv * 100))) *
this.source.encFactor / 100)) / 100;
169 public virtual string Name
173 return this.source.GetName();
179 public virtual string FullName
188 public virtual Sprite GetIcon(
string suffix =
"")
191 if ((result = SpriteSheet.Get(
"Media/Graphics/Icon/Element/icon_elements",
"ele_" +
this.source.alias + suffix)) ==
null)
193 result = (SpriteSheet.Get(
"Media/Graphics/Icon/Element/icon_elements",
"ele_" + this.source.aliasParent + suffix) ?? SpriteSheet.Get(
"Media/Graphics/Icon/Element/icon_elements",
"cat_" +
this.source.category));
200 public virtual int ExpToNext
210 public virtual bool UseExpMod
220 public virtual int CostTrain
224 return Mathf.Max((this.ValueWithoutLink / 10 + 5) * (100 + this.vTempPotential) / 500, 1);
230 public virtual int CostLearn
240 public virtual bool ShowXP
244 return EClass.debug.showExtra || this.source.category !=
"attribute";
250 public virtual bool ShowMsgOnValueChanged
260 public virtual bool ShowValue
270 public virtual bool ShowPotential
280 public virtual bool UsePotential
290 public virtual bool PotentialAsStock
300 public virtual bool ShowRelativeAttribute
310 public virtual string ShortName
320 public bool IsGlobalElement
324 return this.vExp == -1 || this.vExp == -2;
330 public bool IsFactionWideElement
334 return this.vExp == -1;
340 public bool IsPartyWideElement
344 return this.vExp == -2;
349 public int SortVal(
bool charaSheet =
false)
351 int num = (this.source.sort != 0) ? this.source.sort : this.id;
352 return (this.IsFlag ? 100000 : 0) + ((!charaSheet && this.IsGlobalElement) ? -1000000 : 0) + num;
363 public virtual bool ShowEncNumber
377 return this.source.tag.Contains(
"trait");
383 public bool IsFoodTrait
387 return !this.source.foodEffect.IsEmpty();
393 public bool IsFoodTraitMain
397 return this.IsFoodTrait && (this.source.tag.Contains(
"primary") || this.source.tag.Contains(
"foodpot"));
403 public bool IsMainAttribute
407 return this.source.category ==
"attribute" && this.source.tag.Contains(
"primary");
417 return (
this as
Act) ??
ACT.Create(this.
id);
422 public bool HasTag(
string tag)
424 return this.source.tag.Contains(tag);
428 public void SetImage(Image i)
430 Sprite icon = this.GetIcon(
"");
439 public virtual string GetDetail()
441 return this.source.GetDetail();
445 public bool IsFactionElement(
Chara c)
453 foreach (
Element element
in EClass.pc.faction.charaElements.dict.Values)
455 if (element.id ==
this.id && element.Value > 0)
461 if (c.faithElements !=
null)
463 foreach (
Element element2
in c.faithElements.dict.Values)
465 if (element2.id ==
this.id && element2.Value > 0)
477 if (!this.source.aliasParent.IsEmpty())
479 return c.elements.GetOrCreateElement(this.source.aliasParent);
485 public static Dictionary<int, int> GetElementMap(
int[] list)
487 Dictionary<int, int> dictionary =
new Dictionary<int, int>();
490 for (
int i = 0; i < list.Length / 2; i++)
492 dictionary[list[i * 2]] = list[i * 2 + 1];
499 public static Dictionary<int, int> GetElementMap(
int[] list, Dictionary<int, int> map)
503 for (
int i = 0; i < list.Length / 2; i++)
505 map[list[i * 2]] = list[i * 2 + 1];
514 if (
Element.ListElements.Count == 0)
518 if (row.categorySub ==
"eleAttack" && row.chance > 0)
527 int num = 40 * (row2.eleP - 100) / 100;
528 if (list.Count == 0 || num < lv)
530 list.Add(
new Tuple<SourceElement.Row, int>(row2, num));
533 return list.RandomItemWeighted((Tuple<SourceElement.Row, int> a) => (
float)(10000 / (100 + (lv - a.Item2) * 25))).Item1;
537 public void WriteNote(UINote n,
ElementContainer owner =
null, Action<UINote> onWriteNote =
null)
540 this._WriteNote(n, owner, onWriteNote,
false,
true);
548 this._WriteNote(n, owner, onWriteNote,
false,
true);
549 refEle._WriteNote(n, owner, onWriteNote,
true,
true);
554 public void _WriteNote(UINote n,
Chara c,
Act act)
556 Element.<>c__DisplayClass101_0 CS$<>8__locals1;
557 CS$<>8__locals1.c = c;
558 CS$<>8__locals1.e = CS$<>8__locals1.c.elements.GetOrCreateElement(act.source.id);
559 Act.Cost cost = CS$<>8__locals1.e.GetCost(CS$<>8__locals1.c);
560 CS$<>8__locals1.p = CS$<>8__locals1.e.GetPower(CS$<>8__locals1.c);
562 string text = this.source.GetText(
"textExtra",
false);
565 foreach (
string text2
in text.Split(
',', StringSplitOptions.None))
567 if (text2.StartsWith(
"@"))
569 Condition condition =
Condition.Create(text2.Replace(
"@",
""), CS$<>8__locals1.p,
null);
570 condition.owner = CS$<>8__locals1.c;
571 if (!this.source.aliasRef.IsEmpty())
573 condition.SetElement(
EClass.sources.elements.alias[
this.source.aliasRef].id);
578 if (num == 8510 || num == 8710)
580 condition.SetRefVal(79, (act.id == 8710) ? 221 : 220);
585 condition.SetRefVal(79, 266);
587 n.AddText(
"_bullet".lang() +
"hintCon".lang(condition.Name, condition.EvaluateTurn(CS$<>8__locals1.p).ToString() ??
"",
null,
null,
null), FontColor.DontChange);
588 condition._WriteNote(n,
true);
592 string text3 = text2.Replace(
"#calc",
Element.<_WriteNote>g__Calc|101_0(ref CS$<>8__locals1));
593 if (!this.source.aliasRef.IsEmpty())
595 text3 = text3.Replace(
"#ele",
EClass.sources.elements.alias[
this.source.aliasRef].GetName().ToLower());
597 n.AddText(
"_bullet".lang() + text3, FontColor.DontChange);
601 if (this.source.tag.Contains(
"syncRide"))
603 n.AddText(
"_bullet".lang() +
"hintSyncRide".lang(), FontColor.DontChange);
605 if (act.HaveLongPressAction)
608 if (i != 8230 && i != 8232)
610 n.AddText(
"_bullet".lang() +
"hintPartyAbility".lang(), FontColor.DontChange);
616 n.AddText(
"isGlobalAct".lang(), FontColor.DontChange);
618 if (cost.type !=
Act.CostType.None && cost.cost != 0)
621 UIItem uiitem = n.AddExtra<UIItem>(
"costPrice");
622 uiitem.text1.SetText(cost.cost.ToString() ??
"", (((cost.type ==
Act.CostType.MP) ? CS$<>8__locals1.c.mana.value : CS$<>8__locals1.c.stamina.value) >= cost.cost) ? FontColor.Good : FontColor.Bad);
623 uiitem.image1.sprite = ((cost.type ==
Act.CostType.MP) ? EClass.core.refs.icons.mana :
EClass.core.refs.icons.stamina);
624 uiitem.image1.SetNativeSize();
629 public void _WriteNote(UINote n,
ElementContainer owner, Action<UINote> onWriteNote,
bool isRef,
bool addHeader =
true)
635 UIText.globalSizeMod = -2;
636 n.AddHeader(
"prevElement".lang(this.FullName,
null,
null,
null,
null),
null);
640 n.AddHeader(this.FullName.ToTitleCase(
true),
null);
643 string detail = this.GetDetail();
644 if (!detail.IsEmpty())
646 n.AddText(
"NoteText_flavor_element", detail, FontColor.DontChange);
649 int num = this.vLink;
650 bool flag = this.ShowValue;
651 bool flag2 = this.ShowRelativeAttribute;
652 if (this.source.category ==
"landfeat")
659 Act act =
ACT.Create(this.source.id);
660 UIItem uiitem = n.AddItem(
"ItemAbility");
661 uiitem.text1.text =
"vValue".lang(this.DisplayValue.ToString() ??
"",
this.ValueWithoutLink.ToString() + ((num == 0) ?
"" : ((num > 0) ? (
" + " + num.ToString()) : (
" - " + (-num).ToString()))),
null,
null,
null);
662 uiitem.text2.text = act.TargetType.ToString().lang();
663 uiitem.text3.text = (((
this is
Spell) ? (owner.Chara.CalcCastingChance(owner.GetOrCreateElement(act.source.id), 1).ToString() +
"%") :
"-") ??
"");
667 n.AddTopic(
"TopicLeft",
"vCurrent".lang(),
"vValue".lang(this.DisplayValue.ToString() ??
"",
this.ValueWithoutLink.ToString() + ((num == 0) ?
"" : ((num > 0) ? (
" + " + num.ToString()) : (
" - " + (-num).ToString()))),
null,
null,
null));
668 if (this.ShowPotential)
670 num = this.vTempPotential;
671 n.AddTopic(
"TopicLeft",
"vPotential".lang(),
"vValue".lang(this.Potential.ToString() ??
"", (
this.vPotential +
this.vSourcePotential +
this.MinPotential).ToString() + ((num == 0) ?
"" : ((num > 0) ? (
" + " + num.ToString()) : (
" - " + (-num).ToString()))),
null,
null,
null));
673 bool potentialAsStock = this.PotentialAsStock;
675 if (flag2 && !this.source.aliasParent.IsEmpty())
678 UIItem uiitem2 = n.AddItem(
"ItemRelativeAttribute");
679 uiitem2.text1.SetText(element.Name);
680 element.SetImage(uiitem2.image1);
681 bool flag3 = this.source.lvFactor > 0 &&
this is
Act;
682 uiitem2.text2.SetActive(flag3);
683 uiitem2.text3.SetActive(flag3);
686 uiitem2.text2.SetText(this.GetPower(
EClass.pc).ToString() ??
"");
689 this.OnWriteNote(n, owner);
690 if (
EClass.debug.showExtra)
692 string text =
"TopicLeft";
693 string text2 =
"Class:";
694 Type type = base.GetType();
695 n.AddTopic(text, text2, ((type !=
null) ? type.ToString() :
null) ??
"");
696 n.AddTopic(
"TopicLeft",
"vExp".lang(), this.vExp.ToString() ??
"");
697 n.AddTopic(
"TopicLeft",
"vSource", this.vSource.ToString() ??
"");
698 n.AddTopic(
"TopicLeft",
"vSourcePotential", this.vSourcePotential.ToString() ??
"");
699 n.AddTopic(
"TopicLeft",
"vPotential", this.vPotential.ToString() ??
"");
700 n.AddTopic(
"TopicLeft",
"Potential", this.Potential.ToString() ??
"");
702 this.CheckLevelBonus(owner, n);
703 if (onWriteNote !=
null)
707 UIText.globalSizeMod = 0;
716 public virtual void OnChangeValue()
723 if (owner ==
null || this.source.levelBonus.IsEmpty())
727 bool flag = n ==
null;
728 string[] array = (this.source.GetText(
"levelBonus",
true) ?? this.source.levelBonus).Split(Environment.NewLine.ToCharArray());
733 string[] array2 = array;
734 for (
int i = 0; i < array2.Length; i++)
736 string text = array2[i];
737 string[] array3 = text.Split(
',', StringSplitOptions.None);
738 int lv = array3[0].ToInt();
742 if (lv > this.ValueWithoutLink)
748 owner.Learn(row.id, 1);
753 string s = (row !=
null) ? row.GetName() : array3[1];
754 n.AddText((
" Lv " + lv.ToString()).TagColor(FontColor.Topic,
null) +
" " + s.TagColorGoodBad(delegate()
758 return owner.Has(row.id);
760 return lv <= this.ValueWithoutLink;
761 }, () =>
false,
false), FontColor.DontChange);
771 public int GetSortVal(UIList.SortMode m)
773 if (m == UIList.SortMode.ByNumber)
775 return -this.vPotential * 10000 + this.source.id;
777 if (m == UIList.SortMode.ByCategory)
779 return this.source.id + (this.source.aliasParent.IsEmpty() ? 0 : (
EClass.sources.elements.alias[
this.source.aliasParent].id * 10000));
781 if (m != UIList.SortMode.ByElementParent)
783 return this.source.id;
785 if (!this.source.aliasParent.IsEmpty())
787 return EClass.sources.elements.alias[this.source.aliasParent].sort;
795 if (this.source.cost[0] == 0)
799 type = Act.CostType.None
805 cost.type =
Act.CostType.MP;
806 int num =
EClass.curve(this.Value, 50, 10, 75);
807 cost.cost = this.source.cost[0] * (100 + (this.source.tag.Contains(
"noCostInc") ? 0 : (num * 3))) / 100;
811 cost.type =
Act.CostType.SP;
812 cost.cost = this.source.cost[0];
813 if (this.source.id == 6020)
815 cost.cost = c.stamina.max / 3 + 10;
818 if (!c.IsPC && cost.cost > 2)
826 public virtual int GetPower(
Card c)
832 public virtual void SetTextValue(UIText text)
834 string text2 = this.DisplayValue.ToString() ??
"";
837 text2 +=
".".TagSize((this.vExp / 10).ToString(
"D2") ??
"", 11);
841 string str = ((this.vLink > 0) ?
"+" :
"") + this.vLink.ToString();
842 text2 =
string.Concat(
new string[]
845 ((this.DisplayValue > this.ValueWithoutLink) ? SkinManager.CurrentColors.textGood : SkinManager.CurrentColors.textBad).ToHex(),
848 (
" (" + str +
")").TagSize(13),
856 public static Element Create(
int id,
int v = 0)
863 Element element = ClassCache.Create<
Element>(row.type.IsEmpty(
"Element"),
"Elin");
866 element._source = row;
871 public static Element Create(
string id,
int v = 1)
873 return Element.Create(
EClass.sources.elements.alias[
id].id, v);
877 public static int GetId(
string alias)
879 return EClass.sources.elements.alias[alias].id;
883 public static int GetResistLv(
int v)
894 public static int GetResistDamage(
int dmg,
int v)
896 int resistLv =
Element.GetResistLv(v);
919 internal static string <_WriteNote>g__Calc|101_0(ref
Element.<>c__DisplayClass101_0 A_0)
921 Dice dice =
Dice.Create(A_0.e, A_0.c);
924 return A_0.p.ToString() ??
"";
926 return dice.ToString();
930 public const int Div = 5;
936 public static int[] List_MainAttributes =
new int[]
950 public static int[] List_MainAttributesMajor =
new int[]
963 public static int[] List_Body =
new int[]
972 public static int[] List_Mind =
new int[]
993 public int vPotential;
996 public int vTempPotential;
1005 public int vSourcePotential;