Elin Decompiled Documentation EA 23.285 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 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(6608, 1274, 0);
45 TryLearn(6011, 281, 0);
46 TryLearn(6018, 226, 0);
47 TryLearn(6019, 227, 0);
48 TryLearn(6700, 1649, 0);
49 TryLearn(6720, 1657, 0);
50 TryLearn(6450, 132, 5);
51 TryLearn(6603, 6020, 50);
52 }
53 void TryLearn(int eleAction, int reqEle, int lqlv)
54 {
55 if (!HasBase(eleAction) && HasBase(reqEle) && GetElement(reqEle).ValueWithoutLink >= lqlv)
56 {
57 SetBase(eleAction, 1);
59 {
60 if (owner.IsPC)
61 {
63 }
64 owner.Say("learnSkill", Card, EClass.sources.elements.map[eleAction].GetName());
65 }
66 }
67 }
68 }
69
70 public override void OnTrain(int ele)
71 {
72 Msg.Say("trainSkill", Card, EClass.sources.elements.map[ele].GetName());
73 }
74
75 public override void OnModTempPotential(Element e, int v, int threshMsg)
76 {
77 if (threshMsg == 0 || Mathf.Abs(v) >= threshMsg)
78 {
79 string lang = ((v > 0) ? "potentialInc" : "potentialDec");
80 if (owner.IsPCFaction && v > 0)
81 {
82 owner.PlaySound("ding_potential");
83 }
84 Msg.SetColor((v > 0) ? "positive" : "negative");
85 owner.Say(lang, owner, e.Name.ToLower());
86 }
87 }
88
89 public override void OnLevelUp(Element e, int lastValue)
90 {
92 {
93 return;
94 }
95 if (owner.IsPC)
96 {
97 if (e.id == 287)
98 {
99 EClass.player.flags.canComupWithFoodRecipe = true;
100 }
101 SE.DingSkill2();
102 }
103 if (owner.isChara)
104 {
106 {
108 {
110 {
112 string text = e.source.GetText("textInc", returnNull: true);
113 if (!text.IsEmpty())
114 {
115 owner.Say(text, owner);
116 }
117 else
118 {
119 owner.Say("ding_skill", owner, e.Name);
120 }
121 owner.pos.TalkWitnesses(owner.Chara, "ding_other", 4, WitnessType.ally, null, 4 + EClass.pc.party.members.Count);
122 }
123 if (owner.IsPCParty)
124 {
125 WidgetPopText.Say("popDing".lang(owner.IsPC ? "" : owner.Name, e.Name, lastValue.ToString() ?? "", e.ValueWithoutLink.ToString() ?? ""), FontColor.Good);
126 }
127 }
128 if (owner.Chara.homeBranch != null)
129 {
130 owner.Chara.homeBranch.Log("bDing", Card, e.Name, lastValue.ToString() ?? "", e.ValueWithoutLink.ToString() ?? "");
131 }
132 }
133 if (e is Skill)
134 {
135 owner.AddExp(10 + EClass.rnd(5));
136 }
138 }
140 }
141
142 public override void OnLevelDown(Element e, int lastValue)
143 {
145 {
146 return;
147 }
148 _ = owner.IsPC;
149 if (!owner.isChara)
150 {
151 return;
152 }
154 {
156 string text = e.source.GetText("textDec", returnNull: true);
157 if (!text.IsEmpty())
158 {
159 Msg.Say(text, owner);
160 }
161 else
162 {
163 Msg.Say("dec_skill", owner, e.Name);
164 }
165 }
167 }
168
169 public override int ValueBonus(Element e)
170 {
171 if (EClass.game == null)
172 {
173 return 0;
174 }
175 int num = 0;
177 {
179 if (element != null)
180 {
181 num += element.Value;
182 }
183 if (owner.IsPCParty)
184 {
185 int id = e.id;
186 if ((id == 70 || (uint)(id - 72) <= 1u) && EClass.game.activeZone != null)
187 {
188 int num2 = 0;
189 foreach (Chara member in EClass.pc.party.members)
190 {
191 if (member.Evalue(1419) > 0)
192 {
193 num2 += member.Evalue(1419);
194 }
195 }
196 if (num2 > 0)
197 {
198 int num3 = 0;
199 foreach (Chara chara in EClass._map.charas)
200 {
201 if (chara.IsHostile(EClass.pc))
202 {
203 num3++;
204 }
205 }
206 if (num3 > 0)
207 {
208 num += Mathf.Max(1, (e.ValueWithoutLink + e.vLink) * (int)Mathf.Clamp(4f + Mathf.Sqrt(num3) * (float)num2 * 2f, 5f, 30f) / 100);
209 }
210 }
211 }
212 }
213 if (e.id == 78)
214 {
215 num += EClass.player.CountKeyItem("lucky_coin") * 2;
216 if (Chara != null && Chara.Evalue(663) > 0)
217 {
218 num = num * 2 + (e.ValueWithoutLink + e.vLink);
219 }
220 }
221 if (e.id != 664 && (owner.Chara.IsMachine || owner.id == "android"))
222 {
223 int num4 = owner.Evalue(664);
224 if (num4 > 0)
225 {
226 switch (e.id)
227 {
228 case 64:
229 case 65:
230 num += (e.ValueWithoutLink + e.vLink) * num4 / 2 / 100;
231 break;
232 case 79:
233 num += (e.ValueWithoutLink + e.vLink) * num4 / 100;
234 break;
235 }
236 }
237 }
238 }
239 if (!e.source.aliasMtp.IsEmpty())
240 {
241 int num5 = owner.Evalue(e.source.aliasMtp);
242 if (num5 != 0)
243 {
244 num += (e.ValueWithoutLink + e.vLink) * num5 / 100;
245 }
246 }
247 return num;
248 }
249}
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:2312
virtual Chara Chara
Definition: Card.cs:2108
string id
Definition: Card.cs:36
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:6375
virtual bool IsPCParty
Definition: Card.cs:2189
string Name
Definition: Card.cs:2177
Point pos
Definition: Card.cs:60
int uid
Definition: Card.cs:123
virtual bool IsPC
Definition: Card.cs:2183
virtual bool isChara
Definition: Card.cs:2121
int Evalue(int ele)
Definition: Card.cs:2611
virtual bool IsPCFaction
Definition: Card.cs:2309
virtual CardRow sourceCard
Definition: Card.cs:2169
SourceCategory.Row category
Definition: Card.cs:2087
bool isReplica
Definition: Card.cs:699
void AddExp(int a, bool applyMod=true)
Definition: Card.cs:3023
int LV
Definition: Card.cs:387
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:7052
Definition: Chara.cs:10
Faction faction
Definition: Chara.cs:429
Party party
Definition: Chara.cs:43
override bool IsPCFaction
Definition: Chara.cs:685
void CalculateMaxStamina()
Definition: Chara.cs:2052
bool IsInActiveZone
Definition: Chara.cs:852
bool IsMachine
Definition: Chara.cs:917
FactionBranch homeBranch
Definition: Chara.cs:1080
bool IsHostile()
Definition: Chara.cs:6660
bool IsGameStarted
Definition: Core.cs:84
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:333
int ValueWithoutLink
Definition: ELEMENT.cs:299
int id
Definition: ELEMENT.cs:255
SourceElement.Row source
Definition: ELEMENT.cs:278
int Value
Definition: ELEMENT.cs:297
virtual string Name
Definition: ELEMENT.cs:309
int vLink
Definition: ELEMENT.cs:265
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: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:19
int CountKeyItem(string alias)
Definition: Player.cs:2216
void TalkWitnesses(Chara criminal, string idTalk, int radius=4, WitnessType type=WitnessType.everyone, Func< Chara, bool > talkIf=null, int chance=3)
Definition: Point.cs:815
Definition: SKILL.cs:290
SourceElement elements
static bool IsActive
Definition: VirtualDate.cs:13
static void Say(string text, FontColor fontColor=FontColor.Default, Sprite sprite=null)