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