Elin Modding Docs Doc
Loading...
Searching...
No Matches
AI_Read.cs
1using System;
2using System.Collections.Generic;
3
4// Token: 0x020001F6 RID: 502
5public class AI_Read : AIAct
6{
7 // Token: 0x170003AE RID: 942
8 // (get) Token: 0x06000E64 RID: 3684 RVA: 0x0006CFE1 File Offset: 0x0006B1E1
9 public override bool LocalAct
10 {
11 get
12 {
13 return this.target == null || (!(this.target.trait is TraitStoryBook) && !(this.target.trait is TraitDeedRelocate));
14 }
15 }
16
17 // Token: 0x170003AF RID: 943
18 // (get) Token: 0x06000E65 RID: 3685 RVA: 0x0006D017 File Offset: 0x0006B217
19 public override bool IsHostileAct
20 {
21 get
22 {
23 return this.target != null && this.target.isNPCProperty;
24 }
25 }
26
27 // Token: 0x06000E66 RID: 3686 RVA: 0x0006D030 File Offset: 0x0006B230
28 public override void OnSetOwner()
29 {
30 if (this.target != null && this.target.trait.GetActDuration(this.owner) == 0 && this.target != null && (this.target.GetRootCard() == this.owner || this.target.parent == null))
31 {
32 this.owner.Say("read", this.owner, this.target.Duplicate(1), null, null);
33 Chara owner = this.owner;
34 this.target.trait.OnRead(this.owner);
35 Thing thing = this.target.Thing;
36 if (thing != null)
37 {
38 thing.Identify(owner.IsPCParty, IDTSource.Identify);
39 }
40 base.Success(null);
41 }
42 }
43
44 // Token: 0x06000E67 RID: 3687 RVA: 0x0006D0F5 File Offset: 0x0006B2F5
45 public override IEnumerable<AIAct.Status> Run()
46 {
47 if (this.target != null && (this.target.GetRootCard() == this.owner || this.target.parent == null))
48 {
49 this.owner.HoldCard(this.target, 1);
50 }
51 else if (this.target != null)
52 {
53 yield return base.DoGrab(this.target, 1, false, null);
54 }
55 else
56 {
57 yield return base.DoGrab<TraitDrink>();
58 }
59 this.target = this.owner.held;
60 if (this.target == null)
61 {
62 yield return this.Cancel();
63 }
64 if (this.target.trait.GetActDuration(this.owner) == 0)
65 {
66 this.owner.Say("read", this.owner, this.target.Duplicate(1), null, null);
67 this.target.trait.OnRead(this.owner);
68 yield return base.Success(null);
69 }
71 {
72 maxProgress = this.target.trait.GetActDuration(this.owner),
73 interval = 2,
74 canProgress = (() => this.owner.held == this.target),
75 onProgressBegin = delegate()
76 {
77 this.owner.Say("read_start", this.owner, this.target.GetName(NameStyle.Full, 1), null);
78 this.owner.PlaySound("read_book", 1f, true);
79 },
80 onProgress = delegate(Progress_Custom p)
81 {
82 if (!this.target.trait.TryProgress(p))
83 {
84 p.Cancel();
85 return;
86 }
87 },
88 onProgressComplete = delegate()
89 {
90 this.owner.PlaySound("read_book_end", 1f, true);
91 this.owner.Say("read_end", this.owner, this.target.GetName(NameStyle.Full, 1), null);
92 this.target.trait.OnRead(this.owner);
93 }
94 };
95 yield return base.Do(seq, null);
96 yield break;
97 }
98
99 // Token: 0x04000D4B RID: 3403
100 public Card target;
101}
Definition AIAct.cs:7
Definition Card.cs:13
Definition Chara.cs:12
Definition Thing.cs:10