Elin Modding Docs Doc
Loading...
Searching...
No Matches
AI_Shear.cs
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4
5// Token: 0x02000202 RID: 514
6public class AI_Shear : AI_TargetCard
7{
8 // Token: 0x06000EAB RID: 3755 RVA: 0x0006D9CC File Offset: 0x0006BBCC
9 public override string GetText(string str = "")
10 {
11 string[] list = Lang.GetList("fur");
12 string str2 = list[Mathf.Clamp(this.target.c_fur / 10, 0, list.Length - 1)];
13 return "AI_Shear".lang() + "(" + str2 + ")";
14 }
15
16 // Token: 0x06000EAC RID: 3756 RVA: 0x0006DA1A File Offset: 0x0006BC1A
17 public override bool IsValidTC(Card c)
18 {
19 return c != null && c.CanBeSheared();
20 }
21
22 // Token: 0x06000EAD RID: 3757 RVA: 0x0006DA27 File Offset: 0x0006BC27
23 public override bool Perform()
24 {
25 this.target = Act.TC;
26 return base.Perform();
27 }
28
29 // Token: 0x06000EAE RID: 3758 RVA: 0x0006DA3A File Offset: 0x0006BC3A
30 public override IEnumerable<AIAct.Status> Run()
31 {
32 yield return base.DoGoto(this.target, null);
33 int furLv = Mathf.Clamp(this.target.c_fur / 10 + 1, 1, 5);
35 {
36 canProgress = (() => this.IsValidTC(this.target)),
37 onProgressBegin = delegate()
38 {
39 this.owner.Say("shear_start", this.owner, this.target, null, null);
40 if (EClass.rnd(5) == 0)
41 {
42 this.owner.Talk("goodBoy", null, null, false);
43 }
44 },
45 onProgress = delegate(Progress_Custom p)
46 {
47 this.owner.LookAt(this.target);
48 this.owner.PlaySound("shear", 1f, true);
49 this.target.renderer.PlayAnime(AnimeID.Shiver, default(Vector3), false);
50 if (this.owner.Dist(this.target) > 1)
51 {
52 EClass.pc.TryMoveTowards(this.target.pos);
53 if (this.owner == null)
54 {
55 p.Cancel();
56 return;
57 }
58 if (this.owner.Dist(this.target) > 1)
59 {
60 EClass.pc.Say("targetTooFar", null, null);
61 p.Cancel();
62 return;
63 }
64 }
65 },
66 onProgressComplete = delegate()
67 {
68 string id = "fiber";
69 string idMat = "wool";
70 string id2 = this.target.id;
71 if (!(id2 == "putty_snow"))
72 {
73 if (!(id2 == "putty_snow_gold"))
74 {
75 if (!this.target.Chara.race.fur.IsEmpty())
76 {
77 string[] array = this.target.Chara.race.fur.Split('/', StringSplitOptions.None);
78 id = array[0];
79 idMat = array[1];
80 }
81 }
82 else
83 {
84 idMat = "gold";
85 }
86 }
87 else
88 {
89 idMat = "cashmere";
90 }
91 Thing thing = ThingGen.Create(id, idMat);
92 int num = 100 * furLv + furLv * furLv * 10;
93 int num2 = this.target.LV;
94 if (this.target.Chara.IsInCombat || this.target.Chara.IsMinion)
95 {
96 this.owner.Say("shear_penalty", null, null);
97 num /= 2;
98 num2 /= 2;
99 }
100 int num3 = 20 + thing.material.tier * 20;
101 thing.SetNum(Mathf.Max(num / num3, 1) + EClass.rnd(furLv + 1));
102 thing.SetEncLv(EClass.curve(num2, 30, 10, 75) / 10);
103 thing.elements.ModBase(2, EClass.curve(num2 / 10 * 10, 30, 10, 75));
104 this.target.c_fur = -5;
105 this.owner.Say("shear_end", this.owner, this.target, thing.Name, null);
106 this.owner.Pick(thing, false, true);
107 this.owner.elements.ModExp(237, 50, false);
108 EClass.pc.stamina.Mod(-1);
109 this.target.Chara.ModAffinity(this.owner, 1, true);
110 }
111 }.SetDuration((6 + furLv * 6) * 100 / (100 + this.owner.Tool.material.hardness * 2), 3);
112 yield return base.Do(seq, null);
113 yield break;
114 }
115}
Definition AIAct.cs:7
Definition Act.2.cs:7
Definition Card.cs:13
Definition Thing.cs:10