Elin Decompiled Documentation EA 23.344.1 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)
 
int GetDNABonus (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 3 of file BaseTaskHarvest.cs.

Member Enumeration Documentation

◆ HarvestType

Enumerator
Floor 
Block 
Obj 
Thing 
Disassemble 

Definition at line 5 of file BaseTaskHarvest.cs.

Member Function Documentation

◆ CanProgress()

override bool BaseTaskHarvest.CanProgress ( )
inlinevirtual

Reimplemented from AIAct.

Reimplemented in TaskHarvest.

Definition at line 300 of file BaseTaskHarvest.cs.

301 {
302 if (tool != owner.Tool)
303 {
304 return false;
305 }
306 return base.CanProgress();
307 }
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 69 of file BaseTaskHarvest.cs.

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

Referenced by GetText().

◆ GetBestTool()

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

Definition at line 110 of file BaseTaskHarvest.cs.

111 {
113 {
114 pos = p
115 };
116 task.SetOwner(c);
117 Thing tool = null;
118 int best = 0;
119 c.things.Foreach(delegate(Thing t)
120 {
121 if (t.trait is TraitTool)
122 {
123 task.SetTarget(c, t);
124 if (task.efficiency > best)
125 {
126 best = task.efficiency;
127 tool = t;
128 }
129 }
130 });
131 return tool;
132 }
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 64 of file BaseTaskHarvest.cs.

65 {
66 return "";
67 }

Referenced by GetText().

◆ GetReqEle()

static int BaseTaskHarvest.GetReqEle ( string  _raw)
inlinestatic

Definition at line 266 of file BaseTaskHarvest.cs.

267 {
268 string[] array = _raw.Split(',');
269 return EClass.sources.elements.alias[array[0]].id;
270 }
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 79 of file BaseTaskHarvest.cs.

80 {
81 if (owner == null)
82 {
83 owner = EClass.pc;
84 }
86 string text = "tHarvest".lang(GetBaseText(str), (EClass.pc.Tool == null) ? "hand".lang() : owner.Tool.NameSimple, toolLv.ToString() ?? "");
87 if (EClass.pc.HasElement(1661))
88 {
90 switch (recipeLearnState)
91 {
92 case RecipeManager.LearnState.Learnable:
93 text = text + " " + "TaskDisassemble_newrecipe".lang();
94 break;
95 default:
96 text = text + " " + ("TaskDisassemble_" + recipeLearnState).lang();
97 break;
98 case RecipeManager.LearnState.Unavailable:
99 break;
100 }
101 }
102 text = text + " (" + GetTextDifficulty() + ")";
103 if (IsTooHard)
104 {
105 text = text.TagColor(Color.gray);
106 }
107 return text;
108 }
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:6383
static Player player
Definition: EClass.cs:13
static Chara pc
Definition: EClass.cs:15
RecipeManager recipes
Definition: Player.cs:1167
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 343 of file BaseTaskHarvest.cs.

344 {
345 return Lang.GetList("skillDiff")[difficulty];
346 }
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 74 of file BaseTaskHarvest.cs.

75 {
76 return pos.cell.GetObjName();
77 }
string GetObjName()
Definition: Cell.cs:1677
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 317 of file BaseTaskHarvest.cs.

318 {
319 switch (mat.category)
320 {
321 case "bone":
322 return new int[2] { 100, 50 };
323 case "ore":
324 case "crystal":
325 case "rock":
326 case "gem":
327 return new int[2] { 100, 25 };
328 case "organic":
329 case "skin":
330 return new int[2] { 50, 100 };
331 case "grass":
332 case "fiber":
333 case "wood":
334 return new int[2] { 25, 100 };
335 case "soil":
336 case "water":
337 return new int[2] { 100, 100 };
338 default:
339 return new int[2] { 100, 100 };
340 }
341 }

◆ GetToolEfficiency() [2/2]

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

Definition at line 272 of file BaseTaskHarvest.cs.

273 {
274 int[] toolEfficiency = GetToolEfficiency(mat);
275 _ = new int[2];
276 if (!t.HasElement(220))
277 {
278 toolEfficiency[0] = 0;
279 }
280 if (!t.HasElement(225))
281 {
282 toolEfficiency[1] = 0;
283 }
284 if (t.trait is TraitToolHammer)
285 {
286 toolEfficiency[0] = 50 + owner.Evalue(261);
287 }
288 int num = 20;
289 int[] array = toolEfficiency;
290 foreach (int num2 in array)
291 {
292 if (num2 > num)
293 {
294 num = num2;
295 }
296 }
297 return num;
298 }
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 309 of file BaseTaskHarvest.cs.

310 {
311 if (tool != owner.Tool)
312 {
314 }
315 }

References tool.

◆ SetTarget()

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

Definition at line 134 of file BaseTaskHarvest.cs.

135 {
136 if (c == null)
137 {
138 c = EClass.pc;
139 }
140 if (_tool == null)
141 {
142 _tool = c.Tool;
143 }
144 tool = _tool;
145 string[] array = null;
146 SourceMaterial.Row row = null;
147 switch (this.harvestType)
148 {
149 case HarvestType.Obj:
150 array = pos.sourceObj.reqHarvest;
151 row = (pos.cell.isObjDyed ? pos.sourceObj.DefaultMaterial : pos.cell.matObj);
152 break;
153 case HarvestType.Thing:
154 array = target.trait.ReqHarvest.Split(',');
155 row = target.material;
156 break;
157 case HarvestType.Disassemble:
158 if (target == null)
159 {
160 return;
161 }
162 array = new string[2] { "handicraft", "1" };
163 row = target.material;
164 break;
165 case HarvestType.Floor:
166 if (pos.cell.HasBridge)
167 {
168 array = pos.sourceBridge.reqHarvest;
169 row = pos.matBridge;
170 }
171 else
172 {
173 array = pos.sourceFloor.reqHarvest;
174 row = pos.matFloor;
175 }
176 break;
177 case HarvestType.Block:
178 if (pos.HasBlock)
179 {
180 array = pos.sourceBlock.reqHarvest;
181 row = pos.matBlock;
182 break;
183 }
184 array = pos.sourceFloor.reqHarvest?.Clone() as string[];
185 if (array != null && array.Length != 0)
186 {
187 array[0] = "mining";
188 }
189 row = pos.matFloor;
190 break;
191 }
192 if (array == null || array.Length < 2 || !EClass.sources.elements.alias.ContainsKey(array[0]))
193 {
194 Debug.LogWarning(string.Format("#source {0} at {1} has no valid reqHarvest 'skill,level' ({2}), using default", this.harvestType, pos, (array == null) ? "null" : string.Join(',', array)));
195 string text = this.harvestType switch
196 {
197 HarvestType.Obj => "gathering",
198 HarvestType.Floor => "digging",
199 _ => "mining",
200 };
201 array = new string[2] { text, "1" };
202 }
203 matHardness = row.hardness;
204 if (this.harvestType == HarvestType.Obj)
205 {
206 matHardness = matHardness * ((pos.growth != null) ? pos.growth.GetHp() : pos.sourceObj.hp) / 100;
207 }
208 if (row.tag.Contains("hard"))
209 {
210 matHardness *= 3;
211 }
213 if ((uint)harvestType <= 1u && row.id == 0)
214 {
215 matHardness *= 100;
216 }
217 idEle = (IsHarvest ? 250 : EClass.sources.elements.alias[array[0]].id);
219 int num = array[1].ToInt();
220 reqLv = matHardness + num;
221 isToolRequired = ((!IsHarvest && idEle != 250) ? true : false);
222 toolLv = 0;
223 if (tool != null)
224 {
225 int num2 = ((idEle == 220 || idEle == 225) ? GetToolEfficiency(tool, row) : 100);
226 toolLv += tool.material.hardness * num2 / 100;
227 toolLv += (int)(tool.encLV + tool.blessedState);
228 }
229 toolLv += c.Evalue(idEle) * 3 / 2;
230 if (toolLv < 0)
231 {
232 toolLv = 1;
233 }
234 efficiency = (toolLv + 5) * 100 / ((reqLv + 5) * 140 / 100);
235 if (efficiency < 50)
236 {
237 efficiency = 50;
238 }
239 if (IsTooHard)
240 {
241 difficulty = 3;
242 }
243 else if (efficiency > 150)
244 {
245 difficulty = 0;
246 }
247 else if (efficiency > 100)
248 {
249 difficulty = 1;
250 }
251 else
252 {
253 difficulty = 2;
254 }
256 if (this.harvestType == HarvestType.Obj && IsHarvest && plantData != null && plantData.size > 0)
257 {
258 maxProgress = (int)Mathf.Clamp(Rand.Range(8f, 10f) * (float)(100 + plantData.size * 100 + plantData.size * plantData.size * 30) / (float)efficiency, 2f, 1000f);
259 }
260 else
261 {
262 maxProgress = (int)Mathf.Clamp(Rand.Range(8f, 16f) * 100f / (float)efficiency, 2f, 30f);
263 }
264 }
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:715
SourceMaterial.Row matObj
Definition: Cell.cs:1082
static Map _map
Definition: EClass.cs:19
static Element Create(int id, int v=0)
Definition: ELEMENT.cs:1163
virtual int GetHp()
Definition: GrowSystem.cs:730
PlantData TryGetPlant(Point p)
Definition: Map.cs:2082
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(), Debug, 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 30 of file BaseTaskHarvest.cs.

Referenced by TaskHarvest.OnCreateProgress().

◆ effectFrame

int BaseTaskHarvest.effectFrame = 1

Definition at line 32 of file BaseTaskHarvest.cs.

Referenced by TaskHarvest.OnCreateProgress().

◆ efficiency

int BaseTaskHarvest.efficiency

Definition at line 28 of file BaseTaskHarvest.cs.

◆ idEle

int BaseTaskHarvest.idEle

Definition at line 20 of file BaseTaskHarvest.cs.

Referenced by TaskHarvest.OnCreateProgress().

◆ isToolRequired

bool BaseTaskHarvest.isToolRequired

Definition at line 34 of file BaseTaskHarvest.cs.

◆ matHardness

int BaseTaskHarvest.matHardness

Definition at line 18 of file BaseTaskHarvest.cs.

◆ maxProgress

int BaseTaskHarvest.maxProgress

◆ reqElement

Element BaseTaskHarvest.reqElement

Definition at line 16 of file BaseTaskHarvest.cs.

◆ reqLv

int BaseTaskHarvest.reqLv

Definition at line 22 of file BaseTaskHarvest.cs.

◆ target

◆ tool

Thing BaseTaskHarvest.tool

Definition at line 36 of file BaseTaskHarvest.cs.

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

◆ toolLv

int BaseTaskHarvest.toolLv

Definition at line 24 of file BaseTaskHarvest.cs.

Referenced by GetText().

Property Documentation

◆ CanPressRepeat

override bool BaseTaskHarvest.CanPressRepeat
get

Definition at line 58 of file BaseTaskHarvest.cs.

◆ CanReapSeed

virtual bool BaseTaskHarvest.CanReapSeed
get

Definition at line 52 of file BaseTaskHarvest.cs.

◆ CursorIcon

override CursorInfo BaseTaskHarvest.CursorIcon
get

Definition at line 62 of file BaseTaskHarvest.cs.

◆ harvestType

virtual HarvestType BaseTaskHarvest.harvestType
get

Definition at line 54 of file BaseTaskHarvest.cs.

◆ IsGrowth

virtual bool BaseTaskHarvest.IsGrowth
get

Definition at line 56 of file BaseTaskHarvest.cs.

◆ IsHarvest

bool BaseTaskHarvest.IsHarvest
get

Definition at line 50 of file BaseTaskHarvest.cs.

◆ IsTooHard

bool BaseTaskHarvest.IsTooHard
get

Definition at line 38 of file BaseTaskHarvest.cs.

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

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

◆ LeftHand

override int BaseTaskHarvest.LeftHand
get

Definition at line 60 of file BaseTaskHarvest.cs.


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