Elin Decompiled Documentation EA 23.331 Nightly
Loading...
Searching...
No Matches
BaseTaskHarvest Class Reference
Inheritance diagram for BaseTaskHarvest:
TaskDesignation TaskPoint ISyncScreen Task IInspect AIAct Act Element EClass TaskDig TaskHarvest TaskMine

Public Types

enum  HarvestType {
  Floor , Block , Obj , Thing ,
  Disassemble
}
 
- Public Types inherited from AIAct
enum  Status { Running , Fail , Success }
 
- Public Types inherited from Act
enum  CostType { None , MP , SP }
 
- Public Types inherited from IInspect
enum  NoteMode { Default , Recipe , Product , Info }
 

Public Member Functions

virtual string GetIdRecipe (Point p)
 
virtual string GetBaseText (string str)
 
override string GetTextSmall (Card c)
 
override string GetText (string str="")
 
void SetTarget (Chara c, Thing _tool=null)
 
int GetToolEfficiency (Thing t, SourceMaterial.Row mat)
 
override bool CanProgress ()
 
override void OnStart ()
 
int[] GetToolEfficiency (SourceMaterial.Row mat)
 
string GetTextDifficulty ()
 
- Public Member Functions inherited from TaskDesignation
virtual string GetTextOrbit ()
 
bool PointHasOtherDesignation ()
 
virtual void DrawMarker (int x, int z, RenderParam p)
 
virtual void Draw (int x, int z, RenderParam p)
 
virtual void OnEnterScreen ()
 
virtual void OnLeaveScreen ()
 
virtual void TrySpawnOrbit ()
 
void DespawnOrbit ()
 
- Public Member Functions inherited from TaskPoint
override bool CanManualCancel ()
 
HitResult GetHitResult (Point p)
 
override bool CanPerform ()
 
override bool _CanPerformTask (Chara chara, int radius)
 
override IEnumerable< StatusRun ()
 
void OnInspect ()
 
void WriteNote (UINote n, Action< UINote > onWriteNote=null, IInspect.NoteMode mode=IInspect.NoteMode.Default, Recipe recipe=null)
 
- Public Member Functions inherited from Task
virtual HitResult GetHitResult ()
 
override void OnSuccess ()
 
void TryLater (int min=30)
 
Status Destroy ()
 
virtual void OnDestroy ()
 
override Status Cancel ()
 
override void OnReset ()
 
override bool CanProgress ()
 
bool CanPerformTask (Chara chara, int radius)
 
virtual bool _CanPerformTask (Chara chara, int radius)
 
virtual void OnAdd ()
 
void ToggleSuspend ()
 
- Public Member Functions inherited from AIAct
override string ToString ()
 
override MultiSprite GetStateIcon ()
 
virtual bool ShouldAllyAttack (Chara tg)
 
virtual Point GetDestination ()
 
AIProgress GetProgress ()
 
string GetCurrentActionText ()
 
override bool IsToolValid ()
 
GetChild< T > ()
 
virtual void OnStart ()
 
void SetOwner (Chara c)
 
virtual void OnSetOwner ()
 
void SetChild (AIAct seq, Func< Status > _onChildFail=null)
 
void Start ()
 
override bool Perform ()
 
Status Restart ()
 
Status Success (Action action=null)
 
virtual void OnSuccess ()
 
bool TryCancel (Card c)
 
virtual Status Cancel ()
 
virtual void OnCancel ()
 
virtual void OnCancelOrSuccess ()
 
virtual bool CanManualCancel ()
 
Status KeepRunning ()
 
void Reset ()
 
virtual void OnReset ()
 
Status Tick ()
 
virtual IEnumerable< StatusRun ()
 
Status TickChild ()
 
Status Do (AIAct _seq, Func< Status > _onChildFail=null)
 
Status DoGotoInteraction (Point pos, Func< Status > _onChildFail=null)
 
Status DoGoto (Point pos, int dist=0, bool ignoreConnection=false, Func< Status > _onChildFail=null)
 
Status DoGoto (Card card, Func< Status > _onChildFail=null)
 
Status DoGoto (Card card, int dist, bool ignoreConnection=false, Func< Status > _onChildFail=null)
 
Status DoGotoSpot (Card card, Func< Status > _onChildFail=null)
 
Status DoGoto< T > (Func< Status > _onChildFail=null)
 
Status DoGotoSpot< T > (Func< Status > _onChildFail=null, bool ignoreAccessType=false)
 
Status DoGrab (Card card, int num=-1, bool pickHeld=false, Func< Status > _onChildFail=null)
 
Status DoGrab< T > ()
 
Status DoProgress ()
 
Status DoIdle (int repeat=3)
 
Status DoWait (int count=1)
 
virtual AIProgress CreateProgress ()
 
virtual void OnCreateProgress (Progress_Custom p)
 
virtual bool CanProgress ()
 
virtual void OnBeforeProgress ()
 
virtual void OnProgress ()
 
virtual void OnProgressComplete ()
 
void SimulateZone (int days)
 
virtual void OnSimulateZone (int days)
 
virtual void OnSimulatePosition ()
 
- Public Member Functions inherited from Act
virtual CursorInfo GetCursorIcon (Card c)
 
virtual MultiSprite GetStateIcon ()
 
override Sprite GetSprite ()
 
virtual bool ShowMouseHint (Card c)
 
virtual bool IsValidTC (Card c)
 
virtual string GetHintText (string str="")
 
virtual string GetText (string str="")
 
virtual string GetTextSmall (Card c)
 
bool IsTargetHostileParty ()
 
virtual Color GetActPlanColor ()
 
virtual bool Perform ()
 
bool Perform (Chara _cc, Card _tc=null, Point _tp=null)
 
virtual bool ValidatePerform (Chara _cc, Card _tc, Point _tp)
 
virtual bool CanPerform ()
 
bool CanPerform (Chara _cc, Card _tc=null, Point _tp=null)
 
virtual bool IsToolValid ()
 
new void SetImage (Image image)
 
virtual void OnMarkMapHighlights ()
 
virtual bool ShouldMapHighlight (Point p)
 
- Public Member Functions inherited from Element
virtual SourceElement.Row GetSource ()
 
virtual int GetSourcePotential (int v)
 
virtual Sprite GetSprite ()
 
int GetMaterialSourceValue (Thing t, int v)
 
virtual long GetSourceValue (long v, int lv, SourceValueType type)
 
virtual Sprite GetIcon (string suffix="")
 
bool IsActive (Card c)
 
int SortVal (bool charaSheet=false)
 
virtual bool CanLink (ElementContainer owner)
 
bool HasTag (string tag)
 
void SetImage (Image i)
 
virtual string GetDetail ()
 
bool IsFactionElement (Chara c)
 
Element GetParent (Card c)
 
void WriteNote (UINote n, ElementContainer owner=null, Action< UINote > onWriteNote=null)
 
void WriteNoteWithRef (UINote n, ElementContainer owner, Action< UINote > onWriteNote, Element refEle)
 
void _WriteNote (UINote n, Chara c, Act act)
 
void AddHeaderAbility (UINote n)
 
void _WriteNote (UINote n, ElementContainer owner, Action< UINote > onWriteNote, bool isRef, bool addHeader=true)
 
void AddEncNote (UINote n, Card Card, ElementContainer.NoteMode mode=ElementContainer.NoteMode.Default, Func< Element, string, string > funcText=null, Action< UINote, Element > onAddNote=null)
 
virtual void OnWriteNote (UINote n, ElementContainer owner)
 
virtual void OnChangeValue ()
 
void CheckLevelBonus (ElementContainer owner, UINote n=null)
 
int GetSortVal (UIList.SortMode m)
 
virtual Act.Cost GetCost (Chara c)
 
virtual int GetPower (Card c)
 
virtual void SetTextValue (UIText text, bool shorten=false)
 
virtual bool IsPurchaseFeatReqMet (ElementContainer owner, int lv=-1)
 
virtual void WritePurchaseReq (UINote n, int lv=1)
 
void WriteNote (UINote n, Action< UINote > onWriteNote=null, NoteMode mode=NoteMode.Default, Recipe recipe=null)
 
void OnInspect ()
 
void OnEnterScreen ()
 
void OnLeaveScreen ()
 

Static Public Member Functions

static Thing GetBestTool (Chara c, Point p)
 
static int GetReqEle (string _raw)
 
- Static Public Member Functions inherited from Act
static void SetReference (Chara _cc, Card _tc=null, Point _tp=null)
 
static void SetTool (Thing t)
 
- Static Public Member Functions inherited from Element
static string GetName (string alias)
 
static SourceElement.Row Get (int id)
 
static Dictionary< int, int > GetElementMap (int[] list)
 
static Dictionary< int, int > GetElementMap (int[] list, Dictionary< int, int > map)
 
static SourceElement.Row GetRandomElement (int lv=1, bool useWeight=true)
 
static Element Create (int id, int v=0)
 
static Element Create (string id, int v=1)
 
static int GetId (string alias)
 
static int GetResistLv (int v)
 
static long GetResistDamage (long dmg, int v, int power=0)
 
- Static Public Member Functions inherited from EClass
static int rndSeed (int a, int seed)
 
static int rnd (long a)
 
static int rnd (int a)
 
static int curve (long _a, int start, int step, int rate=75)
 
static int sqrt (int a)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 

Public Attributes

Thing target
 
Element reqElement
 
int matHardness
 
int idEle
 
int reqLv
 
int toolLv
 
int maxProgress
 
int efficiency
 
int difficulty
 
int effectFrame = 1
 
bool isToolRequired
 
Thing tool
 
- Public Attributes inherited from TaskDesignation
long sync
 
bool isSynced
 
TCOrbitTask orbit
 
- Public Attributes inherited from TaskPoint
Point pos = new Point()
 
bool isRepeated
 
- Public Attributes inherited from Task
TaskList taskList
 
bool isDestroyed
 
int nextTry
 
bool suspended
 
- Public Attributes inherited from AIAct
new Chara owner
 
Status status
 
IEnumerator< StatusEnumerator
 
AIAct child
 
AIAct parent
 
byte restartCount
 
Func< StatusonChildFail
 
Func< bool > isFail
 
- Public Attributes inherited from Element
SourceElement.Row _source
 
int id
 
int vBase
 
int vExp
 
int vPotential
 
int vTempPotential
 
int vLink
 
int vSource
 
int vSourcePotential
 
ElementContainer owner
 

Properties

bool IsTooHard [get]
 
bool IsHarvest [get]
 
virtual bool CanReapSeed [get]
 
virtual HarvestType harvestType [get]
 
virtual bool IsGrowth [get]
 
override bool CanPressRepeat [get]
 
override int LeftHand [get]
 
override CursorInfo CursorIcon [get]
 
- Properties inherited from TaskDesignation
override bool HasProgress [get]
 
virtual int idMarker [get]
 
virtual int W [get]
 
virtual int H [get]
 
virtual bool ShowOrbit [get]
 
virtual bool Working [get]
 
override bool ShowAuto [get]
 
override CursorInfo CursorIcon [get]
 
TaskManager.Designations Designations [get]
 
long Sync [get]
 
- Properties inherited from TaskPoint
override bool HasProgress [get]
 
virtual int destDist [get]
 
virtual bool destIgnoreConnection [get]
 
virtual bool isBlock [get]
 
virtual bool Loop [get]
 
bool CanInspect [get]
 
string InspectName [get]
 
Point InspectPoint [get]
 
Vector3 InspectPosition [get]
 
- Properties inherited from Task
override TargetType TargetType [get]
 
- Properties inherited from AIAct
virtual bool IsRunning [get]
 
bool IsChildRunning [get]
 
bool IsMoveAI [get]
 
virtual int MaxRestart [get]
 
virtual new string Name [get]
 
virtual MultiSprite stateIcon [get]
 
virtual Sprite actionIcon [get]
 
virtual bool IsNoGoal [get]
 
virtual bool IsAutoTurn [get]
 
virtual bool IsIdle [get]
 
virtual bool CancelOnAggro [get]
 
virtual bool PushChara [get]
 
virtual int MaxProgress [get]
 
virtual bool ShowProgress [get]
 
virtual bool UseTurbo [get]
 
virtual int CurrentProgress [get]
 
virtual bool ShowCursor [get]
 
virtual bool CancelWhenDamaged [get]
 
virtual bool CancelWhenMoved [get]
 
virtual bool InformCancel [get]
 
virtual Thing RenderThing [get]
 
AIAct Current [get]
 
override bool IsAct [get]
 
override bool ShowPotential [get]
 
override bool UsePotential [get]
 
override bool ShowRelativeAttribute [get]
 
virtual bool HasProgress [get]
 
- Properties inherited from Act
override bool ShowPotential [get]
 
override bool UsePotential [get]
 
override bool ShowRelativeAttribute [get]
 
virtual CursorInfo CursorIcon [get]
 
virtual string ID [get]
 
virtual bool IsAct [get]
 
virtual bool WillEndTurn [get]
 
virtual bool CloseLayers [get]
 
virtual int LeftHand [get]
 
virtual int RightHand [get]
 
virtual int ElementPowerMod [get]
 
virtual bool ShowMapHighlight [get]
 
virtual bool ShowMapHighlightBlock [get]
 
virtual bool PickHeldOnStart [get]
 
virtual bool DropHeldOnStart [get]
 
virtual bool CanPressRepeat [get]
 
virtual bool CanAutofire [get]
 
virtual bool ResetAxis [get]
 
virtual bool RequireTool [get]
 
virtual bool IsHostileAct [get]
 
virtual bool HideRightInfo [get]
 
virtual bool ShouldEndMimicry [get]
 
virtual bool HaveLongPressAction [get]
 
virtual float Radius [get]
 
virtual int PerformDistance [get]
 
virtual int MaxRadius [get]
 
virtual TargetType TargetType [get]
 
virtual bool LocalAct [get]
 
virtual bool CanRapidFire [get]
 
virtual float RapidDelay [get]
 
virtual bool ShowAuto [get]
 
- Properties inherited from Element
SourceElement.Row source [get]
 
virtual int DisplayValue [get]
 
virtual int MinValue [get]
 
int Value [get]
 
int ValueWithoutLink [get]
 
virtual int MinPotential [get]
 
int Potential [get]
 
virtual bool CanGainExp [get]
 
bool IsFlag [get]
 
virtual string Name [get]
 
virtual string FullName [get]
 
virtual int ExpToNext [get]
 
virtual bool UseExpMod [get]
 
virtual int CostTrain [get]
 
virtual int CostLearn [get]
 
virtual bool ShowXP [get]
 
virtual bool ShowMsgOnValueChanged [get]
 
virtual bool ShowValue [get]
 
virtual bool ShowPotential [get]
 
virtual bool UsePotential [get]
 
virtual bool PotentialAsStock [get]
 
virtual bool ShowRelativeAttribute [get]
 
virtual bool ShowBonuses [get]
 
virtual string ShortName [get]
 
bool IsGlobalElement [get]
 
bool IsFactionWideElement [get]
 
bool IsPartyWideElement [get]
 
virtual bool ShowEncNumber [get]
 
bool IsTrait [get]
 
bool IsFoodTrait [get]
 
bool IsFoodTraitMain [get]
 
bool IsMainAttribute [get]
 
Act act [get]
 
- Properties inherited from EClass
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Faction Wilds [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 
- Properties inherited from IInspect
bool CanInspect [get]
 
string InspectName [get]
 
Point InspectPoint [get]
 
Vector3 InspectPosition [get]
 
- Properties inherited from ISyncScreen
long Sync [get]
 

Additional Inherited Members

- Static Public Attributes inherited from Act
static Chara CC
 
static Card TC
 
static Point TP = new Point()
 
static Thing TOOL
 
static int powerMod = 100
 
static bool forcePt
 
static Act CurrentAct
 
- Static Public Attributes inherited from Element
const int Div = 5
 
static Element Void = new Element()
 
static int[] List_MainAttributes = new int[9] { 70, 72, 71, 77, 74, 75, 76, 73, 79 }
 
static int[] List_MainAttributesMajor = new int[8] { 70, 72, 71, 77, 74, 75, 76, 73 }
 
static int[] List_Body = new int[4] { 70, 72, 71, 77 }
 
static int[] List_Mind = new int[4] { 74, 75, 76, 73 }
 
static List< SourceElement.RowListElements = new List<SourceElement.Row>()
 
static List< SourceElement.RowListAttackElements = new List<SourceElement.Row>()
 
- Static Public Attributes inherited from EClass
static Core core
 

Detailed Description

Definition at line 4 of file BaseTaskHarvest.cs.

Member Enumeration Documentation

◆ HarvestType

Enumerator
Floor 
Block 
Obj 
Thing 
Disassemble 

Definition at line 6 of file BaseTaskHarvest.cs.

Member Function Documentation

◆ CanProgress()

override bool BaseTaskHarvest.CanProgress ( )
inlinevirtual

Reimplemented from AIAct.

Reimplemented in TaskHarvest.

Definition at line 288 of file BaseTaskHarvest.cs.

289 {
290 if (tool != owner.Tool)
291 {
292 return false;
293 }
294 return base.CanProgress();
295 }
new Chara owner
Definition: AIAct.cs:14
Thing Tool
Definition: Card.cs:2480

References tool.

◆ GetBaseText()

virtual string BaseTaskHarvest.GetBaseText ( string  str)
inlinevirtual

Reimplemented in TaskHarvest.

Definition at line 70 of file BaseTaskHarvest.cs.

71 {
72 return base.GetText(str);
73 }

Referenced by GetText().

◆ GetBestTool()

static Thing BaseTaskHarvest.GetBestTool ( Chara  c,
Point  p 
)
inlinestatic

Definition at line 111 of file BaseTaskHarvest.cs.

112 {
114 {
115 pos = p
116 };
117 task.SetOwner(c);
118 Thing tool = null;
119 int best = 0;
120 c.things.Foreach(delegate(Thing t)
121 {
122 if (t.trait is TraitTool)
123 {
124 task.SetTarget(c, t);
125 if (task.efficiency > best)
126 {
127 best = task.efficiency;
128 tool = t;
129 }
130 }
131 });
132 return tool;
133 }
void SetOwner(Chara c)
Definition: AIAct.cs:189
Trait trait
Definition: Card.cs:54
ThingContainer things
Definition: Card.cs:39
Point pos
Definition: TaskPoint.cs:11
void Foreach(Action< Thing > action, bool onlyAccessible=true)
Definition: Thing.cs:8

References ThingContainer.Foreach(), TaskPoint.pos, AIAct.SetOwner(), Card.things, tool, and Card.trait.

◆ GetIdRecipe()

virtual string BaseTaskHarvest.GetIdRecipe ( Point  p)
inlinevirtual

Reimplemented in TaskDig, TaskHarvest, and TaskMine.

Definition at line 65 of file BaseTaskHarvest.cs.

66 {
67 return "";
68 }

Referenced by GetText().

◆ GetReqEle()

static int BaseTaskHarvest.GetReqEle ( string  _raw)
inlinestatic

Definition at line 254 of file BaseTaskHarvest.cs.

255 {
256 string[] array = _raw.Split(',');
257 return EClass.sources.elements.alias[array[0]].id;
258 }
Definition: EClass.cs:6
static SourceManager sources
Definition: EClass.cs:43
SourceElement elements

References SourceManager.elements, and EClass.sources.

◆ GetText()

override string BaseTaskHarvest.GetText ( string  str = "")
inlinevirtual

Reimplemented from Act.

Definition at line 80 of file BaseTaskHarvest.cs.

81 {
82 if (owner == null)
83 {
84 owner = EClass.pc;
85 }
87 string text = "tHarvest".lang(GetBaseText(str), (EClass.pc.Tool == null) ? "hand".lang() : owner.Tool.NameSimple, toolLv.ToString() ?? "");
88 if (EClass.pc.HasElement(1661))
89 {
91 switch (recipeLearnState)
92 {
93 case RecipeManager.LearnState.Learnable:
94 text = text + " " + "TaskDisassemble_newrecipe".lang();
95 break;
96 default:
97 text = text + " " + ("TaskDisassemble_" + recipeLearnState).lang();
98 break;
99 case RecipeManager.LearnState.Unavailable:
100 break;
101 }
102 }
103 text = text + " (" + GetTextDifficulty() + ")";
104 if (IsTooHard)
105 {
106 text = text.TagColor(Color.gray);
107 }
108 return text;
109 }
string GetTextDifficulty()
virtual string GetBaseText(string str)
virtual string GetIdRecipe(Point p)
void SetTarget(Chara c, Thing _tool=null)
string NameSimple
Definition: Card.cs:2193
bool HasElement(int ele, bool includeNagative=false)
Definition: Card.cs:6351
static Player player
Definition: EClass.cs:13
static Chara pc
Definition: EClass.cs:15
RecipeManager recipes
Definition: Player.cs:1164
LearnState GetRecipeLearnState(string idRecipe)

References Color, GetBaseText(), GetIdRecipe(), RecipeManager.GetRecipeLearnState(), GetTextDifficulty(), Card.HasElement(), IsTooHard, Card.NameSimple, AIAct.owner, EClass.pc, EClass.player, TaskPoint.pos, Player.recipes, SetTarget(), Card.Tool, and toolLv.

◆ GetTextDifficulty()

string BaseTaskHarvest.GetTextDifficulty ( )
inline

Definition at line 331 of file BaseTaskHarvest.cs.

332 {
333 return Lang.GetList("skillDiff")[difficulty];
334 }
Definition: Lang.cs:7
static string[] GetList(string id)
Definition: Lang.cs:113

References Lang.GetList().

Referenced by GetText().

◆ GetTextSmall()

override string BaseTaskHarvest.GetTextSmall ( Card  c)
inlinevirtual

Reimplemented from Act.

Reimplemented in TaskDig, TaskHarvest, and TaskMine.

Definition at line 75 of file BaseTaskHarvest.cs.

76 {
77 return pos.cell.GetObjName();
78 }
string GetObjName()
Definition: Cell.cs:1640
Cell cell
Definition: Point.cs:51

References Point.cell, Cell.GetObjName(), and TaskPoint.pos.

◆ GetToolEfficiency() [1/2]

int[] BaseTaskHarvest.GetToolEfficiency ( SourceMaterial::Row  mat)
inline

Definition at line 305 of file BaseTaskHarvest.cs.

306 {
307 switch (mat.category)
308 {
309 case "bone":
310 return new int[2] { 100, 50 };
311 case "ore":
312 case "crystal":
313 case "rock":
314 case "gem":
315 return new int[2] { 100, 25 };
316 case "organic":
317 case "skin":
318 return new int[2] { 50, 100 };
319 case "grass":
320 case "fiber":
321 case "wood":
322 return new int[2] { 25, 100 };
323 case "soil":
324 case "water":
325 return new int[2] { 100, 100 };
326 default:
327 return new int[2] { 100, 100 };
328 }
329 }

◆ GetToolEfficiency() [2/2]

int BaseTaskHarvest.GetToolEfficiency ( Thing  t,
SourceMaterial::Row  mat 
)
inline

Definition at line 260 of file BaseTaskHarvest.cs.

261 {
262 int[] toolEfficiency = GetToolEfficiency(mat);
263 _ = new int[2];
264 if (!t.HasElement(220))
265 {
266 toolEfficiency[0] = 0;
267 }
268 if (!t.HasElement(225))
269 {
270 toolEfficiency[1] = 0;
271 }
272 if (t.trait is TraitToolHammer)
273 {
274 toolEfficiency[0] = 50 + owner.Evalue(261);
275 }
276 int num = 20;
277 int[] array = toolEfficiency;
278 foreach (int num2 in array)
279 {
280 if (num2 > num)
281 {
282 num = num2;
283 }
284 }
285 return num;
286 }
int GetToolEfficiency(Thing t, SourceMaterial.Row mat)
int Evalue(int ele)
Definition: Card.cs:2704

References Card.HasElement(), and Card.trait.

◆ OnStart()

override void BaseTaskHarvest.OnStart ( )
inlinevirtual

Reimplemented from AIAct.

Definition at line 297 of file BaseTaskHarvest.cs.

298 {
299 if (tool != owner.Tool)
300 {
302 }
303 }

References tool.

◆ SetTarget()

void BaseTaskHarvest.SetTarget ( Chara  c,
Thing  _tool = null 
)
inline

Definition at line 135 of file BaseTaskHarvest.cs.

136 {
137 if (c == null)
138 {
139 c = EClass.pc;
140 }
141 if (_tool == null)
142 {
143 _tool = c.Tool;
144 }
145 tool = _tool;
146 string[] array = null;
147 SourceMaterial.Row row = null;
148 switch (this.harvestType)
149 {
150 case HarvestType.Obj:
151 array = pos.sourceObj.reqHarvest;
152 row = (pos.cell.isObjDyed ? pos.sourceObj.DefaultMaterial : pos.cell.matObj);
153 break;
154 case HarvestType.Thing:
155 array = target.trait.ReqHarvest.Split(',');
156 row = target.material;
157 break;
158 case HarvestType.Disassemble:
159 if (target == null)
160 {
161 return;
162 }
163 array = new string[2] { "handicraft", "1" };
164 row = target.material;
165 break;
166 case HarvestType.Floor:
167 if (pos.cell.HasBridge)
168 {
169 array = pos.sourceBridge.reqHarvest;
170 row = pos.matBridge;
171 }
172 else
173 {
174 array = pos.sourceFloor.reqHarvest;
175 row = pos.matFloor;
176 }
177 break;
178 case HarvestType.Block:
179 if (pos.HasBlock)
180 {
181 array = pos.sourceBlock.reqHarvest;
182 row = pos.matBlock;
183 break;
184 }
185 array = new string[pos.sourceFloor.reqHarvest.Length];
186 Array.Copy(pos.sourceFloor.reqHarvest, array, pos.sourceFloor.reqHarvest.Length);
187 array[0] = "mining";
188 row = pos.matFloor;
189 break;
190 }
191 matHardness = row.hardness;
192 if (this.harvestType == HarvestType.Obj)
193 {
194 matHardness = matHardness * ((pos.growth != null) ? pos.growth.GetHp() : pos.sourceObj.hp) / 100;
195 }
196 if (row.tag.Contains("hard"))
197 {
198 matHardness *= 3;
199 }
201 if ((uint)harvestType <= 1u && row.id == 0)
202 {
203 matHardness *= 100;
204 }
205 idEle = (IsHarvest ? 250 : EClass.sources.elements.alias[array[0]].id);
207 int num = array[1].ToInt();
208 reqLv = matHardness + num;
209 isToolRequired = ((!IsHarvest && idEle != 250) ? true : false);
210 toolLv = 0;
211 if (tool != null)
212 {
213 int num2 = ((idEle == 220 || idEle == 225) ? GetToolEfficiency(tool, row) : 100);
214 toolLv += tool.material.hardness * num2 / 100;
215 toolLv += (int)(tool.encLV + tool.blessedState);
216 }
217 toolLv += c.Evalue(idEle) * 3 / 2;
218 if (toolLv < 0)
219 {
220 toolLv = 1;
221 }
222 efficiency = (toolLv + 5) * 100 / ((reqLv + 5) * 140 / 100);
223 if (efficiency < 50)
224 {
225 efficiency = 50;
226 }
227 if (IsTooHard)
228 {
229 difficulty = 3;
230 }
231 else if (efficiency > 150)
232 {
233 difficulty = 0;
234 }
235 else if (efficiency > 100)
236 {
237 difficulty = 1;
238 }
239 else
240 {
241 difficulty = 2;
242 }
244 if (this.harvestType == HarvestType.Obj && IsHarvest && plantData != null && plantData.size > 0)
245 {
246 maxProgress = (int)Mathf.Clamp(Rand.Range(8f, 10f) * (float)(100 + plantData.size * 100 + plantData.size * plantData.size * 30) / (float)efficiency, 2f, 1000f);
247 }
248 else
249 {
250 maxProgress = (int)Mathf.Clamp(Rand.Range(8f, 16f) * 100f / (float)efficiency, 2f, 30f);
251 }
252 }
virtual HarvestType harvestType
SourceMaterial.Row material
Definition: Card.cs:2103
int encLV
Definition: Card.cs:329
BlessedState blessedState
Definition: Card.cs:281
bool HasBridge
Definition: Cell.cs:679
SourceMaterial.Row matObj
Definition: Cell.cs:1046
static Map _map
Definition: EClass.cs:19
static Element Create(int id, int v=0)
Definition: ELEMENT.cs:1123
virtual int GetHp()
Definition: GrowSystem.cs:746
PlantData TryGetPlant(Point p)
Definition: Map.cs:1988
int size
Definition: PlantData.cs:15
SourceMaterial.Row matBlock
Definition: Point.cs:55
SourceMaterial.Row matFloor
Definition: Point.cs:57
SourceBlock.Row sourceBlock
Definition: Point.cs:63
SourceMaterial.Row matBridge
Definition: Point.cs:59
SourceObj.Row sourceObj
Definition: Point.cs:69
SourceFloor.Row sourceFloor
Definition: Point.cs:65
bool HasBlock
Definition: Point.cs:141
SourceFloor.Row sourceBridge
Definition: Point.cs:67
GrowSystem growth
Definition: Point.cs:77
Definition: Rand.cs:4
static int Range(int min, int max)
Definition: Rand.cs:49
virtual string ReqHarvest
Definition: Trait.cs:315

References EClass._map, Element.Create(), SourceManager.elements, Card.Evalue(), SourceMaterial.Row.hardness, Card.material, EClass.pc, Rand.Range(), Trait.ReqHarvest, PlantData.size, EClass.sources, SourceMaterial.Row.tag, Card.Tool, tool, Card.trait, and Map.TryGetPlant().

Referenced by TaskHarvest.CanProgress(), GetText(), TaskDig.OnCreateProgress(), TaskHarvest.OnCreateProgress(), TaskMine.OnCreateProgress(), and TaskDig.OnProgressComplete().

Member Data Documentation

◆ difficulty

int BaseTaskHarvest.difficulty

Definition at line 31 of file BaseTaskHarvest.cs.

Referenced by TaskHarvest.OnCreateProgress().

◆ effectFrame

int BaseTaskHarvest.effectFrame = 1

Definition at line 33 of file BaseTaskHarvest.cs.

Referenced by TaskHarvest.OnCreateProgress().

◆ efficiency

int BaseTaskHarvest.efficiency

Definition at line 29 of file BaseTaskHarvest.cs.

◆ idEle

int BaseTaskHarvest.idEle

Definition at line 21 of file BaseTaskHarvest.cs.

Referenced by TaskHarvest.OnCreateProgress().

◆ isToolRequired

bool BaseTaskHarvest.isToolRequired

Definition at line 35 of file BaseTaskHarvest.cs.

◆ matHardness

int BaseTaskHarvest.matHardness

Definition at line 19 of file BaseTaskHarvest.cs.

◆ maxProgress

int BaseTaskHarvest.maxProgress

◆ reqElement

Element BaseTaskHarvest.reqElement

Definition at line 17 of file BaseTaskHarvest.cs.

◆ reqLv

int BaseTaskHarvest.reqLv

Definition at line 23 of file BaseTaskHarvest.cs.

◆ target

◆ tool

Thing BaseTaskHarvest.tool

Definition at line 37 of file BaseTaskHarvest.cs.

Referenced by TaskHarvest.CanProgress(), and GetBestTool().

◆ toolLv

int BaseTaskHarvest.toolLv

Definition at line 25 of file BaseTaskHarvest.cs.

Referenced by GetText().

Property Documentation

◆ CanPressRepeat

override bool BaseTaskHarvest.CanPressRepeat
get

Definition at line 59 of file BaseTaskHarvest.cs.

◆ CanReapSeed

virtual bool BaseTaskHarvest.CanReapSeed
get

Definition at line 53 of file BaseTaskHarvest.cs.

◆ CursorIcon

override CursorInfo BaseTaskHarvest.CursorIcon
get

Definition at line 63 of file BaseTaskHarvest.cs.

◆ harvestType

virtual HarvestType BaseTaskHarvest.harvestType
get

Definition at line 55 of file BaseTaskHarvest.cs.

◆ IsGrowth

virtual bool BaseTaskHarvest.IsGrowth
get

Definition at line 57 of file BaseTaskHarvest.cs.

◆ IsHarvest

bool BaseTaskHarvest.IsHarvest
get

Definition at line 51 of file BaseTaskHarvest.cs.

◆ IsTooHard

bool BaseTaskHarvest.IsTooHard
get

Definition at line 39 of file BaseTaskHarvest.cs.

40 {
41 get
42 {
44 {
45 return reqLv > toolLv;
46 }
47 return false;
48 }
49 }

Referenced by GetText(), and TaskDig.OnProgressComplete().

◆ LeftHand

override int BaseTaskHarvest.LeftHand
get

Definition at line 61 of file BaseTaskHarvest.cs.


The documentation for this class was generated from the following file: