9 public bool IsValidTarget(
Card c)
11 return c !=
null && c.trait.CanEat(this.owner);
16 public override bool LocalAct
25 public override bool CanManualCancel()
32 public override bool IsHostileAct
36 return this.target !=
null && this.target.isNPCProperty;
41 public override void OnStart()
46 public override IEnumerable<
AIAct.Status> Run()
48 if (this.target !=
null && (this.target.GetRootCard() ==
this.owner ||
this.target.parent ==
null))
50 this.owner.HoldCard(this.target, 1);
52 else if (this.target !=
null)
54 yield
return base.DoGrab(this.target, 1,
false,
null);
58 if (!this.IsValidTarget(this.owner.held))
61 if (!this.IsValidTarget(this.owner.held))
63 yield
return this.Cancel();
68 yield
return base.Do(
new AI_Cook(),
new Func<AIAct.Status>(base.KeepRunning));
69 if (!this.IsValidTarget(this.owner.held))
71 yield
return this.Cancel();
73 yield
return base.DoGotoSpot<
TraitHearth>(
new Func<
AIAct.Status>(base.KeepRunning));
76 this.target = this.owner.held;
77 if (this.target ==
null)
79 yield
return this.Cancel();
81 if (
EClass._zone.IsPCFaction && !
this.owner.IsPCParty &&
this.owner.memberType != FactionMemberType.Livestock && !
this.owner.noMove)
85 int max = (this.target.SelfWeight < 100) ? 1 : (2 + (int)Mathf.Sqrt((
float)(this.target.SelfWeight * 2 / 3)));
89 cancelWhenMoved =
false,
90 canProgress = (() => this.IsValidTarget(this.target) && this.owner.held == this.target),
91 onProgressBegin = delegate()
93 this.owner.Say(
"eat_start", this.owner, this.target.GetName(NameStyle.Full, 1),
null);
94 this.owner.PlaySound(
"eat", 1f,
true);
98 this.target.PlayAnime(AnimeID.Eat,
false);
100 if (turn == 1 && this.owner.IsPC &&
this.owner.hunger.GetPhase() == 0 && !
EClass.debug.godFood)
102 this.owner.Say(
"eat_full",
null,
null);
107 foreach (
Element element
in this.target.elements.dict.Values)
109 if (!element.source.foodEffect.IsEmpty())
111 string[] foodEffect = element.source.foodEffect;
112 if (foodEffect[0] ==
"poison" || foodEffect[0] ==
"love")
114 this.owner.Talk(
"eatWeird",
null,
null,
false);
119 CardRow refCard = this.target.refCard;
120 if (refCard !=
null && refCard.id ==
"mammoth")
122 EClass.player.forceTalk =
true;
123 this.owner.Talk(
"eatammoth",
null,
null,
false);
129 onProgressComplete = delegate()
131 if (this.owner.IsPC &&
this.owner.hunger.GetPhase() == 0 && !
EClass.debug.godFood)
133 this.owner.Say(
"eat_full",
null,
null);
136 this.owner.Say(
"eat_end", this.owner, this.target.GetName(NameStyle.Full, 1),
null);
137 this.owner.ShowEmo(Emo.happy, 0f,
true);
138 FoodEffect.Proc(this.owner, this.target.Thing);
139 this.target.ModNum(-1,
true);
141 }.SetDuration(max, 5);
142 yield
return base.Do(seq,
null);
150 public bool cook =
true;