3 const float FISHING_SUCCESS = 0.2;
4 const float FISHING_BAIT_LOSS = 0.02;
5 const float FISHING_HOOK_LOSS = 0.015;
6 const float FISHING_DAMAGE = 1.5;
7 const float FISHING_GARBAGE_CHANCE = 0.2;
10 bool m_IsBaitAnEmptyHook;
11 int m_FishingResult = -1;
12 float m_RodQualityModifier = 0;
18 m_IsBaitAnEmptyHook = !m_Bait.ConfigIsExisting(
"hookType");
21 bool IsBaitEmptyHook()
23 return m_IsBaitAnEmptyHook;
50 super.EndActionComponent();
64 if (action.HasAlternativeInterrupt())
106 float rnd =
Math.RandomFloatInclusive(0.0, 1.0);
120 fish.SetHealth(
"",
"Health", fish.GetMaxHealth(
"",
"Health") * 0.1);
128 if (fish.HasQuantity())
130 float coef =
Math.RandomFloatInclusive(0.5, 1.0);
131 float item_quantity = fish.GetQuantityMax() * coef;
132 item_quantity =
Math.Round(item_quantity);
133 fish.SetQuantity( item_quantity );
134 fish.InsertAgent(
eAgents.CHOLERA);
188 m_CallbackClass = ActionFishingNewCB;
193 m_Text =
"#start_fishing";
196 override void CreateConditionComponents()
202 override bool HasTarget()
207 override bool HasAlternativeInterrupt()
218 bait =
ItemBase.Cast(rod.FindAttachmentBySlotName(
"Hook"));
220 if (bait && !bait.IsRuined())
234 if (super.SetupAction(player, target, item, action_data, extra_data))
236 vector cursorPosition = action_data.m_Target.GetCursorHitPos();
237 if (cursorPosition ==
vector.Zero)
238 cursorPosition = player.GetPosition();
240 if (
GetGame().SurfaceIsSea(cursorPosition[0], cursorPosition[2]))
248 FishingActionData.Cast(action_data).m_RodQualityModifier = rod.GetFishingEffectivityBonus();
256 override void OnFinishProgressServer(
ActionData action_data )
259 FishingActionData.Cast(action_data).m_FishingResult = EvaluateFishingResult(action_data);
262 override void OnFinishProgressClient(
ActionData action_data )
265 FishingActionData.Cast(action_data).m_FishingResult = EvaluateFishingResult(action_data);
268 override void OnStartClient(
ActionData action_data )
271 rod.AnimateFishingRod(
true);
273 override void OnStartServer(
ActionData action_data )
276 rod.AnimateFishingRod(
true);
279 override void OnEndClient(
ActionData action_data )
282 rod.AnimateFishingRod(
false);
284 override void OnEndServer(
ActionData action_data )
287 rod.AnimateFishingRod(
false);
292 super.WriteToContext(ctx, action_data);
296 ctx.Write(action_data.m_Target.GetCursorHitPos());
300 override bool ReadFromContext(
ParamsReadContext ctx, out ActionReciveData action_recive_data)
302 super.ReadFromContext(ctx, action_recive_data);
307 if (!ctx.Read(cursor_position))
310 action_recive_data.m_Target.SetCursorHitPos(cursor_position);
315 int EvaluateFishingResult(
ActionData action_data)
317 if (action_data.m_Player.IsQuickFishing())
322 float daytimeModifier = 1;
323 float hookModifier = 1;
326 daytimeModifier =
GetGame().GetDayTime();
327 if ((daytimeModifier > 18 && daytimeModifier < 22) || (daytimeModifier > 5 && daytimeModifier < 9))
333 daytimeModifier = 0.5;
337 if (fad.IsBaitEmptyHook())
342 chance = 1 - (((fad.FISHING_SUCCESS * daytimeModifier) + fad.m_RodQualityModifier)) * hookModifier;
348 else if (rnd < fad.FISHING_BAIT_LOSS && !fad.IsBaitEmptyHook())