Elin Decompiled Documentation EA 23.359.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())
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 && !item2.GetBool(137))
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> list5 = EClass._map.ListPointsInCircle(CC.pos, 12f, mustBeWalkable: false);
540 if (list5.Count == 0)
541 {
542 list5.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, list5, actRef, "spell_earthquake");
555 break;
556 }
557 case EffectId.Meteor:
558 {
559 EffectMeteor.Create(cc.pos, 10, 10, delegate
560 {
561 });
562 List<Point> list3 = EClass._map.ListPointsInCircle(CC.pos, 10f);
563 if (list3.Count == 0)
564 {
565 list3.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, list3, actRef, "spell_ball");
578 return;
579 }
580 case EffectId.Comet:
581 {
582 EffectMeteor.CreateComet(tp, delegate
583 {
584 }, matColor * 2f);
585 List<Point> list9 = EClass._map.ListPointsInCircle(tp, 7f);
586 if (list9.Count == 0)
587 {
588 list9.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, list9, 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> list7 = new List<Point>();
630 list7.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, list7, actRef, (id == EffectId.MoonSpear) ? "spell_spear" : "spell_arrow");
638 return;
639 }
640 case EffectId.Missile:
641 {
642 List<Point> list = new List<Point>();
643 List<Point> list2 = 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 list2.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 num3 = 0; num3 < 6 + EClass.rnd(7); num3++)
666 {
667 list.Clear();
668 list.Add(list2.RandomItem());
669 DamageEle(CC, id, power, element, list, 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 num4 = 1;
711 int num5 = -1;
712 int radius2 = 3;
713 bool flag4 = false;
714 bool flag5 = actRef.n1 == "special";
715 int num6 = -1;
716 string text = "";
717 bool notMeAgain = CC.HasTag(CTAG.notMeAgain);
718 switch (actRef.n1)
719 {
720 case "shadow":
721 case "tsunami":
722 num4 = Mathf.Clamp(power / 100, 1, 5) + ((power >= 100) ? EClass.rnd(2) : 0);
723 break;
724 case "monster":
725 case "fire":
726 case "animal":
727 num4 = 1 + EClass.rnd(2);
728 break;
729 case "special_force":
730 id3 = "army_palmia";
731 num4 = 4 + EClass.rnd(2);
732 num6 = EClass._zone.DangerLv;
733 break;
734 case "tentacle":
735 num5 = 20 + EClass.rnd(10);
736 radius2 = 1;
737 break;
738 case "special":
739 CC.SetInt(70, EClass.world.date.GetRaw() + 1440);
740 num4 = Mathf.Clamp(7 + CC.LV / 100, 4, 20);
741 num6 = CC.LV;
742 break;
743 case "special2":
744 num4 = 30;
745 num6 = CC.LV;
746 break;
747 }
748 num4 += CC.Evalue(1240);
749 for (int num7 = 0; num7 < num4; num7++)
750 {
751 if (EClass._zone.CountMinions(CC) >= CC.MaxSummon)
752 {
753 break;
754 }
755 Point point = null;
756 point = ((!(actRef.n1 == "special2")) ? tp.GetRandomPoint(radius2)?.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 (num6 != -1)
764 {
765 CardBlueprint.current.lv = num6;
766 }
767 if (!text.IsEmpty())
768 {
769 CardBlueprint.current.idEle = text;
770 }
771 switch (actRef.n1)
772 {
773 case "special":
774 if (num7 == 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 && !flag5)
830 {
831 num7--;
832 continue;
833 }
834 long num8 = -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 num9 = 1;
845 if (!CC.IsPC)
846 {
847 num9 = (CC.IsPCFactionOrMinion ? (CC.LV / 2) : (CC.LV / 3 * 2));
848 }
849 if (num6 == -1)
850 {
851 num8 = chara2.LV * (100 + power / 10) / 100 + power / 30;
852 }
853 if (num8 < num9)
854 {
855 num8 = num9;
856 }
857 if (num8 > 99999999)
858 {
859 num8 = 99999999L;
860 }
861 }
862 }
863 else
864 {
865 num8 = power / 10 + 1;
866 }
867 if (chara2.LV < num8)
868 {
869 chara2.SetLv((int)num8);
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 (num5 != -1)
902 {
903 chara2.SetSummon(num5);
904 }
905 flag4 = true;
906 }
907 if (!flag4)
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> list6 = EClass._map.ListPointsInArc(CC.pos, tp, 7, 35f);
936 if (list6.Count == 0)
937 {
938 list6.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, list6, 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 radius = ((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 radius = 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 radius = 1.5f;
995 }
996 cc.SetBool(137, enable: true);
997 }
998 bool flag3 = id == EffectId.Explosive || id == EffectId.Suicide || id == EffectId.Rocket;
999 List<Point> list10 = EClass._map.ListPointsInCircle((id == EffectId.GravityGun || id == EffectId.Rocket || id == EffectId.Flare) ? tp : cc.pos, radius, !flag3, !flag3);
1000 if (list10.Count == 0)
1001 {
1002 list10.Add(cc.pos.Copy());
1003 }
1004 cc.Say((id == EffectId.Suicide) ? "abSuicide" : "spell_ball", cc, element.Name.ToLower());
1005 EClass.Wait(0.8f, cc);
1006 TryDelay(delegate
1007 {
1008 if (id == EffectId.Flare)
1009 {
1010 tp.PlayEffect("flare");
1011 }
1012 if (id != EffectId.GravityGun)
1013 {
1014 cc.PlaySound((id == EffectId.Flare) ? "spell_flare" : "spell_ball");
1015 }
1016 });
1018 {
1019 Shaker.ShakeCam("ball");
1020 }
1021 DamageEle(actRef.origin ?? cc, id, power, element, list10, actRef, (id == EffectId.Suicide) ? "suicide" : "spell_ball");
1022 cc.SetBool(137, enable: false);
1023 if (id == EffectId.Suicide && cc.IsAliveInCurrentZone)
1024 {
1025 cc.Die();
1026 }
1027 return;
1028 }
1029 case EffectId.Bolt:
1030 {
1031 List<Point> list8 = EClass._map.ListPointsInLine(CC.pos, tp, 10);
1032 if (list8.Count == 0)
1033 {
1034 list8.Add(CC.pos.Copy());
1035 }
1036 CC.Say("spell_bolt", CC, element.Name.ToLower());
1037 EClass.Wait(0.8f, CC);
1038 TryDelay(delegate
1039 {
1040 CC.PlaySound("spell_bolt");
1041 });
1043 {
1044 Shaker.ShakeCam("bolt");
1045 }
1046 DamageEle(CC, id, power, element, list8, actRef, "spell_bolt");
1047 return;
1048 }
1049 case EffectId.Bubble:
1050 case EffectId.Web:
1051 case EffectId.MistOfDarkness:
1052 case EffectId.Puddle:
1053 {
1054 if (LangGame.Has("ab" + id))
1055 {
1056 CC.Say("ab" + id, CC);
1057 }
1058 tp.PlaySound("vomit");
1059 int num = 2 + EClass.rnd(3);
1060 int id2 = ((id == EffectId.Puddle) ? 4 : ((id == EffectId.Bubble) ? 5 : ((id == EffectId.MistOfDarkness) ? 6 : 7)));
1061 EffectId idEffect = ((id == EffectId.Bubble) ? EffectId.BallBubble : EffectId.PuddleEffect);
1062 if (id == EffectId.Bubble && CC.id == "cancer")
1063 {
1064 idEffect = EffectId.Nothing;
1065 num = 1 + EClass.rnd(3);
1066 }
1067 for (int i = 0; i < num; i++)
1068 {
1069 Point randomPoint = tp.GetRandomPoint(2);
1070 if (randomPoint != null && !randomPoint.HasBlock && (id != EffectId.Puddle || !randomPoint.cell.IsTopWaterAndNoSnow))
1071 {
1072 int num2 = 4 + EClass.rnd(5);
1073 if (id == EffectId.Web)
1074 {
1075 num2 *= 3;
1076 }
1077 EClass._map.SetEffect(randomPoint.x, randomPoint.z, new CellEffect
1078 {
1079 id = id2,
1080 amount = num2,
1081 idEffect = idEffect,
1082 idEle = element.id,
1083 power = power,
1084 isHostileAct = CC.IsPCParty,
1085 color = BaseTileMap.GetColorInt(ref matColor, 100)
1086 });
1087 }
1088 }
1089 return;
1090 }
1091 }
1092 List<Card> list11 = tp.ListCards();
1093 list11.Reverse();
1094 if (list11.Contains(CC))
1095 {
1096 list11.Remove(CC);
1097 list11.Insert(0, CC);
1098 }
1099 bool flag6 = true;
1100 foreach (Card item5 in list11)
1101 {
1102 if (tc == null || item5 == tc)
1103 {
1104 Proc(id, power, state, CC, item5, actRef);
1105 if (flag2 && item5.isChara && item5 != CC)
1106 {
1107 CC.DoHostileAction(item5);
1108 }
1109 if (actRef.refThing == null || !(actRef.refThing.trait is TraitRod))
1110 {
1111 return;
1112 }
1113 EffectId effectId = id;
1114 if ((uint)(effectId - 200) <= 4u)
1115 {
1116 return;
1117 }
1118 flag6 = false;
1119 }
1120 }
1121 if (flag6)
1122 {
1123 CC.SayNothingHappans();
1124 }
1125 }
1126
1127 public static void Proc(EffectId id, Card cc, Card tc = null, int power = 100, ActRef actRef = default(ActRef))
1128 {
1129 Proc(id, power, BlessedState.Normal, cc, tc, actRef);
1130 }
1131
1132 public static void Proc(EffectId id, int power, BlessedState state, Card cc, Card tc = null, ActRef actRef = default(ActRef))
1133 {
1134 if (tc == null)
1135 {
1136 tc = cc;
1137 }
1138 Chara TC = tc.Chara;
1139 Chara CC = cc.Chara;
1140 bool blessed = state >= BlessedState.Blessed;
1141 bool flag = state <= BlessedState.Cursed;
1142 int orgPower = power;
1143 if (blessed || flag)
1144 {
1145 power *= 2;
1146 }
1147 switch (id)
1148 {
1149 case EffectId.Duplicate:
1150 CC.TryDuplicate();
1151 break;
1152 case EffectId.Fuse:
1153 if (!CC.TryFuse() && CC.IsPC)
1154 {
1156 }
1157 break;
1158 case EffectId.Escape:
1159 if (CC.IsPCFaction || (EClass._zone.Boss == CC && EClass.rnd(30) != 0))
1160 {
1161 return;
1162 }
1163 CC.Say("escape", CC);
1164 CC.PlaySound("escape");
1165 if (EClass._zone.Boss == CC)
1166 {
1167 CC.TryDropBossLoot();
1168 }
1169 if (CC.id == "bell_silver")
1170 {
1173 {
1175 }
1176 }
1177 CC.Destroy();
1178 break;
1179 case EffectId.BurnMana:
1180 CC.PlaySound("fire");
1181 CC.PlayEffect("Element/eleFire");
1182 CC.Say("burn_mana", CC);
1183 CC.mana.Mod(-CC.mana.max / 3 - 1);
1184 break;
1185 case EffectId.Exterminate:
1186 {
1187 CC.PlaySound("clean_floor");
1188 Msg.Say("exterminate");
1189 List<Chara> list = EClass._map.charas.Where((Chara chara3) => (chara3.isCopy || chara3.isHatchling || chara3.id == "cocoon" || chara3.id == "cocoon_alien") && !chara3.IsPCFactionOrMinion).ToList();
1190 if (list.Count == 0)
1191 {
1193 return;
1194 }
1195 foreach (Chara item in list)
1196 {
1197 item.Say("split_fail", item);
1198 item.PlayEffect("vanish");
1199 item.Die();
1200 }
1201 break;
1202 }
1203 case EffectId.DropMine:
1204 {
1205 if (CC.pos.Installed != null || EClass._zone.IsPCFaction)
1206 {
1207 return;
1208 }
1209 Thing thing4 = ThingGen.Create("mine");
1210 thing4.c_idRefCard = "dog_mine";
1211 Zone.ignoreSpawnAnime = true;
1212 EClass._zone.AddCard(thing4, CC.pos).Install();
1213 break;
1214 }
1215 case EffectId.LittleSisterMigration:
1216 case EffectId.SilverCatMigration:
1217 {
1218 bool flag5 = id == EffectId.SilverCatMigration;
1219 if (!EClass.game.IsSurvival && ((flag5 && EClass._zone.id != "startVillage2") || (!flag5 && !(EClass._zone is Zone_LittleGarden))))
1220 {
1222 return;
1223 }
1224 List<Chara> list2 = new List<Chara>();
1225 bool flag6 = false;
1226 foreach (Chara chara3 in EClass._map.charas)
1227 {
1228 if (!chara3.IsPCFactionOrMinion && chara3.id == (flag5 ? "cat_silver" : "littleOne"))
1229 {
1230 if (flag6)
1231 {
1232 flag6 = false;
1233 continue;
1234 }
1235 list2.Add(chara3);
1236 flag6 = true;
1237 }
1238 }
1239 if (list2.Count == 0)
1240 {
1242 return;
1243 }
1244 EClass.pc.PlaySound("chime_angel");
1245 foreach (Chara item2 in list2)
1246 {
1247 item2.PlayEffect("revive");
1248 item2.Destroy();
1249 }
1250 Msg.Say(flag5 ? "cat_migration" : "little_migration", list2.Count.ToString() ?? "");
1251 EClass._zone.ModInfluence(list2.Count);
1252 if (flag5)
1253 {
1254 EClass.player.stats.catDepart += list2.Count;
1255 break;
1256 }
1257 EClass.player.stats.sistersDepart += list2.Count;
1259 break;
1260 }
1261 case EffectId.MagicMap:
1262 if (!CC.IsPC)
1263 {
1264 CC.SayNothingHappans();
1265 break;
1266 }
1267 if (flag)
1268 {
1269 CC.Say("abMagicMap_curse", CC);
1270 CC.PlaySound("curse3");
1271 CC.PlayEffect("curse");
1272 CC.AddCondition<ConConfuse>(200, force: true);
1273 break;
1274 }
1275 CC.Say("abMagicMap", CC);
1276 CC.PlayEffect("identify");
1277 CC.PlaySound("identify");
1278 if (blessed)
1279 {
1281 }
1282 else
1283 {
1284 EClass._map.Reveal(CC.pos, power);
1285 }
1286 break;
1287 case EffectId.AbsorbMana:
1288 {
1289 if (CC == TC)
1290 {
1291 EClass.game.religions.Element.Talk("ability");
1292 }
1293 Dice dice = Dice.Create("ActManaAbsorb", power, CC, (actRef.refThing != null) ? null : actRef.act);
1294 TC.mana.Mod(MathEx.ClampToInt(dice.Roll() + TC.mana.max / 5));
1295 TC.PlaySound("heal");
1296 TC.PlayEffect("heal");
1297 if (TC == CC)
1298 {
1299 CC.Say("absorbMana", CC);
1300 }
1301 break;
1302 }
1303 case EffectId.ModPotential:
1304 {
1305 Element element = cc.elements.ListElements((Element e) => e.HasTag("primary")).RandomItem();
1306 cc.elements.ModTempPotential(element.id, power / 10);
1307 break;
1308 }
1309 case EffectId.ForgetItems:
1310 {
1311 TC.PlaySound("curse3");
1312 TC.PlayEffect("curse");
1313 TC.Say("forgetItems", TC);
1314 int num11 = power / 50 + 1 + EClass.rnd(3);
1315 List<Thing> source = TC.things.List((Thing thing8) => thing8.c_IDTState == 0);
1316 for (int num12 = 0; num12 < num11; num12++)
1317 {
1318 source.RandomItem().c_IDTState = 5;
1319 }
1320 break;
1321 }
1322 case EffectId.EnchantWeapon:
1323 case EffectId.EnchantArmor:
1324 case EffectId.EnchantWeaponGreat:
1325 case EffectId.EnchantArmorGreat:
1326 {
1327 bool armor = id == EffectId.EnchantArmor || id == EffectId.EnchantArmorGreat;
1328 bool flag7 = id == EffectId.EnchantWeaponGreat || id == EffectId.EnchantArmorGreat;
1329 if (!tc.isThing)
1330 {
1331 LayerDragGrid.CreateEnchant(CC, armor, flag7, state);
1332 return;
1333 }
1334 cc.PlaySound("identify");
1335 cc.PlayEffect("identify");
1336 if (flag)
1337 {
1338 cc.Say("enc_curse", tc);
1339 tc.ModEncLv(-1);
1340 break;
1341 }
1342 int num13 = (flag7 ? 4 : 2) + (blessed ? 1 : 0);
1343 if (tc.encLV >= num13)
1344 {
1345 cc.Say("enc_resist", tc);
1346 break;
1347 }
1348 cc.Say("enc", tc);
1349 tc.ModEncLv(1);
1350 break;
1351 }
1352 case EffectId.Identify:
1353 case EffectId.GreaterIdentify:
1354 {
1355 bool flag8 = id == EffectId.GreaterIdentify;
1356 if (flag)
1357 {
1358 Redirect(EffectId.ForgetItems, flag8 ? BlessedState.Cursed : BlessedState.Normal, default(ActRef));
1359 break;
1360 }
1361 if (!tc.isThing || (actRef.refThing == null && cc.IsPC && tc.GetRootCard() == tc))
1362 {
1363 int count = ((!blessed) ? 1 : (flag8 ? (2 + EClass.rnd(2)) : (3 + EClass.rnd(3))));
1364 LayerDragGrid.CreateIdentify(tc.isChara ? tc.Chara : CC, flag8, state, 0, count);
1365 return;
1366 }
1367 cc.PlaySound("identify");
1368 cc.PlayEffect("identify");
1369 tc.Thing.Identify(cc.IsPCParty, (!flag8) ? IDTSource.Identify : IDTSource.SuperiorIdentify);
1370 break;
1371 }
1372 case EffectId.Uncurse:
1373 {
1374 if (!tc.isThing)
1375 {
1376 LayerDragGrid.CreateUncurse(CC, state);
1377 return;
1378 }
1379 Thing thing3 = tc.Thing;
1380 if (thing3.blessedState == BlessedState.Cursed)
1381 {
1382 thing3.SetBlessedState(BlessedState.Normal);
1383 }
1384 else if (thing3.blessedState == BlessedState.Doomed)
1385 {
1386 thing3.SetBlessedState(BlessedState.Normal);
1387 }
1388 thing3.GetRootCard()?.TryStack(thing3);
1389 LayerInventory.SetDirty(thing3);
1390 break;
1391 }
1392 case EffectId.Lighten:
1393 {
1394 if (!tc.isThing)
1395 {
1396 LayerDragGrid.CreateLighten(CC, state);
1397 return;
1398 }
1399 if (tc.Num > 1)
1400 {
1401 tc = tc.Split(1);
1402 }
1403 cc.PlaySound("offering");
1404 cc.PlayEffect("buff");
1405 int num = (tc.isWeightChanged ? tc.c_weight : tc.Thing.source.weight);
1406 tc.isWeightChanged = true;
1407 Element orCreateElement = tc.elements.GetOrCreateElement(64);
1408 Element orCreateElement2 = tc.elements.GetOrCreateElement(65);
1409 Element orCreateElement3 = tc.elements.GetOrCreateElement(67);
1410 Element orCreateElement4 = tc.elements.GetOrCreateElement(66);
1411 bool flag2 = tc.IsEquipmentOrRangedOrAmmo || tc.IsThrownWeapon;
1412 int num2 = (blessed ? (power / 4) : power);
1413 int num3 = Mathf.Clamp(Mathf.Max(orCreateElement3.vBase - tc.encLV, orCreateElement4.vBase) * num2 / 1000, 1, 5);
1414 int num4 = Mathf.Clamp(Mathf.Max(orCreateElement2.vBase - tc.encLV * 2, orCreateElement.vBase) * num2 / 1000, 1, 5);
1415 if (flag)
1416 {
1417 num = (int)(0.01f * (float)num * (float)power * 0.75f + 500f);
1418 if (num < 0 || num > 10000000)
1419 {
1420 num = 10000000;
1421 flag2 = false;
1422 }
1423 if (flag2)
1424 {
1425 if (tc.IsWeapon || tc.IsThrownWeapon || tc.IsAmmo)
1426 {
1427 tc.elements.ModBase(67, num3);
1428 tc.elements.ModBase(66, -num3);
1429 }
1430 else
1431 {
1432 tc.elements.ModBase(65, num4);
1433 tc.elements.ModBase(64, -num4);
1434 }
1435 }
1436 cc.Say("lighten_curse", tc);
1437 }
1438 else
1439 {
1440 num = num * (100 - power / 10) / 100;
1441 if (flag2)
1442 {
1443 if (tc.IsWeapon || tc.IsThrownWeapon || tc.IsAmmo)
1444 {
1445 tc.elements.ModBase(67, -num3);
1446 tc.elements.ModBase(66, num3);
1447 }
1448 else
1449 {
1450 tc.elements.ModBase(65, -num4);
1451 tc.elements.ModBase(64, num4);
1452 }
1453 }
1454 cc.Say("lighten", tc);
1455 }
1456 tc.c_weight = num;
1457 tc.SetDirtyWeight();
1458 if (tc.parent == null)
1459 {
1460 CC.Pick(tc.Thing, msg: false);
1461 }
1463 break;
1464 }
1465 case EffectId.Reconstruction:
1466 {
1467 if (!tc.isThing)
1468 {
1469 LayerDragGrid.CreateReconstruction(CC, state, power / ((!(blessed || flag)) ? 1 : 2));
1470 return;
1471 }
1472 if (tc.Num > 1)
1473 {
1474 tc = tc.Split(1);
1475 }
1476 cc.PlaySound("mutation");
1477 cc.PlayEffect("identify");
1478 cc.Say("reconstruct", tc);
1479 EClass.game.cards.uidNext += EClass.rnd(30);
1480 int num10 = Mathf.Max(tc.genLv, tc.LV, EClass.player.stats.deepest);
1482 {
1483 blesstedState = state
1484 });
1485 Thing thing2 = ThingGen.Create(tc.id, -1, (int)((long)num10 * (long)power / 400));
1486 thing2.genLv = num10;
1487 thing2.idSkin = tc.idSkin;
1488 if (tc.c_uidAttune != 0)
1489 {
1490 thing2.c_uidAttune = tc.c_uidAttune;
1491 if (thing2.id == "amulet_engagement" || thing2.id == "ring_engagement")
1492 {
1493 if (tc.c_uidAttune != EClass.pc.uid)
1494 {
1495 thing2.elements.ModBase(484, 3);
1496 }
1497 if (thing2.rarity < Rarity.Mythical)
1498 {
1499 thing2.rarity = Rarity.Mythical;
1500 }
1501 }
1502 }
1503 tc.Destroy();
1504 CC.Pick(thing2, msg: false);
1505 if (!CC.IsPC)
1506 {
1507 CC.TryEquip(thing2);
1508 }
1509 break;
1510 }
1511 case EffectId.ChangeMaterialLesser:
1512 case EffectId.ChangeMaterial:
1513 case EffectId.ChangeMaterialGreater:
1514 {
1515 SourceMaterial.Row row = EClass.sources.materials.alias.TryGetValue(actRef.n1);
1516 if (!tc.isThing)
1517 {
1518 LayerDragGrid.CreateChangeMaterial(CC, actRef.refThing, row, id, state);
1519 return;
1520 }
1521 if (tc.Num > 1)
1522 {
1523 tc = tc.Split(1);
1524 }
1525 string name2 = tc.Name;
1526 if (row == null)
1527 {
1528 bool num7 = id == EffectId.ChangeMaterialGreater;
1529 bool flag4 = id == EffectId.ChangeMaterialLesser;
1530 string text = tc.Thing.source.tierGroup;
1531 Dictionary<string, SourceMaterial.TierList> tierMap = SourceMaterial.tierMap;
1532 int num8 = 1;
1533 if (flag)
1534 {
1535 num8 -= 2;
1536 }
1537 if (blessed)
1538 {
1539 num8++;
1540 }
1541 if (num7)
1542 {
1543 num8++;
1544 }
1545 if (flag4)
1546 {
1547 num8 -= 2;
1548 }
1549 num8 = Mathf.Clamp(num8 + EClass.rnd(2), 0, 4);
1550 if (EClass.rnd(10) == 0)
1551 {
1552 text = ((text == "metal") ? "leather" : "metal");
1553 }
1554 SourceMaterial.TierList tierList = (text.IsEmpty() ? tierMap.RandomItem() : tierMap[text]);
1555 for (int num9 = 0; num9 < 1000; num9++)
1556 {
1557 row = tierList.tiers[num8].Select();
1558 if (row != tc.material)
1559 {
1560 break;
1561 }
1562 }
1563 }
1564 cc.PlaySound("offering");
1565 cc.PlayEffect("buff");
1566 if ((tc.id == "log" || tc.id == "branch") && tc.material.alias == "carbone")
1567 {
1568 foreach (Element item3 in tc.elements.dict.Values.ToList())
1569 {
1570 if (item3.IsTrait && item3.vBase != 0)
1571 {
1572 tc.elements.ModBase(item3.id, -item3.vBase);
1573 }
1574 }
1575 }
1576 tc.ChangeMaterial(row);
1577 if (tc.trait is TraitGene && tc.c_DNA != null)
1578 {
1579 DNA.Type type = DNA.GetType(tc.material.alias);
1580 tc.c_DNA.Generate(type);
1581 }
1582 cc.Say("materialChanged", name2, row.GetName());
1583 if (CC != null)
1584 {
1585 if (tc.parent == null)
1586 {
1587 CC.Pick(tc.Thing, msg: false);
1588 }
1590 }
1591 break;
1592 }
1593 case EffectId.ChangeRarity:
1594 {
1595 EClass.sources.materials.alias.TryGetValue(actRef.n1);
1596 if (!tc.isThing)
1597 {
1598 LayerDragGrid.CreateChangeRarity(CC, actRef.refThing, id, state);
1599 return;
1600 }
1601 if (tc.Num > 1)
1602 {
1603 tc = tc.Split(1);
1604 }
1605 string name = tc.Name;
1606 cc.PlaySound("offering");
1607 cc.PlayEffect("buff");
1608 bool flag3 = tc.rarity == Rarity.Legendary;
1610 {
1611 rarity = (flag3 ? Rarity.Mythical : Rarity.Legendary),
1612 generation = CardBlueprint.Generation.GarokkHammer
1613 });
1614 Rand.SetBaseSeed(tc.uid + 1);
1615 Rand.SetSeed(tc.uid + 2);
1616 Thing thing = ThingGen.Create(tc.id, tc.idMaterial, tc.genLv);
1617 Rand.SetSeed();
1618 Rand.SetBaseSeed();
1619 thing.SetEncLv(tc.encLV);
1620 thing.SetBlessedState(tc.blessedState);
1621 int num5 = 0;
1622 foreach (Element item4 in thing.elements.dict.Values.ToList().Shuffle())
1623 {
1624 int num6 = (tc.elements.Has(item4.id) ? tc.elements.GetElement(item4.id).vBase : 0);
1625 if (num6 != 0 && (Mathf.Abs(item4.vBase) <= Mathf.Abs(num6) || !MathEx.IsSameSign(item4.vBase, num6)))
1626 {
1627 continue;
1628 }
1629 int id2 = item4.id;
1630 if (id2 != 11)
1631 {
1632 if ((uint)(id2 - 64) > 3u)
1633 {
1634 num5++;
1635 }
1636 tc.elements.SetBase(item4.id, item4.vBase);
1637 Debug.Log(item4.Name + "/" + item4.vBase);
1638 if (flag3 && num5 >= 2)
1639 {
1640 break;
1641 }
1642 }
1643 }
1644 tc.isCrafted = false;
1645 tc.rarity = (flag3 ? Rarity.Mythical : Rarity.Legendary);
1646 EClass.pc.Say("reconstruct", name);
1647 break;
1648 }
1649 case EffectId.ChangeAlias:
1650 {
1651 Chara c = CC;
1652 if (!c.IsPC && !c.trait.UseRandomAlias && blessed)
1653 {
1654 c._alias = null;
1655 c.Say("reconstruct", c);
1656 SE.Change();
1657 c.PlayEffect("mutation");
1658 break;
1659 }
1660 EClass.ui.AddLayer<LayerList>().SetStringList(delegate
1661 {
1662 List<string> list13 = new List<string>();
1663 for (int i = 0; i < 10; i++)
1664 {
1665 list13.Add(AliasGen.GetRandomAlias());
1666 }
1667 return list13;
1668 }, delegate(int a, string b)
1669 {
1670 c._alias = b;
1671 c.Say("reconstruct", c);
1672 SE.Change();
1673 c.PlayEffect("mutation");
1674 }).SetSize()
1675 .EnableReroll()
1676 .SetTitles("wAlias");
1677 break;
1678 }
1679 case EffectId.ChangeBiography:
1680 CC.bio.RerollParents();
1681 CC.Say("reconstruct", CC);
1682 SE.Change();
1683 CC.PlayEffect("mutation");
1684 break;
1685 case EffectId.ReturnVoid:
1686 {
1688 if (EClass.game.IsSurvival || root == null || root.visitCount == 0 || EClass.player.stats.deepestVoid < 1 || (!EClass.debug.enable && EClass.player.CountKeyItem("license_void") == 0))
1689 {
1691 return;
1692 }
1693 int max = Mathf.Min(EClass.player.stats.deepestVoid, -root.MinLv);
1694 int destLv = 1;
1695 Dialog.InputName("dialogVoidReturn".lang(max.ToString() ?? ""), max.ToString() ?? "", delegate(bool cancel, string str)
1696 {
1697 if (!cancel)
1698 {
1699 destLv = Mathf.Abs(str.ToInt());
1700 destLv = Mathf.Clamp(destLv, 1, max) * -1;
1701 Zone zone = ((root.lv == destLv) ? root : (root.children.Find((Spatial spatial) => spatial.lv == destLv) as Zone));
1702 Debug.Log(destLv + "/" + zone);
1703 if (zone == null)
1704 {
1705 zone = SpatialGen.Create(root.GetNewZoneID(destLv), root, register: true) as Zone;
1706 zone.lv = destLv;
1707 }
1708 Msg.Say("returnComplete");
1709 EClass.player.uidLastTravelZone = 0;
1711 EClass.player.lastZonePos = null;
1712 EClass.player.returnInfo = null;
1713 }
1714 });
1715 break;
1716 }
1717 case EffectId.Return:
1718 case EffectId.Evac:
1719 if (!cc.IsPC)
1720 {
1721 Redirect(EffectId.Teleport, state, default(ActRef));
1722 return;
1723 }
1724 cc.PlaySound("return_cast");
1725 if (EClass.player.returnInfo == null)
1726 {
1727 if (id == EffectId.Evac)
1728 {
1729 EClass.player.returnInfo = new Player.ReturnInfo
1730 {
1731 turns = EClass.rnd(10) + 10,
1732 isEvac = true
1733 };
1734 }
1735 else
1736 {
1737 if (EClass.game.spatials.ListReturnLocations().Count == 0)
1738 {
1739 Msg.Say("returnNowhere");
1740 break;
1741 }
1742 EClass.player.returnInfo = new Player.ReturnInfo
1743 {
1744 turns = EClass.rnd(10) + 10,
1745 askDest = true
1746 };
1747 }
1748 Msg.Say("returnBegin");
1749 }
1750 else
1751 {
1752 EClass.player.returnInfo = null;
1753 Msg.Say("returnAbort");
1754 }
1755 break;
1756 case EffectId.Teleport:
1757 case EffectId.TeleportShort:
1758 case EffectId.Gate:
1759 if (!tc.HasHost)
1760 {
1761 if (!flag)
1762 {
1763 if (id != EffectId.Gate && tc.isChara && tc.Chara.IsInCombat && tc.Chara.enemy != null && (tc.IsPCParty || id == EffectId.TeleportShort))
1764 {
1765 tc.Teleport(GetTeleportPos(tc.pos, 6, tc.Chara.enemy));
1766 }
1767 else if (id == EffectId.TeleportShort)
1768 {
1769 tc.Teleport(GetTeleportPos(tc.pos));
1770 }
1771 else
1772 {
1773 tc.Teleport(GetTeleportPos(tc.pos, EClass._map.bounds.Width));
1774 }
1775 }
1776 if (id == EffectId.Gate && CC.IsPC)
1777 {
1778 foreach (Chara chara4 in EClass._map.charas)
1779 {
1780 if (!chara4.HasHost && chara4 != tc && (chara4.IsPCParty || chara4.IsPCPartyMinion))
1781 {
1782 chara4.Teleport(tc.pos.GetNearestPoint(allowBlock: false, allowChara: false) ?? tc.pos);
1783 }
1784 }
1785 }
1786 }
1787 if (tc.ExistsOnMap && tc.id == "mush_quantum" && !tc.HasElement(400) && !tc.HasCondition<ConGravity>())
1788 {
1789 if (EClass.rnd(2) == 0)
1790 {
1791 if (tc.IsGlobal || EClass._zone.IsInstance || tc.c_bossType != BossType.none)
1792 {
1793 tc.Die();
1794 }
1795 else
1796 {
1797 tc.Destroy();
1798 }
1799 break;
1800 }
1801 tc.Chara.TryDuplicate(DuplicateCondition.Quantum, null, inheritHostility: true);
1802 }
1803 if (flag)
1804 {
1805 Redirect(EffectId.Gravity, BlessedState.Normal, default(ActRef));
1806 }
1807 if (blessed)
1808 {
1809 Redirect(EffectId.Levitate, BlessedState.Normal, default(ActRef));
1810 }
1811 break;
1812 }
1813 if (TC == null)
1814 {
1815 return;
1816 }
1817 switch (id)
1818 {
1819 case EffectId.ThrowPotion:
1820 if (!CC.pos.Equals(TC.pos))
1821 {
1822 Thing t = ThingGen.Create(new string[6] { "330", "331", "334", "335", "336", "1142" }.RandomItem());
1823 ActThrow.Throw(CC, TC.pos, t, ThrowMethod.Punish, 0.7f);
1824 }
1825 break;
1826 case EffectId.StripBlessing:
1827 {
1828 List<Condition> list6 = new List<Condition>();
1829 foreach (Condition condition4 in TC.conditions)
1830 {
1831 if (GetBlessingDifficulty(condition4) > 0 && EClass.rnd(GetBlessingDifficulty(condition4)) == 0)
1832 {
1833 list6.Add(condition4);
1834 }
1835 }
1836 if (list6.Count == 0)
1837 {
1838 CC.SayNothingHappans();
1839 break;
1840 }
1841 TC.pos.PlayEffect("holyveil");
1842 TC.pos.PlaySound("holyveil");
1843 TC.Say("unpolluted", TC);
1844 list6.Shuffle();
1845 {
1846 foreach (Condition item5 in list6)
1847 {
1848 item5.Kill();
1849 if (CC.IsHostile(TC))
1850 {
1851 break;
1852 }
1853 }
1854 break;
1855 }
1856 }
1857 case EffectId.ShutterHex:
1858 {
1859 if (!CC.IsHostile(TC))
1860 {
1861 break;
1862 }
1863 int num25 = 0;
1864 foreach (Condition condition5 in TC.conditions)
1865 {
1866 if (condition5.Type == ConditionType.Debuff)
1867 {
1868 num25++;
1869 }
1870 }
1871 if (num25 == 0)
1872 {
1873 CC.SayNothingHappans();
1874 break;
1875 }
1876 TC.pos.PlayEffect("holyveil");
1877 TC.pos.PlaySound("holyveil");
1878 TC.pos.PlaySound("atk_eleSound");
1879 TC.conditions.ForeachReverse(delegate(Condition condition4)
1880 {
1881 if (condition4.Type == ConditionType.Debuff && EClass.rnd(3) == 0)
1882 {
1883 condition4.Kill();
1884 }
1885 });
1886 TC.Say("abShutterHex", TC);
1887 Point center = CC.pos.Copy();
1888 List<Chara> list10 = TC.pos.ListCharasInRadius(TC, 4, (Chara chara3) => chara3 == TC || chara3.IsHostile(CC));
1889 for (int num26 = 0; num26 < num25; num26++)
1890 {
1891 TweenUtil.Delay((float)num26 * 0.1f, delegate
1892 {
1893 center.PlaySound("shutterhex");
1894 });
1895 foreach (Chara item6 in list10)
1896 {
1897 if (item6.ExistsOnMap)
1898 {
1899 Effect effect = Effect.Get("spell_moonspear");
1900 TrailRenderer componentInChildren = effect.GetComponentInChildren<TrailRenderer>();
1901 Color startColor = (componentInChildren.endColor = EClass.Colors.elementColors["eleHoly"]);
1902 componentInChildren.startColor = startColor;
1903 Point pos = item6.pos.Copy();
1904 TweenUtil.Delay((float)num26 * 0.1f, delegate
1905 {
1906 effect.Play(center, 0f, pos);
1907 });
1908 long dmg = Dice.Create("SpShutterHex", power, CC, (actRef.refThing != null) ? null : actRef.act).Roll();
1909 item6.DamageHP(dmg, 919, power, AttackSource.None, CC, showEffect: false);
1910 }
1911 }
1912 }
1913 break;
1914 }
1915 case EffectId.Draw:
1916 {
1917 if (CC.Dist(TC) <= 1 || (CC.IsPCFactionOrMinion && TC.IsPCFactionOrMinion && TC.isRestrained))
1918 {
1919 break;
1920 }
1921 Point point = CC.GetFirstStep(TC.pos, PathManager.MoveType.Combat);
1922 if (!point.IsValid)
1923 {
1924 point = CC.pos.GetRandomPoint(1)?.GetNearestPoint(allowBlock: false, allowChara: false);
1925 }
1926 if (point == null || !CC.CanSeeLos(point))
1927 {
1928 break;
1929 }
1930 CC.Say("abDraw", CC, TC);
1931 CC.PlaySound("draw");
1932 if (TC.HasCondition<ConGravity>() || TC.HasElement(493))
1933 {
1934 CC.SayNothingHappans();
1935 break;
1936 }
1937 TC.MoveImmediate(point, !EClass.core.config.camera.smoothFollow);
1938 if (CC.id == "tentacle")
1939 {
1940 TC.AddCondition<ConEntangle>();
1941 }
1942 break;
1943 }
1944 case EffectId.CatSniff:
1945 {
1946 Chara nearbyCatToSniff = CC.GetNearbyCatToSniff();
1947 if (nearbyCatToSniff != null)
1948 {
1949 CC.Sniff(nearbyCatToSniff);
1950 }
1951 break;
1952 }
1953 case EffectId.Steal:
1954 {
1956 {
1957 break;
1958 }
1959 if (TC.Evalue(426) > 0)
1960 {
1961 TC.Say((actRef.n1 == "money") ? "abStealNegateMoney" : "abStealNegate", TC);
1962 break;
1963 }
1964 Thing thing7 = null;
1965 bool flag11 = actRef.n1 == "food";
1966 if (actRef.n1 == "money")
1967 {
1968 int currency = TC.GetCurrency();
1969 if (currency > 0)
1970 {
1971 currency = Mathf.Clamp(EClass.rnd(currency / 10), 1, 100 + EClass.rndHalf(Mathf.Min(CC.LV, 1000000) * 200));
1972 thing7 = ThingGen.Create("money").SetNum(currency);
1973 TC.ModCurrency(-currency);
1974 }
1975 }
1976 else
1977 {
1978 Func<Thing, bool> func = (Thing thing8) => true;
1979 if (flag11)
1980 {
1981 func = (Thing thing8) => thing8.IsFood;
1982 }
1983 List<Thing> list12 = TC.things.List(delegate(Thing thing8)
1984 {
1985 if (thing8.parentCard?.trait is TraitChestMerchant || thing8.trait is TraitTool || thing8.IsThrownWeapon)
1986 {
1987 return false;
1988 }
1989 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);
1990 }, onlyAccessible: true);
1991 if (list12.Count > 0)
1992 {
1993 thing7 = list12.RandomItem();
1994 if (thing7.Num > 1)
1995 {
1996 thing7 = thing7.Split(1);
1997 }
1998 }
1999 CC.AddCooldown(6640, 200);
2000 }
2001 if (thing7 == null)
2002 {
2003 CC.Say("abStealNothing", CC, TC);
2004 break;
2005 }
2006 thing7.SetInt(116, 1);
2007 TC.PlaySound(thing7.material.GetSoundDrop(thing7.sourceCard));
2008 CC.Pick(thing7, msg: false);
2009 CC.Say("abSteal", CC, TC, thing7.Name);
2010 if (actRef.n1 == "food")
2011 {
2012 if (CC.hunger.value != 0)
2013 {
2014 CC.InstantEat(thing7);
2015 }
2016 }
2017 else
2018 {
2019 CC.Say("abStealEscape", CC);
2020 CC.Teleport(GetTeleportPos(tc.pos, 30), silent: true);
2021 }
2022 break;
2023 }
2024 case EffectId.NeckHunt:
2025 CC.TryNeckHunt(TC, power);
2026 break;
2027 case EffectId.CurseEQ:
2028 {
2029 if (CC != null && CC != TC)
2030 {
2031 TC.Say("curse", CC, TC);
2032 }
2033 TC.PlaySound("curse3");
2034 TC.PlayEffect("curse");
2035 if (EClass.rnd(150 + TC.LUC * 5 + TC.Evalue(972) * 20) >= power + (flag ? 200 : 0) || TC.TryNullifyCurse())
2036 {
2037 break;
2038 }
2039 List<Thing> list4 = TC.things.List(delegate(Thing thing8)
2040 {
2041 if (!thing8.isEquipped || thing8.blessedState == BlessedState.Doomed || thing8.IsToolbelt)
2042 {
2043 return false;
2044 }
2045 return (thing8.blessedState < BlessedState.Blessed || EClass.rnd(10) == 0) ? true : false;
2046 });
2047 if (list4.Count == 0)
2048 {
2049 CC.SayNothingHappans();
2050 break;
2051 }
2052 Thing thing5 = list4.RandomItem();
2053 TC.Say("curse_hit", TC, thing5);
2054 thing5.SetBlessedState((thing5.blessedState == BlessedState.Cursed) ? BlessedState.Doomed : BlessedState.Cursed);
2055 LayerInventory.SetDirty(thing5);
2056 break;
2057 }
2058 case EffectId.UncurseEQ:
2059 case EffectId.UncurseEQGreater:
2060 {
2061 TC.Say("uncurseEQ" + (blessed ? "_bless" : (flag ? "_curse" : "")), TC);
2062 TC.PlaySound("uncurse");
2063 TC.PlayEffect("uncurse");
2064 if (flag)
2065 {
2066 Redirect(EffectId.CurseEQ, BlessedState.Normal, default(ActRef));
2067 break;
2068 }
2069 int success = 0;
2070 int fail = 0;
2071 List<Thing> list9 = new List<Thing>();
2072 TC.things.Foreach(delegate(Thing thing8)
2073 {
2074 int num29 = 0;
2075 if ((thing8.isEquipped || thing8.IsRangedWeapon || blessed) && thing8.blessedState < BlessedState.Normal)
2076 {
2077 if (thing8.blessedState == BlessedState.Cursed)
2078 {
2079 num29 = EClass.rnd(200);
2080 }
2081 if (thing8.blessedState == BlessedState.Doomed)
2082 {
2083 num29 = EClass.rnd(1000);
2084 }
2085 if (blessed)
2086 {
2087 num29 /= 2;
2088 }
2089 if (id == EffectId.UncurseEQGreater)
2090 {
2091 num29 /= 10;
2092 }
2093 if (power >= num29)
2094 {
2095 TC.Say("uncurseEQ_success", thing8);
2096 thing8.SetBlessedState(BlessedState.Normal);
2097 if (thing8.isEquipped && thing8.HasElement(656))
2098 {
2099 TC.body.Unequip(thing8);
2100 }
2101 LayerInventory.SetDirty(thing8);
2102 success++;
2103 list9.Add(thing8);
2104 }
2105 else
2106 {
2107 fail++;
2108 }
2109 }
2110 });
2111 foreach (Thing item7 in list9)
2112 {
2113 item7.GetRootCard()?.TryStack(item7);
2114 }
2115 if (success == 0 && fail == 0)
2116 {
2117 TC.SayNothingHappans();
2118 }
2119 else if (fail > 0)
2120 {
2121 TC.Say("uncurseEQ_fail");
2122 }
2123 break;
2124 }
2125 case EffectId.Buff:
2126 {
2127 string text2 = actRef.n1;
2128 string text3 = "";
2129 if (flag)
2130 {
2131 text3 = EClass.sources.stats.alias[text2].curse;
2132 if (!text3.IsEmpty())
2133 {
2134 text2 = text3;
2135 }
2136 }
2137 Condition condition = Condition.Create(text2, power, delegate(Condition con)
2138 {
2139 if (!actRef.aliasEle.IsEmpty())
2140 {
2141 con.SetElement(EClass.sources.elements.alias[actRef.aliasEle].id);
2142 }
2143 });
2144 condition.isPerfume = TC.IsPC && actRef.isPerfume;
2145 Condition condition2 = TC.AddCondition(condition, CC);
2146 if (condition2 != null && condition2.isPerfume)
2147 {
2148 condition2.value = 3;
2149 Msg.Say("perfume", TC);
2150 }
2151 if (!text3.IsEmpty())
2152 {
2153 CC.DoHostileAction(TC);
2154 }
2155 break;
2156 }
2157 case EffectId.KizuamiTrick:
2158 {
2159 EClass.game.religions.Trickery.Talk("ability");
2160 bool hex = CC.IsHostile(TC);
2161 List<SourceStat.Row> list7 = EClass.sources.stats.rows.Where((SourceStat.Row con) => con.tag.Contains("random") && con.group == (hex ? "Debuff" : "Buff")).ToList();
2162 int power2 = power;
2163 for (int num24 = 0; num24 < 4 + EClass.rnd(2); num24++)
2164 {
2165 SourceStat.Row row2 = list7.RandomItem();
2166 list7.Remove(row2);
2167 Proc(hex ? EffectId.DebuffKizuami : EffectId.Buff, CC, TC, power2, new ActRef
2168 {
2169 n1 = row2.alias
2170 });
2171 }
2173 {
2174 EClass.Wait(0.3f, TC);
2175 }
2176 break;
2177 }
2178 case EffectId.Debuff:
2179 case EffectId.DebuffKizuami:
2180 {
2181 CC.DoHostileAction(TC);
2182 bool isPowerful = TC.IsPowerful;
2183 string n = actRef.n1;
2184 if (n == "ConSuffocation")
2185 {
2186 power = power * 2 / 3;
2187 }
2188 int num17 = TC.WIL * (isPowerful ? 20 : 5);
2189 ConHolyVeil condition3 = TC.GetCondition<ConHolyVeil>();
2190 if (condition3 != null)
2191 {
2192 num17 += condition3.power * 5;
2193 }
2194 num17 /= EClass.sources.stats.alias[n].hexPower;
2195 if (id != EffectId.DebuffKizuami && EClass.rnd(power) < num17)
2196 {
2197 int num18 = 10;
2198 int num19 = (TC.IsPowerful ? 40 : 90);
2199 if (CC.IsPCFaction)
2200 {
2201 num18 += EClass.curve(CC.LER, 100, 50) / 10;
2202 }
2203 if (TC.IsPowerful)
2204 {
2205 num18 /= 2;
2206 }
2207 if (condition3 != null)
2208 {
2209 num18 /= 5;
2210 }
2211 if (num18 >= num19)
2212 {
2213 num18 = num19;
2214 }
2215 Debug.Log(num18);
2216 if (EClass.rnd(100) > num18)
2217 {
2218 TC.Say("debuff_resist", TC);
2219 CC.DoHostileAction(TC);
2220 break;
2221 }
2222 }
2223 TC.AddCondition(Condition.Create(n, power, delegate(Condition con)
2224 {
2225 con.givenByPcParty = CC.IsPCParty;
2226 (con as ConDeathSentense)?.SetChara(CC);
2227 if (!actRef.aliasEle.IsEmpty())
2228 {
2229 con.SetElement(EClass.sources.elements.alias[actRef.aliasEle].id);
2230 }
2231 (con as ConMiasma)?.SetResistPenetrationLevel(TC, CC);
2232 }), CC);
2233 if (n == "ConBane" && CC.HasElement(1416))
2234 {
2235 TC.AddCondition<ConExcommunication>(power);
2236 }
2237 CC.DoHostileAction(TC);
2239 {
2240 EClass.Wait(0.3f, TC);
2241 }
2242 break;
2243 }
2244 case EffectId.Mutation:
2245 TC.MutateRandom(1, 100, ether: false, state);
2247 {
2248 EClass.Wait(0.3f, TC);
2249 }
2250 break;
2251 case EffectId.CureMutation:
2252 TC.MutateRandom(-1, 100, ether: false, state);
2253 break;
2254 case EffectId.Ally:
2255 {
2256 Msg.Say("gainAlly");
2257 Chara chara2 = CharaGen.CreateFromFilter("chara", cc.LV);
2258 EClass._zone.AddCard(chara2, cc.pos.GetNearestPoint(allowBlock: false, allowChara: false));
2259 if (cc.IsPCFactionOrMinion)
2260 {
2261 chara2.MakeAlly(msg: false);
2262 }
2263 chara2.PlaySound("identify");
2264 chara2.PlayEffect("teleport");
2265 break;
2266 }
2267 case EffectId.Wish:
2268 if (!TC.IsPC)
2269 {
2270 break;
2271 }
2272 if (blessed || flag)
2273 {
2274 power /= 2;
2275 }
2276 Dialog.InputName("dialogWish", "q", delegate(bool cancel, string text4)
2277 {
2278 if (!cancel)
2279 {
2280 Msg.Say("wish", TC, text4);
2281 Wish(text4, EClass.pc.NameTitled, power, state);
2282 }
2283 });
2284 break;
2285 case EffectId.Faith:
2286 {
2288 tc.PlayEffect("aura_heaven");
2289 tc.PlaySound("aura_heaven");
2290 tc.Say("faith", tc, faith.Name);
2291 if (flag)
2292 {
2293 tc.Say("faith_curse", tc, faith.Name);
2294 break;
2295 }
2296 if (blessed)
2297 {
2298 tc.Say("faith_bless", tc, faith.Name);
2299 }
2300 tc.ModExp(306, power * 10);
2301 if (tc.elements.Base(85) < tc.elements.Value(306))
2302 {
2303 tc.ModExp(85, power * 10);
2304 }
2305 break;
2306 }
2307 case EffectId.TransGender:
2308 {
2309 tc.PlaySound("mutation");
2310 tc.PlayEffect("mutation");
2311 int gender = tc.bio.gender;
2312 int gender2 = gender switch
2313 {
2314 1 => 2,
2315 2 => 1,
2316 _ => (EClass.rnd(2) != 0) ? 1 : 2,
2317 };
2318 if (gender != 0 && EClass.rnd(10) == 0)
2319 {
2320 gender2 = 0;
2321 }
2322 tc.bio.SetGender(gender2);
2323 tc.Say("transGender", tc, Gender.Name(tc.bio.gender));
2324 tc.Talk("tail");
2325 int age2 = tc.bio.GetAge(tc.Chara);
2326 if (blessed && age2 > 1)
2327 {
2328 tc.Say("ageDown", tc);
2329 tc.bio.SetAge(tc.Chara, age2 - 1);
2330 }
2331 else if (flag)
2332 {
2333 tc.Say("ageUp", tc);
2334 tc.bio.SetAge(tc.Chara, age2 + 1);
2335 }
2336 break;
2337 }
2338 case EffectId.TransBlood:
2339 {
2340 tc.PlaySound("mutation");
2341 tc.PlayEffect("mutation");
2342 int num21 = ((actRef.refThing != null) ? actRef.refThing.GetInt(118) : actRef.refVal);
2343 if (num21 == 0)
2344 {
2345 num21 = tc.GetInt(118);
2346 if (num21 == 0)
2347 {
2348 num21 = EClass.game.seed + tc.uid;
2349 }
2350 num21++;
2351 }
2352 tc.Say("transBlood", tc);
2353 tc.Talk("tail");
2354 tc.c_bloodData = null;
2355 tc.SetInt(118, num21);
2356 break;
2357 }
2358 case EffectId.ResetFeat:
2359 {
2360 if (!tc.IsPC)
2361 {
2362 tc.SayNothingHappans();
2363 break;
2364 }
2365 tc.PlaySound("mutation");
2366 tc.PlayEffect("mutation");
2367 List<Element> list3 = new List<Element>();
2368 foreach (Element value in EClass.pc.elements.dict.Values)
2369 {
2370 if (value.source.category != "feat" || value.id == 1644)
2371 {
2372 continue;
2373 }
2374 switch (value.source.categorySub)
2375 {
2376 case "general":
2377 case "attribute":
2378 case "skill":
2379 case "special":
2380 if (value.vBase > 0)
2381 {
2382 list3.Add(value);
2383 }
2384 break;
2385 }
2386 }
2387 int num14 = 0;
2388 foreach (Element item8 in list3)
2389 {
2390 int dNABonus = item8.GetDNABonus(EClass.pc);
2391 if (dNABonus < item8.vBase)
2392 {
2393 for (int num15 = 0; num15 < item8.vBase - dNABonus; num15++)
2394 {
2395 num14 += item8.source.cost.TryGet(num15);
2396 }
2397 EClass.pc.SetFeat(item8.id, dNABonus);
2398 }
2399 }
2400 EClass.pc.feat += num14;
2401 EClass.pc.Refresh();
2406 tc.Say("resetFeat");
2407 break;
2408 }
2409 case EffectId.Youth:
2410 {
2411 tc.PlaySound("mutation");
2412 tc.PlayEffect("mutation");
2413 int age = tc.bio.GetAge(tc.Chara);
2414 if (!flag && age <= 0)
2415 {
2416 tc.SayNothingHappans();
2417 break;
2418 }
2419 age = Mathf.Max(0, age * 100 / (flag ? 75 : (blessed ? 400 : 200))) + (flag ? 1 : 0);
2420 tc.Say(flag ? "ageUp" : "ageDown", tc);
2421 tc.bio.SetAge(tc.Chara, age);
2422 break;
2423 }
2424 case EffectId.EternalYouth:
2425 {
2426 tc.PlaySound("mutation");
2427 tc.PlayEffect("mutation");
2428 if (tc.IsUnique)
2429 {
2430 tc.SayNothingHappans();
2431 break;
2432 }
2433 int age3 = tc.bio.GetAge(tc.Chara);
2434 if (flag)
2435 {
2436 if (tc.c_lockedAge != 0)
2437 {
2438 tc.Say("eternalYouth2", tc);
2439 tc.c_lockedAge = 0;
2440 tc.elements.Remove(1243);
2441 tc.bio.SetAge(tc.Chara, age3);
2442 }
2443 Redirect(EffectId.Youth, BlessedState.Cursed, default(ActRef));
2444 }
2445 else if (tc.c_lockedAge != 0)
2446 {
2447 tc.SayNothingHappans();
2448 }
2449 else
2450 {
2451 tc.PlaySound("dropRewardXmas");
2452 tc.Say("eternalYouth1", tc);
2453 tc.c_lockedAge = age3 + 1;
2454 tc.elements.SetBase(1243, 1);
2455 if (blessed)
2456 {
2457 Redirect(EffectId.Youth, BlessedState.Blessed, default(ActRef));
2458 }
2459 }
2460 break;
2461 }
2462 case EffectId.BuffStats:
2463 case EffectId.DebuffStats:
2464 case EffectId.LulwyTrick:
2465 Debug.Log(power + "/" + id.ToString() + "/" + actRef.n1);
2466 if (id == EffectId.LulwyTrick)
2467 {
2468 EClass.game.religions.Wind.Talk("ability");
2469 }
2470 if (flag)
2471 {
2472 if (id == EffectId.BuffStats)
2473 {
2474 id = EffectId.DebuffStats;
2475 }
2476 else if (id == EffectId.DebuffStats)
2477 {
2478 id = EffectId.BuffStats;
2479 }
2480 }
2481 if (power < 0 || id == EffectId.DebuffStats)
2482 {
2483 power = Mathf.Abs(power);
2484 if (blessed)
2485 {
2486 power /= 4;
2487 }
2488 flag = true;
2489 }
2490 TC.AddCondition(Condition.Create(power, delegate(ConBuffStats con)
2491 {
2492 con.SetRefVal(Element.GetId(actRef.n1), (int)id);
2493 }), CC);
2494 break;
2495 case EffectId.Revive:
2496 {
2497 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();
2498 if (TC.IsPCFaction || TC.IsPCFactionMinion)
2499 {
2500 if (TC.IsPC && list11.Count == 0)
2501 {
2502 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();
2503 }
2504 if (list11.Count > 0)
2505 {
2506 list11.RandomItem().Value.Chara.GetRevived();
2507 break;
2508 }
2509 }
2510 TC.SayNothingHappans();
2511 break;
2512 }
2513 case EffectId.DamageBody:
2514 case EffectId.DamageMind:
2515 case EffectId.DamageBodyGreat:
2516 case EffectId.DamageMindGreat:
2517 case EffectId.Weaken:
2518 {
2519 bool flag9 = id == EffectId.DamageBody || id == EffectId.DamageBodyGreat;
2520 bool mind = id == EffectId.DamageMind || id == EffectId.DamageMindGreat;
2521 int num22 = ((id == EffectId.DamageBody || id == EffectId.DamageMind) ? 1 : (4 + EClass.rnd(4)));
2522 if (id == EffectId.Weaken)
2523 {
2524 flag9 = EClass.rnd(2) == 0;
2525 mind = !flag9;
2526 num22 = 1;
2527 }
2528 else
2529 {
2530 TC.PlayEffect("debuff");
2531 TC.PlaySound("debuff");
2532 }
2533 TC.Say(flag9 ? "damageBody" : "damageMind", TC);
2534 for (int num23 = 0; num23 < num22; num23++)
2535 {
2536 TC.DamageTempElements(power, flag9, mind, id != EffectId.Weaken);
2537 }
2538 if (TC.IsPC)
2539 {
2540 Tutorial.Play("healer");
2541 }
2542 break;
2543 }
2544 case EffectId.EnhanceBody:
2545 case EffectId.EnhanceMind:
2546 case EffectId.EnhanceBodyGreat:
2547 case EffectId.EnhanceMindGreat:
2548 {
2549 bool flag10 = id == EffectId.EnhanceBody || id == EffectId.EnhanceBodyGreat;
2550 bool mind2 = id == EffectId.EnhanceMind || id == EffectId.EnhanceMindGreat;
2551 if (id != EffectId.EnhanceBody && id != EffectId.EnhanceMind)
2552 {
2553 EClass.rnd(4);
2554 }
2555 TC.Say(flag10 ? "enhanceBody" : "enhanceMind", TC);
2556 TC.PlayEffect("buff");
2557 TC.PlaySound("buff");
2558 TC.EnhanceTempElements(power, flag10, mind2, onlyRenew: true);
2559 break;
2560 }
2561 case EffectId.RestoreBody:
2562 case EffectId.RestoreMind:
2563 {
2564 bool flag12 = id == EffectId.RestoreBody;
2565 if (flag)
2566 {
2567 Redirect(flag12 ? EffectId.DamageBodyGreat : EffectId.DamageMindGreat, BlessedState.Normal, default(ActRef));
2568 break;
2569 }
2570 TC.Say(flag12 ? "restoreBody" : "restoreMind", TC);
2571 TC.PlaySound("heal");
2572 TC.PlayEffect("heal");
2573 TC.CureHost(flag12 ? CureType.CureBody : CureType.CureMind, power, state);
2574 if (blessed)
2575 {
2576 Redirect(flag12 ? EffectId.EnhanceBodyGreat : EffectId.EnhanceMindGreat, BlessedState.Normal, default(ActRef));
2577 }
2578 break;
2579 }
2580 case EffectId.HealComplete:
2581 TC.HealHPHost(100000000L, (actRef.refThing == null) ? HealSource.Magic : HealSource.Item);
2582 TC.CureHost(CureType.HealComplete, power, state);
2583 TC.Say("heal_heavy", TC);
2584 break;
2585 case EffectId.Heal:
2586 case EffectId.JureHeal:
2587 {
2588 long num16 = 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();
2589 if (actRef.refThing != null)
2590 {
2591 num16 = num16 * (100 + actRef.refThing.Evalue(750) * 10) / 100;
2592 }
2593 num16 = num16 * Mathf.Max(100 + CC.Evalue(413), 0) / 100;
2594 if (flag)
2595 {
2596 TC.DamageHP(num16 / 2, 919, power);
2597 break;
2598 }
2599 if (id == EffectId.JureHeal)
2600 {
2601 EClass.game.religions.Healing.Talk("ability");
2602 num16 += TC.MaxHP / 4;
2603 TC.AddCondition<ConInvulnerable>();
2604 TC.HealHP(num16, HealSource.Item);
2605 TC.Cure(CureType.Heal, power, state);
2606 }
2607 else
2608 {
2609 TC.HealHPHost(num16, (actRef.refThing == null) ? HealSource.Magic : HealSource.Item);
2610 TC.CureHost(CureType.Heal, power, state);
2611 }
2612 TC.Say((power >= 300) ? "heal_heavy" : "heal_light", TC);
2613 break;
2614 }
2615 case EffectId.RemedyJure:
2616 TC.HealHP(1000000L, HealSource.Magic);
2617 TC.CureHost(CureType.Jure, power, state);
2618 TC.Say("heal_jure", TC);
2619 break;
2620 case EffectId.Headpat:
2621 CC.PlaySound("headpat");
2622 CC.Cuddle(TC, headpat: true);
2623 break;
2624 case EffectId.RemoveHex:
2625 case EffectId.RemoveHexAll:
2626 {
2627 if (flag)
2628 {
2629 Redirect(EffectId.CurseEQ, BlessedState.Normal, default(ActRef));
2630 break;
2631 }
2632 IList<Condition> list5 = TC.conditions.Copy();
2633 list5.Shuffle();
2634 CC.PlaySound("remove_hex");
2635 CC.PlayEffect("remove_hex");
2636 foreach (Condition item9 in list5)
2637 {
2638 if (item9.Type != ConditionType.Debuff || item9.IsKilled)
2639 {
2640 continue;
2641 }
2642 if (EClass.rnd(power * (CC.IsPowerful ? 5 : 2)) > EClass.rnd(item9.power) || (id == EffectId.RemoveHex && EClass.rnd(2) == 0))
2643 {
2644 CC.Say("removeHex", TC, item9.Name.ToLower());
2645 item9.Kill();
2646 }
2647 else
2648 {
2649 if (id == EffectId.RemoveHexAll)
2650 {
2651 item9.power /= 2;
2652 }
2653 CC.Say("removeHex_fail", TC, item9.Name.ToLower());
2654 }
2655 if (id == EffectId.RemoveHex)
2656 {
2657 break;
2658 }
2659 }
2660 if (blessed)
2661 {
2662 TC.AddCondition<ConHolyVeil>(power / 2);
2663 }
2664 break;
2665 }
2666 case EffectId.CureCorruption:
2667 TC.PlaySound("heal");
2668 TC.PlayEffect("heal");
2669 if (flag)
2670 {
2671 TC.Say("cureCorruption_curse", TC);
2672 TC.mana.Mod(9999);
2673 TC.ModCorruption(power);
2674 }
2675 else
2676 {
2677 TC.Say("cureCorruption", TC);
2678 TC.ModCorruption(-power * (blessed ? 150 : 200) / 100);
2679 }
2680 break;
2681 case EffectId.Degenerate:
2682 {
2683 if (TC == null || TC.HasCondition<ConTransmuteHuman>())
2684 {
2685 CC.SayNothingHappans();
2686 break;
2687 }
2688 Chara chara = CharaGen.Create("baby");
2689 chara.c_altName = TC.c_altName ?? TC.source.GetName(TC);
2690 TC.AddCondition(Condition.Create(power, delegate(ConTransmuteHuman con)
2691 {
2692 con.chara = chara;
2693 }));
2694 break;
2695 }
2696 case EffectId.Drink:
2697 case EffectId.DrinkRamune:
2698 case EffectId.DrinkMilk:
2699 if (id == EffectId.DrinkRamune)
2700 {
2701 TC.Say("drinkRamune", TC);
2702 }
2703 if (TC.IsPC)
2704 {
2705 TC.Say("drinkGood", TC);
2706 }
2707 if (id == EffectId.DrinkMilk)
2708 {
2709 if (TC.IsPC)
2710 {
2711 TC.Say("drinkMilk", TC);
2712 }
2713 if (blessed)
2714 {
2715 TC.ModHeight(EClass.rnd(5) + 3);
2716 }
2717 else if (flag)
2718 {
2719 TC.ModHeight((EClass.rnd(5) + 3) * -1);
2720 }
2721 }
2722 break;
2723 case EffectId.DrinkWater:
2724 if (flag)
2725 {
2726 if (TC.IsPC)
2727 {
2728 TC.Say("drinkWater_dirty", TC);
2729 }
2731 }
2732 else if (TC.IsPC)
2733 {
2734 TC.Say("drinkWater_clear", TC);
2735 }
2736 break;
2737 case EffectId.DrinkWaterDirty:
2738 if (TC.IsPC)
2739 {
2740 TC.Say("drinkWater_dirty", TC);
2741 }
2742 if (TC.IsPCFaction)
2743 {
2744 TC.Vomit();
2745 }
2746 break;
2747 case EffectId.SaltWater:
2748 if (TC.HasElement(1211))
2749 {
2750 TC.Say("drinkSaltWater_snail", TC);
2751 int num20 = ((TC.hp > 10) ? (TC.hp - EClass.rnd(10)) : 10000);
2752 TC.DamageHP(num20, AttackSource.None, CC);
2753 }
2754 else if (TC.IsPC)
2755 {
2756 TC.Say("drinkSaltWater", TC);
2757 }
2758 break;
2759 case EffectId.Booze:
2760 TC.AddCondition<ConDrunk>(power);
2761 if (TC.HasElement(1215))
2762 {
2763 TC.Say("drunk_dwarf", TC);
2764 TC.AddCondition(Condition.Create(power + EClass.rnd(power), delegate(ConBuffStats con)
2765 {
2766 con.SetRefVal(Element.List_MainAttributes.RandomItem(), (int)id);
2767 }));
2768 }
2769 break;
2770 case EffectId.CatsEye:
2771 if (flag)
2772 {
2773 Redirect(EffectId.Blind, BlessedState.Normal, default(ActRef));
2774 }
2775 else
2776 {
2777 TC.AddCondition<ConNightVision>(power);
2778 }
2779 break;
2780 case EffectId.Hero:
2781 if (flag)
2782 {
2783 Redirect(EffectId.Fear, BlessedState.Normal, default(ActRef));
2784 }
2785 else
2786 {
2787 TC.AddCondition<ConHero>(power);
2788 }
2789 break;
2790 case EffectId.HolyVeil:
2791 if (flag)
2792 {
2793 Redirect(EffectId.Fear, BlessedState.Normal, default(ActRef));
2794 }
2795 else
2796 {
2797 TC.AddCondition<ConHolyVeil>(power);
2798 }
2799 break;
2800 case EffectId.Levitate:
2801 if (flag)
2802 {
2803 Redirect(EffectId.Gravity, BlessedState.Normal, default(ActRef));
2804 }
2805 else
2806 {
2807 TC.AddCondition<ConLevitate>(power);
2808 }
2809 break;
2810 case EffectId.Gravity:
2811 if (blessed)
2812 {
2813 power /= 4;
2814 }
2815 TC.AddCondition<ConGravity>(power);
2816 if (flag)
2817 {
2818 Redirect(EffectId.BuffStats, BlessedState.Cursed, new ActRef
2819 {
2820 n1 = "STR"
2821 });
2822 }
2823 break;
2824 case EffectId.Fear:
2825 if (blessed)
2826 {
2827 power /= 4;
2828 }
2829 TC.AddCondition<ConFear>(power);
2830 if (flag)
2831 {
2832 Redirect(EffectId.Confuse, BlessedState.Normal, default(ActRef));
2833 }
2834 break;
2835 case EffectId.Faint:
2836 if (blessed)
2837 {
2838 power /= 4;
2839 }
2840 TC.AddCondition<ConFaint>(power);
2841 if (flag)
2842 {
2843 Redirect(EffectId.Disease, BlessedState.Normal, default(ActRef));
2844 }
2845 break;
2846 case EffectId.Paralyze:
2847 if (blessed)
2848 {
2849 power /= 4;
2850 }
2851 TC.AddCondition<ConParalyze>(power);
2852 if (flag)
2853 {
2854 Redirect(EffectId.Blind, BlessedState.Normal, default(ActRef));
2855 }
2856 break;
2857 case EffectId.Poison:
2858 if (blessed)
2859 {
2860 power /= 4;
2861 }
2862 TC.AddCondition<ConPoison>(power);
2863 if (flag)
2864 {
2865 Redirect(EffectId.Paralyze, BlessedState.Normal, default(ActRef));
2866 }
2867 break;
2868 case EffectId.Sleep:
2869 case EffectId.BlueDrag:
2870 if (blessed)
2871 {
2872 power /= 4;
2873 }
2874 TC.AddCondition<ConSleep>(power);
2875 if (id == EffectId.BlueDrag)
2876 {
2877 TC.PlayEffect("buff");
2878 TC.PlaySound("offering");
2879 int num27 = TC.Evalue(1423);
2880 if (num27 > 0)
2881 {
2882 int num28 = 0;
2883 if (flag && num27 > 1)
2884 {
2885 num28 = -1;
2886 }
2887 else if (num27 < 15)
2888 {
2889 num28 = ((!blessed) ? 1 : 2);
2890 if (num28 + num27 > 15)
2891 {
2892 num28 = 1;
2893 }
2894 }
2895 if (num28 != 0)
2896 {
2897 TC.SetFeat(1423, num27 + num28, msg: true);
2898 TC.SetInt(134, TC.GetInt(134) + num28);
2899 }
2900 }
2901 }
2902 if (flag)
2903 {
2904 Redirect(EffectId.Disease, BlessedState.Normal, default(ActRef));
2905 }
2906 break;
2907 case EffectId.Confuse:
2908 if (blessed)
2909 {
2910 power /= 4;
2911 }
2912 TC.AddCondition<ConConfuse>(power);
2913 if (flag)
2914 {
2915 Redirect(EffectId.Fear, BlessedState.Normal, default(ActRef));
2916 }
2917 break;
2918 case EffectId.Blind:
2919 if (blessed)
2920 {
2921 power /= 4;
2922 }
2923 TC.AddCondition<ConBlind>(power);
2924 if (flag)
2925 {
2926 Redirect(EffectId.Confuse, BlessedState.Normal, default(ActRef));
2927 }
2928 break;
2929 case EffectId.Disease:
2930 if (blessed)
2931 {
2932 power /= 4;
2933 }
2934 TC.AddCondition<ConDisease>(power);
2935 if (flag)
2936 {
2937 Redirect(EffectId.Poison, BlessedState.Normal, default(ActRef));
2938 }
2939 break;
2940 case EffectId.Acid:
2941 {
2942 if (blessed)
2943 {
2944 power /= 4;
2945 }
2946 List<Thing> list8 = TC.things.List((Thing thing8) => (thing8.Num <= 1 && thing8.IsEquipmentOrRanged && !thing8.IsToolbelt && !thing8.IsLightsource && thing8.isEquipped) ? true : false);
2947 if (list8.Count != 0)
2948 {
2949 Thing thing6 = list8.RandomItem();
2950 TC.Say("acid_hit", TC);
2951 if (thing6.isAcidproof)
2952 {
2953 TC.Say("acid_nullify", thing6);
2954 }
2955 else if (thing6.encLV > -5)
2956 {
2957 TC.Say("acid_rust", TC, thing6);
2958 thing6.ModEncLv(-1);
2959 LayerInventory.SetDirty(thing6);
2960 }
2961 if (TC.IsPCParty)
2962 {
2963 Tutorial.Reserve("rust");
2964 }
2965 }
2966 break;
2967 }
2968 case EffectId.PuddleEffect:
2969 TC.DamageHP(power / 5, actRef.idEle, power);
2970 break;
2971 case EffectId.Acidproof:
2972 if (blessed)
2973 {
2974 power /= 4;
2975 }
2976 if (TC.IsPC)
2977 {
2978 TC.Say("pc_pain");
2979 }
2980 TC.Say("drink_acid", TC);
2981 TC.DamageHP(power / 5, 923, power);
2982 break;
2983 case EffectId.LevelDown:
2984 Msg.Say("nothingHappens");
2985 break;
2986 case EffectId.Love:
2987 case EffectId.LovePlus:
2988 if (flag)
2989 {
2990 if (CC == TC)
2991 {
2992 TC.Say("love_curse_self", TC);
2993 }
2994 else
2995 {
2996 TC.Say("love_curse", CC, TC);
2997 TC.ModAffinity(CC, -power / 4, show: false);
2998 }
2999 TC.ShowEmo(Emo.angry);
3000 }
3001 else
3002 {
3003 LoveMiracle(TC, CC, power, id, state);
3004 }
3005 break;
3006 case EffectId.HairGrowth:
3007 if (flag)
3008 {
3009 if (TC.HasElement(1532))
3010 {
3011 TC.SetMutation(1532);
3012 }
3013 else
3014 {
3015 TC.SetMutation(1533, 1);
3016 }
3017 TC.c_fur = 0;
3018 break;
3019 }
3020 if (blessed)
3021 {
3022 if (TC.HasElement(1533))
3023 {
3024 TC.SetMutation(1533);
3025 }
3026 else
3027 {
3028 TC.SetMutation(1532, 1);
3029 }
3030 }
3031 TC.PlayEffect("aura_heaven");
3032 TC.PlaySound("godbless");
3033 if (!TC.HaveFur())
3034 {
3035 TC.Say("grow_hair_fail", TC);
3036 break;
3037 }
3038 TC.Say("grow_hair", TC);
3039 TC.c_fur = 100;
3040 break;
3041 case EffectId.Gene:
3042 GeneMiracle(TC, CC, blessed ? DNA.Type.Superior : (flag ? DNA.Type.Brain : DNA.Type.Default));
3043 break;
3044 }
3045 int GetBlessingDifficulty(Condition condition4)
3046 {
3047 if (condition4.Type != ConditionType.Buff)
3048 {
3049 return 0;
3050 }
3051 if (condition4 is ConTransmuteBat && TC.HasCooldown(8793))
3052 {
3053 return 0;
3054 }
3055 if (!CC.IsHostile(TC))
3056 {
3057 return 1;
3058 }
3059 if (condition4 is ConBoost)
3060 {
3061 return 5;
3062 }
3063 if (condition4 is ConRebirth)
3064 {
3065 return 10;
3066 }
3067 if (condition4 is ConInvulnerable)
3068 {
3069 return 100;
3070 }
3071 return 2;
3072 }
3073 void Redirect(EffectId _id, BlessedState _state, ActRef _ref1)
3074 {
3075 Proc(_id, orgPower, _state, cc, tc, _ref1);
3076 }
3077 }
3078
3079 public static void Poison(Chara tc, Chara c, int power)
3080 {
3081 tc.Say("eat_poison", tc);
3082 tc.Talk("scream");
3083 if (power > 100000000)
3084 {
3085 power = 100000000;
3086 }
3087 int num = (int)Mathf.Sqrt(power * 100);
3088 tc.DamageHP(num * 2 + EClass.rnd(num), 915, power);
3089 if (!tc.isDead && !tc.IsPC)
3090 {
3092 }
3093 }
3094
3095 public static void LoveMiracle(Chara tc, Chara c, int power, EffectId idEffect = EffectId.Love, BlessedState? state = null)
3096 {
3097 if (c == tc)
3098 {
3099 tc.Say("love_ground", tc);
3100 }
3101 else
3102 {
3103 tc.Say("love_chara", c, tc);
3104 }
3105 tc.ModAffinity(EClass.pc, power / 4);
3106 if ((idEffect != EffectId.Love || EClass.rnd(2) != 0) && (!EClass._zone.IsUserZone || tc.IsPCFaction || !EClass.game.principal.disableUsermapBenefit))
3107 {
3108 if (idEffect == EffectId.MoonSpear && EClass.rnd(EClass.debug.enable ? 2 : 20) == 0)
3109 {
3110 Thing thing = tc.MakeGene();
3111 tc.GiveBirth(thing, effect: true);
3112 tc.Say("item_drop", thing);
3113 }
3114 else if (idEffect != EffectId.LovePlus && EClass.rnd(2) == 0)
3115 {
3116 Thing c2 = tc.MakeMilk(effect: true, 1, addToZone: true, state);
3117 tc.Say("item_drop", c2);
3118 }
3119 else
3120 {
3121 Thing c3 = tc.MakeEgg(effect: true, 1, addToZone: true, (idEffect == EffectId.LovePlus) ? 3 : 20, state);
3122 tc.Say("item_drop", c3);
3123 }
3124 }
3125 }
3126
3127 public static void GeneMiracle(Chara tc, Chara c, DNA.Type type)
3128 {
3130 {
3132 return;
3133 }
3134 if (c == tc)
3135 {
3136 tc.Say("love_ground", tc);
3137 }
3138 else
3139 {
3140 tc.Say("love_chara", c, tc);
3141 }
3142 Thing t = tc.MakeGene(type);
3143 tc.GiveBirth(t, effect: true);
3144 }
3145
3146 public static Point GetTeleportPos(Point org, int radius = 6, Chara target = null)
3147 {
3148 Point point = new Point();
3149 for (int i = 0; i < 10000; i++)
3150 {
3151 point.Set(org);
3152 point.x += EClass.rnd(radius) - EClass.rnd(radius);
3153 point.z += EClass.rnd(radius) - EClass.rnd(radius);
3154 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)))
3155 {
3156 return point;
3157 }
3158 }
3159 return org.GetRandomNeighbor().GetNearestPoint();
3160 }
3161
3162 public static Point GetShortTeleportPos(Point org, Point targetPos, int destDist, int maxOffset = 6)
3163 {
3164 for (int i = 0; i <= maxOffset; i++)
3165 {
3166 int destDist2 = destDist + i;
3167 List<Point> list = EClass._map.ListPointsOnEdge(targetPos, destDist2);
3168 list.RemoveAll((Point p) => !ValidPos(p));
3169 if (list.Count > 0)
3170 {
3171 return list.RandomItem();
3172 }
3173 if (i == 0)
3174 {
3175 continue;
3176 }
3177 destDist2 = destDist - i;
3178 if (destDist2 >= 1)
3179 {
3180 list = EClass._map.ListPointsOnEdge(targetPos, destDist2);
3181 list.RemoveAll((Point p) => !ValidPos(p));
3182 if (list.Count > 0)
3183 {
3184 return list.RandomItem();
3185 }
3186 }
3187 }
3188 return GetTeleportPos(org);
3189 static bool ValidPos(Point p)
3190 {
3191 if (!p.IsValid || !p.IsInBounds || p.cell.blocked || p.cell.HasZoneStairs())
3192 {
3193 return false;
3194 }
3195 return true;
3196 }
3197 }
3198
3199 public static bool Wish(string s, string name, int power, BlessedState state)
3200 {
3202 string netMsg = GameLang.Parse("wish".langGame(), thirdPerson: true, name, s);
3203 List<WishItem> list = new List<WishItem>();
3204 long wishLv = 10 + power / 4;
3205 int wishValue = MathEx.ClampToInt(5000 + (long)power * 50L);
3206 if (state >= BlessedState.Blessed)
3207 {
3208 wishLv = wishLv * 150 / 100;
3209 }
3210 else if (state <= BlessedState.Cursed)
3211 {
3212 wishLv = wishLv * 150 / 100;
3213 wishValue = 1;
3214 }
3215 Debug.Log(power + "/" + wishValue);
3216 string _s = s.ToLower();
3217 foreach (CardRow r in EClass.sources.cards.rows)
3218 {
3219 if (r.HasTag(CTAG.godArtifact))
3220 {
3221 bool flag = false;
3222 foreach (Religion item in EClass.game.religions.list)
3223 {
3224 if (item.giftRank >= 2 && item.IsValidArtifact(r.id))
3225 {
3226 flag = true;
3227 }
3228 }
3229 if (!flag)
3230 {
3231 continue;
3232 }
3233 }
3234 else if (r.quality >= 4 || r.HasTag(CTAG.noWish))
3235 {
3236 switch (r.id)
3237 {
3238 case "medal":
3239 case "plat":
3240 case "money":
3241 case "money2":
3242 break;
3243 default:
3244 continue;
3245 }
3246 }
3247 if (r.isChara)
3248 {
3249 continue;
3250 }
3251 string text = r.GetName().ToLower();
3252 int score = Compare(_s, text);
3253 if (score == 0)
3254 {
3255 continue;
3256 }
3257 list.Add(new WishItem
3258 {
3259 score = score,
3260 n = text,
3261 action = delegate
3262 {
3263 Debug.Log(r.id);
3264 SourceCategory.Row category = EClass.sources.cards.map[r.id].Category;
3265 if (category.IsChildOf("weapon") || category.IsChildOf("armor") || category.IsChildOf("ranged"))
3266 {
3267 CardBlueprint.SetRarity(Rarity.Legendary);
3268 }
3269 Thing thing = ThingGen.Create(r.id, -1, MathEx.ClampToInt(wishLv));
3270 int num = 1;
3271 int price = thing.GetPrice(CurrencyType.Money, sell: false, PriceType.Tourism);
3272 bool flag2 = thing.trait is TraitDeed || thing.rarity >= Rarity.Artifact || thing.source._origin == "artifact_summon";
3273 switch (thing.id)
3274 {
3275 case "rod_wish":
3276 thing.c_charges = 0;
3277 break;
3278 case "money":
3279 num = EClass.rndHalf(wishValue * 3);
3280 break;
3281 case "plat":
3282 num = EClass.rndHalf(wishValue / 500 + 4);
3283 break;
3284 case "money2":
3285 num = EClass.rndHalf(wishValue / 500 + 4);
3286 break;
3287 case "medal":
3288 num = EClass.rndHalf(wishValue / 2000 + 4);
3289 break;
3290 default:
3291 if (!flag2 && thing.trait.CanStack)
3292 {
3293 int num2 = wishValue;
3294 num2 -= price;
3295 for (int i = 1; i < 1000; i++)
3296 {
3297 int num3 = price + i * 2 * (price + 500);
3298 if (num3 > 0 && num2 > num3)
3299 {
3300 num++;
3301 num2 -= num3;
3302 }
3303 }
3304 }
3305 break;
3306 }
3307 if (price > 2500 && num > 3)
3308 {
3309 num = 3 + (int)Mathf.Sqrt(num - 3);
3310 }
3311 if (price > 5000 && num > 2)
3312 {
3313 num = 2 + (int)Mathf.Sqrt(num - 2) / 2;
3314 }
3315 if (price > 10000 && num > 1)
3316 {
3317 num = 1 + Mathf.Min((int)Mathf.Sqrt(num - 1) / 3, 2);
3318 }
3319 if (num < 1)
3320 {
3321 num = 1;
3322 }
3323 thing.SetNum(num);
3324 Debug.Log(_s + "/" + num + "/" + score);
3325 if (thing.HasTag(CTAG.godArtifact))
3326 {
3327 EClass.game.religions.Reforge(thing.id);
3328 }
3329 else
3330 {
3331 EClass._zone.AddCard(thing, EClass.pc.pos);
3332 }
3333 netMsg = netMsg + Lang.space + GameLang.Parse("wishNet".langGame(), Msg.IsThirdPerson(thing), Msg.GetName(thing).ToTitleCase());
3334 Net.SendChat(name, netMsg, ChatCategory.Wish, Lang.langCode);
3335 Msg.Say("dropReward");
3336 }
3337 });
3338 }
3339 if (list.Count == 0)
3340 {
3341 netMsg = netMsg + Lang.space + "wishFail".langGame();
3342 Net.SendChat(name, netMsg, ChatCategory.Wish, Lang.langCode);
3343 Msg.Say("wishFail");
3344 return false;
3345 }
3346 list.Sort((WishItem a, WishItem b) => b.score - a.score);
3347 foreach (WishItem item2 in list)
3348 {
3349 Debug.Log(item2.score + "/" + s + "/" + item2.n);
3350 }
3351 list[0].action();
3352 return true;
3353 }
3354
3355 public static int Compare(string s, string t)
3356 {
3357 if (s.IsEmpty())
3358 {
3359 return 0;
3360 }
3361 int num = 0;
3362 if (t == s)
3363 {
3364 num += 100 + EClass.rnd(30);
3365 }
3366 if (t.Contains(s))
3367 {
3368 num += 100 + EClass.rnd(30);
3369 }
3370 return num;
3371 }
3372}
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:3079
static void LoveMiracle(Chara tc, Chara c, int power, EffectId idEffect=EffectId.Love, BlessedState? state=null)
Definition: ActEffect.cs:3095
static void Proc(EffectId id, int power, BlessedState state, Card cc, Card tc=null, ActRef actRef=default(ActRef))
Definition: ActEffect.cs:1132
static void GeneMiracle(Chara tc, Chara c, DNA.Type type)
Definition: ActEffect.cs:3127
static int angle
Definition: ActEffect.cs:21
static int Compare(string s, string t)
Definition: ActEffect.cs:3355
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:3162
static void Proc(EffectId id, Card cc, Card tc=null, int power=100, ActRef actRef=default(ActRef))
Definition: ActEffect.cs:1127
static bool Wish(string s, string name, int power, BlessedState state)
Definition: ActEffect.cs:3199
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:3146
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:6651
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:7211
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:8290
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:6685
bool IsEquipmentOrRanged
Definition: Card.cs:2272
void TryStack(Thing t)
Definition: Card.cs:7489
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:7324
void Destroy()
Definition: Card.cs:5314
bool HaveFur()
Definition: Card.cs:8456
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
bool GetBool(string id)
Definition: Card.cs:2557
int Dist(Card c)
Definition: Card.cs:8246
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
void SetBool(string id, bool enable)
Definition: Card.cs:2562
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:7329
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:1830
override bool IsAliveInCurrentZone
Definition: Chara.cs:569
Element MainElement
Definition: Chara.cs:737
new TraitChara trait
Definition: Chara.cs:511
CharaBody body
Definition: Chara.cs:96
bool IsLevitating
Definition: Chara.cs:605
bool TryNeckHunt(Chara TC, int power, bool harvest=false)
Definition: Chara.cs:10335
void Cuddle(Chara c, bool headpat=false)
Definition: Chara.cs:6665
void InstantEat(Thing t=null, bool sound=true)
Definition: Chara.cs:8101
Condition AddCondition(string id, int p=100, bool force=false)
Definition: Chara.cs:9912
Faction faction
Definition: Chara.cs:433
void ModAffinity(Chara c, int a, bool show=true, bool showOnlyEmo=false)
Definition: Chara.cs:8482
override bool IsPC
Definition: Chara.cs:632
Chara host
Definition: Chara.cs:35
Point GetFirstStep(Point newPoint, PathManager.MoveType moveType=PathManager.MoveType.Default)
Definition: Chara.cs:2863
Chara GetNearbyCatToSniff()
Definition: Chara.cs:8671
void SetFeat(int id, int value=1, bool msg=false)
Definition: Chara.cs:10601
bool CanSeeLos(Card c, int dist=-1)
Definition: Chara.cs:1334
override bool IsPCParty
Definition: Chara.cs:635
Chara TryDuplicate(DuplicateCondition con=DuplicateCondition.Default, Point dest=null, bool inheritHostility=false)
Definition: Chara.cs:1988
bool RequestProtection(Chara attacker, Action< Chara > action)
Definition: Chara.cs:8993
bool IsInCombat
Definition: Chara.cs:920
bool HasCondition(string alias)
Definition: Chara.cs:10094
void SetMainElement(string id, int v=0, bool elemental=false)
Definition: Chara.cs:2326
Stats hunger
Definition: Chara.cs:1226
bool HasMinion(string id)
Definition: Chara.cs:2655
override bool HasHost
Definition: Chara.cs:708
override bool IsPCFaction
Definition: Chara.cs:691
override bool IsPCPartyMinion
Definition: Chara.cs:659
int MaxSummon
Definition: Chara.cs:734
void MakeMinion(Chara _master, MinionType type=MinionType.Default)
Definition: Chara.cs:2611
Chara Duplicate()
Definition: Chara.cs:2010
void MakeAlly(bool msg=true)
Definition: Chara.cs:2548
void SetSummon(int duration, bool dropCorpse=false)
Definition: Chara.cs:2667
Stats mana
Definition: Chara.cs:1238
void TryDropBossLoot()
Definition: Chara.cs:6031
string NameTitled
Definition: Chara.cs:524
Chara parasite
Definition: Chara.cs:32
Chara ride
Definition: Chara.cs:29
void RefreshFaithElement()
Definition: Chara.cs:10918
void AddCooldown(int idEle, int turns=0)
Definition: Chara.cs:9308
Thing MakeGene(DNA.Type? type=null)
Definition: Chara.cs:8755
Religion faith
Definition: Chara.cs:445
Chara enemy
Definition: Chara.cs:88
void DoHostileAction(Card _tg, bool immediate=false)
Definition: Chara.cs:6797
bool TryEquip(Thing t, bool useFav=false)
Definition: Chara.cs:8263
bool IsHostile()
Definition: Chara.cs:6982
bool isDead
Definition: Chara.cs:395
Chara SetHostility(Hostility h)
Definition: Chara.cs:1530
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4636
void Sniff(Chara c)
Definition: Chara.cs:8683
bool TryFuse(float chance=1f)
Definition: Chara.cs:1864
void MoveZone(string alias)
Definition: Chara.cs:3607
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:2775
List< Point > ListPointsInArc(Point center, Point to, int radius, float angle)
Definition: Map.cs:2496
void Reveal(Point center, int power=100)
Definition: Map.cs:1031
void MineObj(Point point, Task task=null, Chara c=null)
Definition: Map.cs:2001
void MineBlock(Point point, bool recoverBlock=false, Chara c=null, bool mineObj=true)
Definition: Map.cs:1829
void TryShatter(Point pos, int ele, int power, Card CC=null)
Definition: Map.cs:1337
void SetEffect(int x, int z, CellEffect effect=null)
Definition: Map.cs:1669
List< Point > ListPointsOnEdge(Point center, int destDist, bool mustBeWalkable=true, bool los=true)
Definition: Map.cs:2465
List< Point > ListPointsInLine(Point center, Point to, int radius, bool returnOnBlocked=true)
Definition: Map.cs:2513
List< Point > ListPointsInCircle(Point center, float radius, bool mustBeWalkable=true, bool los=true)
Definition: Map.cs:2439
List< Chara > charas
Definition: Map.cs:84
void RevealAll(bool reveal=true)
Definition: Map.cs:1018
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:2645
Stats stats
Definition: Player.cs:1095
int CountKeyItem(string alias)
Definition: Player.cs:2275
ReturnInfo returnInfo
Definition: Player.cs:942
Definition: Point.cs:9
Thing Installed
Definition: Point.cs:323
SourceMaterial.Row matBlock
Definition: Point.cs:51
List< Card > ListCards(bool includeMasked=false)
Definition: Point.cs:1053
Point Copy()
Definition: Point.cs:487
override string ToString()
Definition: Point.cs:520
Point Set(int _x, int _z)
Definition: Point.cs:499
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:620
void ModFire(int value, bool extinguish=false)
Definition: Point.cs:935
int z
Definition: Point.cs:39
bool IsSync
Definition: Point.cs:340
List< Chara > Charas
Definition: Point.cs:336
SoundSource PlaySound(string id, bool synced=true, float v=1f, bool spatial=true)
Definition: Point.cs:1255
ref Vector3 PositionCenter()
Definition: Point.cs:588
bool Equals(int _x, int _z)
Definition: Point.cs:962
bool IsSunLit
Definition: Point.cs:178
bool IsValid
Definition: Point.cs:84
Effect PlayEffect(string id)
Definition: Point.cs:1250
bool HasObj
Definition: Point.cs:133
int Distance(Point p)
Definition: Point.cs:991
Chara FirstChara
Definition: Point.cs:284
bool HasBlock
Definition: Point.cs:137
bool IsInBounds
Definition: Point.cs:100
Cell cell
Definition: Point.cs:47
Point GetRandomNeighbor()
Definition: Point.cs:760
void Animate(AnimeID id, bool animeBlock=false)
Definition: Point.cs:1304
Point GetRandomPoint(int radius, bool requireLos=true, bool allowChara=true, bool allowBlocked=false, int tries=100)
Definition: Point.cs:770
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:139
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:833
override CardRow sourceCard
Definition: Thing.cs:47
Thing Identify(bool show=true, IDTSource idtSource=IDTSource.Identify)
Definition: Thing.cs:2166
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:4038
FactionBranch branch
Definition: Zone.cs:34
bool HasField(int idEle)
Definition: Zone.cs:3178
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:3919
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:2160
Definition: ActRef.cs:2
Act act
Definition: ActRef.cs:3
Thing refThing
Definition: ActRef.cs:9