Elin Decompiled Documentation EA 23.199 Nightly
Loading...
Searching...
No Matches
ElementContainerCard.cs
Go to the documentation of this file.
1using UnityEngine;
2
4{
5 public Card owner;
6
7 public override Card Card => owner;
8
9 public override Chara Chara => owner.Chara;
10
11 public override bool IsMeleeWeapon
12 {
13 get
14 {
15 if (Card.category.slot == 35)
16 {
17 return Card.category.skill != 0;
18 }
19 return false;
20 }
21 }
22
23 public void SetOwner(Card c, bool applyFeat)
24 {
25 owner = c;
26 SourceValueType sourceValueType = ((c.IsEquipmentOrRangedOrAmmo && c.rarity < Rarity.Artifact) ? SourceValueType.EquipmentRandom : SourceValueType.Fixed);
27 ApplyElementMap(c.uid, sourceValueType, c.sourceCard.elementMap, (sourceValueType != SourceValueType.EquipmentRandom) ? 1 : c.LV, invert: false, applyFeat);
28 }
29
30 public override void OnLearn(int ele)
31 {
33 {
34 SE.DingSkill2();
35 }
36 Msg.Say("learnSkill", Card, EClass.sources.elements.map[ele].GetName());
38 }
39
40 public void CheckSkillActions()
41 {
42 if (owner.IsPC)
43 {
44 TryLearn(6011, 281, 0);
45 TryLearn(6018, 226, 0);
46 TryLearn(6019, 227, 0);
47 TryLearn(6700, 1649, 0);
48 TryLearn(6720, 1657, 0);
49 TryLearn(6450, 132, 5);
50 TryLearn(6603, 6020, 50);
51 }
52 void TryLearn(int eleAction, int reqEle, int lqlv)
53 {
54 if (!HasBase(eleAction) && HasBase(reqEle) && GetElement(reqEle).ValueWithoutLink >= lqlv)
55 {
56 SetBase(eleAction, 1);
58 {
59 if (owner.IsPC)
60 {
62 }
63 owner.Say("learnSkill", Card, EClass.sources.elements.map[eleAction].GetName());
64 }
65 }
66 }
67 }
68
69 public override void OnTrain(int ele)
70 {
71 Msg.Say("trainSkill", Card, EClass.sources.elements.map[ele].GetName());
72 }
73
74 public override void OnModTempPotential(Element e, int v, int threshMsg)
75 {
76 if (threshMsg == 0 || Mathf.Abs(v) >= threshMsg)
77 {
78 string lang = ((v > 0) ? "potentialInc" : "potentialDec");
79 if (owner.IsPCFaction && v > 0)
80 {
81 owner.PlaySound("ding_potential");
82 }
83 Msg.SetColor((v > 0) ? "positive" : "negative");
84 owner.Say(lang, owner, e.Name.ToLower());
85 }
86 }
87
88 public override void OnLevelUp(Element e, int lastValue)
89 {
91 {
92 return;
93 }
94 if (owner.IsPC)
95 {
96 if (e.id == 287)
97 {
98 EClass.player.flags.canComupWithFoodRecipe = true;
99 }
100 SE.DingSkill2();
101 }
102 if (owner.isChara)
103 {
105 {
107 {
109 {
111 string text = e.source.GetText("textInc", returnNull: true);
112 if (!text.IsEmpty())
113 {
114 owner.Say(text, owner);
115 }
116 else
117 {
118 owner.Say("ding_skill", owner, e.Name);
119 }
120 owner.pos.TalkWitnesses(owner.Chara, "ding_other", 4, WitnessType.ally, null, 4 + EClass.pc.party.members.Count);
121 }
122 if (owner.IsPCParty)
123 {
124 WidgetPopText.Say("popDing".lang(owner.IsPC ? "" : owner.Name, e.Name, lastValue.ToString() ?? "", e.ValueWithoutLink.ToString() ?? ""), FontColor.Good);
125 }
126 }
127 if (owner.Chara.homeBranch != null)
128 {
129 owner.Chara.homeBranch.Log("bDing", Card, e.Name, lastValue.ToString() ?? "", e.ValueWithoutLink.ToString() ?? "");
130 }
131 }
132 if (e is Skill)
133 {
134 owner.AddExp(10 + EClass.rnd(5));
135 }
137 }
139 }
140
141 public override void OnLevelDown(Element e, int lastValue)
142 {
144 {
145 return;
146 }
147 _ = owner.IsPC;
148 if (!owner.isChara)
149 {
150 return;
151 }
153 {
155 string text = e.source.GetText("textDec", returnNull: true);
156 if (!text.IsEmpty())
157 {
158 Msg.Say(text, owner);
159 }
160 else
161 {
162 Msg.Say("dec_skill", owner, e.Name);
163 }
164 }
166 }
167
168 public override int ValueBonus(Element e)
169 {
170 if (EClass.game == null)
171 {
172 return 0;
173 }
174 int num = 0;
176 {
178 if (element != null)
179 {
180 num += element.Value;
181 }
182 if (owner.IsPCParty)
183 {
184 int id = e.id;
185 if ((id == 70 || (uint)(id - 72) <= 1u) && EClass.game.activeZone != null)
186 {
187 int num2 = 0;
188 foreach (Chara member in EClass.pc.party.members)
189 {
190 if (member.Evalue(1419) > 0)
191 {
192 num2 += member.Evalue(1419);
193 }
194 }
195 if (num2 > 0)
196 {
197 int num3 = 0;
198 foreach (Chara chara in EClass._map.charas)
199 {
200 if (chara.IsHostile(EClass.pc))
201 {
202 num3++;
203 }
204 }
205 if (num3 > 0)
206 {
207 num += Mathf.Max(1, (e.ValueWithoutLink + e.vLink) * (int)Mathf.Clamp(4f + Mathf.Sqrt(num3) * (float)num2 * 2f, 5f, 30f) / 100);
208 }
209 }
210 }
211 }
212 if (e.id == 78)
213 {
214 num += EClass.player.CountKeyItem("lucky_coin") * 2;
215 if (Chara != null && Chara.Evalue(663) > 0)
216 {
217 num = num * 2 + (e.ValueWithoutLink + e.vLink);
218 }
219 }
220 if (e.id != 664 && (owner.Chara.IsMachine || owner.id == "android"))
221 {
222 int num4 = owner.Evalue(664);
223 if (num4 > 0)
224 {
225 switch (e.id)
226 {
227 case 64:
228 case 65:
229 num += (e.ValueWithoutLink + e.vLink) * num4 / 2 / 100;
230 break;
231 case 79:
232 num += (e.ValueWithoutLink + e.vLink) * num4 / 100;
233 break;
234 }
235 }
236 }
237 }
238 if (!e.source.aliasMtp.IsEmpty())
239 {
240 int num5 = owner.Evalue(e.source.aliasMtp);
241 if (num5 != 0)
242 {
243 num += (e.ValueWithoutLink + e.vLink) * num5 / 100;
244 }
245 }
246 return num;
247 }
248}
FontColor
Definition: FontColor.cs:2
Rarity
Definition: Rarity.cs:2
SourceValueType
WitnessType
Definition: WitnessType.cs:2
Dictionary< int, int > elementMap
Definition: CardRow.cs:43
Definition: Card.cs:11
bool IsPCFactionOrMinion
Definition: Card.cs:2234
virtual Chara Chara
Definition: Card.cs:2032
string id
Definition: Card.cs:33
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:5939
virtual bool IsPCParty
Definition: Card.cs:2111
string Name
Definition: Card.cs:2099
Point pos
Definition: Card.cs:57
int uid
Definition: Card.cs:120
virtual bool IsPC
Definition: Card.cs:2105
virtual bool isChara
Definition: Card.cs:2045
int Evalue(int ele)
Definition: Card.cs:2533
virtual bool IsPCFaction
Definition: Card.cs:2231
virtual CardRow sourceCard
Definition: Card.cs:2093
SourceCategory.Row category
Definition: Card.cs:2011
void AddExp(int a)
Definition: Card.cs:2903
int LV
Definition: Card.cs:372
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6586
Definition: Chara.cs:10
Faction faction
Definition: Chara.cs:425
Party party
Definition: Chara.cs:43
override bool IsPCFaction
Definition: Chara.cs:669
void CalculateMaxStamina()
Definition: Chara.cs:1963
bool IsInActiveZone
Definition: Chara.cs:836
bool IsMachine
Definition: Chara.cs:901
FactionBranch homeBranch
Definition: Chara.cs:1052
bool IsHostile()
Definition: Chara.cs:6298
bool IsGameStarted
Definition: Core.cs:84
Definition: EClass.cs:5
static Game game
Definition: EClass.cs:8
static Core core
Definition: EClass.cs:6
static Map _map
Definition: EClass.cs:18
static int rnd(long a)
Definition: EClass.cs:58
static SourceManager sources
Definition: EClass.cs:42
static Player player
Definition: EClass.cs:12
static Chara pc
Definition: EClass.cs:14
void SetOwner(Card c, bool applyFeat)
override void OnLearn(int ele)
override int ValueBonus(Element e)
override void OnLevelDown(Element e, int lastValue)
override void OnTrain(int ele)
override void OnModTempPotential(Element e, int v, int threshMsg)
override void OnLevelUp(Element e, int lastValue)
int ValueWithoutLink(int ele)
void ApplyElementMap(int uid, SourceValueType type, Dictionary< int, int > map, int lv, bool invert=false, bool applyFeat=false)
Element SetBase(string alias, int v, int potential=0)
bool HasBase(int ele)
Element GetElement(string alias)
virtual bool ShowMsgOnValueChanged
Definition: ELEMENT.cs:328
int ValueWithoutLink
Definition: ELEMENT.cs:294
int id
Definition: ELEMENT.cs:250
SourceElement.Row source
Definition: ELEMENT.cs:273
int Value
Definition: ELEMENT.cs:292
virtual string Name
Definition: ELEMENT.cs:304
int vLink
Definition: ELEMENT.cs:260
string Log(string idLang, string ref1=null, string ref2=null, string ref3=null, string ref4=null)
ElementContainerFaction charaElements
Definition: FACTION.cs:146
Zone activeZone
Definition: Game.cs:248
static void Redraw()
List< Chara > charas
Definition: Map.cs:81
Color Negative
Definition: MsgColors.cs:15
Color Ding
Definition: MsgColors.cs:11
Definition: Msg.cs:5
static MsgColors colors
Definition: Msg.cs:20
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
static void SetColor()
Definition: Msg.cs:22
List< Chara > members
Definition: Party.cs:18
int CountKeyItem(string alias)
Definition: Player.cs:2100
void TalkWitnesses(Chara criminal, string idTalk, int radius=4, WitnessType type=WitnessType.everyone, Func< Chara, bool > talkIf=null, int chance=3)
Definition: Point.cs:803
Definition: SKILL.cs:288
SourceElement elements
static bool IsActive
Definition: VirtualDate.cs:13
static void Say(string text, FontColor fontColor=FontColor.Default, Sprite sprite=null)