Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
ElementContainer Class Reference
Inheritance diagram for ElementContainer:
EClass ElementContainerCard ElementContainerFaction ElementContainerZone

Public Types

enum  NoteMode {
  Default , CharaMake , CharaMakeAttributes , Domain ,
  Trait
}
 

Public Member Functions

void ApplyElementMap (int uid, SourceValueType type, Dictionary< int, int > map, int lv, bool invert=false, bool applyFeat=false)
 
void ApplyMaterialElementMap (Thing t, bool invert=false)
 
void ImportElementMap (Dictionary< int, int > map)
 
ElementContainer ImportElementMap (int[] ints)
 
void ApplyPotential (int mode=0)
 
int Value (int ele)
 
virtual int ValueBonus (Element e)
 
int ValueWithoutLink (int ele)
 
int ValueWithoutLink (string alias)
 
int GetFeatRef (int ele, int idx=0)
 
int Exp (int ele)
 
bool Has (int ele)
 
bool Has (SourceElement.Row row)
 
bool Has (string alias)
 
bool HasBase (int ele)
 
int Base (int ele)
 
void Learn (int ele, int v=1)
 
void Train (int ele, int a=10)
 
void ModExp (int ele, int a, bool chain=false)
 
virtual void OnLearn (int ele)
 
virtual void OnTrain (int ele)
 
virtual void OnLevelUp (Element e, int lastValue)
 
virtual void OnLevelDown (Element e, int lastValue)
 
Element SetBase (string alias, int v, int potential=0)
 
Element SetBase (int id, int v, int potential=0)
 
void SetTo (int id, int v)
 
void Remove (int id)
 
Element ModBase (int ele, int v)
 
virtual void OnChangeValue ()
 
Element ModPotential (int ele, int v)
 
Element ModTempPotential (int ele, int v, int threshMsg=0)
 
virtual void OnModTempPotential (Element e, int v, int threshMsg)
 
int GetSpellExp (Chara c, Element e, int costMod=100)
 
Element GetElement (string alias)
 
Element GetElement (int id)
 
Element CreateElement (int id)
 
Element GetOrCreateElement (Element ele)
 
Element GetOrCreateElement (string alias)
 
Element GetOrCreateElement (int id)
 
void SetParent (Card c)
 
void SetParent (ElementContainer newParent=null)
 
List< ElementListElements (Func< Element, bool > shoudList=null, Comparison< Element > comparison=null)
 
List< ElementListBestAttributes ()
 
List< ElementListBestSkills ()
 
List< ElementListGeneFeats ()
 
List< ElementListLearnable (Chara c)
 
List< ElementListRune ()
 
void CopyTo (ElementContainer container)
 
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 AddNoteAll (UINote n)
 

Static Public Member Functions

static int GetSortVal (Element a)
 
- Static Public Member Functions inherited from EClass
static int rnd (int a)
 
static int curve (int a, int start, int step, int rate=75)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 

Public Attributes

Dictionary< int, Elementdict = new Dictionary<int, Element>()
 
ElementContainer parent
 
List< int > list
 

Static Public Attributes

const int sizeElement = 5
 
- Static Public Attributes inherited from EClass
static Core core
 

Properties

virtual Card Card [get]
 
virtual Chara Chara [get]
 
virtual bool IsMeleeWeapon [get]
 
- Properties inherited from EClass
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Faction Wilds [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 

Private Member Functions

void OnSerializing (StreamingContext context)
 
void OnDeserialized (StreamingContext context)
 
Element ModLink (int id, int v)
 

Detailed Description

Definition at line 9 of file ElementContainer.cs.

Member Enumeration Documentation

◆ NoteMode

Enumerator
Default 
CharaMake 
CharaMakeAttributes 
Domain 
Trait 

Definition at line 11 of file ElementContainer.cs.

Member Function Documentation

◆ AddNote()

void ElementContainer.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 
)
inline

Definition at line 675 of file ElementContainer.cs.

676 {
677 List<Element> list = new List<Element>();
678 foreach (Element value2 in dict.Values)
679 {
680 if ((isValid == null || isValid(value2)) && (mode != NoteMode.CharaMake || value2.ValueWithoutLink != 0) && (value2.Value != 0 || mode == NoteMode.CharaMakeAttributes) && (!value2.HasTag("hidden") || EClass.debug.showExtra))
681 {
682 list.Add(value2);
683 }
684 }
685 if (addRaceFeat)
686 {
687 Element element = Element.Create(29, 1);
688 element.owner = this;
689 list.Add(element);
690 }
691 if (list.Count == 0)
692 {
693 return;
694 }
695 onAdd?.Invoke();
696 switch (mode)
697 {
698 case NoteMode.CharaMake:
699 case NoteMode.CharaMakeAttributes:
700 list.Sort((Element a, Element b) => a.GetSortVal(UIList.SortMode.ByElementParent) - b.GetSortVal(UIList.SortMode.ByElementParent));
701 break;
702 case NoteMode.Trait:
703 list.Sort((Element a, Element b) => GetSortVal(b) - GetSortVal(a));
704 break;
705 default:
706 list.Sort((Element a, Element b) => a.SortVal() - b.SortVal());
707 break;
708 }
709 string text = "";
710 foreach (Element e in list)
711 {
712 switch (mode)
713 {
714 case NoteMode.Domain:
715 n.AddText(e.Name, FontColor.Default);
716 continue;
717 case NoteMode.Default:
718 case NoteMode.Trait:
719 {
720 bool flag = e.source.tag.Contains("common");
721 string categorySub = e.source.categorySub;
722 bool flag2 = false;
723 bool flag3 = (e.source.tag.Contains("neg") ? (e.Value > 0) : (e.Value < 0));
724 int num = Mathf.Abs(e.Value);
725 bool flag4 = Card != null && Card.ShowFoodEnc;
726 bool flag5 = Card != null && Card.IsWeapon && e is Ability;
727 if (e.IsTrait || (flag4 && e.IsFoodTrait))
728 {
729 string[] textArray = e.source.GetTextArray("textAlt");
730 int num2 = Mathf.Clamp(e.Value / 10 + 1, (e.Value < 0 || textArray.Length <= 2) ? 1 : 2, textArray.Length - 1);
731 text = "altEnc".lang(textArray[0].IsEmpty(e.Name), textArray[num2], EClass.debug.showExtra ? (e.Value + " " + e.Name) : "");
732 flag3 = num2 <= 1 || textArray.Length <= 2;
733 flag2 = true;
734 }
735 else if (flag5)
736 {
737 text = "isProc".lang(e.Name);
738 flag3 = false;
739 }
740 else if (categorySub == "resist")
741 {
742 text = ("isResist" + (flag3 ? "Neg" : "")).lang(e.Name);
743 }
744 else if (categorySub == "eleAttack")
745 {
746 text = "isEleAttack".lang(e.Name);
747 }
748 else if (!e.source.textPhase.IsEmpty() && e.Value > 0)
749 {
750 text = e.source.GetText("textPhase");
751 }
752 else
753 {
754 string name = e.Name;
755 bool flag6 = e.source.category == "skill" || (e.source.category == "attribute" && !e.source.textPhase.IsEmpty());
756 bool flag7 = e.source.category == "enchant";
757 if (e.source.tag.Contains("multiplier"))
758 {
759 flag6 = (flag7 = false);
760 name = EClass.sources.elements.alias[e.source.aliasRef].GetName();
761 }
762 flag2 = !(flag6 || flag7);
763 text = (flag6 ? "textEncSkill" : (flag7 ? "textEncEnc" : "textEnc")).lang(name, num + (e.source.tag.Contains("ratio") ? "%" : ""), ((e.Value > 0) ? "encIncrease" : "encDecrease").lang());
764 }
765 int num3 = ((!(e is Resistance)) ? 1 : 0);
766 int num4 = 5;
767 if (e.id == 484)
768 {
769 num3 = 0;
770 num4 = 1;
771 }
772 if (!flag && !flag2 && !e.source.tag.Contains("flag"))
773 {
774 text = text + " [" + "*".Repeat(Mathf.Clamp(num * e.source.mtp / num4 + num3, 1, 5)) + ((num * e.source.mtp / num4 + num3 > 5) ? "+" : "") + "]";
775 }
776 if (e.HasTag("hidden"))
777 {
778 text = "(debug)" + text;
779 }
780 FontColor color = (flag ? FontColor.Default : (flag3 ? FontColor.Bad : FontColor.Good));
781 if (e.IsGlobalElement)
782 {
783 text = text + " " + (e.IsFactionWideElement ? "_factionWide" : "_partyWide").lang();
784 if (!e.IsActive(Card))
785 {
786 continue;
787 }
788 color = FontColor.Myth;
789 }
790 if (flag4 && e.IsFoodTrait && !e.IsFoodTraitMain)
791 {
792 color = FontColor.FoodMisc;
793 }
794 if (e.id == 2 && e.Value >= 0)
795 {
796 color = FontColor.FoodQuality;
797 }
798 if (funcText != null)
799 {
800 text = funcText(e, text);
801 }
802 UIItem uIItem = n.AddText("NoteText_enc", text, color);
803 Sprite sprite = EClass.core.refs.icons.enc.enc;
804 Thing thing = Card?.Thing;
805 if (thing != null)
806 {
807 if (thing.material.HasEnc(e.id))
808 {
809 sprite = EClass.core.refs.icons.enc.mat;
810 }
811 foreach (int key in thing.source.elementMap.Keys)
812 {
813 if (key == e.id)
814 {
815 sprite = EClass.core.refs.icons.enc.card;
816 }
817 }
818 if (e.id == thing.GetInt(107))
819 {
820 sprite = EClass.core.refs.icons.enc.cat;
821 }
822 if (thing.GetRuneEnc(e.id) != null)
823 {
824 sprite = EClass.core.refs.icons.enc.rune;
825 }
826 }
827 if ((bool)sprite)
828 {
829 uIItem.image1.SetActive(enable: true);
830 uIItem.image1.sprite = sprite;
831 }
832 uIItem.image2.SetActive(e.source.IsWeaponEnc);
833 onAddNote?.Invoke(n, e);
834 continue;
835 }
836 }
837 UIItem uIItem2 = n.AddTopic("TopicAttribute", e.Name, "".TagColor((e.ValueWithoutLink > 0) ? SkinManager.CurrentColors.textGood : SkinManager.CurrentColors.textBad, e.ValueWithoutLink.ToString() ?? ""));
838 if ((bool)uIItem2.button1)
839 {
840 uIItem2.button1.tooltip.onShowTooltip = delegate(UITooltip t)
841 {
843 };
844 }
845 e.SetImage(uIItem2.image1);
846 Image image = uIItem2.image2;
847 int value = (e.Potential - 80) / 20;
848 image.enabled = e.Potential != 80;
849 image.sprite = EClass.core.refs.spritesPotential[Mathf.Clamp(Mathf.Abs(value), 0, EClass.core.refs.spritesPotential.Count - 1)];
850 image.color = ((e.Potential - 80 >= 0) ? Color.white : new Color(1f, 0.7f, 0.7f));
851 }
852 }
FontColor
Definition: FontColor.cs:2
int GetInt(int id, int? defaultInt=null)
Definition: BaseCard.cs:25
Definition: Card.cs:11
ElementContainerCard elements
Definition: Card.cs:37
SourceMaterial.Row material
Definition: Card.cs:1927
SocketData GetRuneEnc(int idEle)
Definition: Card.cs:3371
virtual Thing Thing
Definition: Card.cs:1934
bool ShowFoodEnc
Definition: Card.cs:2054
bool showExtra
Definition: CoreDebug.cs:167
List< Sprite > spritesPotential
Definition: CoreRef.cs:359
Icons icons
Definition: CoreRef.cs:339
CoreRef refs
Definition: Core.cs:51
Definition: EClass.cs:5
static Core core
Definition: EClass.cs:6
static SourceManager sources
Definition: EClass.cs:42
static Chara pc
Definition: EClass.cs:14
static CoreDebug debug
Definition: EClass.cs:48
static int GetSortVal(Element a)
Dictionary< int, Element > dict
int ValueWithoutLink
Definition: ELEMENT.cs:284
int id
Definition: ELEMENT.cs:240
SourceElement.Row source
Definition: ELEMENT.cs:263
bool HasTag(string tag)
Definition: ELEMENT.cs:463
int GetSortVal(UIList.SortMode m)
Definition: ELEMENT.cs:834
void SetImage(Image i)
Definition: ELEMENT.cs:468
int Value
Definition: ELEMENT.cs:282
bool IsFoodTrait
Definition: ELEMENT.cs:354
virtual string Name
Definition: ELEMENT.cs:294
static Element Create(int id, int v=0)
Definition: ELEMENT.cs:913
void WriteNote(UINote n, ElementContainer owner=null, Action< UINote > onWriteNote=null)
Definition: ELEMENT.cs:574
bool IsGlobalElement
Definition: ELEMENT.cs:335
bool IsTrait
Definition: ELEMENT.cs:352
bool IsFoodTraitMain
Definition: ELEMENT.cs:357
bool IsActive(Card c)
Definition: ELEMENT.cs:443
int SortVal(bool charaSheet=false)
Definition: ELEMENT.cs:452
static SkinColorProfile CurrentColors
Definition: SkinManager.cs:84
SourceElement elements
Definition: Thing.cs:8
SourceThing.Row source
Definition: Thing.cs:11
Definition: UIItem.cs:5
Image image2
Definition: UIItem.cs:16
UIButton button1
Definition: UIItem.cs:18
Image image1
Definition: UIItem.cs:14
Definition: UIList.cs:9
SortMode
Definition: UIList.cs:27
UIItem AddTopic(string id, string text, string value=null)
Definition: UINote.cs:144
UIItem AddText(string text, FontColor color=FontColor.DontChange)
Definition: UINote.cs:113
UINote note
Definition: UITooltip.cs:21

References UIItem.button1, CoreRef.Icons.Enc.card, CoreRef.Icons.Enc.cat, Color, EClass.core, Element.Create(), SkinManager.CurrentColors, EClass.debug, dict, Card.elements, SourceManager.elements, CoreRef.Icons.Enc.enc, CoreRef.Icons.enc, BaseCard.GetInt(), Card.GetRuneEnc(), GetSortVal(), Element.GetSortVal(), Element.HasTag(), CoreRef.icons, Element.id, UIItem.image1, UIItem.image2, Element.IsActive(), Element.IsFoodTrait, Element.IsFoodTraitMain, Element.IsGlobalElement, Element.IsTrait, list, CoreRef.Icons.Enc.mat, Card.material, Element.Name, UITooltip.note, EClass.pc, Core.refs, CoreRef.Icons.Enc.rune, Element.SetImage(), CoreDebug.showExtra, Card.ShowFoodEnc, Element.SortVal(), Element.source, Thing.source, EClass.sources, CoreRef.spritesPotential, SkinColorProfile.textBad, SkinColorProfile.textGood, Card.Thing, Element.Value, Element.ValueWithoutLink, and Element.WriteNote().

Referenced by AddNoteAll(), UICharaMaker.Refresh(), RecipeCard.WriteNote(), and Thing.WriteNote().

◆ AddNoteAll()

void ElementContainer.AddNoteAll ( UINote  n)
inline

Definition at line 854 of file ElementContainer.cs.

855 {
856 Transform transform = n.AddExtra<Transform>("noteRace");
857 UINote n2 = transform.Find("note1").GetComponent<UINote>();
858 UINote n3 = transform.Find("note2").GetComponent<UINote>();
859 AddNote(n3, (Element e) => e.HasTag("primary"), delegate
860 {
861 n3.AddHeader("HeaderNoteSmall", "attributes");
862 }, NoteMode.CharaMakeAttributes);
863 AddNote(n2, (Element e) => e.source.category == "skill" && !e.HasTag("hidden") && e.ValueWithoutLink > 1 && e.source.categorySub != "weapon", delegate
864 {
865 n2.AddHeader("HeaderNoteSmall", "skills");
866 }, NoteMode.CharaMake);
867 AddNote(n2, (Element e) => e is Feat, delegate
868 {
869 n2.AddHeader("HeaderNoteSmall", "feats");
870 }, NoteMode.CharaMake);
871 }
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)
Definition: FEAT.cs:249
Definition: UINote.cs:6

References AddNote(), Element.HasTag(), Element.source, and Element.ValueWithoutLink.

Referenced by UICharaMaker.ListJob(), and UICharaMaker.ListRace().

◆ ApplyElementMap()

void ElementContainer.ApplyElementMap ( int  uid,
SourceValueType  type,
Dictionary< int, int >  map,
int  lv,
bool  invert = false,
bool  applyFeat = false 
)
inline

Definition at line 73 of file ElementContainer.cs.

74 {
75 int num = ((!invert) ? 1 : (-1));
76 Rand.SetSeed(uid);
77 foreach (KeyValuePair<int, int> item in map)
78 {
79 Element orCreateElement = GetOrCreateElement(item.Key);
80 int value = item.Value;
81 if (value != 0)
82 {
83 if (orCreateElement.source.category == "skill")
84 {
85 orCreateElement.vSourcePotential += orCreateElement.GetSourcePotential(value) * num;
86 }
87 int num2 = orCreateElement.GetSourceValue(value, lv, type) * num;
88 orCreateElement.vSource += num2;
89 if (applyFeat && orCreateElement is Feat)
90 {
91 (orCreateElement as Feat).Apply(num2, this);
92 }
93 }
94 }
95 Rand.SetSeed();
96 }
Element GetOrCreateElement(Element ele)
virtual int GetSourceValue(int v, int lv, SourceValueType type)
Definition: ELEMENT.cs:428
virtual int GetSourcePotential(int v)
Definition: ELEMENT.cs:401
Definition: Rand.cs:4
static void SetSeed(int a=-1)
Definition: Rand.cs:37

References GetOrCreateElement(), Element.GetSourcePotential(), Element.GetSourceValue(), item, Rand.SetSeed(), and Element.source.

Referenced by Chara.ApplyJob(), Chara.ApplyRace(), UICharaMaker.ListJob(), UICharaMaker.ListRace(), Chara.OnDeserialized(), Card.SetLv(), and ElementContainerCard.SetOwner().

◆ ApplyMaterialElementMap()

void ElementContainer.ApplyMaterialElementMap ( Thing  t,
bool  invert = false 
)
inline

Definition at line 98 of file ElementContainer.cs.

99 {
100 int num = ((!invert) ? 1 : (-1));
102 Rand.SetSeed(t.uid);
103 foreach (KeyValuePair<int, int> item in material.elementMap)
104 {
105 int value = item.Value;
106 if (value == 0)
107 {
108 continue;
109 }
110 Element orCreateElement = GetOrCreateElement(item.Key);
111 if (!orCreateElement.source.IsMaterialEncAppliable(t))
112 {
113 if (orCreateElement.vBase == 0 && orCreateElement.vSource == 0 && orCreateElement.vLink == 0 && orCreateElement.vExp == 0 && orCreateElement.vPotential == 0)
114 {
115 Remove(orCreateElement.id);
116 }
117 continue;
118 }
119 int num2 = orCreateElement.GetMaterialSourceValue(t, value) * num;
120 orCreateElement.vSource += num2;
121 if (orCreateElement.vBase == 0 && orCreateElement.vSource == 0 && orCreateElement.vLink == 0 && orCreateElement.vExp == 0 && orCreateElement.vPotential == 0)
122 {
123 Remove(orCreateElement.id);
124 }
125 }
126 Rand.SetSeed();
127 }
int uid
Definition: Card.cs:118
void Remove(int id)
int GetMaterialSourceValue(Thing t, int v)
Definition: ELEMENT.cs:411
int vBase
Definition: ELEMENT.cs:242
int vExp
Definition: ELEMENT.cs:244
int vPotential
Definition: ELEMENT.cs:246
int vLink
Definition: ELEMENT.cs:250
int vSource
Definition: ELEMENT.cs:252

References Element.GetMaterialSourceValue(), GetOrCreateElement(), Element.id, item, Card.material, material, Remove(), Rand.SetSeed(), Element.source, Card.uid, Element.vBase, Element.vExp, Element.vLink, Element.vPotential, and Element.vSource.

Referenced by Thing.ApplyMaterialElements().

◆ ApplyPotential()

void ElementContainer.ApplyPotential ( int  mode = 0)
inline

Definition at line 146 of file ElementContainer.cs.

147 {
148 foreach (Element value in dict.Values)
149 {
150 if (value.HasTag("primary"))
151 {
152 value.vTempPotential = (value.ValueWithoutLink - ((mode != 2) ? 7 : 0)) * 5;
153 }
154 }
155 }

References dict, and Element.HasTag().

Referenced by UICharaMaker.ListJob(), UICharaMaker.ListRace(), and UICharaMaker.Refresh().

◆ Base()

int ElementContainer.Base ( int  ele)
inline

Definition at line 251 of file ElementContainer.cs.

252 {
253 return GetElement(ele)?.ValueWithoutLink ?? 0;
254 }
Element GetElement(string alias)

References GetElement(), and Element.ValueWithoutLink.

Referenced by Chara.ModTempElement(), and FoodEffect.Proc().

◆ CopyTo()

void ElementContainer.CopyTo ( ElementContainer  container)
inline

Definition at line 645 of file ElementContainer.cs.

646 {
647 container.dict.Clear();
648 foreach (KeyValuePair<int, Element> item in dict)
649 {
650 Element element = container.CreateElement(item.Key);
651 element.vBase = item.Value.vBase;
652 element.vExp = item.Value.vExp;
653 element.vSource = item.Value.vSource;
654 }
655 }
Element CreateElement(int id)

References dict, and item.

Referenced by Card.Duplicate().

◆ CreateElement()

Element ElementContainer.CreateElement ( int  id)
inline

Definition at line 489 of file ElementContainer.cs.

490 {
491 Element element = Element.Create(id);
492 if (element == null)
493 {
494 return null;
495 }
496 element.owner = this;
497 dict.Add(id, element);
498 return element;
499 }

References Element.Create(), and dict.

Referenced by GetOrCreateElement(), and ListElements().

◆ Exp()

int ElementContainer.Exp ( int  ele)
inline

Definition at line 204 of file ElementContainer.cs.

205 {
206 return GetElement(ele)?.vExp ?? 0;
207 }

References GetElement(), and Element.vExp.

◆ GetElement() [1/2]

Element ElementContainer.GetElement ( int  id)
inline

Definition at line 484 of file ElementContainer.cs.

485 {
486 return dict.TryGetValue(id);
487 }

References dict.

◆ GetElement() [2/2]

◆ GetFeatRef()

int ElementContainer.GetFeatRef ( int  ele,
int  idx = 0 
)
inline

Definition at line 194 of file ElementContainer.cs.

195 {
196 if (!(GetElement(ele) is Feat feat))
197 {
198 return 0;
199 }
200 feat.Apply(feat.Value, this);
201 return Feat.featRef[idx].ToInt();
202 }
static string[] featRef
Definition: FEAT.cs:252

References Feat.featRef, and GetElement().

◆ GetOrCreateElement() [1/3]

◆ GetOrCreateElement() [2/3]

Element ElementContainer.GetOrCreateElement ( int  id)
inline

Definition at line 511 of file ElementContainer.cs.

512 {
513 Element value = null;
514 if (!dict.TryGetValue(id, out value))
515 {
516 value = CreateElement(id);
517 }
518 return value;
519 }

References CreateElement(), and dict.

◆ GetOrCreateElement() [3/3]

Element ElementContainer.GetOrCreateElement ( string  alias)
inline

Definition at line 506 of file ElementContainer.cs.

507 {
508 return GetOrCreateElement(EClass.sources.elements.alias[alias].id);
509 }

References SourceManager.elements, GetOrCreateElement(), and EClass.sources.

◆ GetSortVal()

static int ElementContainer.GetSortVal ( Element  a)
inlinestatic

Definition at line 657 of file ElementContainer.cs.

658 {
659 int num = a.Value;
660 if (a.source.textAlt.Length <= 2 || a.Value < 0)
661 {
662 num -= 100000;
663 }
664 if (a.id == 2)
665 {
666 num += 20000;
667 }
668 if (a.IsFoodTraitMain)
669 {
670 num += 10000;
671 }
672 return num;
673 }

References Element.id, Element.IsFoodTraitMain, Element.source, and Element.Value.

Referenced by AddNote(), and Thing.ListLimitedValidTraits().

◆ GetSpellExp()

int ElementContainer.GetSpellExp ( Chara  c,
Element  e,
int  costMod = 100 
)
inline

Definition at line 462 of file ElementContainer.cs.

463 {
464 Act.Cost cost = e.GetCost(c);
465 int num = cost.cost * ((cost.type == Act.CostType.SP) ? 20 : 5) * (100 + c.Evalue(1208) * 30) / 100 + 10;
466 num = num * costMod / 100;
467 if (!e.source.aliasParent.IsEmpty())
468 {
469 int num2 = ValueWithoutLink(e.source.aliasParent) - ValueWithoutLink(e.source.id);
470 num = ((num2 < 0) ? (num * 100 / (100 - num2 * 25)) : (num * (100 + num2 * 5) / 100));
471 }
472 if (num < 0)
473 {
474 num = 0;
475 }
476 return num;
477 }
Definition: ACT.cs:62
CostType
Definition: ACT.cs:64
int Evalue(int ele)
Definition: Card.cs:2431
int ValueWithoutLink(int ele)
virtual Act.Cost GetCost(Chara c)
Definition: ELEMENT.cs:853
Definition: ACT.cs:71

References Card.Evalue(), Element.GetCost(), Element.source, and ValueWithoutLink().

Referenced by ActMelee.Attack().

◆ Has() [1/3]

bool ElementContainer.Has ( int  ele)
inline

Definition at line 209 of file ElementContainer.cs.

210 {
211 Element element = GetElement(ele);
212 if (element == null)
213 {
214 return false;
215 }
216 return element.Value > 0;
217 }

References GetElement().

Referenced by BaseCondition._WriteNote(), Element.CheckLevelBonus(), Has(), BuildMenu.OnActivate(), HotbarManager.ResetHotbar(), AI_PassTime.Run(), Card.Teleport(), BuildMenu.Toggle(), TraitFoodEgg.Update(), and Element.BonusInfo.WriteNote().

◆ Has() [2/3]

bool ElementContainer.Has ( SourceElement::Row  row)
inline

Definition at line 219 of file ElementContainer.cs.

220 {
221 return Has(row.id);
222 }
bool Has(int ele)

References Has().

◆ Has() [3/3]

bool ElementContainer.Has ( string  alias)
inline

Definition at line 224 of file ElementContainer.cs.

225 {
226 return Has(EClass.sources.elements.alias[alias].id);
227 }

References SourceManager.elements, Has(), and EClass.sources.

◆ HasBase()

bool ElementContainer.HasBase ( int  ele)
inline

Definition at line 229 of file ElementContainer.cs.

230 {
231 Element element = GetElement(ele);
232 if (element == null)
233 {
234 return false;
235 }
236 int num = element.ValueWithoutLink;
237 switch (ele)
238 {
239 case 300:
240 num += Value(1516) * -4;
241 num += Value(1517) * 4;
242 break;
243 case 307:
244 num += Value(1524) * -4;
245 num += Value(1525) * 4;
246 break;
247 }
248 return num != 0;
249 }
int Value(int ele)

References GetElement(), Value(), and Element.ValueWithoutLink.

Referenced by ElementContainerCard.CheckSkillActions(), TraitBookSkill.OnRead(), TraitBookSkill.SetName(), TraitBookPlan.WriteNote(), and TraitBookSkill.WriteNote().

◆ ImportElementMap() [1/2]

void ElementContainer.ImportElementMap ( Dictionary< int, int >  map)
inline

Definition at line 129 of file ElementContainer.cs.

130 {
131 foreach (KeyValuePair<int, int> item in map)
132 {
133 GetOrCreateElement(item.Key).vSource += item.Value;
134 }
135 }

References GetOrCreateElement(), item, and Element.vSource.

Referenced by WindowChara.RefreshNote().

◆ ImportElementMap() [2/2]

ElementContainer ElementContainer.ImportElementMap ( int[]  ints)
inline

Definition at line 137 of file ElementContainer.cs.

138 {
139 for (int i = 0; i < ints.Length; i += 2)
140 {
141 GetOrCreateElement(ints[i]).vSource += ints[i + 1];
142 }
143 return this;
144 }

References GetOrCreateElement(), and Element.vSource.

◆ Learn()

void ElementContainer.Learn ( int  ele,
int  v = 1 
)
inline

Definition at line 256 of file ElementContainer.cs.

257 {
258 ModBase(ele, v);
259 OnLearn(ele);
260 }
Element ModBase(int ele, int v)
virtual void OnLearn(int ele)

References ModBase(), and OnLearn().

Referenced by DNA.Apply(), Element.CheckLevelBonus(), Religion.JoinFaith(), and TraitBookSkill.OnRead().

◆ ListBestAttributes()

List< Element > ElementContainer.ListBestAttributes ( )
inline

Definition at line 608 of file ElementContainer.cs.

609 {
610 List<Element> obj = ListElements((Element a) => a.HasTag("primary"));
611 obj.Sort((Element a, Element b) => (b.ValueWithoutLink - a.ValueWithoutLink) * 100000 + a.id - b.id);
612 return obj;
613 }
List< Element > ListElements(Func< Element, bool > shoudList=null, Comparison< Element > comparison=null)

References Element.HasTag(), Element.id, ListElements(), and Element.ValueWithoutLink.

Referenced by AI_Fuck.Finish(), and TraitDrinkMilkMother.OnDrink().

◆ ListBestSkills()

List< Element > ElementContainer.ListBestSkills ( )
inline

Definition at line 615 of file ElementContainer.cs.

616 {
617 List<Element> obj = ListElements((Element a) => a.source.category == "skill");
618 obj.Sort((Element a, Element b) => (b.ValueWithoutLink - a.ValueWithoutLink) * 100000 + a.id - b.id);
619 return obj;
620 }

References Element.id, ListElements(), Element.source, and Element.ValueWithoutLink.

Referenced by TraitDrinkMilkMother.OnDrink(), and LayerEmbark.RefreshMembers().

◆ ListElements()

List< Element > ElementContainer.ListElements ( Func< Element, bool >  shoudList = null,
Comparison< Element comparison = null 
)
inline

Definition at line 551 of file ElementContainer.cs.

552 {
553 List<Element> list = new List<Element>();
554 List<Element> eles = dict.Values.ToList();
555 if (Card != null && Card.Chara != null)
556 {
558 {
559 AddElements(EClass.pc.faction.charaElements, isGlobal: true);
560 }
561 AddElements(Card.Chara.faithElements, isGlobal: false);
562 }
563 foreach (Element item2 in eles)
564 {
565 if (shoudList == null || shoudList(item2))
566 {
567 list.Add(item2);
568 }
569 }
570 if (comparison != null)
571 {
572 list.Sort(comparison);
573 }
574 return list;
575 void AddElements(ElementContainer container, bool isGlobal)
576 {
577 if (container == null)
578 {
579 return;
580 }
581 foreach (Element value in container.dict.Values)
582 {
583 bool flag = true;
584 foreach (Element item3 in eles)
585 {
586 if (value.id == item3.id)
587 {
588 flag = false;
589 break;
590 }
591 }
592 if (flag && value.Value != 0)
593 {
594 if (isGlobal)
595 {
597 eles.Add(item);
598 }
599 else
600 {
601 eles.Add(value);
602 }
603 }
604 }
605 }
606 }
virtual Chara Chara
Definition: Card.cs:1946
Faction faction
Definition: Chara.cs:412
override bool IsPCFaction
Definition: Chara.cs:656
ElementContainer faithElements
Definition: Chara.cs:38
ElementContainerFaction charaElements
Definition: FACTION.cs:144

References Card.Chara, Faction.charaElements, CreateElement(), dict, Card.elements, Chara.faction, Chara.faithElements, Element.id, Chara.IsPCFaction, item, list, EClass.pc, and Element.Value.

Referenced by WidgetStatsBar.Build(), Card.CanAddRune(), ListBestAttributes(), ListBestSkills(), ListGeneFeats(), ListRune(), ActEffect.Proc(), WindowCharaMini.Refresh(), WindowChara.RefreshSkill(), and WindowChara.RefreshStatic().

◆ ListGeneFeats()

List< Element > ElementContainer.ListGeneFeats ( )
inline

Definition at line 622 of file ElementContainer.cs.

623 {
624 return ListElements((Element a) => a.Value > 0 && a.source.category == "feat" && a.source.cost.Length != 0 && a.source.cost[0] > 0 && a.source.geneSlot >= 0);
625 }

References ListElements(), Element.source, and Element.Value.

◆ ListLearnable()

List< Element > ElementContainer.ListLearnable ( Chara  c)
inline

Definition at line 627 of file ElementContainer.cs.

628 {
629 List<Element> list = new List<Element>();
630 foreach (KeyValuePair<int, Element> item in c.elements.dict)
631 {
632 if (!dict.ContainsKey(item.Key))
633 {
634 list.Add(item.Value);
635 }
636 }
637 return list;
638 }

References dict, item, and list.

◆ ListRune()

List< Element > ElementContainer.ListRune ( )
inline

Definition at line 640 of file ElementContainer.cs.

641 {
642 return ListElements((Element a) => !a.source.encSlot.IsEmpty() && a.vBase + a.vSource != 0);
643 }

References ListElements(), Element.source, Element.vBase, and Element.vSource.

Referenced by TraitCrafter.Craft().

◆ ModBase()

Element ElementContainer.ModBase ( int  ele,
int  v 
)
inline

Definition at line 402 of file ElementContainer.cs.

403 {
404 Element orCreateElement = GetOrCreateElement(ele);
405 orCreateElement.vBase += v;
406 if (parent != null && orCreateElement.CanLink(this))
407 {
408 parent.ModLink(ele, v);
409 }
410 orCreateElement.CheckLevelBonus(this);
411 orCreateElement.OnChangeValue();
412 if (orCreateElement.vBase == 0 && orCreateElement.vSource == 0 && orCreateElement.vLink == 0 && orCreateElement.vPotential == 0 && orCreateElement.vExp == 0)
413 {
414 Remove(orCreateElement.id);
415 }
416 return orCreateElement;
417 }
ElementContainer parent
Element ModLink(int id, int v)
virtual void OnChangeValue()
Definition: ELEMENT.cs:789
void CheckLevelBonus(ElementContainer owner, UINote n=null)
Definition: ELEMENT.cs:793
virtual bool CanLink(ElementContainer owner)
Definition: ELEMENT.cs:458

References Element.CanLink(), Element.CheckLevelBonus(), GetOrCreateElement(), Element.id, ModLink(), Element.OnChangeValue(), parent, Remove(), Element.vBase, Element.vExp, Element.vLink, Element.vPotential, and Element.vSource.

Referenced by DNA.Apply(), Feat.Apply(), Thing.ApplyMaterial(), Card.ApplySocket(), TraitDrink.BlendLove(), TraitDrink.BlendPoison(), CoreDebug.COM_MaxConstruction(), Card.EjectSockets(), CoreDebug.Fix_EtherDisease(), AI_Shear.GetFur(), Learn(), Card.MakeFoodFrom(), Card.ModEncLv(), ModExp(), Chara.ModTempElement(), TraitDrinkMilkMother.OnDrink(), ElementContainerFaction.OnEquip(), FactionBranch.OnUnclaimZone(), ElementContainerFaction.OnUnequip(), ActEffect.Proc(), CoreDebug.QuickStart(), Chara.RefreshWorkElements(), AI_Idle.Run(), Card.SetBlessedState(), Card.SetLv(), Chara.SetMainElement(), SetTo(), ConDisease.Tick(), Map.TryShatter(), TraitFoodEgg.Update(), and FactionBranch.Upgrade().

◆ ModExp()

void ElementContainer.ModExp ( int  ele,
int  a,
bool  chain = false 
)
inline

Definition at line 268 of file ElementContainer.cs.

269 {
270 if ((Card != null && Card.isChara && Card.Chara.isDead) || a == 0)
271 {
272 return;
273 }
274 Element element = GetElement(ele);
275 if (element == null || !element.CanGainExp)
276 {
277 return;
278 }
279 int value = (element.UsePotential ? element.Potential : 100);
280 if (element.UseExpMod && a >= 0)
281 {
282 float num = (float)a * (float)Mathf.Clamp(value, 10, 1000) / (float)(100 + Mathf.Max(0, element.ValueWithoutLink) * 25);
283 a = (int)num;
284 if (EClass.rndf(1f) < num % 1f)
285 {
286 a++;
287 }
288 }
289 element.vExp += a;
290 if (!chain && element.source.parentFactor > 0f && Card != null && !element.source.aliasParent.IsEmpty())
291 {
292 Element element2 = element.GetParent(Card);
293 if (element2.CanGainExp)
294 {
295 ModExp(element2.id, (int)Math.Max(1f, (float)a * element.source.parentFactor / 100f), chain: true);
296 }
297 }
298 if (element.vExp >= element.ExpToNext)
299 {
300 int num2 = element.vExp - element.ExpToNext;
301 int vBase = element.vBase;
302 ModBase(ele, 1);
303 OnLevelUp(element, vBase);
304 element.vExp = Mathf.Clamp(num2 / 2, 0, element.ExpToNext / 2);
305 if (element.vTempPotential > 0)
306 {
307 element.vTempPotential -= element.vTempPotential / 4 + EClass.rnd(5) + 5;
308 if (element.vTempPotential < 0)
309 {
310 element.vTempPotential = 0;
311 }
312 }
313 else if (element.vTempPotential < 0)
314 {
315 element.vTempPotential += -element.vTempPotential / 4 + EClass.rnd(5) + 5;
316 if (element.vTempPotential > 0)
317 {
318 element.vTempPotential = 0;
319 }
320 }
321 }
322 else if (element.vExp < 0)
323 {
324 if (element.ValueWithoutLink <= 1)
325 {
326 element.vExp = 0;
327 return;
328 }
329 int vBase2 = element.vBase;
330 ModBase(ele, -1);
331 OnLevelDown(element, vBase2);
332 element.vExp = Mathf.Max(element.ExpToNext / 2, element.ExpToNext + element.vExp);
333 }
334 }
virtual bool isChara
Definition: Card.cs:1959
bool isDead
Definition: Chara.cs:374
static int rnd(int a)
Definition: EClass.cs:50
static float rndf(float a)
Definition: EClass.cs:79
void ModExp(int ele, int a, bool chain=false)
virtual void OnLevelDown(Element e, int lastValue)
virtual void OnLevelUp(Element e, int lastValue)
virtual bool CanGainExp
Definition: ELEMENT.cs:290
virtual bool UseExpMod
Definition: ELEMENT.cs:300
int vTempPotential
Definition: ELEMENT.cs:248
Element GetParent(Card c)
Definition: ELEMENT.cs:512
virtual int ExpToNext
Definition: ELEMENT.cs:298

References Element.CanGainExp, Card.Chara, Element.ExpToNext, GetElement(), Element.GetParent(), Element.id, Card.isChara, Chara.isDead, ModBase(), ModExp(), OnLevelDown(), OnLevelUp(), EClass.rnd(), EClass.rndf(), Element.source, Element.UseExpMod, Element.ValueWithoutLink, Element.vBase, Element.vExp, and Element.vTempPotential.

Referenced by TraitAltar._OnOffer(), Chara.ApplyDeathPenalty(), Card.DamageHP(), StatsMana.Mod(), Card.ModExp(), ModExp(), Player.MoveZone(), Policy.OnAdvanceHour(), TaskChopWood.OnCreateProgress(), TaskDig.OnCreateProgress(), TaskDrawWater.OnCreateProgress(), TaskHarvest.OnCreateProgress(), TaskMine.OnCreateProgress(), TaskPlow.OnCreateProgress(), TaskPourWater.OnCreateProgress(), TaskCraft.OnProgress(), AI_Fish.ProgressFish.OnProgressComplete(), TaskCraft.OnProgressComplete(), TaskDig.OnProgressComplete(), TaskMine.OnProgressComplete(), TraitBookSkill.OnRead(), TraitScrollStatic.OnRead(), FoodEffect.Proc(), AI_Fuck.Run(), AI_PlayMusic.Run(), AI_Shear.Run(), AI_Slaughter.Run(), AI_Steal.Run(), AI_UseCrafter.Run(), and Card.SpawnLoot().

◆ ModLink()

Element ElementContainer.ModLink ( int  id,
int  v 
)
inlineprivate

Definition at line 450 of file ElementContainer.cs.

451 {
452 Element orCreateElement = GetOrCreateElement(id);
453 orCreateElement.vLink += v;
454 orCreateElement.OnChangeValue();
455 if (parent != null && orCreateElement.CanLink(this))
456 {
457 parent.ModLink(id, v);
458 }
459 return orCreateElement;
460 }

References Element.CanLink(), GetOrCreateElement(), ModLink(), Element.OnChangeValue(), and parent.

Referenced by ModBase(), ModLink(), Remove(), SetBase(), and SetParent().

◆ ModPotential()

Element ElementContainer.ModPotential ( int  ele,
int  v 
)
inline

Definition at line 423 of file ElementContainer.cs.

424 {
425 Element orCreateElement = GetOrCreateElement(ele);
426 orCreateElement.vPotential += v;
427 if (orCreateElement.vPotential > 1000)
428 {
429 orCreateElement.vPotential = 1000;
430 }
431 return orCreateElement;
432 }

References GetOrCreateElement(), and Element.vPotential.

Referenced by Feat.Apply(), and FoodEffect.Proc().

◆ ModTempPotential()

Element ElementContainer.ModTempPotential ( int  ele,
int  v,
int  threshMsg = 0 
)
inline

Definition at line 434 of file ElementContainer.cs.

435 {
436 Element orCreateElement = GetOrCreateElement(ele);
437 orCreateElement.vTempPotential += v;
438 if (orCreateElement.vTempPotential > 1000)
439 {
440 orCreateElement.vTempPotential = 1000;
441 }
442 OnModTempPotential(orCreateElement, v, threshMsg);
443 return orCreateElement;
444 }
virtual void OnModTempPotential(Element e, int v, int threshMsg)

References GetOrCreateElement(), OnModTempPotential(), and Element.vTempPotential.

Referenced by AI_Fuck.Finish(), FoodEffect.Proc(), ActEffect.Proc(), AI_Idle.Run(), and Train().

◆ OnChangeValue()

virtual void ElementContainer.OnChangeValue ( )
inlinevirtual

Definition at line 419 of file ElementContainer.cs.

420 {
421 }

◆ OnDeserialized()

void ElementContainer.OnDeserialized ( StreamingContext  context)
inlineprivate

Definition at line 53 of file ElementContainer.cs.

54 {
55 if (list == null)
56 {
57 return;
58 }
59 for (int i = 0; i < list.Count; i += 5)
60 {
61 Element orCreateElement = GetOrCreateElement(list[i]);
62 if (orCreateElement != null)
63 {
64 orCreateElement.vBase += list[i + 1];
65 orCreateElement.vExp += list[i + 2];
66 orCreateElement.vPotential += list[i + 3];
67 orCreateElement.vTempPotential = list[i + 4];
68 orCreateElement.owner = this;
69 }
70 }
71 }

References GetOrCreateElement(), and list.

◆ OnLearn()

virtual void ElementContainer.OnLearn ( int  ele)
inlinevirtual

Reimplemented in ElementContainerCard, and ElementContainerZone.

Definition at line 336 of file ElementContainer.cs.

337 {
338 }

Referenced by Learn().

◆ OnLevelDown()

virtual void ElementContainer.OnLevelDown ( Element  e,
int  lastValue 
)
inlinevirtual

Reimplemented in ElementContainerCard.

Definition at line 348 of file ElementContainer.cs.

349 {
350 }

Referenced by ModExp().

◆ OnLevelUp()

virtual void ElementContainer.OnLevelUp ( Element  e,
int  lastValue 
)
inlinevirtual

Reimplemented in ElementContainerCard, and ElementContainerZone.

Definition at line 344 of file ElementContainer.cs.

345 {
346 }

Referenced by ModExp().

◆ OnModTempPotential()

virtual void ElementContainer.OnModTempPotential ( Element  e,
int  v,
int  threshMsg 
)
inlinevirtual

Reimplemented in ElementContainerCard.

Definition at line 446 of file ElementContainer.cs.

447 {
448 }

Referenced by ModTempPotential().

◆ OnSerializing()

void ElementContainer.OnSerializing ( StreamingContext  context)
inlineprivate

Definition at line 36 of file ElementContainer.cs.

37 {
38 list = new List<int>();
39 foreach (Element value in dict.Values)
40 {
41 if (value.vBase != 0 || value.vExp != 0 || value.vPotential != 0 || value.vTempPotential != 0)
42 {
43 list.AddRange(new int[5] { value.id, value.vBase, value.vExp, value.vPotential, value.vTempPotential });
44 }
45 }
46 if (list.Count == 0)
47 {
48 list = null;
49 }
50 }

References dict, Element.id, list, Element.vBase, Element.vExp, Element.vPotential, and Element.vTempPotential.

◆ OnTrain()

virtual void ElementContainer.OnTrain ( int  ele)
inlinevirtual

Reimplemented in ElementContainerCard.

Definition at line 340 of file ElementContainer.cs.

341 {
342 }

Referenced by Train().

◆ Remove()

void ElementContainer.Remove ( int  id)
inline

Definition at line 389 of file ElementContainer.cs.

390 {
391 Element element = GetElement(id);
392 if (element != null)
393 {
394 if (parent != null && element.CanLink(this))
395 {
396 parent.ModLink(id, -element.Value);
397 }
398 dict.Remove(id);
399 }
400 }

References Element.CanLink(), dict, GetElement(), ModLink(), parent, and Element.Value.

Referenced by ApplyMaterialElementMap(), Card.CheckJustCooked(), ModBase(), Chara.ModTempElement(), Trait.OnBarter(), Player.OnStartNewGame(), LayerCraft.RefreshProduct(), SetBase(), and SetTo().

◆ SetBase() [1/2]

Element ElementContainer.SetBase ( int  id,
int  v,
int  potential = 0 
)
inline

Definition at line 357 of file ElementContainer.cs.

358 {
359 Element orCreateElement = GetOrCreateElement(id);
360 if (parent != null && orCreateElement.CanLink(this))
361 {
362 parent.ModLink(id, -orCreateElement.vBase + v);
363 }
364 orCreateElement.vBase = v;
365 orCreateElement.vExp = 0;
366 orCreateElement.vPotential = potential;
367 orCreateElement.OnChangeValue();
368 if (orCreateElement.vBase == 0 && orCreateElement.vSource == 0 && orCreateElement.vLink == 0 && orCreateElement.vPotential == 0 && orCreateElement.vExp == 0)
369 {
370 Remove(orCreateElement.id);
371 }
372 return orCreateElement;
373 }

References Element.CanLink(), GetOrCreateElement(), Element.id, ModLink(), Element.OnChangeValue(), parent, Remove(), Element.vBase, Element.vExp, Element.vLink, Element.vPotential, and Element.vSource.

◆ SetBase() [2/2]

◆ SetParent() [1/2]

◆ SetParent() [2/2]

void ElementContainer.SetParent ( ElementContainer  newParent = null)
inline

Definition at line 526 of file ElementContainer.cs.

527 {
528 if (parent != null)
529 {
530 foreach (Element value in dict.Values)
531 {
532 if (value.CanLink(this))
533 {
534 parent.ModLink(value.id, -(value.vBase + value.vSource));
535 }
536 }
537 }
538 if (newParent != null)
539 {
540 foreach (Element value2 in dict.Values)
541 {
542 if (value2.CanLink(this))
543 {
544 newParent.ModLink(value2.id, value2.vBase + value2.vSource);
545 }
546 }
547 }
548 parent = newParent;
549 }

References Element.CanLink(), dict, Element.id, ModLink(), parent, Element.vBase, and Element.vSource.

◆ SetTo()

void ElementContainer.SetTo ( int  id,
int  v 
)
inline

Definition at line 375 of file ElementContainer.cs.

376 {
377 Element orCreateElement = GetOrCreateElement(id);
378 int num = v - (orCreateElement.vBase + orCreateElement.vSource);
379 if (num != 0)
380 {
381 ModBase(id, num);
382 }
383 if (orCreateElement.vBase == 0 && orCreateElement.vSource == 0 && orCreateElement.vLink == 0 && orCreateElement.vPotential == 0 && orCreateElement.vExp == 0)
384 {
385 Remove(orCreateElement.id);
386 }
387 }

References GetOrCreateElement(), Element.id, ModBase(), Remove(), Element.vBase, Element.vExp, Element.vLink, Element.vPotential, and Element.vSource.

Referenced by Card.AddRune(), DNA.GenerateWithGene(), TraitSeed.MakeSeed(), TraitAgingShelf.OnProduce(), and TraitDryBrick.OnProduce().

◆ Train()

void ElementContainer.Train ( int  ele,
int  a = 10 
)
inline

Definition at line 262 of file ElementContainer.cs.

263 {
264 OnTrain(ele);
265 ModTempPotential(ele, a);
266 }
virtual void OnTrain(int ele)
Element ModTempPotential(int ele, int v, int threshMsg=0)

References ModTempPotential(), and OnTrain().

◆ Value()

int ElementContainer.Value ( int  ele)
inline

◆ ValueBonus()

virtual int ElementContainer.ValueBonus ( Element  e)
inlinevirtual

Reimplemented in ElementContainerCard.

Definition at line 179 of file ElementContainer.cs.

180 {
181 return 0;
182 }

◆ ValueWithoutLink() [1/2]

int ElementContainer.ValueWithoutLink ( int  ele)
inline

◆ ValueWithoutLink() [2/2]

int ElementContainer.ValueWithoutLink ( string  alias)
inline

Definition at line 189 of file ElementContainer.cs.

190 {
191 return GetElement(alias)?.ValueWithoutLink ?? 0;
192 }

References GetElement(), and Element.ValueWithoutLink.

Member Data Documentation

◆ dict

◆ list

List<int> ElementContainer.list

◆ parent

ElementContainer ElementContainer.parent

Definition at line 22 of file ElementContainer.cs.

Referenced by ModBase(), ModLink(), Remove(), SetBase(), and SetParent().

◆ sizeElement

const int ElementContainer.sizeElement = 5
static

Definition at line 24 of file ElementContainer.cs.

Property Documentation

◆ Card

virtual Card ElementContainer.Card
get

◆ Chara

virtual Chara ElementContainer.Chara
get

◆ IsMeleeWeapon

virtual bool ElementContainer.IsMeleeWeapon
get

Definition at line 33 of file ElementContainer.cs.

Referenced by AttbWeapon.CanLink().


The documentation for this class was generated from the following file: