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

Public Member Functions

override bool CanManualCancel ()
 
override string GetBaseText (string str)
 
override string GetTextSmall (Card c)
 
override bool CanProgress ()
 
override HitResult GetHitResult ()
 
override void OnCreateProgress (Progress_Custom p)
 
string GetIdDismantled ()
 
bool ShouldGenerateDismantled (string dest)
 
bool HaveHarvestThing ()
 
void HarvestThing ()
 
- Public Member Functions inherited from BaseTaskHarvest
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 ()
 
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 ()
 
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 ()
 
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, 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 ()
 
virtual bool CanPerform ()
 
bool Perform (Chara _cc, Card _tc=null, Point _tp=null)
 
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 int GetSourceValue (int 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)
 
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)
 
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 TaskHarvest TryGetAct (Chara c, Point p)
 
- Static Public Member Functions inherited from BaseTaskHarvest
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)
 
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 int GetResistDamage (int dmg, int v, int power=0)
 
- Static Public Member Functions inherited from EClass
static int rnd (int a)
 
static int curve (int a, int start, int step, int rate=75)
 
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

bool wasReapSeed
 
bool wasCrime
 
bool harvestingCrop
 
HarvestType mode = HarvestType.Obj
 
- Public Attributes inherited from BaseTaskHarvest
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 IsObj [get]
 
bool IsReapSeed [get]
 
override HarvestType harvestType [get]
 
override int RightHand [get]
 
override int destDist [get]
 
override bool IsGrowth [get]
 
override bool IsHostileAct [get]
 
- Properties inherited from BaseTaskHarvest
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 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]
 
virtual bool IsCrime [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

- Public Types inherited from BaseTaskHarvest
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 }
 
- 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 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 TaskHarvest.cs.

Member Function Documentation

◆ CanManualCancel()

override bool TaskHarvest.CanManualCancel ( )
inlinevirtual

Reimplemented from AIAct.

Definition at line 73 of file TaskHarvest.cs.

74 {
75 return true;
76 }

◆ CanProgress()

override bool TaskHarvest.CanProgress ( )
inlinevirtual

Reimplemented from BaseTaskHarvest.

Definition at line 192 of file TaskHarvest.cs.

193 {
194 if (tool != null && tool.trait is TraitToolSickle && !pos.cell.CanReapSeed())
195 {
196 return false;
197 }
198 if (IsObj)
199 {
201 if (base.CanProgress())
202 {
203 return pos.HasObj;
204 }
205 return false;
206 }
207 if (target == null || !target.ExistsOnMap)
208 {
209 return false;
210 }
211 return base.CanProgress();
212 }
new Chara owner
Definition: AIAct.cs:14
void SetTarget(Chara c, Thing _tool=null)
bool ExistsOnMap
Definition: Card.cs:1961
Trait trait
Definition: Card.cs:49
bool CanReapSeed()
Definition: Cell.cs:1665
Definition: EClass.cs:5
static Chara pc
Definition: EClass.cs:14
bool HasObj
Definition: Point.cs:137
Cell cell
Definition: Point.cs:51
Point pos
Definition: TaskPoint.cs:11

References Cell.CanReapSeed(), Point.cell, Card.ExistsOnMap, Point.HasObj, IsObj, AIAct.owner, EClass.pc, TaskPoint.pos, BaseTaskHarvest.SetTarget(), BaseTaskHarvest.target, BaseTaskHarvest.tool, and Card.trait.

◆ GetBaseText()

override string TaskHarvest.GetBaseText ( string  str)
inlinevirtual

Reimplemented from BaseTaskHarvest.

Definition at line 78 of file TaskHarvest.cs.

79 {
80 if (IsReapSeed)
81 {
82 return "TaskHarvestSeed".lang();
83 }
84 if (mode == HarvestType.Disassemble)
85 {
86 string text = (HaveHarvestThing() ? "TaskDisassemble" : "TaskDisassemble_destroy").lang();
87 string idRecipe = (IsObj ? pos.sourceObj.RecipeID : ((target != null) ? target.source.RecipeID : ""));
89 {
90 text = text + " " + "TaskDisassemble_newrecipe".lang();
91 }
92 return text;
93 }
94 if (!base.IsHarvest)
95 {
96 return base.GetBaseText(str);
97 }
98 return "actHarvest".lang();
99 }
bool enable
Definition: CoreDebug.cs:285
static Player player
Definition: EClass.cs:12
static CoreDebug debug
Definition: EClass.cs:48
RecipeManager recipes
Definition: Player.cs:898
bool CanCeomUpWithRecipe(string idRecipe)
bool HaveHarvestThing()
Definition: TaskHarvest.cs:499
HarvestType mode
Definition: TaskHarvest.cs:11
bool IsReapSeed
Definition: TaskHarvest.cs:16
SourceThing.Row source
Definition: Thing.cs:11

References RecipeManager.CanCeomUpWithRecipe(), EClass.debug, CoreDebug.enable, HaveHarvestThing(), IsObj, IsReapSeed, mode, EClass.player, Player.recipes, Thing.source, and BaseTaskHarvest.target.

◆ GetHitResult()

override HitResult TaskHarvest.GetHitResult ( )
inlinevirtual

Reimplemented from Task.

Definition at line 214 of file TaskHarvest.cs.

215 {
216 if (harvestingCrop && !base.IsHarvest)
217 {
218 return HitResult.Default;
219 }
220 if (IsObj)
221 {
222 if (base.IsHarvest)
223 {
224 return HitResult.Valid;
225 }
226 if (pos.HasObj)
227 {
228 return HitResult.Valid;
229 }
231 {
232 return HitResult.Valid;
233 }
234 return HitResult.Default;
235 }
236 if (target == null || !target.ExistsOnMap)
237 {
238 return HitResult.Default;
239 }
240 return HitResult.Valid;
241 }
HitResult
Definition: HitResult.cs:2
static BuildMenu Instance
Definition: BuildMenu.cs:77
bool godBuild
Definition: CoreDebug.cs:303
bool HasDecal
Definition: Point.cs:139
bool harvestingCrop
Definition: TaskHarvest.cs:9

References EClass.debug, Card.ExistsOnMap, CoreDebug.godBuild, harvestingCrop, Point.HasDecal, Point.HasObj, BuildMenu.Instance, IsObj, TaskPoint.pos, and BaseTaskHarvest.target.

◆ GetIdDismantled()

string TaskHarvest.GetIdDismantled ( )
inline

Definition at line 468 of file TaskHarvest.cs.

469 {
470 string result = target.source.components[0].Split('|')[0].Split('/')[0];
472 {
473 result = target.material.thing;
474 }
475 return result;
476 }
SourceMaterial.Row material
Definition: Card.cs:1927
bool IsEquipmentOrRangedOrAmmo
Definition: Card.cs:2090

References Card.IsEquipmentOrRangedOrAmmo, Card.material, Thing.source, and BaseTaskHarvest.target.

Referenced by HarvestThing(), and HaveHarvestThing().

◆ GetTextSmall()

override string TaskHarvest.GetTextSmall ( Card  c)
inlinevirtual

Reimplemented from BaseTaskHarvest.

Definition at line 101 of file TaskHarvest.cs.

102 {
103 if (IsObj)
104 {
105 return base.GetTextSmall(c);
106 }
107 if (target == null)
108 {
109 return "";
110 }
111 return target.Name;
112 }
string Name
Definition: Card.cs:2013

References IsObj, Card.Name, and BaseTaskHarvest.target.

◆ HarvestThing()

void TaskHarvest.HarvestThing ( )
inline

Definition at line 505 of file TaskHarvest.cs.

506 {
507 string text = GetIdDismantled();
508 float num = target.Num;
509 float num2 = 1.0999999f;
510 if (text == "log" || text == "rock")
511 {
512 num2 = 2.1999998f;
513 }
514 string text2 = target.id;
515 if (text2 == "glass" || text2 == "brick")
516 {
517 num2 = 2.1999998f;
518 }
519 if (target.trait is TraitAmmo)
520 {
521 num2 = 50f;
522 }
523 float num3 = num % num2;
524 num /= num2;
525 Debug.Log("num:" + num + " div:" + num3 + " chance:" + num2 + " check:" + (num2 - num3 + 1f));
526 if (num3 > 0f && EClass.rndf(num2 - num3 + 1f) < 1f)
527 {
528 num += 1f;
529 }
530 if (target.sockets != null)
531 {
533 }
534 int decay = target.decay;
535 int lV = target.LV;
536 target.Die(null, EClass.pc);
537 if ((int)num <= 0 || !ShouldGenerateDismantled(text))
538 {
539 return;
540 }
541 if (target.isCopy)
542 {
543 text = "ash3";
544 }
546 {
547 fixedQuality = true
548 });
549 Thing thing = ThingGen.Create(text, 1, Mathf.Max(1, lV * 2 / 3));
550 if (thing != null)
551 {
552 thing.SetNum((int)num);
554 thing.decay = decay;
555 if (thing.IsDecayed && thing.IsFood)
556 {
557 thing.elements.SetBase(73, -10);
558 }
560 }
561 }
static void Set(CardBlueprint _bp)
bool IsDecayed
Definition: Card.cs:2147
ElementContainerCard elements
Definition: Card.cs:37
string id
Definition: Card.cs:31
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:2838
bool isCopy
Definition: Card.cs:850
void EjectSockets()
Definition: Card.cs:3323
Thing SetNum(int a)
Definition: Card.cs:3242
virtual void Die(Element e=null, Card origin=null, AttackSource attackSource=AttackSource.None)
Definition: Card.cs:4471
int decay
Definition: Card.cs:202
bool IsFood
Definition: Card.cs:2051
Point pos
Definition: Card.cs:55
int Num
Definition: Card.cs:154
List< int > sockets
Definition: Card.cs:43
int LV
Definition: Card.cs:370
static Map _map
Definition: EClass.cs:18
static float rndf(float a)
Definition: EClass.cs:79
Element SetBase(string alias, int v, int potential=0)
void TrySmoothPick(Cell cell, Thing t, Chara c)
Definition: Map.cs:1791
bool IsBlocked
Definition: Point.cs:339
string GetIdDismantled()
Definition: TaskHarvest.cs:468
bool ShouldGenerateDismantled(string dest)
Definition: TaskHarvest.cs:478
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Definition: Thing.cs:8

References EClass._map, Card.ChangeMaterial(), ThingGen.Create(), Debug, Card.decay, Card.Die(), Card.EjectSockets(), Card.elements, GetIdDismantled(), Card.id, Point.IsBlocked, Card.isCopy, Card.IsDecayed, Card.IsFood, Card.LV, Card.material, Card.Num, AIAct.owner, EClass.pc, Card.pos, TaskPoint.pos, EClass.rndf(), CardBlueprint.Set(), ElementContainer.SetBase(), Card.SetNum(), ShouldGenerateDismantled(), Card.sockets, BaseTaskHarvest.target, Card.trait, and Map.TrySmoothPick().

Referenced by OnCreateProgress().

◆ HaveHarvestThing()

bool TaskHarvest.HaveHarvestThing ( )
inline

Definition at line 499 of file TaskHarvest.cs.

500 {
501 string idDismantled = GetIdDismantled();
502 return ShouldGenerateDismantled(idDismantled);
503 }

References GetIdDismantled(), and ShouldGenerateDismantled().

Referenced by GetBaseText().

◆ OnCreateProgress()

override void TaskHarvest.OnCreateProgress ( Progress_Custom  p)
inlinevirtual

Reimplemented from AIAct.

Definition at line 243 of file TaskHarvest.cs.

244 {
246 string i = (IsObj ? pos.cell.GetObjName() : target.Name);
247 SourceMaterial.Row mat = (IsObj ? pos.cell.matObj : target.material);
248 GrowSystem growth = pos.growth;
249 float num = (base.IsHarvest ? 0.5f : ((!IsObj) ? 1f : ((growth != null) ? growth.MtpProgress : 1f)));
250 int exp = 50;
253 p.textHint = i;
254 p.maxProgress = (int)((float)(maxProgress * 150) * num / 100f);
255 p.interval = 1;
256 p.onProgressBegin = delegate
257 {
258 if (TryGetAct(owner, pos) == null)
259 {
260 p.Cancel();
261 }
262 else if (base.IsTooHard)
263 {
264 owner.Say((mode == HarvestType.Disassemble) ? "tooHardToDisassemble" : "tooHardToHarvest", owner, i);
265 p.Cancel();
266 }
267 else if (mode == HarvestType.Disassemble)
268 {
269 owner.Say("disassemble_start", owner, owner.Tool, i);
270 }
271 else if (owner.Tool == null)
272 {
273 owner.Say("harvestHand_start", owner, i);
274 }
275 else
276 {
277 owner.Say("harvest_start", owner, owner.Tool, i);
278 }
279 };
280 p.onProgress = delegate(Progress_Custom _p)
281 {
284 if (_p.progress % 2 == 0)
285 {
286 if (IsObj)
287 {
288 if (base.IsHarvest && growth != null)
289 {
291 if (growth.AnimeProgress != 0)
292 {
293 pos.Animate(growth.AnimeProgress);
294 }
295 return;
296 }
297 pos.Animate(AnimeID.HitObj);
298 }
299 else
300 {
301 target.PlayAnime(AnimeID.HitObj);
302 }
304 mat.PlayHitEffect(pos);
305 mat.AddBlood(pos);
306 effectFrame += maxProgress / 4 + 1;
307 if (EClass._zone.IsCrime(owner, this))
308 {
310 }
311 }
312 };
313 p.onProgressComplete = delegate
314 {
315 string idRecipe = (IsObj ? pos.sourceObj.RecipeID : ((target != null) ? target.source.RecipeID : ""));
317 int num2 = ((EClass.rnd(3) != 0) ? 1 : 0);
318 if (IsObj)
319 {
320 SourceObj.Row sourceObj = pos.sourceObj;
321 bool flag = false;
322 if (difficulty >= 0 && EClass.rnd(6) == 0)
323 {
324 flag = true;
325 }
326 if (difficulty >= 2 && EClass.rnd(3) == 0)
327 {
328 flag = true;
329 }
330 if (flag && growth != null)
331 {
332 growth.OnHitFail(owner);
333 }
334 if (EClass._zone is Zone_Harvest && !base.IsHarvest && pos.IsFarmField)
335 {
337 pos.SetObj();
338 }
339 else
340 {
341 if (base.IsHarvest && !IsReapSeed)
342 {
343 if (pos.growth.CanHarvest())
344 {
345 harvestingCrop = true;
346 }
348 }
349 else if (growth != null && !IsReapSeed)
350 {
352 }
353 else
354 {
355 EClass._map.MineObj(pos, this);
356 }
357 if (sourceObj.alias == "mound")
358 {
359 if (EClass.rnd(7) == 0)
360 {
361 EClass._zone.AddThing("plat", pos);
362 }
363 else if (EClass.rnd(3) == 0)
364 {
366 }
367 else
368 {
369 EClass._zone.AddThing("bone", pos);
370 }
371 }
372 }
373 }
374 else
375 {
376 exp = target.Num * 5;
377 num2 = target.Num / 3 + EClass.rnd(target.Num / 3 + 2);
379 {
380 HarvestThing();
381 }
382 }
383 if (EClass._zone.IsCrime(owner, this) && EClass.rnd(3) != 0)
384 {
386 }
387 if (backerObj != null)
388 {
389 if (backerObj != null && !backerObj.loot.IsEmpty() && !EClass.player.doneBackers.Contains(backerObj.id))
390 {
391 if (EClass.sources.cards.map.ContainsKey(backerObj.loot))
392 {
393 Thing thing = ThingGen.Create(backerObj.loot);
394 switch (backerObj.id)
395 {
396 case 490:
397 case 867:
398 case 5160:
399 thing.c_charges = 0;
400 thing.c_priceFix = -100;
401 break;
402 case 2531:
403 thing.MakeFoodFrom("cloud_electric");
404 break;
405 case 1027:
406 thing.ChangeMaterial(25);
407 thing.SetBlessedState(BlessedState.Doomed);
408 thing.ChangeRarity(Rarity.Legendary);
409 break;
410 case 4565:
411 EClass._zone.AddThing("rod", pos);
412 EClass._zone.AddThing("money", pos).SetNum(121);
413 break;
414 case 5367:
415 thing.Dye("obsidian");
416 break;
417 case 471:
418 case 1828:
419 case 5765:
420 thing.SetBlessedState(BlessedState.Cursed);
421 break;
422 case 5529:
423 thing.ChangeMaterial(25);
424 break;
425 case 1854:
426 thing.decay = 10000;
427 break;
428 case 4788:
429 thing.SetEncLv(1);
430 break;
431 case 4615:
432 thing.ChangeMaterial("meat");
433 break;
434 }
435 EClass._zone.AddCard(thing, pos);
436 }
437 else
438 {
439 Debug.LogError("exception: Backer Loot not valid:" + backerObj.id + "/" + backerObj.loot);
440 }
441 Debug.Log(backerObj.id + "/" + backerObj.Name + "/" + backerObj.loot);
442 }
443 EClass.player.doneBackers.Add(backerObj.id);
444 if (!backerObj.Text.IsEmpty() && EClass.core.config.backer.Show(backerObj))
445 {
446 bool num3 = backerObj.type == 1;
447 Msg.Say(num3 ? "backerRemain_read" : "backerTree_read");
448 Msg.Say(num3 ? "backerRemain" : "backerTree", backerObj.Text);
449 }
450 }
451 if (owner.IsPC)
452 {
454 }
456 if (wasReapSeed)
457 {
458 owner.ModExp(286, 20);
459 }
460 owner.stamina.Mod(-num2);
461 if (owner != null && owner.IsPC)
462 {
464 }
465 };
466 }
AnimeID
Definition: AnimeID.cs:2
BlessedState
Definition: BlessedState.cs:2
Rarity
Definition: Rarity.cs:2
virtual Status Cancel()
Definition: AIAct.cs:291
int progress
Definition: AIProgress.cs:5
virtual void NextFrame()
bool isNPCProperty
Definition: Card.cs:526
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:5404
Thing Tool
Definition: Card.cs:2270
void CalculateFOV()
Definition: Card.cs:5728
virtual void SetBlessedState(BlessedState s)
Definition: Card.cs:3572
void Dye(string idMat)
Definition: Card.cs:5267
void SetEncLv(int a)
Definition: Card.cs:3567
Card MakeFoodFrom(string _id)
Definition: Card.cs:4918
void ModExp(string alias, int a)
Definition: Card.cs:2508
void PlayAnime(AnimeID id, bool force=false)
Definition: Card.cs:5423
virtual void ChangeRarity(Rarity q)
Definition: Card.cs:3597
CardRenderer renderer
Definition: Card.cs:57
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6046
string GetObjName()
Definition: Cell.cs:1600
override bool IsPC
Definition: Chara.cs:597
Stats stamina
Definition: Chara.cs:955
override void LookAt(Card c)
Definition: Chara.cs:3219
BackerContentConfig backer
Definition: CoreConfig.cs:600
CoreConfig config
Definition: Core.cs:70
static Game game
Definition: EClass.cs:8
static int rnd(int a)
Definition: EClass.cs:50
static Core core
Definition: EClass.cs:6
static Zone _zone
Definition: EClass.cs:20
static SourceManager sources
Definition: EClass.cs:42
void ModExp(int ele, int a, bool chain=false)
bool disableUsermapBenefit
GamePrincipal principal
Definition: Game.cs:221
bool CanHarvest()
Definition: GrowSystem.cs:482
virtual AnimeID AnimeProgress
Definition: GrowSystem.cs:95
virtual void OnHitFail(Chara c)
Definition: GrowSystem.cs:500
void OnProgressComplete(Chara c)
Definition: GrowSystem.cs:504
virtual string GetSoundProgress()
Definition: GrowSystem.cs:121
void Harvest(Chara c)
Definition: GrowSystem.cs:599
void DestroyObj(Point point)
Definition: Map.cs:1812
void MineObj(Point point, Task task=null, Chara c=null)
Definition: Map.cs:1827
SourceBacker.Row GetBackerObj(Point p)
Definition: Map.cs:1579
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
void ModKarma(int a)
Definition: Player.cs:2289
HashSet< int > doneBackers
Definition: Player.cs:874
void SetObj(int id=0, int value=1, int dir=0)
Definition: Point.cs:892
bool IsFarmField
Definition: Point.cs:127
SoundSource PlaySound(string id, bool synced=true, float v=1f, bool spatial=true)
Definition: Point.cs:1217
SourceObj.Row sourceObj
Definition: Point.cs:69
bool TryWitnessCrime(Chara criminal, Chara target=null, int radius=4, Func< Chara, bool > funcWitness=null)
Definition: Point.cs:845
void Animate(AnimeID id, bool animeBlock=false)
Definition: Point.cs:1266
GrowSystem growth
Definition: Point.cs:77
void ComeUpWithRecipe(string idRecipe, int chanceForRandomRecipe=0)
Dictionary< string, CardRow > map
Definition: SourceCard.cs:8
SourceCard cards
string GetSoundImpact(RenderRow c=null)
void AddBlood(Point p, int a=1)
void PlayHitEffect(Point p, int emit=2)
virtual void Mod(int a)
Definition: Stats.cs:135
bool wasReapSeed
Definition: TaskHarvest.cs:5
override bool IsHostileAct
Definition: TaskHarvest.cs:40
void HarvestThing()
Definition: TaskHarvest.cs:505
bool wasCrime
Definition: TaskHarvest.cs:7
static TaskHarvest TryGetAct(Chara c, Point p)
Definition: TaskHarvest.cs:114
static Thing CreateFromCategory(string idCat, int lv=-1)
Definition: ThingGen.cs:75
string alias
Definition: TileRow.cs:12
Card AddThing(string id, int x, int z)
Definition: Zone.cs:1883
virtual bool IsUserZone
Definition: Zone.cs:264
bool IsCrime(Chara c, Act act)
Definition: Zone.cs:3259
Card AddCard(Card t, Point point)
Definition: Zone.cs:1893

References EClass._map, EClass._zone, SourceMaterial.Row.AddBlood(), Zone.AddCard(), Zone.AddThing(), TileRow.alias, Point.Animate(), GrowSystem.AnimeProgress, CoreConfig.backer, Card.CalculateFOV(), AIAct.Cancel(), GrowSystem.CanHarvest(), SourceManager.cards, Point.cell, Card.ChangeMaterial(), Card.ChangeRarity(), RecipeManager.ComeUpWithRecipe(), Core.config, EClass.core, ThingGen.Create(), ThingGen.CreateFromCategory(), Debug, Map.DestroyObj(), BaseTaskHarvest.difficulty, GamePrincipal.disableUsermapBenefit, Player.doneBackers, Card.Dye(), BaseTaskHarvest.effectFrame, Card.elements, EClass.game, Map.GetBackerObj(), Cell.GetObjName(), SourceMaterial.Row.GetSoundImpact(), GrowSystem.GetSoundProgress(), Point.growth, GrowSystem.Harvest(), harvestingCrop, HarvestThing(), SourceBacker.Row.id, BaseTaskHarvest.idEle, Zone.IsCrime(), Point.IsFarmField, IsHostileAct, Card.isNPCProperty, IsObj, Chara.IsPC, IsReapSeed, Zone.IsUserZone, Chara.LookAt(), SourceBacker.Row.loot, Card.MakeFoodFrom(), SourceCard.map, Card.material, BaseTaskHarvest.maxProgress, Map.MineObj(), Stats.Mod(), mode, ElementContainer.ModExp(), Card.ModExp(), Player.ModKarma(), Card.Name, SourceBacker.Row.Name, CardRenderer.NextFrame(), Card.Num, GrowSystem.OnHitFail(), GrowSystem.OnProgressComplete(), AIAct.owner, EClass.pc, Card.PlayAnime(), EClass.player, SourceMaterial.Row.PlayHitEffect(), Point.PlaySound(), Card.PlaySound(), Card.pos, TaskPoint.pos, Game.principal, AIProgress.progress, Player.recipes, Card.renderer, EClass.rnd(), Msg.Say(), Card.Say(), Card.SetBlessedState(), Card.SetEncLv(), Card.SetNum(), Point.SetObj(), BaseTaskHarvest.SetTarget(), CoreConfig.BackerContentConfig.Show(), Thing.source, Point.sourceObj, EClass.sources, Chara.stamina, BaseTaskHarvest.target, SourceBacker.Row.Text, Card.Tool, TryGetAct(), Point.TryWitnessCrime(), wasCrime, and wasReapSeed.

◆ ShouldGenerateDismantled()

bool TaskHarvest.ShouldGenerateDismantled ( string  dest)
inline

Definition at line 478 of file TaskHarvest.cs.

479 {
480 if (target.trait is TraitGrave)
481 {
482 return false;
483 }
484 if (dest.Contains("$") || dest.Contains("#") || dest.Contains("@") || dest.Contains("-"))
485 {
486 return false;
487 }
488 if (dest == target.id || !EClass.sources.cards.map.ContainsKey(dest))
489 {
490 return false;
491 }
492 if (target.source.components.IsEmpty())
493 {
494 return false;
495 }
496 return true;
497 }

References SourceManager.cards, Card.id, SourceCard.map, Thing.source, EClass.sources, BaseTaskHarvest.target, and Card.trait.

Referenced by HarvestThing(), and HaveHarvestThing().

◆ TryGetAct()

static TaskHarvest TaskHarvest.TryGetAct ( Chara  c,
Point  p 
)
inlinestatic

Definition at line 114 of file TaskHarvest.cs.

115 {
116 Thing t = c.Tool;
117 bool hasTool = t != null && (t.HasElement(225) || t.HasElement(220));
118 bool hasDiggingTool = t != null && t.HasElement(230);
119 if (t != null)
120 {
121 if (t.trait is TraitToolShears)
122 {
123 return null;
124 }
125 if (t.trait is TraitToolWaterCan)
126 {
127 return null;
128 }
129 if (t.trait is TraitToolMusic)
130 {
131 return null;
132 }
133 if (t.trait is TraitToolSickle && !p.cell.CanReapSeed())
134 {
135 return null;
136 }
137 }
138 if (p.HasObj && IsValidTarget(p.sourceObj.reqHarvest))
139 {
140 return new TaskHarvest
141 {
142 pos = p.Copy()
143 };
144 }
145 if (p.HasThing)
146 {
147 for (int num = p.Things.Count - 1; num >= 0; num--)
148 {
149 t = p.Things[num];
150 if (t.trait.ReqHarvest != null && IsValidTarget(t.trait.ReqHarvest.Split(',')))
151 {
152 return new TaskHarvest
153 {
154 pos = p.Copy(),
155 mode = HarvestType.Thing,
156 target = t
157 };
158 }
159 }
160 for (int num2 = p.Things.Count - 1; num2 >= 0; num2--)
161 {
162 t = p.Things[num2];
164 {
165 return new TaskHarvest
166 {
167 pos = p.Copy(),
168 mode = HarvestType.Disassemble,
169 target = t
170 };
171 }
172 }
173 }
174 return null;
175 bool IsValidTarget(string[] raw)
176 {
177 if (raw[0] == "digging")
178 {
179 return hasDiggingTool;
180 }
181 bool num3 = p.cell.CanHarvest();
182 int num4 = (num3 ? 250 : EClass.sources.elements.alias[raw[0]].id);
183 bool flag = ((!num3 && num4 != 250) ? true : false);
184 if (!flag && t != null && !t.trait.CanHarvest)
185 {
186 return false;
187 }
188 return !flag || hasTool;
189 }
190 }
bool isMasked
Definition: Card.cs:562
bool HasElement(int ele, int req=1)
Definition: Card.cs:5214
bool isHidden
Definition: Card.cs:502
bool CanHarvest()
Definition: Cell.cs:1660
Point Copy()
Definition: Point.cs:467
List< Thing > Things
Definition: Point.cs:314
bool HasThing
Definition: Point.cs:239
SourceElement elements
virtual bool CanHarvest
Definition: Trait.cs:86
virtual bool CanBeDisassembled
Definition: Trait.cs:294
virtual string ReqHarvest
Definition: Trait.cs:291

References Trait.CanBeDisassembled, Cell.CanHarvest(), Trait.CanHarvest, Cell.CanReapSeed(), Point.cell, Point.Copy(), SourceManager.elements, Card.HasElement(), Point.HasObj, Point.HasThing, Card.isHidden, Card.isMasked, mode, TaskPoint.pos, Trait.ReqHarvest, Point.sourceObj, EClass.sources, BaseTaskHarvest.target, Point.Things, Card.Tool, and Card.trait.

Referenced by OnCreateProgress(), and HotItemHeld.TrySetToolAct().

Member Data Documentation

◆ harvestingCrop

bool TaskHarvest.harvestingCrop

Definition at line 9 of file TaskHarvest.cs.

Referenced by GetHitResult(), and OnCreateProgress().

◆ mode

HarvestType TaskHarvest.mode = HarvestType.Obj

Definition at line 11 of file TaskHarvest.cs.

Referenced by GetBaseText(), OnCreateProgress(), and TryGetAct().

◆ wasCrime

bool TaskHarvest.wasCrime

Definition at line 7 of file TaskHarvest.cs.

Referenced by OnCreateProgress().

◆ wasReapSeed

bool TaskHarvest.wasReapSeed

Definition at line 5 of file TaskHarvest.cs.

Referenced by OnCreateProgress().

Property Documentation

◆ destDist

override int TaskHarvest.destDist
get

Definition at line 35 of file TaskHarvest.cs.

◆ harvestType

override HarvestType TaskHarvest.harvestType
get

Definition at line 31 of file TaskHarvest.cs.

◆ IsGrowth

override bool TaskHarvest.IsGrowth
get

Definition at line 37 of file TaskHarvest.cs.

◆ IsHostileAct

override bool TaskHarvest.IsHostileAct
get

Definition at line 39 of file TaskHarvest.cs.

40 {
41 get
42 {
43 if (!wasCrime)
44 {
45 if (mode == HarvestType.Disassemble)
46 {
47 Thing thing = target;
48 if (thing != null && thing.isNPCProperty)
49 {
50 goto IL_007b;
51 }
52 }
53 if (mode == HarvestType.Obj)
54 {
55 if (!pos.sourceObj.ContainsTag("crime"))
56 {
57 if (pos.growth != null && pos.growth.IsCrimeToHarvest)
58 {
59 return !(EClass._zone is Zone_Harvest);
60 }
61 return false;
62 }
63 return true;
64 }
65 return false;
66 }
67 goto IL_007b;
68 IL_007b:
69 return true;
70 }
71 }
virtual bool IsCrimeToHarvest
Definition: GrowSystem.cs:89

Referenced by OnCreateProgress().

◆ IsObj

bool TaskHarvest.IsObj
get

Definition at line 13 of file TaskHarvest.cs.

Referenced by CanProgress(), GetBaseText(), GetHitResult(), GetTextSmall(), and OnCreateProgress().

◆ IsReapSeed

bool TaskHarvest.IsReapSeed
get

Definition at line 15 of file TaskHarvest.cs.

16 {
17 get
18 {
19 if (IsObj && CanReapSeed && owner.Tool != null)
20 {
22 {
23 return owner.Tool.category.IsChildOf("scythe");
24 }
25 return true;
26 }
27 return false;
28 }
29 }
virtual bool CanReapSeed
SourceCategory.Row category
Definition: Card.cs:1925

Referenced by GetBaseText(), and OnCreateProgress().

◆ RightHand

override int TaskHarvest.RightHand
get

Definition at line 33 of file TaskHarvest.cs.


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