Elin Decompiled Documentation EA 23.350.1 Nightly
Loading...
Searching...
No Matches
ActEffect.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using UnityEngine;
5
6public class ActEffect : EClass
7{
8 private class WishItem
9 {
10 public string n;
11
12 public int score;
13
14 public Action action;
15 }
16
17 public static int RapidCount;
18
19 public static float RapidDelay;
20
21 public static int angle = 20;
22
23 public static void TryDelay(Action a)
24 {
25 if (RapidCount == 0)
26 {
27 a();
28 return;
29 }
30 TweenUtil.Delay((float)RapidCount * RapidDelay, delegate
31 {
32 a();
33 });
34 }
35
36 public static bool DamageEle(Card CC, EffectId id, int power, Element e, List<Point> points, ActRef actref, string lang = null, Point center = null)
37 {
38 if (points.Count == 0)
39 {
41 return false;
42 }
44 {
45 Debug.Log(e.source.alias);
46 e = Element.Create(0, 1);
47 }
48 ElementRef elementRef = EClass.setting.elements[e.source.alias];
49 int num = actref.act?.ElementPowerMod ?? 50;
50 int num2 = 0;
51 List<Card> list = new List<Card>();
52 bool flag = false;
53 if (center == null)
54 {
55 center = CC.pos.Copy();
56 }
57 if ((id == EffectId.Explosive || id == EffectId.Rocket || id == EffectId.GravityGun) && actref.refThing != null)
58 {
59 power = power * actref.refThing.material.hardness / 10;
60 }
61 string text = id.ToString();
62 string text2 = (EClass.sources.calc.map.ContainsKey(text) ? text : (EClass.sources.calc.map.ContainsKey("Sp" + text) ? ("Sp" + text) : (text.ToLowerInvariant() + "_")));
63 foreach (Point p in points)
64 {
65 bool flag2 = true;
66 AttackSource attackSource = AttackSource.None;
67 switch (id)
68 {
69 case EffectId.Explosive:
70 case EffectId.Rocket:
71 case EffectId.GravityGun:
72 text2 = "ball_";
73 flag = false;
74 break;
75 case EffectId.BallBubble:
76 text2 = "ball_";
77 break;
78 case EffectId.Earthquake:
79 text2 = "SpEarthquake";
80 flag2 = false;
81 flag = true;
82 break;
83 case EffectId.Meteor:
84 text2 = "SpMeteor";
85 break;
86 default:
87 if (CC.isChara && p.Equals(CC.pos) && points.Count >= 2)
88 {
89 continue;
90 }
91 break;
92 case EffectId.Suicide:
93 break;
94 }
95 Effect effect = null;
96 Effect effect2 = (flag2 ? Effect.Get("trail1") : null);
97 Point point = p;
98 switch (id)
99 {
100 case EffectId.Arrow:
101 case EffectId.MoonSpear:
102 case EffectId.MoonArrow:
103 case EffectId.Missile:
104 {
105 object id2;
106 switch (id)
107 {
108 default:
109 id2 = "spell_arrow";
110 break;
111 case EffectId.Missile:
112 id2 = "spell_missile";
113 break;
114 case EffectId.MoonSpear:
115 case EffectId.MoonArrow:
116 id2 = "spell_moonspear";
117 break;
118 }
119 effect = Effect.Get((string)id2);
120 if (id == EffectId.Arrow || id == EffectId.Missile)
121 {
122 effect.sr.color = elementRef.colorSprite;
123 }
124 TrailRenderer componentInChildren = effect.GetComponentInChildren<TrailRenderer>();
125 Color startColor = (componentInChildren.endColor = elementRef.colorSprite);
126 componentInChildren.startColor = startColor;
127 point = CC.pos;
128 break;
129 }
130 case EffectId.Earthquake:
131 {
132 if (EClass.rnd(4) == 0 && p.IsSync)
133 {
134 effect = Effect.Get("smoke_earthquake");
135 }
136 float num3 = 0.06f * (float)CC.pos.Distance(p);
137 Point pos2 = p.Copy();
138 TweenUtil.Tween(num3, null, delegate
139 {
140 pos2.Animate(AnimeID.Quake, animeBlock: true);
141 });
142 if (effect != null)
143 {
144 effect.SetStartDelay(num3);
145 }
146 break;
147 }
148 default:
149 {
150 effect = Effect.Get("Element/ball_" + ((e.id == 0) ? "Void" : ((id == EffectId.GravityGun) ? "Gravity" : e.source.alias.Remove(0, 3))));
151 if (effect == null)
152 {
153 effect = Effect.Get("Element/ball_Fire");
154 }
155 float startDelay = ((id == EffectId.Meteor || id == EffectId.Comet) ? 0.1f : 0.04f) * (float)center.Distance(p);
156 effect.SetStartDelay(startDelay);
157 effect2.SetStartDelay(startDelay);
158 if (id == EffectId.GravityGun)
159 {
160 float duration = 0.06f * (float)center.Distance(p);
161 Point pos = p.Copy();
162 TweenUtil.Tween(duration, null, delegate
163 {
164 pos.Animate(AnimeID.Gravity, animeBlock: true);
165 });
166 }
167 break;
168 }
169 }
170 if (effect2 != null)
171 {
172 effect2.SetParticleColor(elementRef.colorTrail, changeMaterial: true, "_TintColor").Play(point);
173 }
174 if (effect != null)
175 {
176 switch (id)
177 {
178 case EffectId.Missile:
179 TryDelay(delegate
180 {
181 effect.Play(CC.pos);
182 effect.GetComponent<MissileHomingEffect>().Launch(CC.pos.PositionCenter(), p.PositionCenter());
183 });
184 break;
185 case EffectId.Arrow:
186 case EffectId.MoonSpear:
187 case EffectId.MoonArrow:
188 TryDelay(delegate
189 {
190 effect.Play(CC.pos, 0f, p);
191 });
192 break;
193 default:
194 TryDelay(delegate
195 {
196 effect.Play(p).Flip(p.x > center.x);
197 });
198 break;
199 }
200 if (id == EffectId.Flare)
201 {
202 TryDelay(delegate
203 {
204 Effect.Get("flare2").Play(EClass.rndf(0.5f), p);
205 });
206 }
207 }
208 if (e.id == 910)
209 {
210 EClass._map.TryShatter(p, 910, power, CC);
211 }
212 if (e.id == 911)
213 {
214 EClass._map.TryShatter(p, 911, power, CC);
215 }
216 foreach (Card item in p.ListCards().ToList())
217 {
218 Card c = item;
219 if ((!c.isChara && !c.trait.CanBeAttacked) || (c.IsMultisize && item == CC) || (c.isChara && (c.Chara.host == CC || c.Chara.parasite == CC || c.Chara.ride == CC)))
220 {
221 continue;
222 }
223 switch (id)
224 {
225 case EffectId.Arrow:
226 case EffectId.Hand:
227 case EffectId.Sword:
228 case EffectId.MoonSpear:
229 case EffectId.MoonArrow:
230 if (c.isChara && CC.isChara)
231 {
232 c.Chara.RequestProtection(CC.Chara, delegate(Chara a)
233 {
234 c = a;
235 });
236 }
237 if (id == EffectId.MoonSpear || (id == EffectId.MoonArrow && EClass.rnd(5) == 0))
238 {
239 attackSource = AttackSource.MoonSpear;
240 }
241 break;
242 }
243 switch (id)
244 {
245 case EffectId.Arrow:
246 attackSource = AttackSource.MagicArrow;
247 break;
248 case EffectId.Hand:
249 attackSource = AttackSource.MagicHand;
250 break;
251 case EffectId.Sword:
252 attackSource = AttackSource.MagicSword;
253 break;
254 }
255 long num4 = 0L;
256 bool isChara = CC.isChara;
257 if (id == EffectId.Suicide)
258 {
259 num4 = CC.MaxHP * 2;
260 num4 = num4 * 100 / (50 + center.Distance(p) * 75);
261 if ((c.HasCondition<ConBrightnessOfLife>() || c.HasTag(CTAG.suicide)) && !c.HasCondition<ConWet>() && !c.IsPowerful)
262 {
263 list.Add(c);
264 }
265 }
266 else
267 {
268 Dice dice = Dice.Create(text2, power, CC, (actref.refThing != null) ? null : actref.act);
269 if (dice == null)
270 {
271 Debug.Log(text2);
272 }
273 num4 = dice.Roll();
274 Debug.Log(id.ToString() + "/" + text2 + "/" + power + "/" + actref.act?.ToString() + "/" + dice?.ToString() + "/" + num4);
275 switch (id)
276 {
277 case EffectId.Earthquake:
278 if (c.HasCondition<ConGravity>())
279 {
280 num4 = dice.RollMax() * 2;
281 }
282 else if (c.isChara && c.Chara.IsLevitating)
283 {
284 num4 /= 2;
285 }
286 break;
287 case EffectId.Sword:
288 num4 = num4 * (int)Mathf.Min(70f + Mathf.Sqrt(CC.Evalue(101)) * 3f, 200f) / 100;
289 break;
290 case EffectId.GravityGun:
291 num4 /= 5;
292 break;
293 }
294 int num5 = 0;
295 switch (id)
296 {
297 case EffectId.Earthquake:
298 case EffectId.Comet:
299 num5 = 5;
300 break;
301 case EffectId.Ball:
302 case EffectId.Explosive:
303 case EffectId.BallBubble:
304 case EffectId.Rocket:
305 case EffectId.GravityGun:
306 num5 = 10;
307 break;
308 }
309 if (num5 != 0)
310 {
311 num4 = num4 * 100 / (90 + center.Distance(p) * num5);
312 }
313 }
314 if (id == EffectId.Sword)
315 {
316 c.PlaySound("ab_magicsword");
317 c.PlayEffect("hit_slash");
318 }
319 if ((actref.noFriendlyFire && !CC.Chara.IsHostile(c as Chara)) || (flag && c == CC))
320 {
321 continue;
322 }
323 if (isChara && points.Count > 1 && c != null && c.isChara && CC.isChara && CC.Chara.IsFriendOrAbove(c.Chara))
324 {
325 int num6 = CC.Evalue(302);
326 if (!CC.IsPC && CC.IsPCFactionOrMinion)
327 {
328 num6 += EClass.pc.Evalue(302);
329 }
330 if (CC.HasElement(1214))
331 {
332 num6 *= 2;
333 }
334 if (num6 > 0)
335 {
336 if (num6 * 10 > EClass.rnd(num4 + 1))
337 {
338 if (c == c.pos.FirstChara)
339 {
340 CC.ModExp(302, CC.IsPC ? 10 : 50);
341 }
342 continue;
343 }
344 num4 = EClass.rnd(num4 * 100 / (100 + num6 * 10 + 1));
345 if (c == c.pos.FirstChara)
346 {
347 CC.ModExp(302, CC.IsPC ? 20 : 100);
348 }
349 if (num4 == 0L)
350 {
351 continue;
352 }
353 }
354 if ((CC.HasElement(1214) || (!CC.IsPC && (CC.IsPCFaction || CC.IsPCFactionMinion) && EClass.pc.HasElement(1214))) && EClass.rnd(5) != 0)
355 {
356 continue;
357 }
358 }
359 if (!lang.IsEmpty())
360 {
361 if (lang == "spell_hand")
362 {
363 string[] list2 = Lang.GetList("attack" + (CC.isChara ? CC.Chara.race.meleeStyle.IsEmpty("Touch") : "Touch"));
364 string @ref = "_elehand".lang(e.source.GetAltname(2), list2[4]);
365 CC.Say(c.IsPCParty ? "cast_hand_ally" : "cast_hand", CC, c, @ref, c.IsPCParty ? list2[1] : list2[2]);
366 }
367 else
368 {
369 CC.Say(lang + "_hit", CC, c, e.Name.ToLower());
370 }
371 }
372 Chara chara = (CC.isChara ? CC.Chara : ((actref.refThing != null) ? EClass._map.FindChara(actref.refThing.c_uidRefCard) : null));
373 if (c.IsMultisize)
374 {
375 switch (id)
376 {
377 case EffectId.Ball:
378 case EffectId.Explosive:
379 case EffectId.BallBubble:
380 case EffectId.Meteor:
381 case EffectId.Earthquake:
382 case EffectId.Suicide:
383 case EffectId.Rocket:
384 case EffectId.Flare:
385 case EffectId.GravityGun:
386 case EffectId.Comet:
387 num4 /= 2;
388 break;
389 }
390 }
391 if (RapidCount > 0)
392 {
393 num4 = num4 * 100 / (100 + RapidCount * 50);
394 }
395 num4 = num4 * Act.powerMod / 100;
396 c.DamageHP(num4, e.id, power * num / 100, attackSource, chara ?? CC);
398 {
399 switch (id)
400 {
401 case EffectId.GravityGun:
402 if (c.isChara)
403 {
404 AddCon<ConGravity>(1, power);
405 AddCon<ConBlind>(4, power);
406 AddCon<ConDim>(5, power / 2);
407 AddCon<ConSupress>(3, power / 2);
408 if (actref.refThing != null && actref.refThing.id == "gun_gravity2")
409 {
410 AddCon<ConEntangle>(4, power / 3);
411 AddCon<ConSilence>(4, power / 3);
412 AddCon<ConWeakResEle>(4, power);
413 AddCon<ConNightmare>(4, power);
414 }
415 }
416 break;
417 case EffectId.DrainMana:
418 if (CC.IsAliveInCurrentZone && c.isChara && CC.isChara && c.Chara.mana.value > 0)
419 {
420 long num7 = num4 * num / 100;
421 Debug.Log(num4 + " v:" + num7 + " evalue:" + e.Value + " power:" + power + " elepMod:" + num);
422 if (num7 > c.Chara.mana.value)
423 {
424 num7 = c.Chara.mana.value;
425 }
426 c.Chara.mana.Mod((int)(-num7));
427 CC.Chara.mana.Mod((int)num7);
428 }
429 break;
430 }
431 }
432 if (id == EffectId.Explosive && CC.trait is TraitCookerMicrowave)
433 {
434 chara = EClass.pc;
435 }
436 if (chara != null && chara.IsAliveInCurrentZone && (!c.isChara || !c.IsPCFactionOrMinion || chara.IsHostile(c.Chara)))
437 {
438 chara.DoHostileAction(c);
439 }
440 num2++;
441 void AddCon<T>(int rate, int p2) where T : Condition
442 {
443 if (EClass.rnd(1 + actref.refVal) == 0 && !c.Chara.HasCondition<T>() && EClass.rnd(rate) == 0)
444 {
445 c.Chara.AddCondition<T>(p2);
446 }
447 }
448 }
449 if ((id == EffectId.Explosive || id == EffectId.Suicide || id == EffectId.Rocket) && (!EClass._zone.IsPCFaction || !EClass.Branch.HasItemProtection))
450 {
451 int num8;
452 switch (id)
453 {
454 default:
455 num8 = ((actref.refThing != null) ? actref.refThing.material.hardness : (30 + power / 20));
456 break;
457 case EffectId.Suicide:
458 num8 = CC.LV / 3 + 40;
459 break;
460 case EffectId.Meteor:
461 case EffectId.Comet:
462 num8 = 50 + power / 20;
463 break;
464 }
465 int num9 = num8;
466 bool flag3 = EClass._zone.HasLaw && !EClass._zone.IsPCFaction && (CC.IsPC || (id == EffectId.Explosive && actref.refThing == null)) && !(EClass._zone is Zone_Vernis);
467 if (p.HasObj && p.cell.matObj.hardness <= num9)
468 {
470 if (flag3)
471 {
473 }
474 }
475 if (!p.HasObj && p.HasBlock && p.matBlock.hardness <= num9)
476 {
478 if (flag3)
479 {
481 }
482 }
483 }
484 if (e.id == 910)
485 {
486 int num10 = 0;
487 if (id == EffectId.Meteor)
488 {
489 num10 = 2;
490 }
492 {
493 num10 = 0;
494 }
495 if (num10 > EClass.rnd(10))
496 {
497 p.ModFire(4 + EClass.rnd(10));
498 }
499 }
500 if (e.id == 911)
501 {
502 p.ModFire(-20, extinguish: true);
503 }
504 }
505 if (RapidCount == 0)
506 {
507 foreach (Card item2 in list)
508 {
509 if (item2.ExistsOnMap)
510 {
511 RapidCount += 2;
512 ProcAt(id, power, BlessedState.Normal, item2, null, item2.pos, isNeg: true, actref);
513 }
514 }
515 }
516 return num2 > 0;
517 }
518
519 public static void ProcAt(EffectId id, int power, BlessedState state, Card cc, Card tc, Point tp, bool isNeg, ActRef actRef = default(ActRef))
520 {
521 Chara CC = cc.Chara;
522 bool flag = state <= BlessedState.Cursed;
523 bool flag2 = isNeg || flag;
524 Element element = Element.Create(actRef.aliasEle.IsEmpty("eleFire"), power / 10);
525 Color matColor = EClass.Colors.elementColors.TryGetValue(element.source.alias);
527 {
528 angle += 5;
529 if (angle > 100)
530 {
531 angle = 30;
532 }
533 Debug.Log(angle);
534 }
535 switch (id)
536 {
537 case EffectId.Earthquake:
538 {
539 List<Point> list3 = EClass._map.ListPointsInCircle(CC.pos, 12f, mustBeWalkable: false);
540 if (list3.Count == 0)
541 {
542 list3.Add(CC.pos.Copy());
543 }
544 CC.Say("spell_earthquake", CC, element.Name.ToLower());
545 TryDelay(delegate
546 {
547 CC.PlaySound("spell_earthquake");
548 });
550 {
551 Shaker.ShakeCam("ball");
552 }
553 EClass.Wait(1f, CC);
554 DamageEle(CC, id, power, element, list3, actRef, "spell_earthquake");
555 break;
556 }
557 case EffectId.Meteor:
558 {
559 EffectMeteor.Create(cc.pos, 10, 10, delegate
560 {
561 });
562 List<Point> list10 = EClass._map.ListPointsInCircle(CC.pos, 10f);
563 if (list10.Count == 0)
564 {
565 list10.Add(CC.pos.Copy());
566 }
567 CC.Say("spell_ball", CC, element.Name.ToLower());
568 TryDelay(delegate
569 {
570 CC.PlaySound("spell_ball");
571 });
573 {
574 Shaker.ShakeCam("ball");
575 }
576 EClass.Wait(1f, CC);
577 DamageEle(CC, id, power, element, list10, actRef, "spell_ball");
578 return;
579 }
580 case EffectId.Comet:
581 {
582 EffectMeteor.CreateComet(tp, delegate
583 {
584 }, matColor * 2f);
585 List<Point> list2 = EClass._map.ListPointsInCircle(tp, 7f);
586 if (list2.Count == 0)
587 {
588 list2.Add(tp.Copy());
589 }
590 CC.Say("spell_ball", CC, element.Name.ToLower());
591 TryDelay(delegate
592 {
593 CC.PlaySound("spell_ball");
594 });
596 {
597 Shaker.ShakeCam("ball");
598 }
599 EClass.Wait(1f, CC);
600 DamageEle(CC, id, power, element, list2, actRef, "spell_ball", tp);
601 return;
602 }
603 case EffectId.Hand:
604 case EffectId.DrainBlood:
605 case EffectId.DrainMana:
606 case EffectId.Sword:
607 {
608 List<Point> list4 = new List<Point>();
609 list4.Add(tp.Copy());
610 EClass.Wait(0.3f, CC);
611 TryDelay(delegate
612 {
613 CC.PlaySound("spell_hand");
614 });
615 if (!DamageEle(CC, id, power, element, list4, actRef, (id == EffectId.DrainBlood || id == EffectId.DrainMana) ? "" : ((id == EffectId.Sword) ? "spell_sword" : "spell_hand")))
616 {
617 CC.Say("spell_hand_miss", CC, element.Name.ToLower());
618 }
619 if (id == EffectId.Sword && CC.ExistsOnMap)
620 {
621 CC.ModExp(101, 50);
622 }
623 return;
624 }
625 case EffectId.Arrow:
626 case EffectId.MoonSpear:
627 case EffectId.MoonArrow:
628 {
629 List<Point> list = new List<Point>();
630 list.Add(tp.Copy());
631 CC.Say((id == EffectId.MoonSpear) ? "spell_spear" : "spell_arrow", CC, element.Name.ToLower());
632 EClass.Wait(0.5f, CC);
633 TryDelay(delegate
634 {
635 CC.PlaySound((id == EffectId.MoonSpear) ? "spell_moonspear" : "spell_arrow");
636 });
637 DamageEle(CC, id, power, element, list, actRef, (id == EffectId.MoonSpear) ? "spell_spear" : "spell_arrow");
638 return;
639 }
640 case EffectId.Missile:
641 {
642 List<Point> list7 = new List<Point>();
643 List<Point> list8 = new List<Point> { tp.Copy() };
644 foreach (Point item in EClass._map.ListPointsInCircle(tp, 6f, mustBeWalkable: false))
645 {
646 if (item.Equals(tp) || !Los.IsVisible(CC.pos, item))
647 {
648 continue;
649 }
650 foreach (Card item2 in item.ListCards())
651 {
652 if ((item2.isChara && CC.IsHostile(item2.Chara)) || item2.trait.CanBeAttacked)
653 {
654 list8.Add(item);
655 break;
656 }
657 }
658 }
659 CC.Say("spell_missile", CC, element.Name.ToLower());
660 EClass.Wait(0.5f, CC);
661 TryDelay(delegate
662 {
663 CC.PlaySound("spell_missile");
664 });
665 for (int num9 = 0; num9 < 6 + EClass.rnd(7); num9++)
666 {
667 list7.Clear();
668 list7.Add(list8.RandomItem());
669 DamageEle(CC, id, power, element, list7, actRef, "spell_missile");
670 }
671 return;
672 }
673 case EffectId.Summon:
674 {
675 string n = actRef.n1;
676 if (!(n == "special"))
677 {
678 if (n == "special2")
679 {
680 if (EClass._zone.HasField(10000))
681 {
682 foreach (Chara item3 in EClass._map.charas.Where((Chara _c) => _c.id == "cocoon").ToList())
683 {
684 if (!item3.pos.IsSunLit)
685 {
686 item3.pos.PlayEffect("darkwomb3");
687 item3.HatchEgg();
688 }
689 }
690 }
691 CC.PlayEffect("darkwomb");
692 SE.Play("ab_womb");
693 }
694 else
695 {
696 CC.Say("summon_ally", CC);
697 }
698 }
699 else
700 {
701 SE.Play("warhorn");
702 Msg.Say("warhorn");
703 }
704 if (EClass._zone.CountMinions(CC) >= CC.MaxSummon || CC.c_uidMaster != 0)
705 {
706 CC.Say("summon_ally_fail", CC);
707 return;
708 }
709 string id3 = actRef.n1;
710 int num3 = 1;
711 int num4 = -1;
712 int radius = 3;
713 bool flag3 = false;
714 bool flag4 = actRef.n1 == "special";
715 int num5 = -1;
716 string text = "";
717 bool notMeAgain = CC.HasTag(CTAG.notMeAgain);
718 switch (actRef.n1)
719 {
720 case "shadow":
721 case "tsunami":
722 num3 = Mathf.Clamp(power / 100, 1, 5) + ((power >= 100) ? EClass.rnd(2) : 0);
723 break;
724 case "monster":
725 case "fire":
726 case "animal":
727 num3 = 1 + EClass.rnd(2);
728 break;
729 case "special_force":
730 id3 = "army_palmia";
731 num3 = 4 + EClass.rnd(2);
732 num5 = EClass._zone.DangerLv;
733 break;
734 case "tentacle":
735 num4 = 20 + EClass.rnd(10);
736 radius = 1;
737 break;
738 case "special":
739 CC.SetInt(70, EClass.world.date.GetRaw() + 1440);
740 num3 = Mathf.Clamp(7 + CC.LV / 100, 4, 20);
741 num5 = CC.LV;
742 break;
743 case "special2":
744 num3 = 30;
745 num5 = CC.LV;
746 break;
747 }
748 num3 += CC.Evalue(1240);
749 for (int num6 = 0; num6 < num3; num6++)
750 {
751 if (EClass._zone.CountMinions(CC) >= CC.MaxSummon)
752 {
753 break;
754 }
755 Point point = null;
756 point = ((!(actRef.n1 == "special2")) ? tp.GetRandomPoint(radius)?.GetNearestPoint(allowBlock: false, allowChara: false) : EClass._map.GetRandomSurface(centered: false, walkable: true, allowWater: true)?.GetNearestPoint(allowBlock: false, allowChara: false));
757 if (point == null || !point.IsValid)
758 {
759 continue;
760 }
761 Chara chara2 = null;
763 if (num5 != -1)
764 {
765 CardBlueprint.current.lv = num5;
766 }
767 if (!text.IsEmpty())
768 {
769 CardBlueprint.current.idEle = text;
770 }
771 switch (actRef.n1)
772 {
773 case "special":
774 if (num6 == 0 && !CC.HasMinion("imolonac") && !CC.HasMinion("ygolonac"))
775 {
776 chara2 = CharaGen.Create((EClass.rnd(20) == 0) ? "imolonac" : "ygolonac");
777 break;
778 }
779 chara2 = CharaGen.Create("hound", CC.LV);
780 if (text.IsEmpty())
781 {
782 text = chara2.MainElement.source.alias;
783 }
784 break;
785 case "special2":
786 chara2 = CharaGen.Create("cocoon");
787 break;
788 case "yeek":
789 chara2 = CharaGen.CreateFromFilter(SpawnListChara.Get("summon_yeek", (SourceChara.Row r) => r.race == "yeek"), power / 10);
790 break;
791 case "orc":
792 chara2 = CharaGen.CreateFromFilter(SpawnListChara.Get("summon_orc", (SourceChara.Row r) => r.race == "orc"), power / 10);
793 break;
794 case "dragon":
795 chara2 = CharaGen.CreateFromFilter(SpawnListChara.Get("summon_dragon", (SourceChara.Row r) => r.race == "dragon" || r.race == "drake" || r.race == "wyvern"), power / 5);
796 break;
797 case "undead":
798 chara2 = CharaGen.CreateFromFilter(SpawnListChara.Get("summon_undead", (SourceChara.Row r) => (!notMeAgain || !(r.id == CC.id)) && (r.HasTag(CTAG.undead) || (EClass.sources.races.map.TryGetValue(r.race)?.IsUndead ?? false))), power / 5);
799 break;
800 case "pawn":
801 chara2 = CharaGen.CreateFromFilter("c_pawn", power / 10);
802 break;
803 case "machine":
804 chara2 = CharaGen.CreateFromFilter("c_machine", power / 10);
805 break;
806 case "monster":
807 chara2 = CharaGen.CreateFromFilter("c_dungeon", power / 10);
808 break;
809 case "animal":
810 chara2 = CharaGen.CreateFromFilter("c_animal", power / 15);
811 break;
812 case "fire":
813 chara2 = CharaGen.CreateFromElement("Fire", power / 10);
814 break;
815 case "fish":
816 chara2 = CharaGen.CreateFromFilter(SpawnListChara.Get("summon_fish", (SourceChara.Row r) => r.ContainsTag("water") || r.model.Chara.race.tag.Contains("water")), power / 10);
817 break;
818 case "octopus":
819 chara2 = CharaGen.CreateFromFilter(SpawnListChara.Get("summon_octopus", (SourceChara.Row r) => r.race == "octopus"), power / 10);
820 break;
821 default:
822 chara2 = CharaGen.Create(id3, power / 10);
823 break;
824 }
825 if (chara2 == null)
826 {
827 continue;
828 }
829 if (chara2.rarity >= Rarity.Legendary && !flag4)
830 {
831 num6--;
832 continue;
833 }
834 long num7 = -1L;
835 n = actRef.n1;
836 if (!(n == "shadow"))
837 {
838 if (n == "special2")
839 {
840 point.PlayEffect("darkwomb2");
841 }
842 else
843 {
844 int num8 = 1;
845 if (!CC.IsPC)
846 {
847 num8 = (CC.IsPCFactionOrMinion ? (CC.LV / 2) : (CC.LV / 3 * 2));
848 }
849 if (num5 == -1)
850 {
851 num7 = chara2.LV * (100 + power / 10) / 100 + power / 30;
852 }
853 if (num7 < num8)
854 {
855 num7 = num8;
856 }
857 if (num7 > 99999999)
858 {
859 num7 = 99999999L;
860 }
861 }
862 }
863 else
864 {
865 num7 = power / 10 + 1;
866 }
867 if (chara2.LV < num7)
868 {
869 chara2.SetLv((int)num7);
870 }
871 chara2.interest = 0;
872 if (chara2.HaveFur())
873 {
874 chara2.c_fur = -1;
875 }
876 n = actRef.n1;
877 if (!(n == "shadow"))
878 {
879 if (n == "special_force")
880 {
881 chara2.homeZone = EClass._zone;
882 }
883 }
884 else
885 {
886 chara2.hp = chara2.MaxHP / 2;
887 }
888 EClass._zone.AddCard(chara2, point);
889 if (actRef.n1 == "special2")
890 {
891 chara2.SetHostility(Hostility.Enemy);
892 }
893 else if (flag)
894 {
895 chara2.SetHostility(Hostility.Enemy);
896 }
897 else if (!(actRef.n1 == "monster") || actRef.refThing == null)
898 {
899 chara2.MakeMinion(CC);
900 }
901 if (num4 != -1)
902 {
903 chara2.SetSummon(num4);
904 }
905 flag3 = true;
906 }
907 if (!flag3)
908 {
909 CC.Say("summon_ally_fail", CC);
910 }
911 return;
912 }
913 case EffectId.Funnel:
914 case EffectId.Bit:
915 {
916 if (EClass._zone.CountMinions(CC) >= CC.MaxSummon || CC.c_uidMaster != 0)
917 {
918 CC.Say("summon_ally_fail", CC);
919 return;
920 }
921 CC.Say("spell_funnel", CC, element.Name.ToLower());
922 CC.PlaySound("spell_funnel");
923 Chara chara = CharaGen.Create((id == EffectId.Bit) ? "bit2" : "bit");
924 chara.SetMainElement(element.source.alias, element.Value, elemental: true);
925 chara.SetSummon(20 + power / 20 + EClass.rnd(10));
926 chara.SetLv(Mathf.Abs(power) / 15);
927 chara.interest = 0;
928 EClass._zone.AddCard(chara, tp.GetNearestPoint(allowBlock: false, allowChara: false));
929 chara.PlayEffect("teleport");
930 chara.MakeMinion(CC);
931 return;
932 }
933 case EffectId.Breathe:
934 {
935 List<Point> list5 = EClass._map.ListPointsInArc(CC.pos, tp, 7, 35f);
936 if (list5.Count == 0)
937 {
938 list5.Add(CC.pos.Copy());
939 }
940 CC.Say("spell_breathe", CC, element.Name.ToLower());
941 EClass.Wait(0.8f, CC);
942 TryDelay(delegate
943 {
944 CC.PlaySound("spell_breathe");
945 });
947 {
948 Shaker.ShakeCam("breathe");
949 }
950 DamageEle(CC, id, power, element, list5, actRef, "spell_breathe");
951 return;
952 }
953 case EffectId.Scream:
954 CC.PlaySound("scream");
955 CC.PlayEffect("scream");
956 {
957 foreach (Point item4 in EClass._map.ListPointsInCircle(cc.pos, 6f, mustBeWalkable: false, los: false))
958 {
959 foreach (Chara chara3 in item4.Charas)
960 {
961 if (chara3.ResistLv(957) <= 0)
962 {
963 chara3.AddCondition<ConParalyze>(power);
964 }
965 }
966 }
967 return;
968 }
969 case EffectId.Ball:
970 case EffectId.Explosive:
971 case EffectId.BallBubble:
972 case EffectId.Suicide:
973 case EffectId.Rocket:
974 case EffectId.Flare:
975 case EffectId.GravityGun:
976 {
977 float radius2 = ((id == EffectId.GravityGun) ? 4f : ((id == EffectId.Rocket) ? 2.8f : ((id == EffectId.Suicide) ? 3.5f : ((id == EffectId.Flare) ? 2.1f : ((float)((id == EffectId.BallBubble) ? 2 : 5))))));
978 if ((id == EffectId.Explosive || id == EffectId.Rocket) && actRef.refThing != null)
979 {
980 radius2 = 2 + actRef.refThing.Evalue(666);
981 }
982 if (id == EffectId.Suicide)
983 {
984 if (CC.MainElement != Element.Void)
985 {
986 element = CC.MainElement;
987 }
989 {
990 element = Element.Create(919, 10);
991 }
992 if (CC.HasTag(CTAG.kamikaze))
993 {
994 radius2 = 1.5f;
995 }
996 }
997 bool flag5 = id == EffectId.Explosive || id == EffectId.Suicide || id == EffectId.Rocket;
998 List<Point> list9 = EClass._map.ListPointsInCircle((id == EffectId.GravityGun || id == EffectId.Rocket || id == EffectId.Flare) ? tp : cc.pos, radius2, !flag5, !flag5);
999 if (list9.Count == 0)
1000 {
1001 list9.Add(cc.pos.Copy());
1002 }
1003 cc.Say((id == EffectId.Suicide) ? "abSuicide" : "spell_ball", cc, element.Name.ToLower());
1004 EClass.Wait(0.8f, cc);
1005 TryDelay(delegate
1006 {
1007 if (id == EffectId.Flare)
1008 {
1009 tp.PlayEffect("flare");
1010 }
1011 if (id != EffectId.GravityGun)
1012 {
1013 cc.PlaySound((id == EffectId.Flare) ? "spell_flare" : "spell_ball");
1014 }
1015 });
1017 {
1018 Shaker.ShakeCam("ball");
1019 }
1020 DamageEle(actRef.origin ?? cc, id, power, element, list9, actRef, (id == EffectId.Suicide) ? "suicide" : "spell_ball");
1021 if (id == EffectId.Suicide && CC.IsAliveInCurrentZone)
1022 {
1023 CC.Die();
1024 }
1025 return;
1026 }
1027 case EffectId.Bolt:
1028 {
1029 List<Point> list6 = EClass._map.ListPointsInLine(CC.pos, tp, 10);
1030 if (list6.Count == 0)
1031 {
1032 list6.Add(CC.pos.Copy());
1033 }
1034 CC.Say("spell_bolt", CC, element.Name.ToLower());
1035 EClass.Wait(0.8f, CC);
1036 TryDelay(delegate
1037 {
1038 CC.PlaySound("spell_bolt");
1039 });
1041 {
1042 Shaker.ShakeCam("bolt");
1043 }
1044 DamageEle(CC, id, power, element, list6, actRef, "spell_bolt");
1045 return;
1046 }
1047 case EffectId.Bubble:
1048 case EffectId.Web:
1049 case EffectId.MistOfDarkness:
1050 case EffectId.Puddle:
1051 {
1052 if (LangGame.Has("ab" + id))
1053 {
1054 CC.Say("ab" + id, CC);
1055 }
1056 tp.PlaySound("vomit");
1057 int num = 2 + EClass.rnd(3);
1058 int id2 = ((id == EffectId.Puddle) ? 4 : ((id == EffectId.Bubble) ? 5 : ((id == EffectId.MistOfDarkness) ? 6 : 7)));
1059 EffectId idEffect = ((id == EffectId.Bubble) ? EffectId.BallBubble : EffectId.PuddleEffect);
1060 if (id == EffectId.Bubble && CC.id == "cancer")
1061 {
1062 idEffect = EffectId.Nothing;
1063 num = 1 + EClass.rnd(3);
1064 }
1065 for (int i = 0; i < num; i++)
1066 {
1067 Point randomPoint = tp.GetRandomPoint(2);
1068 if (randomPoint != null && !randomPoint.HasBlock && (id != EffectId.Puddle || !randomPoint.cell.IsTopWaterAndNoSnow))
1069 {
1070 int num2 = 4 + EClass.rnd(5);
1071 if (id == EffectId.Web)
1072 {
1073 num2 *= 3;
1074 }
1075 EClass._map.SetEffect(randomPoint.x, randomPoint.z, new CellEffect
1076 {
1077 id = id2,
1078 amount = num2,
1079 idEffect = idEffect,
1080 idEle = element.id,
1081 power = power,
1082 isHostileAct = CC.IsPCParty,
1083 color = BaseTileMap.GetColorInt(ref matColor, 100)
1084 });
1085 }
1086 }
1087 return;
1088 }
1089 }
1090 List<Card> list11 = tp.ListCards().ToList();
1091 list11.Reverse();
1092 if (list11.Contains(CC))
1093 {
1094 list11.Remove(CC);
1095 list11.Insert(0, CC);
1096 }
1097 bool flag6 = true;
1098 foreach (Card item5 in list11)
1099 {
1100 if (tc == null || item5 == tc)
1101 {
1102 Proc(id, power, state, CC, item5, actRef);
1103 if (flag2 && item5.isChara && item5 != CC)
1104 {
1105 CC.DoHostileAction(item5);
1106 }
1107 if (actRef.refThing == null || !(actRef.refThing.trait is TraitRod))
1108 {
1109 return;
1110 }
1111 EffectId effectId = id;
1112 if ((uint)(effectId - 200) <= 4u)
1113 {
1114 return;
1115 }
1116 flag6 = false;
1117 }
1118 }
1119 if (flag6)
1120 {
1121 CC.SayNothingHappans();
1122 }
1123 }
1124
1125 public static void Proc(EffectId id, Card cc, Card tc = null, int power = 100, ActRef actRef = default(ActRef))
1126 {
1127 Proc(id, power, BlessedState.Normal, cc, tc, actRef);
1128 }
1129
1130 public static void Proc(EffectId id, int power, BlessedState state, Card cc, Card tc = null, ActRef actRef = default(ActRef))
1131 {
1132 if (tc == null)
1133 {
1134 tc = cc;
1135 }
1136 Chara TC = tc.Chara;
1137 Chara CC = cc.Chara;
1138 bool blessed = state >= BlessedState.Blessed;
1139 bool flag = state <= BlessedState.Cursed;
1140 int orgPower = power;
1141 if (blessed || flag)
1142 {
1143 power *= 2;
1144 }
1145 switch (id)
1146 {
1147 case EffectId.Duplicate:
1148 CC.TryDuplicate();
1149 break;
1150 case EffectId.Fuse:
1151 if (!CC.TryFuse() && CC.IsPC)
1152 {
1154 }
1155 break;
1156 case EffectId.Escape:
1157 if (CC.IsPCFaction || (EClass._zone.Boss == CC && EClass.rnd(30) != 0))
1158 {
1159 return;
1160 }
1161 CC.Say("escape", CC);
1162 CC.PlaySound("escape");
1163 if (EClass._zone.Boss == CC)
1164 {
1165 CC.TryDropBossLoot();
1166 }
1167 if (CC.id == "bell_silver")
1168 {
1171 {
1173 }
1174 }
1175 CC.Destroy();
1176 break;
1177 case EffectId.BurnMana:
1178 CC.PlaySound("fire");
1179 CC.PlayEffect("Element/eleFire");
1180 CC.Say("burn_mana", CC);
1181 CC.mana.Mod(-CC.mana.max / 3 - 1);
1182 break;
1183 case EffectId.Exterminate:
1184 {
1185 CC.PlaySound("clean_floor");
1186 Msg.Say("exterminate");
1187 List<Chara> list2 = EClass._map.charas.Where((Chara chara3) => (chara3.isCopy || chara3.isHatchling || chara3.id == "cocoon" || chara3.id == "cocoon_alien") && !chara3.IsPCFactionOrMinion).ToList();
1188 if (list2.Count == 0)
1189 {
1191 return;
1192 }
1193 foreach (Chara item in list2)
1194 {
1195 item.Say("split_fail", item);
1196 item.PlayEffect("vanish");
1197 item.Die();
1198 }
1199 break;
1200 }
1201 case EffectId.DropMine:
1202 {
1203 if (CC.pos.Installed != null || EClass._zone.IsPCFaction)
1204 {
1205 return;
1206 }
1207 Thing thing3 = ThingGen.Create("mine");
1208 thing3.c_idRefCard = "dog_mine";
1209 Zone.ignoreSpawnAnime = true;
1210 EClass._zone.AddCard(thing3, CC.pos).Install();
1211 break;
1212 }
1213 case EffectId.LittleSisterMigration:
1214 case EffectId.SilverCatMigration:
1215 {
1216 bool flag2 = id == EffectId.SilverCatMigration;
1217 if (!EClass.game.IsSurvival && ((flag2 && EClass._zone.id != "startVillage2") || (!flag2 && !(EClass._zone is Zone_LittleGarden))))
1218 {
1220 return;
1221 }
1222 List<Chara> list = new List<Chara>();
1223 bool flag3 = false;
1224 foreach (Chara chara3 in EClass._map.charas)
1225 {
1226 if (!chara3.IsPCFactionOrMinion && chara3.id == (flag2 ? "cat_silver" : "littleOne"))
1227 {
1228 if (flag3)
1229 {
1230 flag3 = false;
1231 continue;
1232 }
1233 list.Add(chara3);
1234 flag3 = true;
1235 }
1236 }
1237 if (list.Count == 0)
1238 {
1240 return;
1241 }
1242 EClass.pc.PlaySound("chime_angel");
1243 foreach (Chara item2 in list)
1244 {
1245 item2.PlayEffect("revive");
1246 item2.Destroy();
1247 }
1248 Msg.Say(flag2 ? "cat_migration" : "little_migration", list.Count.ToString() ?? "");
1249 EClass._zone.ModInfluence(list.Count);
1250 if (flag2)
1251 {
1252 EClass.player.stats.catDepart += list.Count;
1253 break;
1254 }
1255 EClass.player.stats.sistersDepart += list.Count;
1257 break;
1258 }
1259 case EffectId.MagicMap:
1260 if (!CC.IsPC)
1261 {
1262 CC.SayNothingHappans();
1263 break;
1264 }
1265 if (flag)
1266 {
1267 CC.Say("abMagicMap_curse", CC);
1268 CC.PlaySound("curse3");
1269 CC.PlayEffect("curse");
1270 CC.AddCondition<ConConfuse>(200, force: true);
1271 break;
1272 }
1273 CC.Say("abMagicMap", CC);
1274 CC.PlayEffect("identify");
1275 CC.PlaySound("identify");
1276 if (blessed)
1277 {
1279 }
1280 else
1281 {
1282 EClass._map.Reveal(CC.pos, power);
1283 }
1284 break;
1285 case EffectId.AbsorbMana:
1286 {
1287 if (CC == TC)
1288 {
1289 EClass.game.religions.Element.Talk("ability");
1290 }
1291 Dice dice = Dice.Create("ActManaAbsorb", power, CC, (actRef.refThing != null) ? null : actRef.act);
1292 TC.mana.Mod(MathEx.ClampToInt(dice.Roll() + TC.mana.max / 5));
1293 TC.PlaySound("heal");
1294 TC.PlayEffect("heal");
1295 if (TC == CC)
1296 {
1297 CC.Say("absorbMana", CC);
1298 }
1299 break;
1300 }
1301 case EffectId.ModPotential:
1302 {
1303 Element element = cc.elements.ListElements((Element e) => e.HasTag("primary")).RandomItem();
1304 cc.elements.ModTempPotential(element.id, power / 10);
1305 break;
1306 }
1307 case EffectId.ForgetItems:
1308 {
1309 TC.PlaySound("curse3");
1310 TC.PlayEffect("curse");
1311 TC.Say("forgetItems", TC);
1312 int num8 = power / 50 + 1 + EClass.rnd(3);
1313 List<Thing> source = TC.things.List((Thing thing8) => thing8.c_IDTState == 0);
1314 for (int num9 = 0; num9 < num8; num9++)
1315 {
1316 source.RandomItem().c_IDTState = 5;
1317 }
1318 break;
1319 }
1320 case EffectId.EnchantWeapon:
1321 case EffectId.EnchantArmor:
1322 case EffectId.EnchantWeaponGreat:
1323 case EffectId.EnchantArmorGreat:
1324 {
1325 bool armor = id == EffectId.EnchantArmor || id == EffectId.EnchantArmorGreat;
1326 bool flag8 = id == EffectId.EnchantWeaponGreat || id == EffectId.EnchantArmorGreat;
1327 if (!tc.isThing)
1328 {
1329 LayerDragGrid.CreateEnchant(CC, armor, flag8, state);
1330 return;
1331 }
1332 cc.PlaySound("identify");
1333 cc.PlayEffect("identify");
1334 if (flag)
1335 {
1336 cc.Say("enc_curse", tc);
1337 tc.ModEncLv(-1);
1338 break;
1339 }
1340 int num10 = (flag8 ? 4 : 2) + (blessed ? 1 : 0);
1341 if (tc.encLV >= num10)
1342 {
1343 cc.Say("enc_resist", tc);
1344 break;
1345 }
1346 cc.Say("enc", tc);
1347 tc.ModEncLv(1);
1348 break;
1349 }
1350 case EffectId.Identify:
1351 case EffectId.GreaterIdentify:
1352 {
1353 bool flag7 = id == EffectId.GreaterIdentify;
1354 if (flag)
1355 {
1356 Redirect(EffectId.ForgetItems, flag7 ? BlessedState.Cursed : BlessedState.Normal, default(ActRef));
1357 break;
1358 }
1359 if (!tc.isThing || (actRef.refThing == null && cc.IsPC && tc.GetRootCard() == tc))
1360 {
1361 int count = ((!blessed) ? 1 : (flag7 ? (2 + EClass.rnd(2)) : (3 + EClass.rnd(3))));
1362 LayerDragGrid.CreateIdentify(tc.isChara ? tc.Chara : CC, flag7, state, 0, count);
1363 return;
1364 }
1365 cc.PlaySound("identify");
1366 cc.PlayEffect("identify");
1367 tc.Thing.Identify(cc.IsPCParty, (!flag7) ? IDTSource.Identify : IDTSource.SuperiorIdentify);
1368 break;
1369 }
1370 case EffectId.Uncurse:
1371 {
1372 if (!tc.isThing)
1373 {
1374 LayerDragGrid.CreateUncurse(CC, state);
1375 return;
1376 }
1377 Thing thing4 = tc.Thing;
1378 if (thing4.blessedState == BlessedState.Cursed)
1379 {
1380 thing4.SetBlessedState(BlessedState.Normal);
1381 }
1382 else if (thing4.blessedState == BlessedState.Doomed)
1383 {
1384 thing4.SetBlessedState(BlessedState.Normal);
1385 }
1386 thing4.GetRootCard()?.TryStack(thing4);
1387 LayerInventory.SetDirty(thing4);
1388 break;
1389 }
1390 case EffectId.Lighten:
1391 {
1392 if (!tc.isThing)
1393 {
1394 LayerDragGrid.CreateLighten(CC, state);
1395 return;
1396 }
1397 if (tc.Num > 1)
1398 {
1399 tc = tc.Split(1);
1400 }
1401 cc.PlaySound("offering");
1402 cc.PlayEffect("buff");
1403 int num = (tc.isWeightChanged ? tc.c_weight : tc.Thing.source.weight);
1404 tc.isWeightChanged = true;
1405 Element orCreateElement = tc.elements.GetOrCreateElement(64);
1406 Element orCreateElement2 = tc.elements.GetOrCreateElement(65);
1407 Element orCreateElement3 = tc.elements.GetOrCreateElement(67);
1408 Element orCreateElement4 = tc.elements.GetOrCreateElement(66);
1409 bool flag4 = tc.IsEquipmentOrRangedOrAmmo || tc.IsThrownWeapon;
1410 if (flag)
1411 {
1412 num = (int)(0.01f * (float)num * (float)power * 0.75f + 500f);
1413 if (num < 0 || num > 10000000)
1414 {
1415 num = 10000000;
1416 flag4 = false;
1417 }
1418 if (flag4)
1419 {
1420 if (tc.IsWeapon || tc.IsThrownWeapon || tc.IsAmmo)
1421 {
1422 tc.elements.ModBase(67, Mathf.Clamp(orCreateElement3.vBase * power / 1000, 1, 5));
1423 tc.elements.ModBase(66, -Mathf.Clamp(orCreateElement4.vBase * power / 1000, 1, 5));
1424 }
1425 else
1426 {
1427 tc.elements.ModBase(65, Mathf.Clamp(orCreateElement2.vBase * power / 1000, 1, 5));
1428 tc.elements.ModBase(64, -Mathf.Clamp(orCreateElement.vBase * power / 1000, 1, 5));
1429 }
1430 }
1431 cc.Say("lighten_curse", tc);
1432 }
1433 else
1434 {
1435 num = num * (100 - power / 10) / 100;
1436 if (blessed)
1437 {
1438 power /= 4;
1439 }
1440 if (flag4)
1441 {
1442 if (tc.IsWeapon || tc.IsThrownWeapon || tc.IsAmmo)
1443 {
1444 tc.elements.ModBase(67, -Mathf.Clamp(orCreateElement3.vBase * power / 1000, 1, 5));
1445 tc.elements.ModBase(66, Mathf.Clamp(orCreateElement4.vBase * power / 1000, 1, 5));
1446 }
1447 else
1448 {
1449 tc.elements.ModBase(65, -Mathf.Clamp(orCreateElement2.vBase * power / 1000, 1, 5));
1450 tc.elements.ModBase(64, Mathf.Clamp(orCreateElement.vBase * power / 1000, 1, 5));
1451 }
1452 }
1453 cc.Say("lighten", tc);
1454 }
1455 tc.c_weight = num;
1456 tc.SetDirtyWeight();
1457 if (tc.parent == null)
1458 {
1459 CC.Pick(tc.Thing, msg: false);
1460 }
1462 break;
1463 }
1464 case EffectId.Reconstruction:
1465 {
1466 if (!tc.isThing)
1467 {
1468 LayerDragGrid.CreateReconstruction(CC, state, power / ((!(blessed || flag)) ? 1 : 2));
1469 return;
1470 }
1471 if (tc.Num > 1)
1472 {
1473 tc = tc.Split(1);
1474 }
1475 cc.PlaySound("mutation");
1476 cc.PlayEffect("identify");
1477 cc.Say("reconstruct", tc);
1478 EClass.game.cards.uidNext += EClass.rnd(30);
1479 int num7 = Mathf.Max(tc.genLv, tc.LV, EClass.player.stats.deepest);
1481 {
1482 blesstedState = state
1483 });
1484 Thing thing2 = ThingGen.Create(tc.id, -1, (int)((long)num7 * (long)power / 400));
1485 thing2.genLv = num7;
1486 thing2.idSkin = tc.idSkin;
1487 if (tc.c_uidAttune != 0)
1488 {
1489 thing2.c_uidAttune = tc.c_uidAttune;
1490 if (thing2.id == "amulet_engagement" || thing2.id == "ring_engagement")
1491 {
1492 if (tc.c_uidAttune != EClass.pc.uid)
1493 {
1494 thing2.elements.ModBase(484, 3);
1495 }
1496 if (thing2.rarity < Rarity.Mythical)
1497 {
1498 thing2.rarity = Rarity.Mythical;
1499 }
1500 }
1501 }
1502 tc.Destroy();
1503 CC.Pick(thing2, msg: false);
1504 if (!CC.IsPC)
1505 {
1506 CC.TryEquip(thing2);
1507 }
1508 break;
1509 }
1510 case EffectId.ChangeMaterialLesser:
1511 case EffectId.ChangeMaterial:
1512 case EffectId.ChangeMaterialGreater:
1513 {
1514 SourceMaterial.Row row = EClass.sources.materials.alias.TryGetValue(actRef.n1);
1515 if (!tc.isThing)
1516 {
1517 LayerDragGrid.CreateChangeMaterial(CC, actRef.refThing, row, id, state);
1518 return;
1519 }
1520 if (tc.Num > 1)
1521 {
1522 tc = tc.Split(1);
1523 }
1524 string name2 = tc.Name;
1525 if (row == null)
1526 {
1527 bool num4 = id == EffectId.ChangeMaterialGreater;
1528 bool flag6 = id == EffectId.ChangeMaterialLesser;
1529 string text = tc.Thing.source.tierGroup;
1530 Dictionary<string, SourceMaterial.TierList> tierMap = SourceMaterial.tierMap;
1531 int num5 = 1;
1532 if (flag)
1533 {
1534 num5 -= 2;
1535 }
1536 if (blessed)
1537 {
1538 num5++;
1539 }
1540 if (num4)
1541 {
1542 num5++;
1543 }
1544 if (flag6)
1545 {
1546 num5 -= 2;
1547 }
1548 num5 = Mathf.Clamp(num5 + EClass.rnd(2), 0, 4);
1549 if (EClass.rnd(10) == 0)
1550 {
1551 text = ((text == "metal") ? "leather" : "metal");
1552 }
1553 SourceMaterial.TierList tierList = (text.IsEmpty() ? tierMap.RandomItem() : tierMap[text]);
1554 for (int num6 = 0; num6 < 1000; num6++)
1555 {
1556 row = tierList.tiers[num5].Select();
1557 if (row != tc.material)
1558 {
1559 break;
1560 }
1561 }
1562 }
1563 cc.PlaySound("offering");
1564 cc.PlayEffect("buff");
1565 if ((tc.id == "log" || tc.id == "branch") && tc.material.alias == "carbone")
1566 {
1567 foreach (Element item3 in tc.elements.dict.Values.ToList())
1568 {
1569 if (item3.IsTrait && item3.vBase != 0)
1570 {
1571 tc.elements.ModBase(item3.id, -item3.vBase);
1572 }
1573 }
1574 }
1575 tc.ChangeMaterial(row);
1576 if (tc.trait is TraitGene && tc.c_DNA != null)
1577 {
1578 DNA.Type type = DNA.GetType(tc.material.alias);
1579 tc.c_DNA.Generate(type);
1580 }
1581 cc.Say("materialChanged", name2, row.GetName());
1582 if (CC != null)
1583 {
1584 if (tc.parent == null)
1585 {
1586 CC.Pick(tc.Thing, msg: false);
1587 }
1589 }
1590 break;
1591 }
1592 case EffectId.ChangeRarity:
1593 {
1594 EClass.sources.materials.alias.TryGetValue(actRef.n1);
1595 if (!tc.isThing)
1596 {
1597 LayerDragGrid.CreateChangeRarity(CC, actRef.refThing, id, state);
1598 return;
1599 }
1600 if (tc.Num > 1)
1601 {
1602 tc = tc.Split(1);
1603 }
1604 string name = tc.Name;
1605 cc.PlaySound("offering");
1606 cc.PlayEffect("buff");
1607 bool flag5 = tc.rarity == Rarity.Legendary;
1609 {
1610 rarity = (flag5 ? Rarity.Mythical : Rarity.Legendary),
1611 generation = CardBlueprint.Generation.GarokkHammer
1612 });
1613 Rand.SetBaseSeed(tc.uid + 1);
1614 Rand.SetSeed(tc.uid + 2);
1615 Thing thing = ThingGen.Create(tc.id, tc.idMaterial, tc.genLv);
1616 Rand.SetSeed();
1617 Rand.SetBaseSeed();
1618 thing.SetEncLv(tc.encLV);
1619 thing.SetBlessedState(tc.blessedState);
1620 int num2 = 0;
1621 foreach (Element item4 in thing.elements.dict.Values.ToList().Shuffle())
1622 {
1623 int num3 = (tc.elements.Has(item4.id) ? tc.elements.GetElement(item4.id).vBase : 0);
1624 if (num3 != 0 && (Mathf.Abs(item4.vBase) <= Mathf.Abs(num3) || !MathEx.IsSameSign(item4.vBase, num3)))
1625 {
1626 continue;
1627 }
1628 int id2 = item4.id;
1629 if (id2 != 11)
1630 {
1631 if ((uint)(id2 - 64) > 3u)
1632 {
1633 num2++;
1634 }
1635 tc.elements.SetBase(item4.id, item4.vBase);
1636 Debug.Log(item4.Name + "/" + item4.vBase);
1637 if (flag5 && num2 >= 2)
1638 {
1639 break;
1640 }
1641 }
1642 }
1643 tc.isCrafted = false;
1644 tc.rarity = (flag5 ? Rarity.Mythical : Rarity.Legendary);
1645 EClass.pc.Say("reconstruct", name);
1646 break;
1647 }
1648 case EffectId.ChangeAlias:
1649 {
1650 Chara c = CC;
1651 if (!c.IsPC && !c.trait.UseRandomAlias && blessed)
1652 {
1653 c._alias = null;
1654 c.Say("reconstruct", c);
1655 SE.Change();
1656 c.PlayEffect("mutation");
1657 break;
1658 }
1659 EClass.ui.AddLayer<LayerList>().SetStringList(delegate
1660 {
1661 List<string> list13 = new List<string>();
1662 for (int i = 0; i < 10; i++)
1663 {
1664 list13.Add(AliasGen.GetRandomAlias());
1665 }
1666 return list13;
1667 }, delegate(int a, string b)
1668 {
1669 c._alias = b;
1670 c.Say("reconstruct", c);
1671 SE.Change();
1672 c.PlayEffect("mutation");
1673 }).SetSize()
1674 .EnableReroll()
1675 .SetTitles("wAlias");
1676 break;
1677 }
1678 case EffectId.ChangeBiography:
1679 CC.bio.RerollParents();
1680 CC.Say("reconstruct", CC);
1681 SE.Change();
1682 CC.PlayEffect("mutation");
1683 break;
1684 case EffectId.ReturnVoid:
1685 {
1687 if (EClass.game.IsSurvival || root == null || root.visitCount == 0 || EClass.player.stats.deepestVoid < 1 || (!EClass.debug.enable && EClass.player.CountKeyItem("license_void") == 0))
1688 {
1690 return;
1691 }
1692 int max = Mathf.Min(EClass.player.stats.deepestVoid, -root.MinLv);
1693 int destLv = 1;
1694 Dialog.InputName("dialogVoidReturn".lang(max.ToString() ?? ""), max.ToString() ?? "", delegate(bool cancel, string str)
1695 {
1696 if (!cancel)
1697 {
1698 destLv = Mathf.Abs(str.ToInt());
1699 destLv = Mathf.Clamp(destLv, 1, max) * -1;
1700 Zone zone = ((root.lv == destLv) ? root : (root.children.Find((Spatial spatial) => spatial.lv == destLv) as Zone));
1701 Debug.Log(destLv + "/" + zone);
1702 if (zone == null)
1703 {
1704 zone = SpatialGen.Create(root.GetNewZoneID(destLv), root, register: true) as Zone;
1705 zone.lv = destLv;
1706 }
1707 Msg.Say("returnComplete");
1708 EClass.player.uidLastTravelZone = 0;
1710 EClass.player.lastZonePos = null;
1711 EClass.player.returnInfo = null;
1712 }
1713 });
1714 break;
1715 }
1716 case EffectId.Return:
1717 case EffectId.Evac:
1718 if (!cc.IsPC)
1719 {
1720 Redirect(EffectId.Teleport, state, default(ActRef));
1721 return;
1722 }
1723 cc.PlaySound("return_cast");
1724 if (EClass.player.returnInfo == null)
1725 {
1726 if (id == EffectId.Evac)
1727 {
1728 EClass.player.returnInfo = new Player.ReturnInfo
1729 {
1730 turns = EClass.rnd(10) + 10,
1731 isEvac = true
1732 };
1733 }
1734 else
1735 {
1736 if (EClass.game.spatials.ListReturnLocations().Count == 0)
1737 {
1738 Msg.Say("returnNowhere");
1739 break;
1740 }
1741 EClass.player.returnInfo = new Player.ReturnInfo
1742 {
1743 turns = EClass.rnd(10) + 10,
1744 askDest = true
1745 };
1746 }
1747 Msg.Say("returnBegin");
1748 }
1749 else
1750 {
1751 EClass.player.returnInfo = null;
1752 Msg.Say("returnAbort");
1753 }
1754 break;
1755 case EffectId.Teleport:
1756 case EffectId.TeleportShort:
1757 case EffectId.Gate:
1758 if (!tc.HasHost)
1759 {
1760 if (!flag)
1761 {
1762 if (id != EffectId.Gate && tc.isChara && tc.Chara.IsInCombat && tc.Chara.enemy != null && (tc.IsPCParty || id == EffectId.TeleportShort))
1763 {
1764 tc.Teleport(GetTeleportPos(tc.pos, 6, tc.Chara.enemy));
1765 }
1766 else if (id == EffectId.TeleportShort)
1767 {
1768 tc.Teleport(GetTeleportPos(tc.pos));
1769 }
1770 else
1771 {
1772 tc.Teleport(GetTeleportPos(tc.pos, EClass._map.bounds.Width));
1773 }
1774 }
1775 if (id == EffectId.Gate && CC.IsPC)
1776 {
1777 foreach (Chara chara4 in EClass._map.charas)
1778 {
1779 if (!chara4.HasHost && chara4 != tc && (chara4.IsPCParty || chara4.IsPCPartyMinion))
1780 {
1781 chara4.Teleport(tc.pos.GetNearestPoint(allowBlock: false, allowChara: false) ?? tc.pos);
1782 }
1783 }
1784 }
1785 }
1786 if (tc.ExistsOnMap && tc.id == "mush_quantum" && !tc.HasElement(400) && !tc.HasCondition<ConGravity>())
1787 {
1788 if (EClass.rnd(2) == 0)
1789 {
1790 if (tc.IsGlobal || EClass._zone.IsInstance || tc.c_bossType != BossType.none)
1791 {
1792 tc.Die();
1793 }
1794 else
1795 {
1796 tc.Destroy();
1797 }
1798 break;
1799 }
1800 tc.Chara.TryDuplicate(DuplicateCondition.Quantum, null, inheritHostility: true);
1801 }
1802 if (flag)
1803 {
1804 Redirect(EffectId.Gravity, BlessedState.Normal, default(ActRef));
1805 }
1806 if (blessed)
1807 {
1808 Redirect(EffectId.Levitate, BlessedState.Normal, default(ActRef));
1809 }
1810 break;
1811 }
1812 if (TC == null)
1813 {
1814 return;
1815 }
1816 switch (id)
1817 {
1818 case EffectId.ThrowPotion:
1819 if (!CC.pos.Equals(TC.pos))
1820 {
1821 Thing t = ThingGen.Create(new string[6] { "330", "331", "334", "335", "336", "1142" }.RandomItem());
1822 ActThrow.Throw(CC, TC.pos, t, ThrowMethod.Punish, 0.7f);
1823 }
1824 break;
1825 case EffectId.StripBlessing:
1826 {
1827 List<Condition> list6 = new List<Condition>();
1828 foreach (Condition condition4 in TC.conditions)
1829 {
1830 if (GetBlessingDifficulty(condition4) > 0 && EClass.rnd(GetBlessingDifficulty(condition4)) == 0)
1831 {
1832 list6.Add(condition4);
1833 }
1834 }
1835 if (list6.Count == 0)
1836 {
1837 CC.SayNothingHappans();
1838 break;
1839 }
1840 TC.pos.PlayEffect("holyveil");
1841 TC.pos.PlaySound("holyveil");
1842 TC.Say("unpolluted", TC);
1843 list6.Shuffle();
1844 {
1845 foreach (Condition item5 in list6)
1846 {
1847 item5.Kill();
1848 if (CC.IsHostile(TC))
1849 {
1850 break;
1851 }
1852 }
1853 break;
1854 }
1855 }
1856 case EffectId.ShutterHex:
1857 {
1858 if (!CC.IsHostile(TC))
1859 {
1860 break;
1861 }
1862 int num22 = 0;
1863 foreach (Condition condition5 in TC.conditions)
1864 {
1865 if (condition5.Type == ConditionType.Debuff)
1866 {
1867 num22++;
1868 }
1869 }
1870 if (num22 == 0)
1871 {
1872 CC.SayNothingHappans();
1873 break;
1874 }
1875 TC.pos.PlayEffect("holyveil");
1876 TC.pos.PlaySound("holyveil");
1877 TC.pos.PlaySound("atk_eleSound");
1878 TC.conditions.ForeachReverse(delegate(Condition condition4)
1879 {
1880 if (condition4.Type == ConditionType.Debuff && EClass.rnd(3) == 0)
1881 {
1882 condition4.Kill();
1883 }
1884 });
1885 TC.Say("abShutterHex", TC);
1886 Point center = CC.pos.Copy();
1887 List<Chara> list10 = TC.pos.ListCharasInRadius(TC, 4, (Chara chara3) => chara3 == TC || chara3.IsHostile(CC));
1888 for (int num23 = 0; num23 < num22; num23++)
1889 {
1890 TweenUtil.Delay((float)num23 * 0.1f, delegate
1891 {
1892 center.PlaySound("shutterhex");
1893 });
1894 foreach (Chara item6 in list10)
1895 {
1896 if (item6.ExistsOnMap)
1897 {
1898 Effect effect = Effect.Get("spell_moonspear");
1899 TrailRenderer componentInChildren = effect.GetComponentInChildren<TrailRenderer>();
1900 Color startColor = (componentInChildren.endColor = EClass.Colors.elementColors["eleHoly"]);
1901 componentInChildren.startColor = startColor;
1902 Point pos = item6.pos.Copy();
1903 TweenUtil.Delay((float)num23 * 0.1f, delegate
1904 {
1905 effect.Play(center, 0f, pos);
1906 });
1907 long dmg = Dice.Create("SpShutterHex", power, CC, (actRef.refThing != null) ? null : actRef.act).Roll();
1908 item6.DamageHP(dmg, 919, power, AttackSource.None, CC, showEffect: false);
1909 }
1910 }
1911 }
1912 break;
1913 }
1914 case EffectId.Draw:
1915 {
1916 if (CC.Dist(TC) <= 1 || (CC.IsPCFactionOrMinion && TC.IsPCFactionOrMinion && TC.isRestrained))
1917 {
1918 break;
1919 }
1920 Point point = CC.GetFirstStep(TC.pos, PathManager.MoveType.Combat);
1921 if (!point.IsValid)
1922 {
1923 point = CC.pos.GetRandomPoint(1)?.GetNearestPoint(allowBlock: false, allowChara: false);
1924 }
1925 if (point == null || !CC.CanSeeLos(point))
1926 {
1927 break;
1928 }
1929 CC.Say("abDraw", CC, TC);
1930 CC.PlaySound("draw");
1931 if (TC.HasCondition<ConGravity>() || TC.HasElement(493))
1932 {
1933 CC.SayNothingHappans();
1934 break;
1935 }
1936 TC.MoveImmediate(point, !EClass.core.config.camera.smoothFollow);
1937 if (CC.id == "tentacle")
1938 {
1939 TC.AddCondition<ConEntangle>();
1940 }
1941 break;
1942 }
1943 case EffectId.CatSniff:
1944 {
1945 Chara nearbyCatToSniff = CC.GetNearbyCatToSniff();
1946 if (nearbyCatToSniff != null)
1947 {
1948 CC.Sniff(nearbyCatToSniff);
1949 }
1950 break;
1951 }
1952 case EffectId.Steal:
1953 {
1955 {
1956 break;
1957 }
1958 if (TC.Evalue(426) > 0)
1959 {
1960 TC.Say((actRef.n1 == "money") ? "abStealNegateMoney" : "abStealNegate", TC);
1961 break;
1962 }
1963 Thing thing7 = null;
1964 bool flag11 = actRef.n1 == "food";
1965 if (actRef.n1 == "money")
1966 {
1967 int currency = TC.GetCurrency();
1968 if (currency > 0)
1969 {
1970 currency = Mathf.Clamp(EClass.rnd(currency / 10), 1, 100 + EClass.rndHalf(Mathf.Min(CC.LV, 1000000) * 200));
1971 thing7 = ThingGen.Create("money").SetNum(currency);
1972 TC.ModCurrency(-currency);
1973 }
1974 }
1975 else
1976 {
1977 Func<Thing, bool> func = (Thing thing8) => true;
1978 if (flag11)
1979 {
1980 func = (Thing thing8) => thing8.IsFood;
1981 }
1982 List<Thing> list12 = TC.things.List(delegate(Thing thing8)
1983 {
1984 if (thing8.parentCard?.trait is TraitChestMerchant || thing8.trait is TraitTool || thing8.IsThrownWeapon)
1985 {
1986 return false;
1987 }
1988 return thing8.trait.CanBeDestroyed && thing8.things.Count == 0 && thing8.invY != 1 && thing8.trait.CanBeStolen && !thing8.trait.CanOnlyCarry && !thing8.IsUnique && !thing8.isEquipped && thing8.blessedState == BlessedState.Normal && func(thing8);
1989 }, onlyAccessible: true);
1990 if (list12.Count > 0)
1991 {
1992 thing7 = list12.RandomItem();
1993 if (thing7.Num > 1)
1994 {
1995 thing7 = thing7.Split(1);
1996 }
1997 }
1998 CC.AddCooldown(6640, 200);
1999 }
2000 if (thing7 == null)
2001 {
2002 CC.Say("abStealNothing", CC, TC);
2003 break;
2004 }
2005 thing7.SetInt(116, 1);
2006 TC.PlaySound(thing7.material.GetSoundDrop(thing7.sourceCard));
2007 CC.Pick(thing7, msg: false);
2008 CC.Say("abSteal", CC, TC, thing7.Name);
2009 if (actRef.n1 == "food")
2010 {
2011 if (CC.hunger.value != 0)
2012 {
2013 CC.InstantEat(thing7);
2014 }
2015 }
2016 else
2017 {
2018 CC.Say("abStealEscape", CC);
2019 CC.Teleport(GetTeleportPos(tc.pos, 30), silent: true);
2020 }
2021 break;
2022 }
2023 case EffectId.NeckHunt:
2024 CC.TryNeckHunt(TC, power);
2025 break;
2026 case EffectId.CurseEQ:
2027 {
2028 if (CC != null && CC != TC)
2029 {
2030 TC.Say("curse", CC, TC);
2031 }
2032 TC.PlaySound("curse3");
2033 TC.PlayEffect("curse");
2034 if (EClass.rnd(150 + TC.LUC * 5 + TC.Evalue(972) * 20) >= power + (flag ? 200 : 0) || TC.TryNullifyCurse())
2035 {
2036 break;
2037 }
2038 List<Thing> list4 = TC.things.List(delegate(Thing thing8)
2039 {
2040 if (!thing8.isEquipped || thing8.blessedState == BlessedState.Doomed || thing8.IsToolbelt)
2041 {
2042 return false;
2043 }
2044 return (thing8.blessedState < BlessedState.Blessed || EClass.rnd(10) == 0) ? true : false;
2045 });
2046 if (list4.Count == 0)
2047 {
2048 CC.SayNothingHappans();
2049 break;
2050 }
2051 Thing thing5 = list4.RandomItem();
2052 TC.Say("curse_hit", TC, thing5);
2053 thing5.SetBlessedState((thing5.blessedState == BlessedState.Cursed) ? BlessedState.Doomed : BlessedState.Cursed);
2054 LayerInventory.SetDirty(thing5);
2055 break;
2056 }
2057 case EffectId.UncurseEQ:
2058 case EffectId.UncurseEQGreater:
2059 {
2060 TC.Say("uncurseEQ" + (blessed ? "_bless" : (flag ? "_curse" : "")), TC);
2061 TC.PlaySound("uncurse");
2062 TC.PlayEffect("uncurse");
2063 if (flag)
2064 {
2065 Redirect(EffectId.CurseEQ, BlessedState.Normal, default(ActRef));
2066 break;
2067 }
2068 int success = 0;
2069 int fail = 0;
2070 List<Thing> list9 = new List<Thing>();
2071 TC.things.Foreach(delegate(Thing thing8)
2072 {
2073 int num26 = 0;
2074 if ((thing8.isEquipped || thing8.IsRangedWeapon || blessed) && thing8.blessedState < BlessedState.Normal)
2075 {
2076 if (thing8.blessedState == BlessedState.Cursed)
2077 {
2078 num26 = EClass.rnd(200);
2079 }
2080 if (thing8.blessedState == BlessedState.Doomed)
2081 {
2082 num26 = EClass.rnd(1000);
2083 }
2084 if (blessed)
2085 {
2086 num26 /= 2;
2087 }
2088 if (id == EffectId.UncurseEQGreater)
2089 {
2090 num26 /= 10;
2091 }
2092 if (power >= num26)
2093 {
2094 TC.Say("uncurseEQ_success", thing8);
2095 thing8.SetBlessedState(BlessedState.Normal);
2096 if (thing8.isEquipped && thing8.HasElement(656))
2097 {
2098 TC.body.Unequip(thing8);
2099 }
2100 LayerInventory.SetDirty(thing8);
2101 success++;
2102 list9.Add(thing8);
2103 }
2104 else
2105 {
2106 fail++;
2107 }
2108 }
2109 });
2110 foreach (Thing item7 in list9)
2111 {
2112 item7.GetRootCard()?.TryStack(item7);
2113 }
2114 if (success == 0 && fail == 0)
2115 {
2116 TC.SayNothingHappans();
2117 }
2118 else if (fail > 0)
2119 {
2120 TC.Say("uncurseEQ_fail");
2121 }
2122 break;
2123 }
2124 case EffectId.Buff:
2125 {
2126 string text2 = actRef.n1;
2127 string text3 = "";
2128 if (flag)
2129 {
2130 text3 = EClass.sources.stats.alias[text2].curse;
2131 if (!text3.IsEmpty())
2132 {
2133 text2 = text3;
2134 }
2135 }
2136 Condition condition = Condition.Create(text2, power, delegate(Condition con)
2137 {
2138 if (!actRef.aliasEle.IsEmpty())
2139 {
2140 con.SetElement(EClass.sources.elements.alias[actRef.aliasEle].id);
2141 }
2142 });
2143 condition.isPerfume = TC.IsPC && actRef.isPerfume;
2144 Condition condition2 = TC.AddCondition(condition);
2145 if (condition2 != null && condition2.isPerfume)
2146 {
2147 condition2.value = 3;
2148 Msg.Say("perfume", TC);
2149 }
2150 if (!text3.IsEmpty())
2151 {
2152 CC.DoHostileAction(TC);
2153 }
2154 break;
2155 }
2156 case EffectId.KizuamiTrick:
2157 {
2158 EClass.game.religions.Trickery.Talk("ability");
2159 bool hex = CC.IsHostile(TC);
2160 List<SourceStat.Row> list7 = EClass.sources.stats.rows.Where((SourceStat.Row con) => con.tag.Contains("random") && con.group == (hex ? "Debuff" : "Buff")).ToList();
2161 int power2 = power;
2162 for (int num21 = 0; num21 < 4 + EClass.rnd(2); num21++)
2163 {
2164 SourceStat.Row row2 = list7.RandomItem();
2165 list7.Remove(row2);
2166 Proc(hex ? EffectId.DebuffKizuami : EffectId.Buff, CC, TC, power2, new ActRef
2167 {
2168 n1 = row2.alias
2169 });
2170 }
2172 {
2173 EClass.Wait(0.3f, TC);
2174 }
2175 break;
2176 }
2177 case EffectId.Debuff:
2178 case EffectId.DebuffKizuami:
2179 {
2180 CC.DoHostileAction(TC);
2181 bool isPowerful = TC.IsPowerful;
2182 string n = actRef.n1;
2183 if (n == "ConSuffocation")
2184 {
2185 power = power * 2 / 3;
2186 }
2187 int num14 = TC.WIL * (isPowerful ? 20 : 5);
2188 ConHolyVeil condition3 = TC.GetCondition<ConHolyVeil>();
2189 if (condition3 != null)
2190 {
2191 num14 += condition3.power * 5;
2192 }
2193 num14 /= EClass.sources.stats.alias[n].hexPower;
2194 if (id != EffectId.DebuffKizuami && EClass.rnd(power) < num14)
2195 {
2196 int num15 = 10;
2197 int num16 = (TC.IsPowerful ? 40 : 90);
2198 if (CC.IsPCFaction)
2199 {
2200 num15 += EClass.curve(CC.LER, 100, 50) / 10;
2201 }
2202 if (TC.IsPowerful)
2203 {
2204 num15 /= 2;
2205 }
2206 if (condition3 != null)
2207 {
2208 num15 /= 5;
2209 }
2210 if (num15 >= num16)
2211 {
2212 num15 = num16;
2213 }
2214 Debug.Log(num15);
2215 if (EClass.rnd(100) > num15)
2216 {
2217 TC.Say("debuff_resist", TC);
2218 CC.DoHostileAction(TC);
2219 break;
2220 }
2221 }
2222 TC.AddCondition(Condition.Create(n, power, delegate(Condition con)
2223 {
2224 con.givenByPcParty = CC.IsPCParty;
2225 (con as ConDeathSentense)?.SetChara(CC);
2226 if (!actRef.aliasEle.IsEmpty())
2227 {
2228 con.SetElement(EClass.sources.elements.alias[actRef.aliasEle].id);
2229 }
2230 (con as ConMiasma)?.SetResistPenetrationLevel(TC, CC);
2231 }));
2232 if (n == "ConBane" && CC.HasElement(1416))
2233 {
2234 TC.AddCondition<ConExcommunication>(power);
2235 }
2236 CC.DoHostileAction(TC);
2238 {
2239 EClass.Wait(0.3f, TC);
2240 }
2241 break;
2242 }
2243 case EffectId.Mutation:
2244 TC.MutateRandom(1, 100, ether: false, state);
2246 {
2247 EClass.Wait(0.3f, TC);
2248 }
2249 break;
2250 case EffectId.CureMutation:
2251 TC.MutateRandom(-1, 100, ether: false, state);
2252 break;
2253 case EffectId.Ally:
2254 {
2255 Msg.Say("gainAlly");
2256 Chara chara2 = CharaGen.CreateFromFilter("chara", cc.LV);
2257 EClass._zone.AddCard(chara2, cc.pos.GetNearestPoint(allowBlock: false, allowChara: false));
2258 if (cc.IsPCFactionOrMinion)
2259 {
2260 chara2.MakeAlly(msg: false);
2261 }
2262 chara2.PlaySound("identify");
2263 chara2.PlayEffect("teleport");
2264 break;
2265 }
2266 case EffectId.Wish:
2267 if (!TC.IsPC)
2268 {
2269 break;
2270 }
2271 if (blessed || flag)
2272 {
2273 power /= 2;
2274 }
2275 Dialog.InputName("dialogWish", "q", delegate(bool cancel, string text4)
2276 {
2277 if (!cancel)
2278 {
2279 Msg.Say("wish", TC, text4);
2280 Wish(text4, EClass.pc.NameTitled, power, state);
2281 }
2282 });
2283 break;
2284 case EffectId.Faith:
2285 {
2287 tc.PlayEffect("aura_heaven");
2288 tc.PlaySound("aura_heaven");
2289 tc.Say("faith", tc, faith.Name);
2290 if (flag)
2291 {
2292 tc.Say("faith_curse", tc, faith.Name);
2293 break;
2294 }
2295 if (blessed)
2296 {
2297 tc.Say("faith_bless", tc, faith.Name);
2298 }
2299 tc.ModExp(306, power * 10);
2300 if (tc.elements.Base(85) < tc.elements.Value(306))
2301 {
2302 tc.ModExp(85, power * 10);
2303 }
2304 break;
2305 }
2306 case EffectId.TransGender:
2307 {
2308 tc.PlaySound("mutation");
2309 tc.PlayEffect("mutation");
2310 int gender = tc.bio.gender;
2311 int gender2 = gender switch
2312 {
2313 1 => 2,
2314 2 => 1,
2315 _ => (EClass.rnd(2) != 0) ? 1 : 2,
2316 };
2317 if (gender != 0 && EClass.rnd(10) == 0)
2318 {
2319 gender2 = 0;
2320 }
2321 tc.bio.SetGender(gender2);
2322 tc.Say("transGender", tc, Gender.Name(tc.bio.gender));
2323 tc.Talk("tail");
2324 int age2 = tc.bio.GetAge(tc.Chara);
2325 if (blessed && age2 > 1)
2326 {
2327 tc.Say("ageDown", tc);
2328 tc.bio.SetAge(tc.Chara, age2 - 1);
2329 }
2330 else if (flag)
2331 {
2332 tc.Say("ageUp", tc);
2333 tc.bio.SetAge(tc.Chara, age2 + 1);
2334 }
2335 break;
2336 }
2337 case EffectId.TransBlood:
2338 {
2339 tc.PlaySound("mutation");
2340 tc.PlayEffect("mutation");
2341 int num18 = ((actRef.refThing != null) ? actRef.refThing.GetInt(118) : actRef.refVal);
2342 if (num18 == 0)
2343 {
2344 num18 = tc.GetInt(118);
2345 if (num18 == 0)
2346 {
2347 num18 = EClass.game.seed + tc.uid;
2348 }
2349 num18++;
2350 }
2351 tc.Say("transBlood", tc);
2352 tc.Talk("tail");
2353 tc.c_bloodData = null;
2354 tc.SetInt(118, num18);
2355 break;
2356 }
2357 case EffectId.ResetFeat:
2358 {
2359 if (!tc.IsPC)
2360 {
2361 tc.SayNothingHappans();
2362 break;
2363 }
2364 tc.PlaySound("mutation");
2365 tc.PlayEffect("mutation");
2366 List<Element> list3 = new List<Element>();
2367 foreach (Element value in EClass.pc.elements.dict.Values)
2368 {
2369 if (value.source.category != "feat" || value.id == 1644)
2370 {
2371 continue;
2372 }
2373 switch (value.source.categorySub)
2374 {
2375 case "general":
2376 case "attribute":
2377 case "skill":
2378 case "special":
2379 if (value.vBase > 0)
2380 {
2381 list3.Add(value);
2382 }
2383 break;
2384 }
2385 }
2386 int num11 = 0;
2387 foreach (Element item8 in list3)
2388 {
2389 int dNABonus = item8.GetDNABonus(EClass.pc);
2390 if (dNABonus < item8.vBase)
2391 {
2392 for (int num12 = 0; num12 < item8.vBase - dNABonus; num12++)
2393 {
2394 num11 += item8.source.cost.TryGet(num12);
2395 }
2396 EClass.pc.SetFeat(item8.id, dNABonus);
2397 }
2398 }
2399 EClass.pc.feat += num11;
2400 EClass.pc.Refresh();
2405 tc.Say("resetFeat");
2406 break;
2407 }
2408 case EffectId.Youth:
2409 {
2410 tc.PlaySound("mutation");
2411 tc.PlayEffect("mutation");
2412 int age = tc.bio.GetAge(tc.Chara);
2413 if (!flag && age <= 0)
2414 {
2415 tc.SayNothingHappans();
2416 break;
2417 }
2418 age = Mathf.Max(0, age * 100 / (flag ? 75 : (blessed ? 400 : 200))) + (flag ? 1 : 0);
2419 tc.Say(flag ? "ageUp" : "ageDown", tc);
2420 tc.bio.SetAge(tc.Chara, age);
2421 break;
2422 }
2423 case EffectId.EternalYouth:
2424 {
2425 tc.PlaySound("mutation");
2426 tc.PlayEffect("mutation");
2427 if (tc.IsUnique)
2428 {
2429 tc.SayNothingHappans();
2430 break;
2431 }
2432 int age3 = tc.bio.GetAge(tc.Chara);
2433 if (flag)
2434 {
2435 if (tc.c_lockedAge != 0)
2436 {
2437 tc.Say("eternalYouth2", tc);
2438 tc.c_lockedAge = 0;
2439 tc.elements.Remove(1243);
2440 tc.bio.SetAge(tc.Chara, age3);
2441 }
2442 Redirect(EffectId.Youth, BlessedState.Cursed, default(ActRef));
2443 }
2444 else if (tc.c_lockedAge != 0)
2445 {
2446 tc.SayNothingHappans();
2447 }
2448 else
2449 {
2450 tc.PlaySound("dropRewardXmas");
2451 tc.Say("eternalYouth1", tc);
2452 tc.c_lockedAge = age3 + 1;
2453 tc.elements.SetBase(1243, 1);
2454 if (blessed)
2455 {
2456 Redirect(EffectId.Youth, BlessedState.Blessed, default(ActRef));
2457 }
2458 }
2459 break;
2460 }
2461 case EffectId.BuffStats:
2462 case EffectId.DebuffStats:
2463 case EffectId.LulwyTrick:
2464 Debug.Log(power + "/" + id.ToString() + "/" + actRef.n1);
2465 if (id == EffectId.LulwyTrick)
2466 {
2467 EClass.game.religions.Wind.Talk("ability");
2468 }
2469 if (flag)
2470 {
2471 if (id == EffectId.BuffStats)
2472 {
2473 id = EffectId.DebuffStats;
2474 }
2475 else if (id == EffectId.DebuffStats)
2476 {
2477 id = EffectId.BuffStats;
2478 }
2479 }
2480 if (power < 0 || id == EffectId.DebuffStats)
2481 {
2482 power = Mathf.Abs(power);
2483 if (blessed)
2484 {
2485 power /= 4;
2486 }
2487 flag = true;
2488 }
2489 TC.AddCondition(Condition.Create(power, delegate(ConBuffStats con)
2490 {
2491 con.SetRefVal(Element.GetId(actRef.n1), (int)id);
2492 }));
2493 break;
2494 case EffectId.Revive:
2495 {
2496 List<KeyValuePair<int, Chara>> list11 = EClass.game.cards.globalCharas.Where((KeyValuePair<int, Chara> a) => a.Value.isDead && a.Value.faction == EClass.pc.faction && !a.Value.isSummon && a.Value.c_wasInPcParty).ToList();
2497 if (TC.IsPCFaction || TC.IsPCFactionMinion)
2498 {
2499 if (TC.IsPC && list11.Count == 0)
2500 {
2501 list11 = EClass.game.cards.globalCharas.Where((KeyValuePair<int, Chara> a) => a.Value.CanRevive() && a.Value.isDead && a.Value.faction == EClass.pc.faction && !a.Value.isSummon).ToList();
2502 }
2503 if (list11.Count > 0)
2504 {
2505 list11.RandomItem().Value.Chara.GetRevived();
2506 break;
2507 }
2508 }
2509 TC.SayNothingHappans();
2510 break;
2511 }
2512 case EffectId.DamageBody:
2513 case EffectId.DamageMind:
2514 case EffectId.DamageBodyGreat:
2515 case EffectId.DamageMindGreat:
2516 case EffectId.Weaken:
2517 {
2518 bool flag9 = id == EffectId.DamageBody || id == EffectId.DamageBodyGreat;
2519 bool mind = id == EffectId.DamageMind || id == EffectId.DamageMindGreat;
2520 int num19 = ((id == EffectId.DamageBody || id == EffectId.DamageMind) ? 1 : (4 + EClass.rnd(4)));
2521 if (id == EffectId.Weaken)
2522 {
2523 flag9 = EClass.rnd(2) == 0;
2524 mind = !flag9;
2525 num19 = 1;
2526 }
2527 else
2528 {
2529 TC.PlayEffect("debuff");
2530 TC.PlaySound("debuff");
2531 }
2532 TC.Say(flag9 ? "damageBody" : "damageMind", TC);
2533 for (int num20 = 0; num20 < num19; num20++)
2534 {
2535 TC.DamageTempElements(power, flag9, mind, id != EffectId.Weaken);
2536 }
2537 if (TC.IsPC)
2538 {
2539 Tutorial.Play("healer");
2540 }
2541 break;
2542 }
2543 case EffectId.EnhanceBody:
2544 case EffectId.EnhanceMind:
2545 case EffectId.EnhanceBodyGreat:
2546 case EffectId.EnhanceMindGreat:
2547 {
2548 bool flag10 = id == EffectId.EnhanceBody || id == EffectId.EnhanceBodyGreat;
2549 bool mind2 = id == EffectId.EnhanceMind || id == EffectId.EnhanceMindGreat;
2550 if (id != EffectId.EnhanceBody && id != EffectId.EnhanceMind)
2551 {
2552 EClass.rnd(4);
2553 }
2554 TC.Say(flag10 ? "enhanceBody" : "enhanceMind", TC);
2555 TC.PlayEffect("buff");
2556 TC.PlaySound("buff");
2557 TC.EnhanceTempElements(power, flag10, mind2, onlyRenew: true);
2558 break;
2559 }
2560 case EffectId.RestoreBody:
2561 case EffectId.RestoreMind:
2562 {
2563 bool flag12 = id == EffectId.RestoreBody;
2564 if (flag)
2565 {
2566 Redirect(flag12 ? EffectId.DamageBodyGreat : EffectId.DamageMindGreat, BlessedState.Normal, default(ActRef));
2567 break;
2568 }
2569 TC.Say(flag12 ? "restoreBody" : "restoreMind", TC);
2570 TC.PlaySound("heal");
2571 TC.PlayEffect("heal");
2572 TC.CureHost(flag12 ? CureType.CureBody : CureType.CureMind, power, state);
2573 if (blessed)
2574 {
2575 Redirect(flag12 ? EffectId.EnhanceBodyGreat : EffectId.EnhanceMindGreat, BlessedState.Normal, default(ActRef));
2576 }
2577 break;
2578 }
2579 case EffectId.HealComplete:
2580 TC.HealHPHost(100000000L, (actRef.refThing == null) ? HealSource.Magic : HealSource.Item);
2581 TC.CureHost(CureType.HealComplete, power, state);
2582 TC.Say("heal_heavy", TC);
2583 break;
2584 case EffectId.Heal:
2585 case EffectId.JureHeal:
2586 {
2587 long num13 = Dice.Create((actRef.act != null && EClass.sources.calc.map.ContainsKey(actRef.act.ID)) ? actRef.act.ID : "SpHealLight", power, CC, (actRef.refThing != null) ? null : actRef.act).Roll();
2588 if (actRef.refThing != null)
2589 {
2590 num13 = num13 * (100 + actRef.refThing.Evalue(750) * 10) / 100;
2591 }
2592 if (flag)
2593 {
2594 TC.DamageHP(num13 / 2, 919, power);
2595 break;
2596 }
2597 if (id == EffectId.JureHeal)
2598 {
2599 EClass.game.religions.Healing.Talk("ability");
2600 num13 += TC.MaxHP / 4;
2601 TC.AddCondition<ConInvulnerable>();
2602 TC.HealHP(num13, HealSource.Item);
2603 TC.Cure(CureType.Heal, power, state);
2604 }
2605 else
2606 {
2607 TC.HealHPHost(num13, (actRef.refThing == null) ? HealSource.Magic : HealSource.Item);
2608 TC.CureHost(CureType.Heal, power, state);
2609 }
2610 TC.Say((power >= 300) ? "heal_heavy" : "heal_light", TC);
2611 break;
2612 }
2613 case EffectId.RemedyJure:
2614 TC.HealHP(1000000L, HealSource.Magic);
2615 TC.CureHost(CureType.Jure, power, state);
2616 TC.Say("heal_jure", TC);
2617 break;
2618 case EffectId.Headpat:
2619 CC.PlaySound("headpat");
2620 CC.Cuddle(TC, headpat: true);
2621 break;
2622 case EffectId.RemoveHex:
2623 case EffectId.RemoveHexAll:
2624 {
2625 if (flag)
2626 {
2627 Redirect(EffectId.CurseEQ, BlessedState.Normal, default(ActRef));
2628 break;
2629 }
2630 IList<Condition> list5 = TC.conditions.Copy();
2631 list5.Shuffle();
2632 CC.PlaySound("remove_hex");
2633 CC.PlayEffect("remove_hex");
2634 foreach (Condition item9 in list5)
2635 {
2636 if (item9.Type != ConditionType.Debuff || item9.IsKilled)
2637 {
2638 continue;
2639 }
2640 if (EClass.rnd(power * (CC.IsPowerful ? 5 : 2)) > EClass.rnd(item9.power) || (id == EffectId.RemoveHex && EClass.rnd(2) == 0))
2641 {
2642 CC.Say("removeHex", TC, item9.Name.ToLower());
2643 item9.Kill();
2644 }
2645 else
2646 {
2647 if (id == EffectId.RemoveHexAll)
2648 {
2649 item9.power /= 2;
2650 }
2651 CC.Say("removeHex_fail", TC, item9.Name.ToLower());
2652 }
2653 if (id == EffectId.RemoveHex)
2654 {
2655 break;
2656 }
2657 }
2658 if (blessed)
2659 {
2660 TC.AddCondition<ConHolyVeil>(power / 2);
2661 }
2662 break;
2663 }
2664 case EffectId.CureCorruption:
2665 TC.PlaySound("heal");
2666 TC.PlayEffect("heal");
2667 if (flag)
2668 {
2669 TC.Say("cureCorruption_curse", TC);
2670 TC.mana.Mod(9999);
2671 TC.ModCorruption(power);
2672 }
2673 else
2674 {
2675 TC.Say("cureCorruption", TC);
2676 TC.ModCorruption(-power * (blessed ? 150 : 200) / 100);
2677 }
2678 break;
2679 case EffectId.Degenerate:
2680 {
2681 if (TC == null || TC.HasCondition<ConTransmuteHuman>())
2682 {
2683 CC.SayNothingHappans();
2684 break;
2685 }
2686 Chara chara = CharaGen.Create("baby");
2687 chara.c_altName = TC.c_altName ?? TC.source.GetName(TC);
2688 TC.AddCondition(Condition.Create(power, delegate(ConTransmuteHuman con)
2689 {
2690 con.chara = chara;
2691 }));
2692 break;
2693 }
2694 case EffectId.Drink:
2695 case EffectId.DrinkRamune:
2696 case EffectId.DrinkMilk:
2697 if (id == EffectId.DrinkRamune)
2698 {
2699 TC.Say("drinkRamune", TC);
2700 }
2701 if (TC.IsPC)
2702 {
2703 TC.Say("drinkGood", TC);
2704 }
2705 if (id == EffectId.DrinkMilk)
2706 {
2707 if (TC.IsPC)
2708 {
2709 TC.Say("drinkMilk", TC);
2710 }
2711 if (blessed)
2712 {
2713 TC.ModHeight(EClass.rnd(5) + 3);
2714 }
2715 else if (flag)
2716 {
2717 TC.ModHeight((EClass.rnd(5) + 3) * -1);
2718 }
2719 }
2720 break;
2721 case EffectId.DrinkWater:
2722 if (flag)
2723 {
2724 if (TC.IsPC)
2725 {
2726 TC.Say("drinkWater_dirty", TC);
2727 }
2729 }
2730 else if (TC.IsPC)
2731 {
2732 TC.Say("drinkWater_clear", TC);
2733 }
2734 break;
2735 case EffectId.DrinkWaterDirty:
2736 if (TC.IsPC)
2737 {
2738 TC.Say("drinkWater_dirty", TC);
2739 }
2740 if (TC.IsPCFaction)
2741 {
2742 TC.Vomit();
2743 }
2744 break;
2745 case EffectId.SaltWater:
2746 if (TC.HasElement(1211))
2747 {
2748 TC.Say("drinkSaltWater_snail", TC);
2749 int num17 = ((TC.hp > 10) ? (TC.hp - EClass.rnd(10)) : 10000);
2750 TC.DamageHP(num17, AttackSource.None, CC);
2751 }
2752 else if (TC.IsPC)
2753 {
2754 TC.Say("drinkSaltWater", TC);
2755 }
2756 break;
2757 case EffectId.Booze:
2758 TC.AddCondition<ConDrunk>(power);
2759 if (TC.HasElement(1215))
2760 {
2761 TC.Say("drunk_dwarf", TC);
2762 TC.AddCondition(Condition.Create(power + EClass.rnd(power), delegate(ConBuffStats con)
2763 {
2764 con.SetRefVal(Element.List_MainAttributes.RandomItem(), (int)id);
2765 }));
2766 }
2767 break;
2768 case EffectId.CatsEye:
2769 if (flag)
2770 {
2771 Redirect(EffectId.Blind, BlessedState.Normal, default(ActRef));
2772 }
2773 else
2774 {
2775 TC.AddCondition<ConNightVision>(power);
2776 }
2777 break;
2778 case EffectId.Hero:
2779 if (flag)
2780 {
2781 Redirect(EffectId.Fear, BlessedState.Normal, default(ActRef));
2782 }
2783 else
2784 {
2785 TC.AddCondition<ConHero>(power);
2786 }
2787 break;
2788 case EffectId.HolyVeil:
2789 if (flag)
2790 {
2791 Redirect(EffectId.Fear, BlessedState.Normal, default(ActRef));
2792 }
2793 else
2794 {
2795 TC.AddCondition<ConHolyVeil>(power);
2796 }
2797 break;
2798 case EffectId.Levitate:
2799 if (flag)
2800 {
2801 Redirect(EffectId.Gravity, BlessedState.Normal, default(ActRef));
2802 }
2803 else
2804 {
2805 TC.AddCondition<ConLevitate>(power);
2806 }
2807 break;
2808 case EffectId.Gravity:
2809 if (blessed)
2810 {
2811 power /= 4;
2812 }
2813 TC.AddCondition<ConGravity>(power);
2814 if (flag)
2815 {
2816 Redirect(EffectId.BuffStats, BlessedState.Cursed, new ActRef
2817 {
2818 n1 = "STR"
2819 });
2820 }
2821 break;
2822 case EffectId.Fear:
2823 if (blessed)
2824 {
2825 power /= 4;
2826 }
2827 TC.AddCondition<ConFear>(power);
2828 if (flag)
2829 {
2830 Redirect(EffectId.Confuse, BlessedState.Normal, default(ActRef));
2831 }
2832 break;
2833 case EffectId.Faint:
2834 if (blessed)
2835 {
2836 power /= 4;
2837 }
2838 TC.AddCondition<ConFaint>(power);
2839 if (flag)
2840 {
2841 Redirect(EffectId.Disease, BlessedState.Normal, default(ActRef));
2842 }
2843 break;
2844 case EffectId.Paralyze:
2845 if (blessed)
2846 {
2847 power /= 4;
2848 }
2849 TC.AddCondition<ConParalyze>(power);
2850 if (flag)
2851 {
2852 Redirect(EffectId.Blind, BlessedState.Normal, default(ActRef));
2853 }
2854 break;
2855 case EffectId.Poison:
2856 if (blessed)
2857 {
2858 power /= 4;
2859 }
2860 TC.AddCondition<ConPoison>(power);
2861 if (flag)
2862 {
2863 Redirect(EffectId.Paralyze, BlessedState.Normal, default(ActRef));
2864 }
2865 break;
2866 case EffectId.Sleep:
2867 case EffectId.BlueDrag:
2868 if (blessed)
2869 {
2870 power /= 4;
2871 }
2872 TC.AddCondition<ConSleep>(power);
2873 if (id == EffectId.BlueDrag)
2874 {
2875 TC.PlayEffect("buff");
2876 TC.PlaySound("offering");
2877 int num24 = TC.Evalue(1423);
2878 if (num24 > 0)
2879 {
2880 int num25 = 0;
2881 if (flag && num24 > 1)
2882 {
2883 num25 = -1;
2884 }
2885 else if (num24 < 15)
2886 {
2887 num25 = ((!blessed) ? 1 : 2);
2888 if (num25 + num24 > 15)
2889 {
2890 num25 = 1;
2891 }
2892 }
2893 if (num25 != 0)
2894 {
2895 TC.SetFeat(1423, num24 + num25, msg: true);
2896 TC.SetInt(134, TC.GetInt(134) + num25);
2897 }
2898 }
2899 }
2900 if (flag)
2901 {
2902 Redirect(EffectId.Disease, BlessedState.Normal, default(ActRef));
2903 }
2904 break;
2905 case EffectId.Confuse:
2906 if (blessed)
2907 {
2908 power /= 4;
2909 }
2910 TC.AddCondition<ConConfuse>(power);
2911 if (flag)
2912 {
2913 Redirect(EffectId.Fear, BlessedState.Normal, default(ActRef));
2914 }
2915 break;
2916 case EffectId.Blind:
2917 if (blessed)
2918 {
2919 power /= 4;
2920 }
2921 TC.AddCondition<ConBlind>(power);
2922 if (flag)
2923 {
2924 Redirect(EffectId.Confuse, BlessedState.Normal, default(ActRef));
2925 }
2926 break;
2927 case EffectId.Disease:
2928 if (blessed)
2929 {
2930 power /= 4;
2931 }
2932 TC.AddCondition<ConDisease>(power);
2933 if (flag)
2934 {
2935 Redirect(EffectId.Poison, BlessedState.Normal, default(ActRef));
2936 }
2937 break;
2938 case EffectId.Acid:
2939 {
2940 if (blessed)
2941 {
2942 power /= 4;
2943 }
2944 List<Thing> list8 = TC.things.List((Thing thing8) => (thing8.Num <= 1 && thing8.IsEquipmentOrRanged && !thing8.IsToolbelt && !thing8.IsLightsource && thing8.isEquipped) ? true : false);
2945 if (list8.Count != 0)
2946 {
2947 Thing thing6 = list8.RandomItem();
2948 TC.Say("acid_hit", TC);
2949 if (thing6.isAcidproof)
2950 {
2951 TC.Say("acid_nullify", thing6);
2952 }
2953 else if (thing6.encLV > -5)
2954 {
2955 TC.Say("acid_rust", TC, thing6);
2956 thing6.ModEncLv(-1);
2957 LayerInventory.SetDirty(thing6);
2958 }
2959 if (TC.IsPCParty)
2960 {
2961 Tutorial.Reserve("rust");
2962 }
2963 }
2964 break;
2965 }
2966 case EffectId.PuddleEffect:
2967 TC.DamageHP(power / 5, actRef.idEle, power);
2968 break;
2969 case EffectId.Acidproof:
2970 if (blessed)
2971 {
2972 power /= 4;
2973 }
2974 if (TC.IsPC)
2975 {
2976 TC.Say("pc_pain");
2977 }
2978 TC.Say("drink_acid", TC);
2979 TC.DamageHP(power / 5, 923, power);
2980 break;
2981 case EffectId.LevelDown:
2982 Msg.Say("nothingHappens");
2983 break;
2984 case EffectId.Love:
2985 case EffectId.LovePlus:
2986 if (flag)
2987 {
2988 if (CC == TC)
2989 {
2990 TC.Say("love_curse_self", TC);
2991 }
2992 else
2993 {
2994 TC.Say("love_curse", CC, TC);
2995 TC.ModAffinity(CC, -power / 4, show: false);
2996 }
2997 TC.ShowEmo(Emo.angry);
2998 }
2999 else
3000 {
3001 LoveMiracle(TC, CC, power, id, state);
3002 }
3003 break;
3004 case EffectId.HairGrowth:
3005 if (flag)
3006 {
3007 if (TC.HasElement(1532))
3008 {
3009 TC.SetMutation(1532);
3010 }
3011 else
3012 {
3013 TC.SetMutation(1533, 1);
3014 }
3015 TC.c_fur = 0;
3016 break;
3017 }
3018 if (blessed)
3019 {
3020 if (TC.HasElement(1533))
3021 {
3022 TC.SetMutation(1533);
3023 }
3024 else
3025 {
3026 TC.SetMutation(1532, 1);
3027 }
3028 }
3029 TC.PlayEffect("aura_heaven");
3030 TC.PlaySound("godbless");
3031 if (!TC.HaveFur())
3032 {
3033 TC.Say("grow_hair_fail", TC);
3034 break;
3035 }
3036 TC.Say("grow_hair", TC);
3037 TC.c_fur = 100;
3038 break;
3039 case EffectId.Gene:
3040 GeneMiracle(TC, CC, blessed ? DNA.Type.Superior : (flag ? DNA.Type.Brain : DNA.Type.Default));
3041 break;
3042 }
3043 int GetBlessingDifficulty(Condition condition4)
3044 {
3045 if (condition4.Type != ConditionType.Buff)
3046 {
3047 return 0;
3048 }
3049 if (condition4 is ConTransmuteBat && TC.HasCooldown(8793))
3050 {
3051 return 0;
3052 }
3053 if (!CC.IsHostile(TC))
3054 {
3055 return 1;
3056 }
3057 if (condition4 is ConBoost)
3058 {
3059 return 5;
3060 }
3061 if (condition4 is ConRebirth)
3062 {
3063 return 10;
3064 }
3065 if (condition4 is ConInvulnerable)
3066 {
3067 return 100;
3068 }
3069 return 2;
3070 }
3071 void Redirect(EffectId _id, BlessedState _state, ActRef _ref1)
3072 {
3073 Proc(_id, orgPower, _state, cc, tc, _ref1);
3074 }
3075 }
3076
3077 public static void Poison(Chara tc, Chara c, int power)
3078 {
3079 tc.Say("eat_poison", tc);
3080 tc.Talk("scream");
3081 if (power > 100000000)
3082 {
3083 power = 100000000;
3084 }
3085 int num = (int)Mathf.Sqrt(power * 100);
3086 tc.DamageHP(num * 2 + EClass.rnd(num), 915, power);
3087 if (!tc.isDead && !tc.IsPC)
3088 {
3090 }
3091 }
3092
3093 public static void LoveMiracle(Chara tc, Chara c, int power, EffectId idEffect = EffectId.Love, BlessedState? state = null)
3094 {
3095 if (c == tc)
3096 {
3097 tc.Say("love_ground", tc);
3098 }
3099 else
3100 {
3101 tc.Say("love_chara", c, tc);
3102 }
3103 tc.ModAffinity(EClass.pc, power / 4);
3104 if ((idEffect != EffectId.Love || EClass.rnd(2) != 0) && (!EClass._zone.IsUserZone || tc.IsPCFaction || !EClass.game.principal.disableUsermapBenefit))
3105 {
3106 if (idEffect == EffectId.MoonSpear && EClass.rnd(EClass.debug.enable ? 2 : 20) == 0)
3107 {
3108 Thing thing = tc.MakeGene();
3109 tc.GiveBirth(thing, effect: true);
3110 tc.Say("item_drop", thing);
3111 }
3112 else if (idEffect != EffectId.LovePlus && EClass.rnd(2) == 0)
3113 {
3114 Thing c2 = tc.MakeMilk(effect: true, 1, addToZone: true, state);
3115 tc.Say("item_drop", c2);
3116 }
3117 else
3118 {
3119 Thing c3 = tc.MakeEgg(effect: true, 1, addToZone: true, (idEffect == EffectId.LovePlus) ? 3 : 20, state);
3120 tc.Say("item_drop", c3);
3121 }
3122 }
3123 }
3124
3125 public static void GeneMiracle(Chara tc, Chara c, DNA.Type type)
3126 {
3128 {
3130 return;
3131 }
3132 if (c == tc)
3133 {
3134 tc.Say("love_ground", tc);
3135 }
3136 else
3137 {
3138 tc.Say("love_chara", c, tc);
3139 }
3140 Thing t = tc.MakeGene(type);
3141 tc.GiveBirth(t, effect: true);
3142 }
3143
3144 public static Point GetTeleportPos(Point org, int radius = 6, Chara target = null)
3145 {
3146 Point point = new Point();
3147 for (int i = 0; i < 10000; i++)
3148 {
3149 point.Set(org);
3150 point.x += EClass.rnd(radius) - EClass.rnd(radius);
3151 point.z += EClass.rnd(radius) - EClass.rnd(radius);
3152 if (point.IsValid && point.IsInBounds && !point.cell.blocked && point.Distance(org) >= radius / 3 + 1 - i / 50 && !point.cell.HasZoneStairs() && (target == null || i >= 100 || Los.IsVisible(point, target.pos)))
3153 {
3154 return point;
3155 }
3156 }
3157 return org.GetRandomNeighbor().GetNearestPoint();
3158 }
3159
3160 public static Point GetShortTeleportPos(Point org, Point targetPos, int destDist, int maxOffset = 6)
3161 {
3162 for (int i = 0; i <= maxOffset; i++)
3163 {
3164 int destDist2 = destDist + i;
3165 List<Point> list = EClass._map.ListPointsOnEdge(targetPos, destDist2);
3166 list.RemoveAll((Point p) => !ValidPos(p));
3167 if (list.Count > 0)
3168 {
3169 return list.RandomItem();
3170 }
3171 if (i == 0)
3172 {
3173 continue;
3174 }
3175 destDist2 = destDist - i;
3176 if (destDist2 >= 1)
3177 {
3178 list = EClass._map.ListPointsOnEdge(targetPos, destDist2);
3179 list.RemoveAll((Point p) => !ValidPos(p));
3180 if (list.Count > 0)
3181 {
3182 return list.RandomItem();
3183 }
3184 }
3185 }
3186 return GetTeleportPos(org);
3187 static bool ValidPos(Point p)
3188 {
3189 if (!p.IsValid || !p.IsInBounds || p.cell.blocked || p.cell.HasZoneStairs())
3190 {
3191 return false;
3192 }
3193 return true;
3194 }
3195 }
3196
3197 public static bool Wish(string s, string name, int power, BlessedState state)
3198 {
3200 string netMsg = GameLang.Parse("wish".langGame(), thirdPerson: true, name, s);
3201 List<WishItem> list = new List<WishItem>();
3202 long wishLv = 10 + power / 4;
3203 int wishValue = MathEx.ClampToInt(5000 + (long)power * 50L);
3204 if (state >= BlessedState.Blessed)
3205 {
3206 wishLv = wishLv * 150 / 100;
3207 }
3208 else if (state <= BlessedState.Cursed)
3209 {
3210 wishLv = wishLv * 150 / 100;
3211 wishValue = 1;
3212 }
3213 Debug.Log(power + "/" + wishValue);
3214 string _s = s.ToLower();
3215 foreach (CardRow r in EClass.sources.cards.rows)
3216 {
3217 if (r.HasTag(CTAG.godArtifact))
3218 {
3219 bool flag = false;
3220 foreach (Religion item in EClass.game.religions.list)
3221 {
3222 if (item.giftRank >= 2 && item.IsValidArtifact(r.id))
3223 {
3224 flag = true;
3225 }
3226 }
3227 if (!flag)
3228 {
3229 continue;
3230 }
3231 }
3232 else if (r.quality >= 4 || r.HasTag(CTAG.noWish))
3233 {
3234 switch (r.id)
3235 {
3236 case "medal":
3237 case "plat":
3238 case "money":
3239 case "money2":
3240 break;
3241 default:
3242 continue;
3243 }
3244 }
3245 if (r.isChara)
3246 {
3247 continue;
3248 }
3249 string text = r.GetName().ToLower();
3250 int score = Compare(_s, text);
3251 if (score == 0)
3252 {
3253 continue;
3254 }
3255 list.Add(new WishItem
3256 {
3257 score = score,
3258 n = text,
3259 action = delegate
3260 {
3261 Debug.Log(r.id);
3262 SourceCategory.Row category = EClass.sources.cards.map[r.id].Category;
3263 if (category.IsChildOf("weapon") || category.IsChildOf("armor") || category.IsChildOf("ranged"))
3264 {
3265 CardBlueprint.SetRarity(Rarity.Legendary);
3266 }
3267 Thing thing = ThingGen.Create(r.id, -1, MathEx.ClampToInt(wishLv));
3268 int num = 1;
3269 int price = thing.GetPrice(CurrencyType.Money, sell: false, PriceType.Tourism);
3270 bool flag2 = thing.trait is TraitDeed || thing.rarity >= Rarity.Artifact || thing.source._origin == "artifact_summon";
3271 switch (thing.id)
3272 {
3273 case "rod_wish":
3274 thing.c_charges = 0;
3275 break;
3276 case "money":
3277 num = EClass.rndHalf(wishValue * 3);
3278 break;
3279 case "plat":
3280 num = EClass.rndHalf(wishValue / 500 + 4);
3281 break;
3282 case "money2":
3283 num = EClass.rndHalf(wishValue / 500 + 4);
3284 break;
3285 case "medal":
3286 num = EClass.rndHalf(wishValue / 2000 + 4);
3287 break;
3288 default:
3289 if (!flag2 && thing.trait.CanStack)
3290 {
3291 int num2 = wishValue;
3292 num2 -= price;
3293 for (int i = 1; i < 1000; i++)
3294 {
3295 int num3 = price + i * 2 * (price + 500);
3296 if (num3 > 0 && num2 > num3)
3297 {
3298 num++;
3299 num2 -= num3;
3300 }
3301 }
3302 }
3303 break;
3304 }
3305 if (price > 2500 && num > 3)
3306 {
3307 num = 3 + (int)Mathf.Sqrt(num - 3);
3308 }
3309 if (price > 5000 && num > 2)
3310 {
3311 num = 2 + (int)Mathf.Sqrt(num - 2) / 2;
3312 }
3313 if (price > 10000 && num > 1)
3314 {
3315 num = 1 + Mathf.Min((int)Mathf.Sqrt(num - 1) / 3, 2);
3316 }
3317 if (num < 1)
3318 {
3319 num = 1;
3320 }
3321 thing.SetNum(num);
3322 Debug.Log(_s + "/" + num + "/" + score);
3323 if (thing.HasTag(CTAG.godArtifact))
3324 {
3325 EClass.game.religions.Reforge(thing.id);
3326 }
3327 else
3328 {
3329 EClass._zone.AddCard(thing, EClass.pc.pos);
3330 }
3331 netMsg = netMsg + Lang.space + GameLang.Parse("wishNet".langGame(), Msg.IsThirdPerson(thing), Msg.GetName(thing).ToTitleCase());
3332 Net.SendChat(name, netMsg, ChatCategory.Wish, Lang.langCode);
3333 Msg.Say("dropReward");
3334 }
3335 });
3336 }
3337 if (list.Count == 0)
3338 {
3339 netMsg = netMsg + Lang.space + "wishFail".langGame();
3340 Net.SendChat(name, netMsg, ChatCategory.Wish, Lang.langCode);
3341 Msg.Say("wishFail");
3342 return false;
3343 }
3344 list.Sort((WishItem a, WishItem b) => b.score - a.score);
3345 foreach (WishItem item2 in list)
3346 {
3347 Debug.Log(item2.score + "/" + s + "/" + item2.n);
3348 }
3349 list[0].action();
3350 return true;
3351 }
3352
3353 public static int Compare(string s, string t)
3354 {
3355 if (s.IsEmpty())
3356 {
3357 return 0;
3358 }
3359 int num = 0;
3360 if (t == s)
3361 {
3362 num += 100 + EClass.rnd(30);
3363 }
3364 if (t.Contains(s))
3365 {
3366 num += 100 + EClass.rnd(30);
3367 }
3368 return num;
3369 }
3370}
AnimeID
Definition: AnimeID.cs:2
AttackSource
Definition: AttackSource.cs:2
BlessedState
Definition: BlessedState.cs:2
BossType
Definition: BossType.cs:2
CTAG
Definition: CTAG.cs:2
@ currency
@ notMeAgain
ChatCategory
Definition: ChatCategory.cs:2
ConditionType
Definition: ConditionType.cs:2
CureType
Definition: CureType.cs:2
CurrencyType
Definition: CurrencyType.cs:2
if(!match.Success)
bool Compare(float lhs)
DuplicateCondition
EffectId
Definition: EffectId.cs:2
Emo
Definition: Emo.cs:2
HealSource
Definition: HealSource.cs:2
Hostility
Definition: Hostility.cs:2
IDTSource
Definition: IDTSource.cs:2
ID_Achievement
PriceType
Definition: PriceType.cs:2
Rarity
Definition: Rarity.cs:2
ThrowMethod
Definition: ThrowMethod.cs:2
static void Poison(Chara tc, Chara c, int power)
Definition: ActEffect.cs:3077
static void LoveMiracle(Chara tc, Chara c, int power, EffectId idEffect=EffectId.Love, BlessedState? state=null)
Definition: ActEffect.cs:3093
static void Proc(EffectId id, int power, BlessedState state, Card cc, Card tc=null, ActRef actRef=default(ActRef))
Definition: ActEffect.cs:1130
static void GeneMiracle(Chara tc, Chara c, DNA.Type type)
Definition: ActEffect.cs:3125
static int angle
Definition: ActEffect.cs:21
static int Compare(string s, string t)
Definition: ActEffect.cs:3353
static float RapidDelay
Definition: ActEffect.cs:19
static int RapidCount
Definition: ActEffect.cs:17
static void TryDelay(Action a)
Definition: ActEffect.cs:23
static Point GetShortTeleportPos(Point org, Point targetPos, int destDist, int maxOffset=6)
Definition: ActEffect.cs:3160
static void Proc(EffectId id, Card cc, Card tc=null, int power=100, ActRef actRef=default(ActRef))
Definition: ActEffect.cs:1125
static bool Wish(string s, string name, int power, BlessedState state)
Definition: ActEffect.cs:3197
static void ProcAt(EffectId id, int power, BlessedState state, Card cc, Card tc, Point tp, bool isNeg, ActRef actRef=default(ActRef))
Definition: ActEffect.cs:519
static Point GetTeleportPos(Point org, int radius=6, Chara target=null)
Definition: ActEffect.cs:3144
static bool DamageEle(Card CC, EffectId id, int power, Element e, List< Point > points, ActRef actref, string lang=null, Point center=null)
Definition: ActEffect.cs:36
static EffectIRenderer Throw(Card c, Point p, Thing t, ThrowMethod method=ThrowMethod.Default, float failChance=0f)
Definition: ActThrow.cs:97
virtual int ElementPowerMod
Definition: ACT.cs:111
void SetElement(int id)
virtual string Name
void SetRefVal(int a, int b)
virtual ConditionType Type
Definition: BaseStats.cs:33
static int GetColorInt(ref Color matColor, int p)
void SetGender(int g)
Definition: Biography.cs:469
int GetAge(Chara c)
Definition: Biography.cs:276
void SetAge(Chara c, int a)
Definition: Biography.cs:297
void RerollParents()
Definition: Biography.cs:402
int gender
Definition: Biography.cs:29
static void Set(CardBlueprint _bp=null)
GlobalCharaList globalCharas
Definition: CardManager.cs:46
virtual string GetName(int i)
Definition: CardRow.cs:95
int quality
Definition: CardRow.cs:19
bool isChara
Definition: CardRow.cs:55
string id
Definition: CardRow.cs:7
Definition: Card.cs:11
int c_lockedAge
Definition: Card.cs:1393
bool IsPCFactionOrMinion
Definition: Card.cs:2342
void Teleport(Point point, bool silent=false, bool force=false)
Definition: Card.cs:6194
virtual bool IsMultisize
Definition: Card.cs:2212
virtual bool isThing
Definition: Card.cs:2133
bool IsAmmo
Definition: Card.cs:2301
int idMaterial
Definition: Card.cs:137
virtual Chara Chara
Definition: Card.cs:2122
Thing Split(int a)
Definition: Card.cs:3665
ElementContainerCard elements
Definition: Card.cs:42
string id
Definition: Card.cs:36
bool IsUnique
Definition: Card.cs:2143
virtual void Die(Element e=null, Card origin=null, AttackSource attackSource=AttackSource.None, Chara originalTarget=null)
Definition: Card.cs:5245
bool IsThrownWeapon
Definition: Card.cs:2299
SourceMaterial.Row material
Definition: Card.cs:2103
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:6645
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:3217
bool isCopy
Definition: Card.cs:881
void SetInt(string id, int value=0)
Definition: Card.cs:2586
virtual bool IsPCParty
Definition: Card.cs:2203
void HatchEgg()
Definition: Card.cs:6123
int c_uidMaster
Definition: Card.cs:1489
Biography bio
Definition: Card.cs:45
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
Definition: Card.cs:7206
Card SetLv(int a)
Definition: Card.cs:3070
Rarity rarity
Definition: Card.cs:317
string Name
Definition: Card.cs:2191
bool IsRangedWeapon
Definition: Card.cs:2297
ICardParent parent
Definition: Card.cs:56
bool ExistsOnMap
Definition: Card.cs:2137
Thing SetNum(int a)
Definition: Card.cs:3676
Thing GiveBirth(Thing t, bool effect)
Definition: Card.cs:6099
int LER
Definition: Card.cs:2411
virtual void SetBlessedState(BlessedState s)
Definition: Card.cs:4076
bool isAcidproof
Definition: Card.cs:689
bool IsToolbelt
Definition: Card.cs:2223
bool HasTag(CTAG tag)
Definition: Card.cs:2728
Point pos
Definition: Card.cs:60
bool IsInMutterDistance(int d=10)
Definition: Card.cs:8273
void SetDirtyWeight()
Definition: Card.cs:2687
int uid
Definition: Card.cs:125
Effect PlayEffect(string id, bool useRenderPos=true, float range=0f, Vector3 fix=default(Vector3))
Definition: Card.cs:6679
bool IsEquipmentOrRanged
Definition: Card.cs:2272
void TryStack(Thing t)
Definition: Card.cs:7484
Trait trait
Definition: Card.cs:54
bool IsPowerful
Definition: Card.cs:2146
int encLV
Definition: Card.cs:329
virtual bool IsAliveInCurrentZone
Definition: Card.cs:2179
Thing MakeMilk(bool effect=true, int num=1, bool addToZone=true, BlessedState? state=null)
Definition: Card.cs:6068
void DamageHP(long dmg, AttackSource attackSource=AttackSource.None, Card origin=null)
Definition: Card.cs:4276
void ModEncLv(int a)
Definition: Card.cs:4027
void SetEncLv(int a)
Definition: Card.cs:4045
void SayNothingHappans()
Definition: Card.cs:7319
void Destroy()
Definition: Card.cs:5314
bool HaveFur()
Definition: Card.cs:8439
BossType c_bossType
Definition: Card.cs:1261
virtual bool IsPC
Definition: Card.cs:2197
virtual bool isChara
Definition: Card.cs:2135
virtual Thing Thing
Definition: Card.cs:2110
Card GetRootCard()
Definition: Card.cs:3607
int Evalue(int ele)
Definition: Card.cs:2704
int Dist(Card c)
Definition: Card.cs:8229
int idSkin
Definition: Card.cs:365
int ResistLv(int res)
Definition: Card.cs:6378
bool IsLightsource
Definition: Card.cs:2225
virtual bool HasHost
Definition: Card.cs:2493
BlessedState blessedState
Definition: Card.cs:281
virtual bool IsGlobal
Definition: Card.cs:2353
bool isHatchling
Definition: Card.cs:941
Card Install()
Definition: Card.cs:3922
Card parentCard
Definition: Card.cs:106
void ModExp(string alias, int a)
Definition: Card.cs:2781
DNA c_DNA
Definition: Card.cs:1933
int genLv
Definition: Card.cs:197
int Num
Definition: Card.cs:161
bool IsWeapon
Definition: Card.cs:2260
int GetInt(string id, int? defaultInt=null)
Definition: Card.cs:2567
bool HasElement(int ele, bool includeNagative=false)
Definition: Card.cs:6383
int LV
Definition: Card.cs:389
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:7324
int c_uidAttune
Definition: Card.cs:1212
Thing MakeEgg(bool effect=true, int num=1, bool addToZone=true, int fertChance=20, BlessedState? state=null)
Definition: Card.cs:6045
bool IsTopWaterAndNoSnow
Definition: Cell.cs:748
SourceMaterial.Row matObj
Definition: Cell.cs:1074
bool HasZoneStairs(bool includeLocked=true)
Definition: Cell.cs:1795
void UnqeuipIfTooHeavy(Thing t)
Definition: CharaBody.cs:196
static Chara CreateFromElement(string idEle, int lv=-1, string idFilter="chara")
Definition: CharaGen.cs:32
static Chara CreateFromFilter(string id, int lv=-1, int levelRange=-1)
Definition: CharaGen.cs:22
static Chara Create(string id, int lv=-1)
Definition: CharaGen.cs:17
Definition: Chara.cs:10
void Refresh(bool calledRecursive=false)
Definition: Chara.cs:1804
override bool IsAliveInCurrentZone
Definition: Chara.cs:567
Element MainElement
Definition: Chara.cs:735
new TraitChara trait
Definition: Chara.cs:509
CharaBody body
Definition: Chara.cs:94
bool IsLevitating
Definition: Chara.cs:603
bool TryNeckHunt(Chara TC, int power, bool harvest=false)
Definition: Chara.cs:10288
void Cuddle(Chara c, bool headpat=false)
Definition: Chara.cs:6629
void InstantEat(Thing t=null, bool sound=true)
Definition: Chara.cs:8064
Condition AddCondition(string id, int p=100, bool force=false)
Definition: Chara.cs:9875
Faction faction
Definition: Chara.cs:431
void ModAffinity(Chara c, int a, bool show=true, bool showOnlyEmo=false)
Definition: Chara.cs:8445
override bool IsPC
Definition: Chara.cs:630
Chara host
Definition: Chara.cs:33
Point GetFirstStep(Point newPoint, PathManager.MoveType moveType=PathManager.MoveType.Default)
Definition: Chara.cs:2833
Chara GetNearbyCatToSniff()
Definition: Chara.cs:8634
void SetFeat(int id, int value=1, bool msg=false)
Definition: Chara.cs:10554
bool CanSeeLos(Card c, int dist=-1)
Definition: Chara.cs:1309
override bool IsPCParty
Definition: Chara.cs:633
Chara TryDuplicate(DuplicateCondition con=DuplicateCondition.Default, Point dest=null, bool inheritHostility=false)
Definition: Chara.cs:1962
bool RequestProtection(Chara attacker, Action< Chara > action)
Definition: Chara.cs:8956
bool IsInCombat
Definition: Chara.cs:911
bool HasCondition(string alias)
Definition: Chara.cs:10047
void SetMainElement(string id, int v=0, bool elemental=false)
Definition: Chara.cs:2300
Stats hunger
Definition: Chara.cs:1201
bool HasMinion(string id)
Definition: Chara.cs:2629
override bool HasHost
Definition: Chara.cs:706
override bool IsPCFaction
Definition: Chara.cs:689
override bool IsPCPartyMinion
Definition: Chara.cs:657
int MaxSummon
Definition: Chara.cs:732
void MakeMinion(Chara _master, MinionType type=MinionType.Default)
Definition: Chara.cs:2585
override void Die(Element e=null, Card origin=null, AttackSource attackSource=AttackSource.None, Chara originalTarget=null)
Definition: Chara.cs:5666
Chara Duplicate()
Definition: Chara.cs:1984
void MakeAlly(bool msg=true)
Definition: Chara.cs:2522
Stats mana
Definition: Chara.cs:1213
void TryDropBossLoot()
Definition: Chara.cs:5995
string NameTitled
Definition: Chara.cs:522
Chara parasite
Definition: Chara.cs:30
Chara ride
Definition: Chara.cs:27
void RefreshFaithElement()
Definition: Chara.cs:10871
void AddCooldown(int idEle, int turns=0)
Definition: Chara.cs:9271
Thing MakeGene(DNA.Type? type=null)
Definition: Chara.cs:8718
Religion faith
Definition: Chara.cs:443
Chara enemy
Definition: Chara.cs:86
void DoHostileAction(Card _tg, bool immediate=false)
Definition: Chara.cs:6761
bool TryEquip(Thing t, bool useFav=false)
Definition: Chara.cs:8226
void SetSummon(int duration)
Definition: Chara.cs:2641
bool IsHostile()
Definition: Chara.cs:6946
bool isDead
Definition: Chara.cs:393
Chara SetHostility(Hostility h)
Definition: Chara.cs:1505
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4606
void Sniff(Chara c)
Definition: Chara.cs:8646
bool TryFuse(float chance=1f)
Definition: Chara.cs:1838
void MoveZone(string alias)
Definition: Chara.cs:3577
UD_String_Color elementColors
Definition: ConWet.cs:2
virtual bool IsKilled
Definition: Condition.cs:8
void Kill(bool silent=false)
Definition: Condition.cs:108
static Condition Create(string alias, int power=100, Action< Condition > onCreate=null)
Definition: Condition.cs:47
new GameConfig game
Definition: CoreConfig.cs:629
GraphicSetting graphic
Definition: CoreConfig.cs:627
CameraConfig camera
Definition: CoreConfig.cs:637
bool enable
Definition: CoreDebug.cs:302
CoreConfig config
Definition: Core.cs:70
Definition: DNA.cs:9
Type
Definition: DNA.cs:11
static Type GetType(string idMat)
Definition: DNA.cs:590
void Generate(Type _type, Chara model=null)
Definition: DNA.cs:293
int GetRaw(int offsetHours=0)
Definition: Date.cs:328
Definition: Dialog.cs:7
static Dialog InputName(string langDetail, string text, Action< bool, string > onClose, InputType inputType=InputType.Default)
Definition: Dialog.cs:536
Definition: Dice.cs:5
static long RollMax(int num, int sides, int bonus=0)
Definition: Dice.cs:81
static long Roll(int num, int sides, int bonus=0, Card card=null)
Definition: Dice.cs:59
override string ToString()
Definition: Dice.cs:126
static Dice Create(Element ele, Card c)
Definition: Dice.cs:131
Definition: EClass.cs:6
static Game game
Definition: EClass.cs:9
static int curve(long _a, int start, int step, int rate=75)
Definition: EClass.cs:69
static ColorProfile Colors
Definition: EClass.cs:39
static Core core
Definition: EClass.cs:7
static void Wait(float a, Card c)
Definition: EClass.cs:112
static Zone _zone
Definition: EClass.cs:21
static World world
Definition: EClass.cs:41
static Map _map
Definition: EClass.cs:19
static int rnd(long a)
Definition: EClass.cs:59
static SourceManager sources
Definition: EClass.cs:43
static float rndf(float a)
Definition: EClass.cs:102
static FactionBranch Branch
Definition: EClass.cs:23
static int rndHalf(int a)
Definition: EClass.cs:97
static Player player
Definition: EClass.cs:13
static Chara pc
Definition: EClass.cs:15
static CoreDebug debug
Definition: EClass.cs:49
static UI ui
Definition: EClass.cs:17
static GameSetting setting
Definition: EClass.cs:35
Definition: EInput.cs:8
static bool isShiftDown
Definition: EInput.cs:272
static void Create(Point center, int radius, int count, Action< int, Point > onComplete)
Definition: EffectMeteor.cs:40
static void CreateComet(Point center, Action< int, Point > onComplete, Color color)
Definition: EffectMeteor.cs:71
Definition: Effect.cs:7
static Effect Get(Effect original)
Definition: Effect.cs:80
Effect SetStartDelay(float a)
Definition: Effect.cs:201
void Play(float delay, Point from, float fixY=0f, Point to=null, Sprite sprite=null)
Definition: Effect.cs:100
Effect SetParticleColor(Color c)
Definition: Effect.cs:293
List< Element > ListElements(Func< Element, bool > shoudList=null, Comparison< Element > comparison=null)
Dictionary< int, Element > dict
bool Has(int ele)
int Value(int ele)
Element ModTempPotential(int ele, int v, int threshMsg=0)
Element ModBase(int ele, int v)
Element SetBase(string alias, int v, int potential=0)
void Remove(int id)
Element GetOrCreateElement(Element ele)
Element GetElement(string alias)
int GetDNABonus(Chara c)
Definition: ELEMENT.cs:531
int id
Definition: ELEMENT.cs:259
int vBase
Definition: ELEMENT.cs:261
SourceElement.Row source
Definition: ELEMENT.cs:282
bool HasTag(string tag)
Definition: ELEMENT.cs:482
static int[] List_MainAttributes
Definition: ELEMENT.cs:249
static int GetId(string alias)
Definition: ELEMENT.cs:1182
int Value
Definition: ELEMENT.cs:301
virtual string Name
Definition: ELEMENT.cs:313
static Element Create(int id, int v=0)
Definition: ELEMENT.cs:1163
static Element Void
Definition: ELEMENT.cs:247
bool IsTrait
Definition: ELEMENT.cs:371
bool HasItemProtection
static string Parse(string text, bool thirdPerson, string val1, string val2=null, string val3=null, string val4=null)
Definition: GameLang.cs:177
bool disableUsermapBenefit
UD_String_ElementRef elements
Definition: GameSetting.cs:362
ReligionManager religions
Definition: Game.cs:159
GamePrincipal principal
Definition: Game.cs:225
SpatialManager spatials
Definition: Game.cs:153
CardManager cards
Definition: Game.cs:156
bool IsSurvival
Definition: Game.cs:276
Definition: Gender.cs:2
static string Name(int g)
Definition: Gender.cs:9
static bool Has(string id)
Definition: LangGame.cs:99
Definition: Lang.cs:7
static string langCode
Definition: Lang.cs:29
static string[] GetList(string id)
Definition: Lang.cs:113
static void Redraw()
static LayerDragGrid CreateEnchant(Chara cc, bool armor, bool superior=false, BlessedState state=BlessedState.Normal, int count=1)
static LayerDragGrid CreateChangeRarity(Chara cc, Thing consume, EffectId idEffect, BlessedState state=BlessedState.Normal, int price=0, int count=1)
static LayerDragGrid CreateChangeMaterial(Chara cc, Thing consume, SourceMaterial.Row mat, EffectId idEffect, BlessedState state=BlessedState.Normal, int price=0, int count=1)
static LayerDragGrid CreateLighten(Chara cc, BlessedState state=BlessedState.Normal, int price=0, int count=1)
static LayerDragGrid CreateUncurse(Chara cc, BlessedState state=BlessedState.Normal, int price=0, int count=1)
static LayerDragGrid CreateReconstruction(Chara cc, BlessedState state=BlessedState.Normal, int power=100, int price=0, int count=1)
static LayerDragGrid CreateIdentify(Chara cc, bool superior=false, BlessedState state=BlessedState.Normal, int price=0, int count=1)
static void SetDirty()
Definition: LayerEquip.cs:15
static void SetDirty(Thing t)
static void SetDirtyAll(bool immediate=false)
LayerList EnableReroll()
Definition: LayerList.cs:259
Layer SetTitles(string langList, string idHeaderRow=null)
Definition: Layer.cs:693
Definition: Los.cs:5
static bool IsVisible(Point p1, Point p2, Action< Point, bool > _onVisit=null)
Definition: Los.cs:167
Point GetRandomSurface(int x, int z, int radius, bool walkable=true, bool allowWater=false)
Definition: MapBounds.cs:182
int Width
Definition: MapBounds.cs:26
Chara FindChara(string id)
Definition: Map.cs:2754
List< Point > ListPointsInArc(Point center, Point to, int radius, float angle)
Definition: Map.cs:2475
void Reveal(Point center, int power=100)
Definition: Map.cs:1024
void MineObj(Point point, Task task=null, Chara c=null)
Definition: Map.cs:1980
void MineBlock(Point point, bool recoverBlock=false, Chara c=null, bool mineObj=true)
Definition: Map.cs:1808
void TryShatter(Point pos, int ele, int power, Card CC=null)
Definition: Map.cs:1316
void SetEffect(int x, int z, CellEffect effect=null)
Definition: Map.cs:1648
List< Point > ListPointsOnEdge(Point center, int destDist, bool mustBeWalkable=true, bool los=true)
Definition: Map.cs:2444
List< Point > ListPointsInLine(Point center, Point to, int radius, bool returnOnBlocked=true)
Definition: Map.cs:2492
List< Point > ListPointsInCircle(Point center, float radius, bool mustBeWalkable=true, bool los=true)
Definition: Map.cs:2418
List< Chara > charas
Definition: Map.cs:84
void RevealAll(bool reveal=true)
Definition: Map.cs:1011
MapBounds bounds
Definition: Map.cs:55
Definition: MathEx.cs:2
static bool IsSameSign(int a, int b)
Definition: MathEx.cs:12
static int ClampToInt(long a)
Definition: MathEx.cs:25
void Launch(Vector2 from, Vector2 to)
Definition: Msg.cs:5
static bool IsThirdPerson(Card c)
Definition: Msg.cs:296
static ThirstPersonInfo thirdPerson1
Definition: Msg.cs:6
static string SayNothingHappen()
Definition: Msg.cs:96
static string GetName(Card c)
Definition: Msg.cs:279
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
Definition: Net.cs:12
static async UniTask< bool > SendChat(string name, string msg, ChatCategory cat, string idLang)
Definition: Net.cs:335
int deepest
Definition: Player.cs:111
int deepestVoid
Definition: Player.cs:114
int escapeSilverBell
Definition: Player.cs:138
void ModKarma(int a)
Definition: Player.cs:2636
Stats stats
Definition: Player.cs:1086
int CountKeyItem(string alias)
Definition: Player.cs:2266
ReturnInfo returnInfo
Definition: Player.cs:933
Definition: Point.cs:9
Thing Installed
Definition: Point.cs:327
SourceMaterial.Row matBlock
Definition: Point.cs:55
List< Card > ListCards(bool includeMasked=false)
Definition: Point.cs:1057
Point Copy()
Definition: Point.cs:491
override string ToString()
Definition: Point.cs:524
Point Set(int _x, int _z)
Definition: Point.cs:503
int x
Definition: Point.cs:36
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false, int minRadius=0)
Definition: Point.cs:624
void ModFire(int value, bool extinguish=false)
Definition: Point.cs:939
int z
Definition: Point.cs:39
bool IsSync
Definition: Point.cs:344
List< Chara > Charas
Definition: Point.cs:340
SoundSource PlaySound(string id, bool synced=true, float v=1f, bool spatial=true)
Definition: Point.cs:1259
ref Vector3 PositionCenter()
Definition: Point.cs:592
bool Equals(int _x, int _z)
Definition: Point.cs:966
bool IsSunLit
Definition: Point.cs:182
bool IsValid
Definition: Point.cs:88
Effect PlayEffect(string id)
Definition: Point.cs:1254
bool HasObj
Definition: Point.cs:137
int Distance(Point p)
Definition: Point.cs:995
Chara FirstChara
Definition: Point.cs:288
bool HasBlock
Definition: Point.cs:141
bool IsInBounds
Definition: Point.cs:104
Cell cell
Definition: Point.cs:51
Point GetRandomNeighbor()
Definition: Point.cs:764
void Animate(AnimeID id, bool animeBlock=false)
Definition: Point.cs:1308
Point GetRandomPoint(int radius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=100)
Definition: Point.cs:774
Definition: Rand.cs:4
static void SetBaseSeed(int a=-1)
Definition: Rand.cs:39
static void SetSeed(int a=-1)
Definition: Rand.cs:44
ReligionWind Wind
Thing Reforge(string id, Point pos=null, bool first=true)
ReligionTrickery Trickery
ReligionElement Element
List< Religion > list
ReligionHealing Healing
virtual void Talk(string idTalk, Card c=null, Card agent=null)
Definition: Religion.cs:175
bool HasTag(CTAG _tag)
Definition: RenderRow.cs:136
Definition: Shaker.cs:5
static void ShakeCam(string id="default", float magnitude=1f)
Definition: Shaker.cs:25
List< CardRow > rows
Definition: SourceCard.cs:7
Dictionary< string, CardRow > map
Definition: SourceCard.cs:9
SourceMaterial materials
SourceRace races
SourceStat stats
SourceCalc calc
SourceCard cards
SourceElement elements
static Dictionary< string, TierList > tierMap
static Spatial Create(string id, Spatial parent, bool register, int x=-99999, int y=-99999, int icon=0)
Definition: SpatialGen.cs:16
Zone Find(string id)
List< Zone > ListReturnLocations()
int lv
Definition: Spatial.cs:142
string id
Definition: Spatial.cs:13
int visitCount
Definition: Spatial.cs:154
List< Spatial > children
Definition: Spatial.cs:37
static SpawnList Get(string id, Func< SourceChara.Row, bool > func)
virtual void Mod(int a)
Definition: Stats.cs:135
virtual int value
Definition: Stats.cs:56
virtual int max
Definition: Stats.cs:68
Definition: Steam.cs:12
static void GetAchievement(ID_Achievement id)
Definition: Steam.cs:53
Definition: TC.cs:4
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Definition: Thing.cs:8
SourceThing.Row source
Definition: Thing.cs:11
bool isEquipped
Definition: Thing.cs:17
override int GetPrice(CurrencyType currency=CurrencyType.Money, bool sell=false, PriceType priceType=PriceType.Default, Chara c=null)
Definition: Thing.cs:829
override CardRow sourceCard
Definition: Thing.cs:47
Thing Identify(bool show=true, IDTSource idtSource=IDTSource.Identify)
Definition: Thing.cs:2155
void Set(string n)
virtual bool UseRandomAlias
Definition: TraitChara.cs:136
virtual SourceElement.Row source
Definition: TraitScroll.cs:5
static void BadEffect(Chara c)
Definition: TraitWell.cs:143
virtual bool CanBeAttacked
Definition: Trait.cs:177
static void Reserve(string idStep, Action onBeforePlay=null)
Definition: Tutorial.cs:55
static void Play(string idStep)
Definition: Tutorial.cs:7
bool ContainsKey(TKey key)
Definition: UDictionary.cs:151
bool TryGetValue(TKey key, out TValue value)
Definition: UDictionary.cs:178
GameDate date
Definition: World.cs:6
Definition: Zone.cs:12
virtual string GetNewZoneID(int level)
Definition: Zone.cs:595
int CountMinions(Chara c)
Definition: Zone.cs:4028
FactionBranch branch
Definition: Zone.cs:34
bool HasField(int idEle)
Definition: Zone.cs:3169
virtual bool IsUserZone
Definition: Zone.cs:278
bool IsInstance
Definition: Zone.cs:496
Chara Boss
Definition: Zone.cs:91
void ModInfluence(int a)
Definition: Zone.cs:3909
override int DangerLv
Definition: Zone.cs:115
virtual int MinLv
Definition: Zone.cs:288
bool IsPCFaction
Definition: Zone.cs:480
ZoneInstance instance
Definition: Zone.cs:58
Card AddCard(Card t, Point point)
Definition: Zone.cs:2151
Definition: ActRef.cs:2
Act act
Definition: ActRef.cs:3
Thing refThing
Definition: ActRef.cs:9