9 public override bool CanPressRepeat
29 public override int PerformDistance
38 public override bool CanPerform()
40 if (this.pcTarget !=
null && this.pcTarget.ExistsOnMap)
42 Act.TP.Set(this.pcTarget.pos);
44 return !Act.TP.IsHidden &&
Act.CC.CanSeeLos(
Act.TP, -1);
48 public override bool Perform()
50 if (this.target ==
null)
52 this.target = (Act.TC as
Thing);
54 if (this.target ==
null || this.target.isDestroyed ||
this.target.GetRootCard() !=
Act.CC)
58 if (this.pcTarget !=
null)
60 if (!this.pcTarget.ExistsOnMap)
64 Act.TP.Set(this.pcTarget.pos);
66 ActThrow.Throw(
Act.CC,
Act.TP,
this.target.HasElement(410, 1) ?
this.target :
this.target.Split(1), ThrowMethod.Default, 0f);
77 if (t.c_isImportant && !t.HasElement(410, 1))
81 if (p ==
null && target !=
null && target.ExistsOnMap)
85 return p !=
null && (!p.HasBlock || p.cell.hasDoor || !p.sourceBlock.tileType.IsBlockPass) && !p.Equals(
EClass.pc.pos) && !t.trait.CanExtendBuild && !t.trait.CanOnlyCarry;
91 if (failChance >
EClass.rndf(1f))
93 Point randomPoint = p.GetRandomPoint(1,
true,
true,
false, 100);
94 if (randomPoint !=
null && !randomPoint.Equals(c.pos))
99 return ActThrow.Throw(c, p, p.FindAttackTarget(), t, method);
105 if (t.parent !=
EClass._zone && !t.HasElement(410, 1))
107 EClass._zone.AddCard(t, c.pos).KillAnime();
111 if (t.trait.ThrowType == ThrowType.Snow)
114 c.Talk(
"snow_throw",
null,
null,
false);
120 c.Say(
"throw", c, t.GetName(NameStyle.Full, 1),
null);
122 c.renderer.NextFrame();
123 c.PlaySound(
"throw", 1f,
true);
125 if (c.isSynced || p.IsSync)
128 t.renderer.SetFirst(
false, c.renderer.position);
130 if (!t.HasElement(410, 1))
132 t._Move(p,
Card.MoveType.Walk);
134 if (!t.trait.CanBeDestroyed)
136 c.PlaySound(
"miss", 1f,
true);
139 ThrowType throwType = t.trait.ThrowType;
140 if (throwType - ThrowType.Potion <= 1)
144 bool flag = method == ThrowMethod.Reward;
145 bool flag2 = method == ThrowMethod.Default;
146 switch (t.trait.ThrowType)
148 case ThrowType.Potion:
152 Act.TC.Say(
"throw_hit", t,
Act.TC,
null,
null);
155 if (
Act.TC !=
null &&
Act.TC.isChara)
157 if (t.trait.CanDrink(
Act.TC.Chara))
159 t.trait.OnDrink(
Act.TC.Chara);
161 flag2 = t.IsNegativeGift;
162 Act.TC.Chara.AddCondition<
ConWet>(100,
false);
166 t.trait.OnThrowGround(c.Chara,
Act.TP);
168 t.Die(
null,
null, AttackSource.Throw);
172 t.Die(
null,
null, AttackSource.Throw);
177 if (
Act.TC !=
null &&
Act.TC.isChara)
179 Act.TC.Say(
"throw_hit", t,
Act.TC,
null,
null);
182 c.Talk(
"snow_hit",
null,
null,
false);
184 Act.TC.Chara.AddCondition<
ConWet>(50,
false);
185 t.Die(
null,
null, AttackSource.Throw);
189 case ThrowType.Flyer:
192 if (
Act.TC !=
null &&
Act.TC.isChara && c.isChara)
194 Act.TC.Say(
"throw_hit", t,
Act.TC,
null,
null);
195 c.Chara.GiveGift(
Act.TC.Chara, t);
199 case ThrowType.MonsterBall:
204 if (traitMonsterBall.chara !=
null)
208 Chara _c =
EClass._zone.AddCard(traitMonsterBall.chara, p).Chara;
209 _c.PlayEffect(
"identify",
true, 0f,
default(Vector3));
210 t.Die(
null,
null, AttackSource.None);
211 if (traitMonsterBall.IsLittleBall && _c.id ==
"littleOne")
213 _c.orgPos = c.pos.Copy();
214 _c.c_originalHostility = (_c.hostility = Hostility.Neutral);
215 EClass._zone.ModInfluence(5);
216 _c.PlaySound(
"chime_angel", 1f,
true);
217 EClass.core.actionsNextFrame.Add(delegate
219 _c.Talk(
"little_saved",
null,
null,
false);
221 EClass.player.flags.little_saved =
true;
222 EClass.player.little_saved++;
230 else if (
Act.TC !=
null &&
Act.TC.isChara)
232 Act.TC.Say(
"throw_hit", t,
Act.TC,
null,
null);
234 if (traitMonsterBall.IsLittleBall)
238 Msg.Say(
"monsterball_invalid");
244 if (!chara.trait.CanBeTamed ||
EClass._zone.IsUserZone)
246 Msg.Say(
"monsterball_invalid");
249 if (chara.LV > traitMonsterBall.owner.LV)
251 Msg.Say(
"monsterball_lv");
254 if (!
EClass.debug.enable && chara.hp > chara.MaxHP / 10)
256 Msg.Say(
"monsterball_hp");
260 Msg.Say(
"monsterball_capture", c, chara,
null,
null);
261 chara.PlaySound(
"identify", 1f,
true);
262 chara.PlayEffect(
"identify",
true, 0f,
default(Vector3));
263 t.ChangeMaterial(
"copper");
264 if (chara.IsLocalChara)
266 string str =
"Creating Replacement NPC for:";
267 Chara chara2 = chara;
268 Debug.Log(str + ((chara2 !=
null) ? chara2.ToString() :
null));
269 EClass._map.deadCharas.Add(chara.CreateReplacement());
271 traitMonsterBall.chara = chara;
272 EClass._zone.RemoveCard(chara);
273 chara.homeZone =
null;
278 case ThrowType.Explosive:
280 t.c_uidRefCard = c.uid;
281 t.Die(
null, c, AttackSource.Throw);
286 if (
Act.TC !=
null &&
Act.TC.isChara)
288 Act.TC.Say(
"throw_hit", t,
Act.TC,
null,
null);
291 c.Talk(
"snow_hit",
null,
null,
false);
293 Act.TC.Say(
"ball_hit",
null,
null);
297 chara3.Pick(t,
true,
true);
305 t.trait.OnThrowGround(c.Chara,
Act.TP);
307 if (!flag &&
Act.TC !=
null)
312 if (
Act.TC.IsAliveInCurrentZone && t.trait is
TraitErohon &&
Act.TC.id == t.c_idRefName)
314 Act.TC.Chara.OnGiveErohon(t);
316 if (!t.isDestroyed && t.trait.CanBeDestroyed && !t.IsFurniture && !t.category.IsChildOf(
"instrument") && !t.IsUnique && !t.HasElement(410, 1))
323 c.PlaySound(
"miss", 1f,
true);
334 c.Chara.DoHostileAction(
Act.TC,
false);
336 if (
Act.TC.trait.CanBeAttacked &&
EClass.rnd(2) == 0)
338 c.Chara.stamina.Mod(-1);
348 public Chara pcTarget;