Elin Decompiled Documentation EA 23.356.1 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 && !c.isReplica) ? SourceValueType.EquipmentRandom : SourceValueType.Fixed);
27 if (c.sourceCard.ContainsTag("fixedElement"))
28 {
29 sourceValueType = SourceValueType.Fixed;
30 }
31 if (c.sourceCard.ContainsTag("randomElement"))
32 {
33 sourceValueType = SourceValueType.EquipmentRandom;
34 }
35 ApplyElementMap(c.uid, sourceValueType, c.sourceCard.elementMap, (sourceValueType != SourceValueType.EquipmentRandom) ? 1 : c.LV, invert: false, applyFeat);
36 }
37
38 public override void OnLearn(int ele)
39 {
41 {
42 SE.DingSkill2();
43 }
44 Msg.Say("learnSkill", Card, EClass.sources.elements.map[ele].GetName());
46 }
47
48 public void CheckSkillActions()
49 {
50 if (owner.IsPC)
51 {
52 TryLearn(6608, 1274, 0);
53 TryLearn(6011, 281, 0);
54 TryLearn(6018, 226, 0);
55 TryLearn(6019, 227, 0);
56 TryLearn(6700, 1649, 0);
57 TryLearn(6720, 1657, 0);
58 TryLearn(6450, 132, 5);
59 TryLearn(6603, 6020, 20);
60 if (HasBase(1405))
61 {
62 TryLearn(6750, 241, 3);
63 TryLearn(6752, 241, 8);
64 TryLearn(6754, 241, 25);
65 TryLearn(6753, 241, 36);
66 }
67 }
68 void TryLearn(int eleAction, int reqEle, int lqlv)
69 {
70 if (HasBase(eleAction) || !HasBase(reqEle) || GetElement(reqEle).ValueWithoutLink < lqlv)
71 {
72 if (HasBase(eleAction) && HasBase(reqEle) && GetElement(reqEle).ValueWithoutLink >= lqlv)
73 {
74 GetElement(eleAction).vPotential = 1;
75 }
76 }
77 else
78 {
79 SetBase(eleAction, 1, 1);
81 {
82 if (owner.IsPC)
83 {
85 }
86 owner.Say("learnSkill", Card, EClass.sources.elements.map[eleAction].GetName());
87 }
88 }
89 }
90 }
91
92 public override void OnTrain(int ele)
93 {
94 Msg.Say("trainSkill", Card, EClass.sources.elements.map[ele].GetName());
95 }
96
97 public override void OnModTempPotential(Element e, int v, int threshMsg)
98 {
99 if ((threshMsg == 0 || Mathf.Abs(v) >= threshMsg) && v != 0)
100 {
101 string lang = ((v > 0) ? "potentialInc" : "potentialDec");
102 if (owner.IsPCFaction && v > 0)
103 {
104 owner.PlaySound("ding_potential");
105 }
106 Msg.SetColor((v > 0) ? "positive" : "negative");
107 owner.Say(lang, owner, e.Name.ToLower());
108 }
109 }
110
111 public override void OnLevelUp(Element e, int lastValue)
112 {
114 {
115 return;
116 }
117 if (owner.IsPC)
118 {
119 if (e.id == 287)
120 {
121 EClass.player.flags.canComupWithFoodRecipe = true;
122 }
123 SE.DingSkill2();
124 }
125 if (owner.isChara)
126 {
128 {
130 {
132 {
134 string text = e.source.GetText("textInc", returnNull: true);
135 if (!text.IsEmpty())
136 {
137 owner.Say(text, owner);
138 }
139 else
140 {
141 owner.Say("ding_skill", owner, e.Name);
142 }
143 owner.pos.TalkWitnesses(owner.Chara, "ding_other", 4, WitnessType.ally, null, 4 + EClass.pc.party.members.Count);
144 }
145 if (owner.IsPCParty)
146 {
147 WidgetPopText.Say("popDing".lang(owner.IsPC ? "" : owner.Name, e.Name, lastValue.ToString() ?? "", e.ValueWithoutLink.ToString() ?? ""), FontColor.Good);
148 }
149 }
150 if (owner.Chara.homeBranch != null)
151 {
152 owner.Chara.homeBranch.Log("bDing", Card, e.Name, lastValue.ToString() ?? "", e.ValueWithoutLink.ToString() ?? "");
153 }
154 }
155 if (e is Skill)
156 {
157 owner.AddExp(10 + EClass.rnd(5));
158 }
160 }
162 }
163
164 public override void OnLevelDown(Element e, int lastValue)
165 {
167 {
168 return;
169 }
170 _ = owner.IsPC;
171 if (!owner.isChara)
172 {
173 return;
174 }
176 {
178 string text = e.source.GetText("textDec", returnNull: true);
179 if (!text.IsEmpty())
180 {
181 Msg.Say(text, owner);
182 }
183 else
184 {
185 Msg.Say("dec_skill", owner, e.Name);
186 }
187 }
189 }
190
191 public override int ValueBonus(Element e)
192 {
193 if (EClass.game == null)
194 {
195 return 0;
196 }
197 int num = 0;
199 {
201 if (element != null)
202 {
203 num += element.Value;
204 }
205 if (owner.IsPCParty)
206 {
207 int id = e.id;
208 if ((id == 70 || (uint)(id - 72) <= 1u) && EClass.game.activeZone != null)
209 {
210 int num2 = 0;
211 foreach (Chara member in EClass.pc.party.members)
212 {
213 if (member.Evalue(1419) > 0)
214 {
215 num2 += member.Evalue(1419);
216 }
217 }
218 if (num2 > 0)
219 {
220 int num3 = 0;
221 foreach (Chara chara in EClass._map.charas)
222 {
223 if (chara.IsHostile(EClass.pc))
224 {
225 num3++;
226 }
227 }
228 if (num3 > 0)
229 {
230 num += Mathf.Max(1, (e.ValueWithoutLink + e.vLink) * (int)Mathf.Clamp(4f + Mathf.Sqrt(num3) * (float)num2 * 2f, 5f, 30f) / 100);
231 }
232 }
233 }
234 }
235 if (e.id == 78)
236 {
237 num += EClass.player.CountKeyItem("lucky_coin") * 2;
238 if (Chara != null && Chara.Evalue(663) > 0)
239 {
240 num = num * 2 + (e.ValueWithoutLink + e.vLink);
241 }
242 }
243 if (e.id != 664 && (owner.Chara.IsMachine || owner.id == "android"))
244 {
245 int num4 = owner.Evalue(664);
246 if (num4 > 0)
247 {
248 switch (e.id)
249 {
250 case 64:
251 case 65:
252 num += (e.ValueWithoutLink + e.vLink) * num4 / 2 / 100;
253 break;
254 case 79:
255 num += (e.ValueWithoutLink + e.vLink) * num4 / 100;
256 break;
257 }
258 }
259 }
260 }
261 if (!e.source.aliasMtp.IsEmpty())
262 {
263 int num5 = owner.Evalue(e.source.aliasMtp);
264 if (num5 != 0)
265 {
266 num += (e.ValueWithoutLink + e.vLink) * num5 / 100;
267 }
268 }
269 return num;
270 }
271}
FontColor
Definition: FontColor.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:2342
virtual Chara Chara
Definition: Card.cs:2122
string id
Definition: Card.cs:36
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:6645
virtual bool IsPCParty
Definition: Card.cs:2203
string Name
Definition: Card.cs:2191
Point pos
Definition: Card.cs:60
int uid
Definition: Card.cs:125
virtual bool IsPC
Definition: Card.cs:2197
virtual bool isChara
Definition: Card.cs:2135
int Evalue(int ele)
Definition: Card.cs:2704
virtual bool IsPCFaction
Definition: Card.cs:2339
virtual CardRow sourceCard
Definition: Card.cs:2183
SourceCategory.Row category
Definition: Card.cs:2101
bool isReplica
Definition: Card.cs:701
void AddExp(int a, bool applyMod=true)
Definition: Card.cs:3123
int LV
Definition: Card.cs:389
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:7324
Definition: Chara.cs:10
Faction faction
Definition: Chara.cs:433
Party party
Definition: Chara.cs:45
override bool IsPCFaction
Definition: Chara.cs:691
void CalculateMaxStamina()
Definition: Chara.cs:2234
bool IsInActiveZone
Definition: Chara.cs:887
bool IsMachine
Definition: Chara.cs:952
FactionBranch homeBranch
Definition: Chara.cs:1115
bool IsHostile()
Definition: Chara.cs:6952
bool IsGameStarted
Definition: Core.cs:87
Definition: EClass.cs:6
static Game game
Definition: EClass.cs:9
static Core core
Definition: EClass.cs:7
static Map _map
Definition: EClass.cs:19
static int rnd(long a)
Definition: EClass.cs:59
static SourceManager sources
Definition: EClass.cs:43
static Player player
Definition: EClass.cs:13
static Chara pc
Definition: EClass.cs:15
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:337
int ValueWithoutLink
Definition: ELEMENT.cs:303
int id
Definition: ELEMENT.cs:259
SourceElement.Row source
Definition: ELEMENT.cs:282
int vPotential
Definition: ELEMENT.cs:265
int Value
Definition: ELEMENT.cs:301
virtual string Name
Definition: ELEMENT.cs:313
int vLink
Definition: ELEMENT.cs:269
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:252
static void Redraw()
List< Chara > charas
Definition: Map.cs:84
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:19
int CountKeyItem(string alias)
Definition: Player.cs:2266
void TalkWitnesses(Chara criminal, string idTalk, int radius=4, WitnessType type=WitnessType.everyone, Func< Chara, bool > talkIf=null, int chance=3)
Definition: Point.cs:816
bool ContainsTag(string _tag)
Definition: RenderRow.cs:162
Definition: SKILL.cs:294
SourceElement elements
static bool IsActive
Definition: VirtualDate.cs:13
static void Say(string text, FontColor fontColor=FontColor.Default, Sprite sprite=null)