Elin Decompiled Documentation EA 23.200 Stable
Loading...
Searching...
No Matches
TaskDig.cs
Go to the documentation of this file.
1public class TaskDig : BaseTaskHarvest
2{
3 public enum Mode
4 {
6 Ramp,
8 }
9
10 public Mode mode;
11
12 public int ramp = 3;
13
14 public override HarvestType harvestType => HarvestType.Floor;
15
16 public override string IdRecipe
17 {
18 get
19 {
20 if (!pos.HasBridge)
21 {
22 return pos.sourceFloor.RecipeID;
23 }
24 return pos.sourceBridge.RecipeID;
25 }
26 }
27
28 public override int RightHand => 1101;
29
30 public override bool IsHostileAct => true;
31
32 public override bool LocalAct => false;
33
34 public override int destDist
35 {
36 get
37 {
39 {
41 {
42 return 1;
43 }
44 return 0;
45 }
46 return 1;
47 }
48 }
49
50 public override bool destIgnoreConnection => true;
51
53
54 public override string GetTextSmall(Card c)
55 {
56 if (!pos.cell.HasBridge)
57 {
58 return pos.cell.GetFloorName();
59 }
60 return pos.cell.GetBridgeName();
61 }
62
63 public override void OnCreateProgress(Progress_Custom p)
64 {
66 p.textHint = pos.cell.GetFloorName();
67 p.maxProgress = maxProgress;
68 p.onProgressBegin = delegate
69 {
70 if (base.IsTooHard)
71 {
73 p.Cancel();
74 }
75 else if (owner.Tool != null)
76 {
77 owner.Say("dig_start", owner, owner.Tool);
78 }
79 };
80 p.onProgress = delegate
81 {
82 SourceMaterial.Row row = (pos.cell.HasBridge ? pos.cell.matBridge : pos.cell.matFloor);
84 row.PlayHitEffect(pos);
85 row.AddBlood(pos);
86 owner.elements.ModExp(230, 5f);
88 if (EClass._zone.IsCrime(owner, this))
89 {
91 }
92 };
93 }
94
95 public override HitResult GetHitResult()
96 {
97 if (EClass._zone.IsRegion && GetTreasureMap() != null)
98 {
99 return HitResult.Valid;
100 }
101 if (mode == Mode.RemoveFloor)
102 {
104 {
105 if (pos.matFloor.category == "soil")
106 {
107 return HitResult.Valid;
108 }
109 return HitResult.Default;
110 }
111 if (EClass._zone.IsSkyLevel && (pos.IsSky || pos.Installed != null || pos.Charas.Count >= 2 || (pos.HasChara && (pos.FirstChara != EClass.pc || EClass.game.IsSurvival))))
112 {
113 return HitResult.Invalid;
114 }
116 {
117 return HitResult.Invalid;
118 }
119 if (!pos.HasBridge && !EClass._zone.IsSkyLevel && pos.sourceFloor.id == 40)
120 {
121 return HitResult.Invalid;
122 }
123 return HitResult.Valid;
124 }
125 if (pos.HasBridge)
126 {
127 if (pos.HasObj)
128 {
129 return HitResult.Warning;
130 }
131 return HitResult.Valid;
132 }
133 return HitResult.Default;
134 }
135
137 {
139 {
140 TraitScrollMapTreasure traitScrollMapTreasure = item.trait as TraitScrollMapTreasure;
141 if (pos.Equals(traitScrollMapTreasure.GetDest(fix: true)))
142 {
143 return item;
144 }
145 }
146 return null;
147 }
148
149 public override void OnProgressComplete()
150 {
151 string idRecipe = IdRecipe;
152 int num = (pos.HasBridge ? pos.matBridge.hardness : pos.matFloor.hardness);
154 {
155 Thing map = GetTreasureMap();
156 if (map != null || EClass.debug.enable)
157 {
158 if (map == null)
159 {
160 map = ThingGen.Create("map_treasure", -1, EClass.pc.LV);
161 }
162 SE.Play("ding_skill");
163 Msg.Say("digTreasure");
164 Rand.UseSeed(map.refVal, delegate
165 {
166 Thing thing = ThingGen.CreateTreasure("chest_treasure", map.LV);
167 EClass._zone.AddCard(thing, EClass.pc.pos);
168 ThingGen.TryLickChest(thing);
169 });
170 map.Destroy();
171 EClass.player.willAutoSave = true;
172 return;
173 }
174 }
175 switch (mode)
176 {
177 case Mode.Default:
179 break;
180 case Mode.RemoveFloor:
182 pos.Animate(AnimeID.Dig, animeBlock: true);
183 if (!owner.IsAgent)
184 {
185 owner.elements.ModExp(230, 20 + num / 2);
186 }
187 break;
188 case Mode.Ramp:
190 break;
191 }
192 if (EClass._zone.IsCrime(owner, this))
193 {
195 }
196 if (EClass.rnd(2) == 0)
197 {
198 owner.stamina.Mod(-1);
199 }
200 if (owner != null)
201 {
202 if (owner.IsPC)
203 {
205 }
207 {
209 }
210 }
211 }
212}
AnimeID
Definition: AnimeID.cs:2
HitResult
Definition: HitResult.cs:2
virtual Status Cancel()
Definition: AIAct.cs:291
new Chara owner
Definition: AIAct.cs:14
void SetTarget(Chara c, Thing _tool=null)
virtual void NextFrame()
Definition: Card.cs:11
bool IsAgent
Definition: Card.cs:2211
ElementContainerCard elements
Definition: Card.cs:39
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:5939
Thing Tool
Definition: Card.cs:2372
Point pos
Definition: Card.cs:57
int refVal
Definition: Card.cs:192
Trait trait
Definition: Card.cs:51
void Destroy()
Definition: Card.cs:4931
ThingContainer things
Definition: Card.cs:36
CardRenderer renderer
Definition: Card.cs:59
int LV
Definition: Card.cs:372
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6586
bool HasBridge
Definition: Cell.cs:671
string GetBridgeName()
Definition: Cell.cs:1599
string GetFloorName()
Definition: Cell.cs:1594
SourceMaterial.Row matFloor
Definition: Cell.cs:1032
override bool IsAliveInCurrentZone
Definition: Chara.cs:559
override bool IsPC
Definition: Chara.cs:610
Stats stamina
Definition: Chara.cs:1128
void FallFromZone()
Definition: Chara.cs:3440
bool enable
Definition: CoreDebug.cs:286
static CursorInfo Dig
Definition: CursorSystem.cs:66
Definition: EClass.cs:5
static Game game
Definition: EClass.cs:8
static Zone _zone
Definition: EClass.cs:20
static Map _map
Definition: EClass.cs:18
static int rnd(long a)
Definition: EClass.cs:58
static Player player
Definition: EClass.cs:12
static Chara pc
Definition: EClass.cs:14
static CoreDebug debug
Definition: EClass.cs:48
void ModExp(int ele, float a, bool chain=false)
bool IsSurvival
Definition: Game.cs:272
void SetBridge(int x, int z, int height=0, int idMat=0, int idBridge=0, int dir=0)
Definition: Map.cs:972
void MineFloor(Point point, Chara c=null, bool recoverBlock=false, bool removePlatform=true)
Definition: Map.cs:1752
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
RecipeManager recipes
Definition: Player.cs:1053
void ModKarma(int a)
Definition: Player.cs:2444
Thing Installed
Definition: Point.cs:315
SourceMaterial.Row matFloor
Definition: Point.cs:57
bool HasBridge
Definition: Point.cs:209
bool IsSky
Definition: Point.cs:212
bool IsWater
Definition: Point.cs:129
int x
Definition: Point.cs:36
int z
Definition: Point.cs:39
List< Chara > Charas
Definition: Point.cs:328
bool Equals(int _x, int _z)
Definition: Point.cs:944
bool TryWitnessCrime(Chara criminal, Chara target=null, int radius=4, Func< Chara, bool > funcWitness=null)
Definition: Point.cs:861
SourceFloor.Row sourceFloor
Definition: Point.cs:65
bool HasObj
Definition: Point.cs:137
Chara FirstChara
Definition: Point.cs:276
bool HasBlock
Definition: Point.cs:141
bool IsInBounds
Definition: Point.cs:104
Cell cell
Definition: Point.cs:51
void Animate(AnimeID id, bool animeBlock=false)
Definition: Point.cs:1286
SourceFloor.Row sourceBridge
Definition: Point.cs:67
bool HasChara
Definition: Point.cs:226
Definition: Rand.cs:4
static void UseSeed(int seed, Action action)
Definition: Rand.cs:22
void ComeUpWithRecipe(string idRecipe, int chanceForRandomRecipe=0)
string GetSoundImpact(RenderRow c=null)
void AddBlood(Point p, int a=1)
void PlayHitEffect(Point p, int emit=2)
virtual bool IsRegion
Definition: Spatial.cs:503
virtual void Mod(int a)
Definition: Stats.cs:135
override void OnCreateProgress(Progress_Custom p)
Definition: TaskDig.cs:63
override void OnProgressComplete()
Definition: TaskDig.cs:149
Thing GetTreasureMap()
Definition: TaskDig.cs:136
override string IdRecipe
Definition: TaskDig.cs:17
override bool destIgnoreConnection
Definition: TaskDig.cs:50
int ramp
Definition: TaskDig.cs:12
override bool LocalAct
Definition: TaskDig.cs:32
override HarvestType harvestType
Definition: TaskDig.cs:14
Mode
Definition: TaskDig.cs:4
override string GetTextSmall(Card c)
Definition: TaskDig.cs:54
Mode mode
Definition: TaskDig.cs:10
override CursorInfo CursorIcon
Definition: TaskDig.cs:52
override bool IsHostileAct
Definition: TaskDig.cs:30
override int destDist
Definition: TaskDig.cs:35
override HitResult GetHitResult()
Definition: TaskDig.cs:95
override int RightHand
Definition: TaskDig.cs:28
Point pos
Definition: TaskPoint.cs:11
List< Thing > List(Func< Thing, bool > func, bool onlyAccessible=false)
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Definition: Thing.cs:8
Point GetDest(bool fix=false)
virtual bool IsSkyLevel
Definition: Zone.cs:262
bool IsPCFaction
Definition: Zone.cs:468
bool IsCrime(Chara c, Act act)
Definition: Zone.cs:3420