Elin Decompiled Documentation EA 23.258 Nightly
Loading...
Searching...
No Matches
ConTransmuteMimic.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using Newtonsoft.Json;
3
5{
6 [JsonProperty]
7 public Thing thing;
8
9 public override bool HasDuration => false;
10
12 {
13 if (thing.trait is TraitFigure traitFigure)
14 {
15 return RendererReplacer.CreateFrom(traitFigure.source.id);
16 }
18 }
19
20 public override void Tick()
21 {
22 }
23
24 public override void OnBeforeStart()
25 {
26 List<Thing> list = owner.things.List((Thing t) => !t.IsMultisize && !t.isEquipped, onlyAccessible: true);
27 if (list.Count > 0)
28 {
29 thing = list.RandomItem().Duplicate(1);
30 }
31 else if (EClass.rnd(3) == 0)
32 {
33 thing = ThingGen.Create("chest3", -1, EClass._zone.ContentLv);
35 }
36 else
37 {
39 }
40 base.OnBeforeStart();
41 }
42
43 public override void SetOwner(Chara _owner, bool onDeserialize = false)
44 {
45 base.SetOwner(_owner);
46 owner.mimicry = this;
47 }
48
49 public override void OnRemoved()
50 {
51 owner.mimicry = null;
52 base.OnRemoved();
53 }
54
55 public virtual void TrySetAct(ActPlan p)
56 {
58 {
59 p.TrySetAct("actContainer", delegate
60 {
61 RevealMimicry(EClass.pc, surprise: true);
62 return true;
64 }
65 }
66
67 public virtual void RevealMimicry(Chara c, bool surprise)
68 {
69 if (owner.IsHostile(c))
70 {
71 owner.DoHostileAction(c, immediate: true);
72 }
73 if (surprise)
74 {
76 }
77 Kill();
78 }
79}
bool TrySetAct(string lang, Func< bool > onPerform, Card tc, CursorInfo cursor=null, int dist=1, bool isHostileAct=false, bool localAct=true, bool canRepeat=false)
Definition: ActPlan.cs:366
virtual bool IsMultisize
Definition: Card.cs:2161
string id
Definition: Card.cs:36
SourceMaterial.Row material
Definition: Card.cs:2052
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:3060
Thing SetNum(int a)
Definition: Card.cs:3520
Trait trait
Definition: Card.cs:54
ThingContainer things
Definition: Card.cs:39
Thing Duplicate(int num)
Definition: Card.cs:3469
bool IsContainer
Definition: Card.cs:2090
Definition: Chara.cs:10
Condition AddCondition(string id, int p=100, bool force=false)
Definition: Chara.cs:9315
void DoHostileAction(Card _tg, bool immediate=false)
Definition: Chara.cs:6398
bool IsHostile()
Definition: Chara.cs:6579
override void OnBeforeStart()
override void SetOwner(Chara _owner, bool onDeserialize=false)
override void OnRemoved()
override RendererReplacer GetRendererReplacer()
override void Tick()
override bool HasDuration
virtual void TrySetAct(ActPlan p)
virtual void RevealMimicry(Chara c, bool surprise)
void Kill(bool silent=false)
Definition: Condition.cs:91
static CursorInfo Container
Definition: CursorSystem.cs:82
Definition: EClass.cs:6
static Zone _zone
Definition: EClass.cs:21
static int rnd(long a)
Definition: EClass.cs:59
static Chara pc
Definition: EClass.cs:15
static RendererReplacer CreateFrom(string id, int shift=0, int mat=-1)
List< Thing > List(Func< Thing, bool > func, bool onlyAccessible=false)
static Thing CreateFromFilter(string id, int lv=-1)
Definition: ThingGen.cs:63
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Definition: Thing.cs:8
bool isEquipped
Definition: Thing.cs:17
override int ContentLv
Definition: Zone.cs:98
BiomeProfile biome
Definition: Zone.cs:129