Elin Modding Docs Doc
Loading...
Searching...
No Matches
ActMelee.cs
1using System;
2using System.Collections.Generic;
3using System.Runtime.CompilerServices;
4using UnityEngine;
5
6// Token: 0x020001BE RID: 446
7public class ActMelee : ActBaseAttack
8{
9 // Token: 0x17000330 RID: 816
10 // (get) Token: 0x06000CE1 RID: 3297 RVA: 0x00065356 File Offset: 0x00063556
11 public override int PerformDistance
12 {
13 get
14 {
15 if (Act.CC != null)
16 {
17 return Act.CC.body.GetMeleeDistance();
18 }
19 return 1;
20 }
21 }
22
23 // Token: 0x17000331 RID: 817
24 // (get) Token: 0x06000CE2 RID: 3298 RVA: 0x00065370 File Offset: 0x00063570
25 public override bool ResetAxis
26 {
27 get
28 {
29 return true;
30 }
31 }
32
33 // Token: 0x06000CE3 RID: 3299 RVA: 0x00065373 File Offset: 0x00063573
34 public bool HideHint(Card c)
35 {
36 return EClass.pc.isBlind || c == null || (c.isChara && !EClass.pc.CanSee(c));
37 }
38
39 // Token: 0x06000CE4 RID: 3300 RVA: 0x0006539E File Offset: 0x0006359E
40 public override string GetHintText(string str = "")
41 {
42 return "";
43 }
44
45 // Token: 0x06000CE5 RID: 3301 RVA: 0x000653A5 File Offset: 0x000635A5
46 public override string GetTextSmall(Card c)
47 {
48 if (!this.HideHint(c))
49 {
50 return base.GetTextSmall(c);
51 }
52 return null;
53 }
54
55 // Token: 0x06000CE6 RID: 3302 RVA: 0x000653B9 File Offset: 0x000635B9
56 public override CursorInfo GetCursorIcon(Card c)
57 {
58 if (!this.HideHint(c))
59 {
60 return CursorSystem.IconMelee;
61 }
62 return null;
63 }
64
65 // Token: 0x06000CE7 RID: 3303 RVA: 0x000653CB File Offset: 0x000635CB
66 public override bool ShowMouseHint(Card c)
67 {
68 return !this.HideHint(c);
69 }
70
71 // Token: 0x17000332 RID: 818
72 // (get) Token: 0x06000CE8 RID: 3304 RVA: 0x000653D7 File Offset: 0x000635D7
73 public override bool CanPressRepeat
74 {
75 get
76 {
77 return true;
78 }
79 }
80
81 // Token: 0x06000CE9 RID: 3305 RVA: 0x000653DC File Offset: 0x000635DC
82 public override bool CanPerform()
83 {
84 if (Act.TC == null || !Act.TC.IsAliveInCurrentZone)
85 {
86 return false;
87 }
88 if (Act.CC.Dist(Act.TC) > this.PerformDistance)
89 {
90 return false;
91 }
92 if (this.PerformDistance == 1)
93 {
94 if (!Act.CC.CanInteractTo(Act.TC))
95 {
96 return false;
97 }
98 }
99 else if (!Act.CC.CanSeeLos(Act.TC, -1, false))
100 {
101 return false;
102 }
103 return base.CanPerform();
104 }
105
106 // Token: 0x06000CEA RID: 3306 RVA: 0x0006544E File Offset: 0x0006364E
107 public override bool Perform()
108 {
109 return this.Attack(1f, false);
110 }
111
112 // Token: 0x06000CEB RID: 3307 RVA: 0x0006545C File Offset: 0x0006365C
113 public bool Attack(float dmgMulti = 1f, bool maxRoll = false)
114 {
115 ActMelee.<>c__DisplayClass13_0 CS$<>8__locals1;
116 CS$<>8__locals1.dmgMulti = dmgMulti;
117 CS$<>8__locals1.maxRoll = maxRoll;
118 Act.CC.combatCount = 10;
119 Act.CC.LookAt(Act.TC);
120 Act.CC.renderer.NextFrame();
121 if (Act.CC.HasCondition<ConFear>())
122 {
123 Act.CC.Say("fear", Act.CC, Act.TC, null, null);
124 if (Act.CC.IsPC)
125 {
126 EInput.Consume(true, 1);
127 }
128 return true;
129 }
130 Act.CC.renderer.PlayAnime(AnimeID.Attack, Act.TC);
131 Card tc = Act.TC;
132 if (tc != null)
133 {
134 Chara chara = tc.Chara;
135 if (chara != null)
136 {
137 chara.RequestProtection(Act.CC, delegate(Chara c)
138 {
139 Act.TC = c;
140 });
141 }
142 }
143 CellEffect effect = Act.TP.cell.effect;
144 if (effect != null && effect.id == 6 && EClass.rnd(2) == 0)
145 {
146 Act.CC.PlaySound("miss", 1f, true);
147 Act.CC.Say("abMistOfDarkness_miss", Act.CC, null, null);
148 return true;
149 }
150 CS$<>8__locals1.hasHit = false;
151 bool flag = false;
152 CS$<>8__locals1.usedTalisman = false;
153 CS$<>8__locals1.count = 0;
154 int num = Act.CC.Dist(Act.TC);
155 foreach (BodySlot bodySlot in Act.CC.body.slots)
156 {
157 if (Act.TC == null || !Act.TC.IsAliveInCurrentZone)
158 {
159 return true;
160 }
161 if (bodySlot.thing != null && bodySlot.elementId == 35 && bodySlot.thing.source.offense.Length >= 2)
162 {
163 ActMelee.<>c__DisplayClass13_1 CS$<>8__locals2;
164 CS$<>8__locals2.w = bodySlot.thing;
165 if (num <= 1 || num <= CS$<>8__locals2.w.Evalue(666) + 1)
166 {
167 flag = true;
168 if (CS$<>8__locals2.w.IsMeleeWithAmmo && Act.CC.IsPC && CS$<>8__locals2.w.c_ammo <= 0 && !Act.CC.HasCondition<ConReload>())
169 {
170 ActRanged.TryReload(CS$<>8__locals2.w, null);
171 }
172 int num2 = (CS$<>8__locals2.w == null) ? 0 : CS$<>8__locals2.w.Evalue(606);
173 if (CS$<>8__locals2.w != null)
174 {
175 CS$<>8__locals2.w.Evalue(607);
176 }
177 List<Point> list = EClass._map.ListPointsInLine(Act.CC.pos, Act.TC.pos, num2 / 10 + ((num2 % 10 > EClass.rnd(10)) ? 1 : 0) + 1);
178 ActMelee.<Attack>g__Attack|13_1(Act.TC, Act.TP, ref CS$<>8__locals1, ref CS$<>8__locals2);
179 if (num2 > 0)
180 {
181 Point obj = Act.TC.pos.Copy();
182 foreach (Point point in list)
183 {
184 if (!point.Equals(obj))
185 {
186 Chara firstChara = point.FirstChara;
187 if (firstChara != null && firstChara.IsHostile(Act.CC))
188 {
189 ActMelee.<Attack>g__Attack|13_1(point.FirstChara, point, ref CS$<>8__locals1, ref CS$<>8__locals2);
190 }
191 }
192 }
193 }
194 int count = CS$<>8__locals1.count;
195 CS$<>8__locals1.count = count + 1;
196 }
197 }
198 }
199 if (!flag)
200 {
201 AttackProcess.Current.Prepare(Act.CC, null, Act.TC, Act.TP, 0, false);
202 if (AttackProcess.Current.Perform(CS$<>8__locals1.count, CS$<>8__locals1.hasHit, CS$<>8__locals1.dmgMulti, CS$<>8__locals1.maxRoll))
203 {
204 CS$<>8__locals1.hasHit = true;
205 }
206 Act.CC.DoHostileAction(Act.TC, false);
207 }
208 if (EClass.core.config.game.waitOnMelee)
209 {
210 EClass.Wait(0.25f, Act.CC);
211 }
212 if (!CS$<>8__locals1.hasHit)
213 {
214 Act.CC.PlaySound("miss", 1f, true);
215 }
216 if (EClass.rnd(2) == 0)
217 {
218 Act.CC.RemoveCondition<ConInvisibility>();
219 }
220 return true;
221 }
222
223 // Token: 0x06000CED RID: 3309 RVA: 0x000658B8 File Offset: 0x00063AB8
224 [CompilerGenerated]
225 internal static void <Attack>g__Attack|13_1(Card _tc, Point _tp, ref ActMelee.<>c__DisplayClass13_0 A_2, ref ActMelee.<>c__DisplayClass13_1 A_3)
226 {
227 Act.TC = _tc;
228 Act.TP = _tp;
229 AttackProcess.Current.Prepare(Act.CC, A_3.w, Act.TC, Act.TP, A_2.count, false);
230 bool flag = AttackProcess.Current.Perform(A_2.count, A_2.hasHit, A_2.dmgMulti, A_2.maxRoll);
231 if (flag)
232 {
233 A_2.hasHit = true;
234 }
235 if (A_3.w.c_ammo > 0 && !Act.CC.HasCondition<ConReload>())
236 {
237 bool flag2 = true;
238 TraitAmmo traitAmmo = (A_3.w.ammoData == null) ? null : (A_3.w.ammoData.trait as TraitAmmo);
239 if (traitAmmo != null)
240 {
241 TraitAmmoTalisman traitAmmoTalisman = traitAmmo as TraitAmmoTalisman;
242 if (traitAmmoTalisman != null)
243 {
244 flag2 = false;
245 if (flag && !A_2.usedTalisman && Act.TC != null && Act.TC.IsAliveInCurrentZone)
246 {
247 Element element = Act.CC.elements.GetElement(traitAmmoTalisman.owner.refVal);
248 Act act = ((element != null) ? element.act : null) ?? ACT.Create(traitAmmoTalisman.owner.refVal);
249 Act.powerMod = traitAmmo.owner.encLV;
250 Debug.Log(Act.powerMod);
251 if (act.Perform(Act.CC, Act.TC, Act.TP))
252 {
253 A_2.usedTalisman = true;
254 flag2 = true;
255 int spellExp = Act.CC.elements.GetSpellExp(Act.CC, act, 200);
256 Act.CC.ModExp(act.id, spellExp);
257 }
258 Act.powerMod = 100;
259 }
260 }
261 }
262 if (flag2)
263 {
264 Thing w = A_3.w;
265 int c_ammo = w.c_ammo;
266 w.c_ammo = c_ammo - 1;
267 if (A_3.w.ammoData != null)
268 {
269 A_3.w.ammoData.Num = A_3.w.c_ammo;
270 }
271 if (A_3.w.c_ammo <= 0)
272 {
273 A_3.w.c_ammo = 0;
274 A_3.w.ammoData = null;
275 }
276 LayerInventory.SetDirty(A_3.w);
277 }
278 }
279 Act.CC.DoHostileAction(Act.TC, false);
280 }
281}
Definition ACT.cs:6
Definition Act.2.cs:7
Definition Card.cs:13
Definition Chara.cs:12
Definition Point.cs:11
Definition Thing.cs:10