Elin Modding Docs Doc
Loading...
Searching...
No Matches
GoalCombat.cs
1using System;
2using System.Collections.Generic;
3using System.Runtime.CompilerServices;
4using UnityEngine;
5
6// Token: 0x0200022E RID: 558
7public class GoalCombat : Goal
8{
9 // Token: 0x1700040C RID: 1036
10 // (get) Token: 0x06000FAC RID: 4012 RVA: 0x0007058E File Offset: 0x0006E78E
11 public override CursorInfo CursorIcon
12 {
13 get
14 {
15 return CursorSystem.IconMelee;
16 }
17 }
18
19 // Token: 0x1700040D RID: 1037
20 // (get) Token: 0x06000FAD RID: 4013 RVA: 0x00070595 File Offset: 0x0006E795
21 public override bool CancelWhenDamaged
22 {
23 get
24 {
25 return false;
26 }
27 }
28
29 // Token: 0x06000FAE RID: 4014 RVA: 0x00070598 File Offset: 0x0006E798
30 public override bool CanManualCancel()
31 {
32 return true;
33 }
34
35 // Token: 0x1700040E RID: 1038
36 // (get) Token: 0x06000FAF RID: 4015 RVA: 0x0007059B File Offset: 0x0006E79B
37 public Tactics tactics
38 {
39 get
40 {
41 return this.owner.tactics;
42 }
43 }
44
45 // Token: 0x06000FB0 RID: 4016 RVA: 0x000705A8 File Offset: 0x0006E7A8
46 public override IEnumerable<AIAct.Status> Run()
47 {
48 if (this.destEnemy != null)
49 {
50 this.owner.enemy = this.destEnemy;
51 this.destEnemy = null;
52 }
53 int count = 0;
54 int lostCount = 0;
55 bool dontWander = this.owner.IsPCParty && !this.owner.IsPC && EClass.game.config.tactics.dontWander;
56 for (;;)
57 {
58 if (EClass.debug.logCombat)
59 {
60 Debug.Log(string.Concat(new string[]
61 {
62 "■",
63 this.owner.Name,
64 "/",
65 count.ToString(),
66 "/",
67 lostCount.ToString()
68 }));
69 }
70 if (EClass._zone.isPeace && this.owner.IsPCFactionOrMinion && !this.owner.IsPC)
71 {
72 this.owner.enemy = null;
73 this.owner.ShowEmo(Emo.happy, 0f, true);
74 yield return base.Success(null);
75 }
76 int num = count;
77 count = num + 1;
78 if (dontWander && this.owner.enemy != null && !EClass.pc.isBlind && !EClass.pc.CanSeeLos(this.owner.enemy, -1, false) && (this.owner.Dist(EClass.pc) > 4 || this.owner.Dist(this.owner.enemy) > 1))
79 {
80 Point firstStep = this.owner.GetFirstStep(EClass.pc.pos, PathManager.MoveType.Combat);
81 if (firstStep.IsValid && !firstStep.HasChara)
82 {
83 this.owner.enemy = null;
84 }
85 }
86 this.tc = this.owner.enemy;
87 if (this.tc != null && this.owner.IsPCFaction)
88 {
89 AI_Shear ai_Shear = EClass.pc.ai as AI_Shear;
90 if (ai_Shear != null && ai_Shear.target == this.tc)
91 {
92 this.tc = (this.owner.enemy = null);
93 }
94 }
95 if (this.tc == null || this.tc.isDead || !this.tc.ExistsOnMap || !this.tc.pos.IsInBounds || lostCount >= 5)
96 {
97 this.tc = (this.owner.enemy = null);
98 if (this.owner.IsPC && EClass.game.config.autoCombat.abortOnKill)
99 {
100 yield return base.Success(null);
101 }
102 this.owner.FindNewEnemy();
103 lostCount = 0;
104 if (this.owner.enemy == null)
105 {
106 yield return base.Success(null);
107 }
108 this.tc = this.owner.enemy;
109 }
110 else if (!this.owner.CanSeeLos(this.tc, -1, false))
111 {
112 num = lostCount;
113 lostCount = num + 1;
114 }
115 else
116 {
117 lostCount = 0;
118 }
119 if (this.owner.IsPC && this.tc.HasEditorTag(EditorTag.Invulnerable))
120 {
121 Msg.Say("abort_idle");
122 yield return base.Success(null);
123 }
124 if (this.tc.IsPCFaction && this.owner.id == "melilith_boss" && EClass._map.plDay.list.Count > 1 && EClass._map.plDay.list[0].data.id != 107)
125 {
126 EClass._zone.SetBGM(107, true);
127 }
128 if (this.abilities == null)
129 {
130 this.abilities = new List<GoalCombat.ItemAbility>();
131 this.BuildAbilityList();
132 }
133 if (this.owner.IsPCFaction && this.tc.IsPCFaction && EClass.rnd(5) == 0 && count > 2)
134 {
135 this.<Run>g__CalmDown|14_0();
136 yield return base.Success(null);
137 }
138 if (this.owner.OriginalHostility >= Hostility.Neutral && this.tc.OriginalHostility >= Hostility.Neutral && !this.owner.IsPCParty && this.owner.c_bossType == BossType.none && (!(this.owner.trait is TraitGuard) || this.owner.IsPCFaction || !this.tc.IsPCParty || !EClass.player.IsCriminal))
139 {
140 if (this.owner.calmCheckTurn < 0 || (!this.owner.enemy.IsPCParty && EClass.rnd(10) == 0))
141 {
142 this.<Run>g__CalmDown|14_0();
143 yield return base.Success(null);
144 }
145 this.owner.calmCheckTurn--;
146 }
147 if (this.owner.IsPC)
148 {
149 CursorSystem.ignoreCount = 1;
150 }
151 if (this.tc.host != null && (this.tc.hp == 0 || EClass.rnd(5) == 0))
152 {
153 this.tc = this.owner.SetEnemy(this.tc.host);
154 }
155 if (this.tc.parasite != null && !this.tc.isRestrained && this.tc.parasite.hp > 0 && EClass.rnd(5) == 0)
156 {
157 this.tc = this.owner.SetEnemy(this.tc.parasite);
158 }
159 if (this.tc.ride != null && !this.tc.isRestrained && this.tc.ride.hp > 0 && EClass.rnd(5) == 0)
160 {
161 this.tc = this.owner.SetEnemy(this.tc.ride);
162 }
163 if (this.tc.enemy != null)
164 {
165 this.tc.TrySetEnemy(this.owner);
166 }
167 if (!this.tc.IsMinion && EClass.rnd(10) == 0 && EClass.rnd(this.tc.DEX + 10) > this.owner.LV && this.tc.HasElement(1315, 1) && !this.owner.HasElement(1315, 1) && this.owner.race.IsMachine && this.owner.CanBeTempAlly(this.tc))
168 {
169 this.owner.Say("dominate_machine", this.tc, this.owner, null, null);
170 this.owner.PlayEffect("boost", true, 0f, default(Vector3));
171 this.owner.PlaySound("boost", 1f, true);
172 this.owner.ShowEmo(Emo.love, 0f, true);
173 this.owner.lastEmo = Emo.angry;
174 this.owner.MakeMinion(this.tc.IsPCParty ? EClass.pc : this.tc, MinionType.Default);
175 yield return base.Success(null);
176 }
177 if (EClass.rnd(5) == 0 && this.tc.HasElement(1325, 1) && this.owner.race.IsPlant && this.owner.CanBeTempAlly(this.tc))
178 {
179 this.owner.Say("dominate_plant", this.tc, this.owner, null, null);
180 this.owner.ShowEmo(Emo.love, 0f, true);
181 this.owner.lastEmo = Emo.angry;
182 this.owner.MakeMinion((this.tc.IsPCParty || this.tc.IsPCFactionMinion) ? EClass.pc : this.tc, MinionType.Friend);
183 yield return base.Success(null);
184 }
185 if (EClass.rnd(20) == 0 && this.owner.isRestrained)
186 {
187 this.owner.Talk("restrained", null, null, false);
188 }
189 if (this is GoalAutoCombat)
190 {
191 ActionMode.Adv.SetTurbo(EClass.game.config.autoCombat.turbo ? -1 : 0);
192 EClass.pc.ModExp(135, 20);
193 }
194 int dist = this.owner.Dist(this.tc);
195 bool move = this.owner.host == null && (this.tactics.ChanceMove > EClass.rnd(100) || (this.owner.IsPC && this.tc.HasCondition<ConFear>() && dist >= EClass.pc.GetSightRadius() - 1));
196 bool haltSecondMove = false;
197 if (!this.owner.IsPC && !this.owner.isBlind && this.tc.source.HasTag(CTAG.suicide) && this.owner.IsNeutralOrAbove() && !this.owner.isSummon && !this.owner.IsMinion && !this.tc.HasCondition<ConWet>())
198 {
199 if (dist <= 3)
200 {
201 if (EClass.rnd(15) == 0)
202 {
203 this.owner.Talk("run_suicide", null, null, false);
204 }
205 if (this.owner.host == null && this.owner.TryMoveFrom(this.tc.pos) != Card.MoveResult.Fail)
206 {
207 yield return AIAct.Status.Running;
208 this.idleCount = 0;
209 continue;
210 }
211 }
212 else if (dist <= 5)
213 {
214 haltSecondMove = true;
215 move = false;
216 }
217 }
218 if (dontWander)
219 {
220 int num2 = this.owner.Dist(EClass.pc);
221 if (num2 > 3)
222 {
223 int x = this.tc.pos.x;
224 int z = this.tc.pos.z;
225 if (EClass.pc.pos.Distance(this.owner.pos.x + ((x > this.owner.pos.x) ? 1 : ((x < this.owner.pos.x) ? -1 : 0)), this.owner.pos.z + ((z > this.owner.pos.z) ? 1 : ((z < this.owner.pos.z) ? -1 : 0))) >= num2)
226 {
227 move = false;
228 haltSecondMove = true;
229 }
230 }
231 }
232 if (this.owner.IsPC && EClass.game.config.autoCombat.bDontChase)
233 {
234 move = false;
235 haltSecondMove = true;
236 }
237 if (EClass.debug.logCombat)
238 {
239 Debug.Log(string.Concat(new string[]
240 {
241 this.owner.Name,
242 "/",
243 move.ToString(),
244 "/",
245 haltSecondMove.ToString(),
246 "/",
247 dist.ToString()
248 }));
249 }
250 if (move)
251 {
252 if (this.owner.IsPC && dist <= this.owner.GetSightRadius() && this.TryUseAbility(dist, true))
253 {
254 yield return AIAct.Status.Running;
255 this.idleCount = 0;
256 continue;
257 }
258 if (this.TryMove(dist))
259 {
260 if (EClass.debug.logCombat)
261 {
262 Debug.Log("moved:" + this.owner.Name);
263 }
264 yield return AIAct.Status.Running;
265 this.idleCount = 0;
266 continue;
267 }
268 }
269 if (this.owner == null)
270 {
271 yield return this.Cancel();
272 }
273 if (dist <= this.owner.GetSightRadius() && this.TryUseAbility(dist, false))
274 {
275 yield return AIAct.Status.Running;
276 this.idleCount = 0;
277 }
278 else
279 {
280 if (EClass.debug.logCombat)
281 {
282 Debug.Log(string.Concat(new string[]
283 {
284 this.owner.Name,
285 "/",
286 move.ToString(),
287 "/",
288 haltSecondMove.ToString(),
289 "/",
290 this.tactics.ChanceSecondMove.ToString()
291 }));
292 }
293 if (!move && !haltSecondMove && this.tactics.ChanceSecondMove > EClass.rnd(100) && this.TryMove(dist))
294 {
295 yield return AIAct.Status.Running;
296 this.idleCount = 0;
297 }
298 else
299 {
300 if (this.owner == null)
301 {
302 yield return this.Cancel();
303 }
304 this.idleCount++;
305 if (this.TryAbortCombat())
306 {
307 yield return base.Success(null);
308 }
309 if (this.idleCount > 2)
310 {
311 if (dontWander)
312 {
313 yield return base.Success(null);
314 }
315 this.idleCount = 0;
316 string aiIdle = this.owner.source.aiIdle;
317 if (aiIdle == "stand" || aiIdle == "root")
318 {
319 yield return base.Success(null);
320 }
321 yield return base.DoGoto(this.tc.pos, 0, false, null);
322 }
323 else if (this.owner.FindNearestNewEnemy())
324 {
325 continue;
326 }
327 yield return AIAct.Status.Running;
328 }
329 }
330 }
331 yield break;
332 }
333
334 // Token: 0x06000FB1 RID: 4017 RVA: 0x000705B8 File Offset: 0x0006E7B8
335 public bool TryMove(int dist)
336 {
337 if (this.owner.host != null)
338 {
339 return false;
340 }
341 if (this.owner.isBlind)
342 {
343 return this.owner.MoveRandom();
344 }
345 int num = this.tc.HasCondition<ConFear>() ? 1 : this.tactics.DestDist;
346 if (!this.owner.IsPC && (this.tactics.source.id == "archer" || this.tactics.source.id == "gunner") && !this.owner.TryEquipRanged())
347 {
348 num = 1;
349 }
350 if (!this.owner.IsPC && num > 1)
351 {
352 if (this.tactics.DestDist == 2)
353 {
354 if (EClass.rnd(5) == 0)
355 {
356 num = 1;
357 }
358 }
359 else if (this.owner.turn / 3 % 5 > 2)
360 {
361 num--;
362 }
363 }
364 bool flag = false;
365 if (dist > num)
366 {
367 flag = (this.owner.TryMoveTowards(this.tc.pos) > Card.MoveResult.Fail);
368 if (!flag)
369 {
370 this.moveFail++;
371 }
372 }
373 else if (dist < num)
374 {
375 flag = (this.owner.TryMoveFrom(this.tc.pos) > Card.MoveResult.Fail);
376 }
377 if (flag)
378 {
379 this.moveFail = 0;
380 }
381 if (EClass.debug.logCombat)
382 {
383 Debug.Log(string.Concat(new string[]
384 {
385 "TryMove:",
386 this.owner.Name,
387 "/",
388 flag.ToString(),
389 "/",
390 dist.ToString(),
391 "/",
392 num.ToString()
393 }));
394 }
395 return flag;
396 }
397
398 // Token: 0x06000FB2 RID: 4018 RVA: 0x00070762 File Offset: 0x0006E962
399 public void AddAbility(Act a, int mod = 0, int chance = 100, bool aiPt = false)
400 {
401 this.abilities.Add(new GoalCombat.ItemAbility
402 {
403 act = a,
404 priorityMod = mod,
405 chance = chance,
406 aiPt = aiPt
407 });
408 }
409
410 // Token: 0x06000FB3 RID: 4019 RVA: 0x00070791 File Offset: 0x0006E991
411 public virtual bool TryUseRanged(int dist)
412 {
413 return this.owner.TryEquipRanged() && ACT.Ranged.Perform(this.owner, this.tc, null);
414 }
415
416 // Token: 0x06000FB4 RID: 4020 RVA: 0x000707BC File Offset: 0x0006E9BC
417 public virtual bool TryThrow(int dist)
418 {
419 if (dist > this.owner.GetSightRadius())
420 {
421 return false;
422 }
423 Thing thing = this.owner.TryGetThrowable();
424 if (thing == null)
425 {
426 return false;
427 }
428 if (!ACT.Throw.CanPerform(this.owner, this.tc, this.tc.pos))
429 {
430 return false;
431 }
432 ActThrow.Throw(this.owner, this.tc.pos, this.tc, thing.HasElement(410, 1) ? thing : thing.Split(1), ThrowMethod.Default);
433 return true;
434 }
435
436 // Token: 0x06000FB5 RID: 4021 RVA: 0x00070848 File Offset: 0x0006EA48
437 public virtual bool TryUseAbility(int dist, bool beforeMove = false)
438 {
439 GoalCombat.<>c__DisplayClass19_0 CS$<>8__locals1 = new GoalCombat.<>c__DisplayClass19_0();
440 CS$<>8__locals1.<>4__this = this;
441 if (this.abilities.Count == 0)
442 {
443 string str = "no ability:";
444 Chara owner = this.owner;
445 Debug.Log(str + ((owner != null) ? owner.ToString() : null));
446 return false;
447 }
448 CS$<>8__locals1.numEnemy = -1;
449 CS$<>8__locals1.numFriend = -1;
450 CS$<>8__locals1.charaBuilt = false;
451 bool flag = this.owner.CanSeeLos(this.tc, dist, false);
452 bool isPCFaction = this.owner.IsPCFaction;
453 bool flag2 = this.owner.HasCondition<ConSilence>();
454 bool isBlind = this.owner.isBlind;
455 bool flag3 = this.owner.HasCondition<ConFear>();
456 bool isConfused = this.owner.isConfused;
457 bool flag4 = this.owner.HasCondition<ConDim>();
458 foreach (GoalCombat.ItemAbility itemAbility in this.abilities)
459 {
460 if (EClass.rnd(100) >= itemAbility.chance)
461 {
462 itemAbility.priority = 0;
463 }
464 else
465 {
466 Act act = itemAbility.act;
467 SourceElement.Row s = act.source;
468 itemAbility.priority = 0;
469 itemAbility.tg = null;
470 itemAbility.pt = false;
471 if (s.abilityType.Length != 0 && (!this.owner.IsPC || !flag2 || !(act is Spell)) && (!beforeMove || act.HasTag("before_move")))
472 {
473 string text = s.abilityType[0];
474 if (this.id != 6602 || (dist > 1 && !this.tc.HasCondition<ConEntangle>()))
475 {
476 uint num = <PrivateImplementationDetails>.ComputeStringHash(text);
477 int num2;
478 if (num <= 2140930120U)
479 {
480 if (num <= 979982427U)
481 {
482 if (num <= 115652151U)
483 {
484 if (num != 13211034U)
485 {
486 if (num != 115652151U)
487 {
488 goto IL_B97;
489 }
490 if (!(text == "debuff"))
491 {
492 goto IL_B97;
493 }
494 if (flag)
495 {
496 num2 = this.tactics.P_Debuff;
497 goto IL_B9A;
498 }
499 continue;
500 }
501 else
502 {
503 if (!(text == "summon"))
504 {
505 goto IL_B97;
506 }
507 if (this.owner.isRestrained || (this.tc != null && this.tc.IsRestrainedResident))
508 {
509 continue;
510 }
511 int num3 = EClass._zone.CountMinions(this.owner);
512 if (num3 < this.owner.MaxSummon)
513 {
514 num2 = this.tactics.P_Summon - 20 * num3 / this.owner.MaxSummon;
515 goto IL_B9A;
516 }
517 continue;
518 }
519 }
520 else if (num != 601369519U)
521 {
522 if (num != 740945997U)
523 {
524 if (num != 979982427U)
525 {
526 goto IL_B97;
527 }
528 if (!(text == "heal"))
529 {
530 goto IL_B97;
531 }
532 goto IL_727;
533 }
534 else
535 {
536 if (!(text == "any"))
537 {
538 goto IL_B97;
539 }
540 num2 = 50;
541 goto IL_B9A;
542 }
543 }
544 else
545 {
546 if (!(text == "suicide"))
547 {
548 goto IL_B97;
549 }
550 if (this.owner.IsPC || this.owner.HasCondition<ConWet>())
551 {
552 continue;
553 }
554 if (this.owner.HasTag(CTAG.kamikaze))
555 {
556 num2 = ((dist <= 1) ? 1000 : 0);
557 goto IL_B9A;
558 }
559 num2 = 100 - 125 * this.owner.hp / this.owner.MaxHP;
560 if (EClass.rnd(200) > num2)
561 {
562 continue;
563 }
564 goto IL_B9A;
565 }
566 }
567 else if (num <= 1167440125U)
568 {
569 if (num != 1000963043U)
570 {
571 if (num != 1167440125U)
572 {
573 goto IL_B97;
574 }
575 if (!(text == "attack"))
576 {
577 goto IL_B97;
578 }
579 }
580 else if (!(text == "attackMelee"))
581 {
582 goto IL_B97;
583 }
584 }
585 else if (num != 1244307660U)
586 {
587 if (num != 2043306875U)
588 {
589 if (num != 2140930120U)
590 {
591 goto IL_B97;
592 }
593 if (!(text == "summonAlly"))
594 {
595 goto IL_B97;
596 }
597 if (!this.owner.isRestrained && (this.tc == null || !this.tc.IsRestrainedResident))
598 {
599 if (this.owner.IsPC)
600 {
601 if (EClass.player.lastEmptyAlly <= 0)
602 {
603 continue;
604 }
605 }
606 else if (EClass._zone.CountMinions(this.owner) > 0)
607 {
608 continue;
609 }
610 num2 = this.tactics.P_Summon;
611 goto IL_B9A;
612 }
613 continue;
614 }
615 else
616 {
617 if (!(text == "melee"))
618 {
619 goto IL_B97;
620 }
621 if (dist > this.owner.body.GetMeleeDistance())
622 {
623 continue;
624 }
625 num2 = (flag3 ? (this.owner.IsPC ? 0 : (this.tactics.P_Melee / 2)) : this.tactics.P_Melee);
626 if (isConfused)
627 {
628 num2 -= (this.owner.IsPC ? 30 : 10);
629 }
630 if (isBlind)
631 {
632 num2 -= (this.owner.IsPC ? 50 : 10);
633 }
634 if (this.tc.HasElement(1221, 1))
635 {
636 num2 -= 40;
637 }
638 if (this.tc.HasElement(1223, 1))
639 {
640 num2 -= 40;
641 goto IL_B9A;
642 }
643 goto IL_B9A;
644 }
645 }
646 else
647 {
648 if (!(text == "buff"))
649 {
650 goto IL_B97;
651 }
652 num2 = CS$<>8__locals1.<TryUseAbility>g__ForeachChara|3(itemAbility, delegate(Chara c)
653 {
654 if (!c.HasCondition(s.proc[1]))
655 {
656 return CS$<>8__locals1.<>4__this.tactics.P_Buff;
657 }
658 return 0;
659 }, true);
660 if (itemAbility.aiPt || (this.owner.IsPC && this.tactics.CastPartyBuff))
661 {
662 itemAbility.pt = true;
663 goto IL_B9A;
664 }
665 goto IL_B9A;
666 }
667 }
668 else if (num <= 2762313447U)
669 {
670 if (num <= 2360683452U)
671 {
672 if (num != 2301512864U)
673 {
674 if (num != 2360683452U)
675 {
676 goto IL_B97;
677 }
678 if (!(text == "attackArea"))
679 {
680 goto IL_B97;
681 }
682 if (this.owner.isRestrained || (this.tc != null && this.tc.IsRestrainedResident))
683 {
684 continue;
685 }
686 bool flag5 = itemAbility.act is ActBolt;
687 if (!flag || (this.owner.IsPCParty && (EClass._zone.IsTown || EClass._zone.IsPCFaction)))
688 {
689 continue;
690 }
691 CS$<>8__locals1.<TryUseAbility>g__GetNumEnemy|0(flag5 ? 6 : 5);
692 if (CS$<>8__locals1.numEnemy != 0)
693 {
694 num2 = this.tactics.P_Spell - 20 + CS$<>8__locals1.numEnemy * 10 + CS$<>8__locals1.<TryUseAbility>g__GetAttackMod|4(act);
695 goto IL_B9A;
696 }
697 continue;
698 }
699 else
700 {
701 if (!(text == "wait"))
702 {
703 goto IL_B97;
704 }
705 if (!this.owner.IsPCParty)
706 {
707 num2 = 50;
708 goto IL_B9A;
709 }
710 continue;
711 }
712 }
713 else if (num != 2627848062U)
714 {
715 if (num != 2671260646U)
716 {
717 if (num != 2762313447U)
718 {
719 goto IL_B97;
720 }
721 if (!(text == "buffStats"))
722 {
723 goto IL_B97;
724 }
725 num2 = CS$<>8__locals1.<TryUseAbility>g__ForeachChara|3(itemAbility, delegate(Chara c)
726 {
727 Element buffStats = c.GetBuffStats(s.proc[1]);
728 if (buffStats != null && buffStats.Value >= 0)
729 {
730 return 0;
731 }
732 return CS$<>8__locals1.<>4__this.tactics.P_Buff;
733 }, true);
734 if (itemAbility.aiPt || (this.owner.IsPC && this.tactics.CastPartyBuff))
735 {
736 itemAbility.pt = true;
737 goto IL_B9A;
738 }
739 goto IL_B9A;
740 }
741 else
742 {
743 if (!(text == "item"))
744 {
745 goto IL_B97;
746 }
747 num2 = (itemAbility.act as ActItem).BuildAct(this.owner);
748 goto IL_B9A;
749 }
750 }
751 else
752 {
753 if (!(text == "ground"))
754 {
755 goto IL_B97;
756 }
757 if (!flag || this.owner.isRestrained || (this.tc != null && this.tc.IsRestrainedResident))
758 {
759 continue;
760 }
761 num2 = 50;
762 if (isPCFaction)
763 {
764 num2 -= 10;
765 goto IL_B9A;
766 }
767 goto IL_B9A;
768 }
769 }
770 else if (num <= 3546849056U)
771 {
772 if (num != 3164374115U)
773 {
774 if (num != 3289626814U)
775 {
776 if (num != 3546849056U)
777 {
778 goto IL_B97;
779 }
780 if (!(text == "dot"))
781 {
782 goto IL_B97;
783 }
784 }
785 else
786 {
787 if (!(text == "teleport"))
788 {
789 goto IL_B97;
790 }
791 num2 = 40;
792 goto IL_B9A;
793 }
794 }
795 else
796 {
797 if (!(text == "taunt"))
798 {
799 goto IL_B97;
800 }
801 bool flag6 = this.owner.HasCondition<StanceTaunt>();
802 bool flag7 = this.tactics.source.taunt != -1 && 100 * this.owner.hp / this.owner.MaxHP >= this.tactics.source.taunt;
803 num2 = ((flag6 && !flag7) ? 100 : ((!flag6 && flag7) ? 100 : 0));
804 goto IL_B9A;
805 }
806 }
807 else if (num != 4208725202U)
808 {
809 if (num != 4274235348U)
810 {
811 if (num != 4289936826U)
812 {
813 goto IL_B97;
814 }
815 if (!(text == "debuffStats"))
816 {
817 goto IL_B97;
818 }
819 if (flag)
820 {
821 num2 = CS$<>8__locals1.<TryUseAbility>g__ForeachChara|3(itemAbility, delegate(Chara c)
822 {
823 Element buffStats = c.GetBuffStats(s.proc[1]);
824 if (buffStats != null && buffStats.Value <= 0)
825 {
826 return 0;
827 }
828 return CS$<>8__locals1.<>4__this.tactics.P_Debuff;
829 }, false);
830 goto IL_B9A;
831 }
832 continue;
833 }
834 else
835 {
836 if (!(text == "hot"))
837 {
838 goto IL_B97;
839 }
840 goto IL_727;
841 }
842 }
843 else
844 {
845 if (!(text == "range"))
846 {
847 goto IL_B97;
848 }
849 if (!flag || EClass.rnd(100) > this.tactics.RangedChance)
850 {
851 continue;
852 }
853 num2 = (flag3 ? (this.owner.IsPC ? 0 : (this.tactics.P_Range / 2)) : this.tactics.P_Range);
854 if (isConfused)
855 {
856 num2 -= (this.owner.IsPC ? 30 : 10);
857 }
858 if (isBlind)
859 {
860 num2 -= (this.owner.IsPC ? 50 : 10);
861 }
862 if (this.owner.ranged != null && this.owner.ranged.trait is TraitToolRangeCane && this.owner.mana.value <= 0)
863 {
864 continue;
865 }
866 goto IL_B9A;
867 }
868 if (!flag)
869 {
870 continue;
871 }
872 bool flag8 = text == "dot";
873 if (flag8 && (this.owner.isRestrained || (this.tc != null && this.tc.IsRestrainedResident)))
874 {
875 continue;
876 }
877 num2 = ((text == "attackMelee") ? this.tactics.P_Melee : this.tactics.P_Spell) + CS$<>8__locals1.<TryUseAbility>g__GetAttackMod|4(act);
878 if (num2 > 0 && flag8)
879 {
880 num2 += 10;
881 }
882 IL_B9A:
883 if (s.target == "Neighbor")
884 {
885 if (dist > 1)
886 {
887 continue;
888 }
889 num2 += 10;
890 }
891 if (s.proc.Length == 0 || !(s.proc[0] == "Debuff") || !this.tc.HasCondition(s.proc[1]))
892 {
893 if (s.abilityType.Length > 1)
894 {
895 num2 += (this.owner.IsPC ? s.abilityType[2] : s.abilityType[1]).ToInt();
896 }
897 if (act is Spell)
898 {
899 if (this.owner.IsPC)
900 {
901 if (act.vPotential <= 0)
902 {
903 continue;
904 }
905 if (flag2 || isConfused || flag4)
906 {
907 num2 -= 50;
908 }
909 }
910 else
911 {
912 if (flag2)
913 {
914 num2 -= 30;
915 }
916 if (isConfused || flag4)
917 {
918 num2 -= 10;
919 }
920 }
921 }
922 if (num2 > 0)
923 {
924 num2 += itemAbility.priorityMod + EClass.rnd(this.tactics.RandomFacotr + itemAbility.priorityMod);
925 }
926 itemAbility.priority = num2;
927 continue;
928 }
929 continue;
930 IL_727:
931 bool isHOT = text == "hot";
932 num2 = CS$<>8__locals1.<TryUseAbility>g__ForeachChara|3(itemAbility, (Chara c) => base.<TryUseAbility>g__HealFactor|6(c), true);
933 if (itemAbility.aiPt || (this.owner.IsPC && this.tactics.CastPartyBuff))
934 {
935 itemAbility.pt = true;
936 goto IL_B9A;
937 }
938 goto IL_B9A;
939 IL_B97:
940 num2 = 0;
941 goto IL_B9A;
942 }
943 }
944 }
945 }
946 this.abilities.Sort((GoalCombat.ItemAbility a, GoalCombat.ItemAbility b) => b.priority - a.priority);
947 foreach (GoalCombat.ItemAbility itemAbility2 in this.abilities)
948 {
949 if (itemAbility2.priority > 0)
950 {
951 if (EClass.debug.logCombat && this.owner.IsPC)
952 {
953 Debug.Log(itemAbility2.act.Name + "/" + itemAbility2.priority.ToString());
954 }
955 if (itemAbility2.act.source.alias == "ActRanged")
956 {
957 if (this.TryThrow(dist))
958 {
959 return true;
960 }
961 if (this.TryUseRanged(dist))
962 {
963 return true;
964 }
965 }
966 else
967 {
968 Act.Cost cost = itemAbility2.act.GetCost(this.owner);
969 if (!this.owner.IsPCParty || !itemAbility2.pt || itemAbility2.act.TargetType.ForceParty || cost.cost * EClass.pc.party.members.Count <= this.owner.mana.value)
970 {
971 if (isPCFaction && cost.cost > 0)
972 {
973 Act.CostType type = cost.type;
974 if (type != Act.CostType.MP)
975 {
976 if (type == Act.CostType.SP)
977 {
978 if (cost.cost > this.owner.stamina.value)
979 {
980 continue;
981 }
982 }
983 }
984 else if (cost.cost > this.owner.mana.value)
985 {
986 continue;
987 }
988 }
989 if ((cost.cost <= 0 || EClass.rnd(100) <= this.tactics.AbilityChance) && itemAbility2.act.CanPerform(this.owner, itemAbility2.tg ?? this.tc, null) && this.owner.UseAbility(itemAbility2.act, itemAbility2.tg ?? this.tc, null, (itemAbility2.act.HaveLongPressAction && itemAbility2.pt) || itemAbility2.aiPt))
990 {
991 if (EClass.debug.logCombat)
992 {
993 string[] array = new string[9];
994 array[0] = this.owner.Name;
995 array[1] = "/";
996 array[2] = itemAbility2.act.id.ToString();
997 array[3] = "/";
998 array[4] = itemAbility2.act.CanPerform(this.owner, itemAbility2.tg ?? this.tc, null).ToString();
999 array[5] = "/";
1000 int num4 = 6;
1001 Chara tg = itemAbility2.tg;
1002 array[num4] = ((tg != null) ? tg.ToString() : null);
1003 array[7] = "/";
1004 int num5 = 8;
1005 Chara chara = this.tc;
1006 array[num5] = ((chara != null) ? chara.ToString() : null);
1007 Debug.Log(string.Concat(array));
1008 }
1009 return true;
1010 }
1011 }
1012 }
1013 }
1014 }
1015 if (EClass.debug.logCombat)
1016 {
1017 Debug.Log(this.owner.Name + "/" + this.abilities.Count.ToString());
1018 foreach (GoalCombat.ItemAbility itemAbility3 in this.abilities)
1019 {
1020 Debug.Log(itemAbility3.act.Name);
1021 }
1022 }
1023 return false;
1024 }
1025
1026 // Token: 0x06000FB6 RID: 4022 RVA: 0x00071918 File Offset: 0x0006FB18
1027 public virtual void BuildAbilityList()
1028 {
1029 foreach (ActList.Item item in this.owner.ability.list.items)
1030 {
1031 this.AddAbility(item.act, 0, item.chance, item.pt);
1032 }
1033 this.AddAbility(ACT.Ranged, 0, 100, false);
1034 this.AddAbility(ACT.Melee, 0, 100, false);
1035 this.AddAbility(ACT.Item, 0, 100, false);
1036 }
1037
1038 // Token: 0x06000FB7 RID: 4023 RVA: 0x000719BC File Offset: 0x0006FBBC
1039 public virtual bool TryAbortCombat()
1040 {
1041 return false;
1042 }
1043
1044 // Token: 0x06000FB9 RID: 4025 RVA: 0x000719D4 File Offset: 0x0006FBD4
1045 [CompilerGenerated]
1046 private void <Run>g__CalmDown|14_0()
1047 {
1048 this.owner.enemy = null;
1049 if (this.owner.ride != null)
1050 {
1051 this.owner.ride.enemy = null;
1052 }
1053 if (this.owner.parasite != null)
1054 {
1055 this.owner.parasite.enemy = null;
1056 }
1057 this.owner.hostility = this.owner.OriginalHostility;
1058 if (this.tc.enemy == this.owner)
1059 {
1060 this.tc.enemy = null;
1061 if (this.tc.ride != null)
1062 {
1063 this.tc.ride.enemy = null;
1064 }
1065 if (this.tc.parasite != null)
1066 {
1067 this.tc.parasite.enemy = null;
1068 }
1069 this.tc.hostility = this.tc.OriginalHostility;
1070 }
1071 this.owner.Say("calmDown", this.owner, null, null);
1072 }
1073
1074 // Token: 0x04000D89 RID: 3465
1075 public Chara destEnemy;
1076
1077 // Token: 0x04000D8A RID: 3466
1078 public Chara tc;
1079
1080 // Token: 0x04000D8B RID: 3467
1081 public int idleCount;
1082
1083 // Token: 0x04000D8C RID: 3468
1084 public int moveFail;
1085
1086 // Token: 0x04000D8D RID: 3469
1087 public List<GoalCombat.ItemAbility> abilities;
1088
1089 // Token: 0x04000D8E RID: 3470
1090 public List<Chara> charas = new List<Chara>();
1091
1092 // Token: 0x02000913 RID: 2323
1093 public class ItemAbility
1094 {
1095 // Token: 0x04002661 RID: 9825
1096 public Act act;
1097
1098 // Token: 0x04002662 RID: 9826
1099 public int priority;
1100
1101 // Token: 0x04002663 RID: 9827
1102 public int priorityMod;
1103
1104 // Token: 0x04002664 RID: 9828
1105 public int chance;
1106
1107 // Token: 0x04002665 RID: 9829
1108 public Chara tg;
1109
1110 // Token: 0x04002666 RID: 9830
1111 public bool pt;
1112
1113 // Token: 0x04002667 RID: 9831
1114 public bool aiPt;
1115 }
1116}
Definition ACT.cs:6
Definition AIAct.cs:7
Definition Act.2.cs:7
Definition Card.cs:13
Definition Chara.cs:12
Definition Goal.cs:5
Definition Msg.cs:7
Definition Point.cs:11
Definition Thing.cs:10