Elin Decompiled Documentation EA 23.102 Nightly
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 int RightHand => 1101;
17
18 public override bool IsHostileAct => true;
19
20 public override bool LocalAct => false;
21
22 public override int destDist
23 {
24 get
25 {
27 {
29 {
30 return 1;
31 }
32 return 0;
33 }
34 return 1;
35 }
36 }
37
38 public override bool destIgnoreConnection => true;
39
41
42 public override string GetTextSmall(Card c)
43 {
44 if (!pos.cell.HasBridge)
45 {
46 return pos.cell.GetFloorName();
47 }
48 return pos.cell.GetBridgeName();
49 }
50
51 public override void OnCreateProgress(Progress_Custom p)
52 {
54 p.textHint = pos.cell.GetFloorName();
55 p.maxProgress = maxProgress;
56 p.onProgressBegin = delegate
57 {
58 if (base.IsTooHard)
59 {
61 p.Cancel();
62 }
63 else if (owner.Tool != null)
64 {
65 owner.Say("dig_start", owner, owner.Tool);
66 }
67 };
68 p.onProgress = delegate
69 {
70 SourceMaterial.Row row = (pos.cell.HasBridge ? pos.cell.matBridge : pos.cell.matFloor);
72 row.PlayHitEffect(pos);
73 row.AddBlood(pos);
74 owner.elements.ModExp(230, 5);
76 if (EClass._zone.IsCrime(owner, this))
77 {
79 }
80 };
81 }
82
83 public override HitResult GetHitResult()
84 {
85 if (EClass._zone.IsRegion && GetTreasureMap() != null)
86 {
87 return HitResult.Valid;
88 }
89 if (mode == Mode.RemoveFloor)
90 {
92 {
93 if (pos.matFloor.category == "soil")
94 {
95 return HitResult.Valid;
96 }
97 return HitResult.Default;
98 }
99 if (EClass._zone.IsSkyLevel && (pos.Installed != null || pos.Charas.Count >= 2 || (pos.HasChara && pos.FirstChara != EClass.pc)))
100 {
101 return HitResult.Invalid;
102 }
104 {
105 return HitResult.Invalid;
106 }
107 if (!pos.HasBridge && pos.sourceFloor.id == 40)
108 {
109 return HitResult.Invalid;
110 }
111 return HitResult.Valid;
112 }
113 if (pos.HasBridge)
114 {
115 if (pos.HasObj)
116 {
117 return HitResult.Warning;
118 }
119 return HitResult.Valid;
120 }
121 return HitResult.Default;
122 }
123
125 {
127 {
128 TraitScrollMapTreasure traitScrollMapTreasure = item.trait as TraitScrollMapTreasure;
129 if (pos.Equals(traitScrollMapTreasure.GetDest(fix: true)))
130 {
131 return item;
132 }
133 }
134 return null;
135 }
136
137 public override void OnProgressComplete()
138 {
139 string idRecipe = (pos.HasBridge ? pos.sourceBridge.RecipeID : pos.sourceFloor.RecipeID);
140 int num = (pos.HasBridge ? pos.matBridge.hardness : pos.matFloor.hardness);
142 {
143 Thing map = GetTreasureMap();
144 if (map != null || EClass.debug.enable)
145 {
146 if (map == null)
147 {
148 map = ThingGen.Create("map_treasure", -1, EClass.pc.LV);
149 }
150 SE.Play("ding_skill");
151 Msg.Say("digTreasure");
152 Rand.UseSeed(map.refVal, delegate
153 {
154 Thing thing = ThingGen.CreateTreasure("chest_treasure", map.LV);
155 EClass._zone.AddCard(thing, EClass.pc.pos);
156 ThingGen.TryLickChest(thing);
157 });
158 map.Destroy();
159 EClass.player.willAutoSave = true;
160 return;
161 }
162 }
163 switch (mode)
164 {
165 case Mode.Default:
167 break;
168 case Mode.RemoveFloor:
170 pos.Animate(AnimeID.Dig, animeBlock: true);
171 if (!owner.IsAgent)
172 {
173 owner.elements.ModExp(230, 20 + num / 2);
174 }
175 break;
176 case Mode.Ramp:
178 break;
179 }
180 if (EClass._zone.IsCrime(owner, this))
181 {
183 }
184 if (EClass.rnd(2) == 0)
185 {
186 owner.stamina.Mod(-1);
187 }
188 if (owner != null)
189 {
190 if (owner.IsPC)
191 {
193 }
195 {
197 }
198 }
199 }
200}
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:2109
ElementContainerCard elements
Definition: Card.cs:37
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:5404
Thing Tool
Definition: Card.cs:2270
Point pos
Definition: Card.cs:55
int refVal
Definition: Card.cs:190
Trait trait
Definition: Card.cs:49
void Destroy()
Definition: Card.cs:4538
ThingContainer things
Definition: Card.cs:34
CardRenderer renderer
Definition: Card.cs:57
int LV
Definition: Card.cs:370
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6046
bool HasBridge
Definition: Cell.cs:671
string GetBridgeName()
Definition: Cell.cs:1595
string GetFloorName()
Definition: Cell.cs:1590
SourceMaterial.Row matFloor
Definition: Cell.cs:1032
override bool IsAliveInCurrentZone
Definition: Chara.cs:546
override bool IsPC
Definition: Chara.cs:597
Stats stamina
Definition: Chara.cs:955
void FallFromZone()
Definition: Chara.cs:3185
bool enable
Definition: CoreDebug.cs:285
static CursorInfo Dig
Definition: CursorSystem.cs:66
Definition: EClass.cs:5
static int rnd(int a)
Definition: EClass.cs:50
static Zone _zone
Definition: EClass.cs:20
static Map _map
Definition: EClass.cs:18
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, int a, bool chain=false)
void SetBridge(int x, int z, int height=0, int idMat=0, int idBridge=0, int dir=0)
Definition: Map.cs:966
void MineFloor(Point point, Chara c=null, bool recoverBlock=false, bool removePlatform=true)
Definition: Map.cs:1739
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:898
void ModKarma(int a)
Definition: Player.cs:2289
Thing Installed
Definition: Point.cs:303
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:316
bool Equals(int _x, int _z)
Definition: Point.cs:924
bool TryWitnessCrime(Chara criminal, Chara target=null, int radius=4, Func< Chara, bool > funcWitness=null)
Definition: Point.cs:845
SourceFloor.Row sourceFloor
Definition: Point.cs:65
bool HasObj
Definition: Point.cs:137
Chara FirstChara
Definition: Point.cs:264
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:1266
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:501
virtual void Mod(int a)
Definition: Stats.cs:135
override void OnCreateProgress(Progress_Custom p)
Definition: TaskDig.cs:51
override void OnProgressComplete()
Definition: TaskDig.cs:137
Thing GetTreasureMap()
Definition: TaskDig.cs:124
override bool destIgnoreConnection
Definition: TaskDig.cs:38
int ramp
Definition: TaskDig.cs:12
override bool LocalAct
Definition: TaskDig.cs:20
override HarvestType harvestType
Definition: TaskDig.cs:14
Mode
Definition: TaskDig.cs:4
override string GetTextSmall(Card c)
Definition: TaskDig.cs:42
Mode mode
Definition: TaskDig.cs:10
override CursorInfo CursorIcon
Definition: TaskDig.cs:40
override bool IsHostileAct
Definition: TaskDig.cs:18
override int destDist
Definition: TaskDig.cs:23
override HitResult GetHitResult()
Definition: TaskDig.cs:83
override int RightHand
Definition: TaskDig.cs:16
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:464
bool IsCrime(Chara c, Act act)
Definition: Zone.cs:3259