Allows for adjustment of all catch probabilities from item qualities (damage, qty...)
329{
337
339 {
342 {
345 }
346 }
347
349 {
351
352 super.CreateResultDataStructure();
353 }
354
356 {
357 super.ClearCatchingItemData();
358
363 }
364
366 {
367
368 if (item.IsRuined() || item.IsSetForDeletion())
369 return;
370
373 {
374 if (
GetGame().ConfigIsExisting(
path +
" baitTypes") &&
GetGame().ConfigIsExisting(
path +
" baitTypeChances"))
375 {
382 {
383 int key;
384 float value;
385 for (int i = 0; i < count; i++)
386 {
390 {
392 }
393 }
394 }
395 else
396 {
397 ErrorEx(
"'baitTypes' and 'baitTypeChances' arrray counts of " + item.GetType() +
" do not match!",
ErrorExSeverity.INFO);
398 }
399 }
400 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityBaseMod"))
402 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMin"))
404 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMax"))
406 }
407 }
408
411 {
412 float ret = 1.0;
415 {
416
417 }
418
419 return ret;
420 }
421
423 {
425 if (
GetGame().SurfaceIsSea(pos[0], pos[2]))
427 else if (
GetGame().SurfaceIsPond( pos[0], pos[2]))
429 else
431 }
432
434 {
435 super.Init(par);
436
438 }
439
441 {
442 #ifdef DEVELOPER
444 {
445 Print(
"********************");
446 Print(
"dbgTrapz | START");
447 Print(
"********************");
448 }
449 #endif
450
451 super.SetupInitialTypes();
452
453 #ifdef DEVELOPER
455 {
457 }
458 #endif
459 }
460
462 {
465
468 }
469
471 {
474 }
475
477 {
479 }
480
483 {
485 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
486 {
488 if (dta)
489 {
493 }
494 else
495 ErrorEx(
"failed to acquire BaitData from type: " + type);
496 }
497
498 #ifdef DEVELOPER
500 {
503 else
504 Print(
"dbgTrapz | UpdateUsedBait to 'null'!");
505 }
506 #endif
507 }
508
510 {
511 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
512 int usedType = -1;
513 float probability = -1;
514 float highestProbability = 0.0;
516 for (int i = 0; i < count; i++)
517 {
520 if (probability > highestProbability)
521 {
522 highestProbability = probability;
523 usedType = baitType;
524 }
525 }
526
528 #ifdef DEVELOPER
530 {
531
532 Print(
"dbgTrapz | using bait type: " + baitType +
" to catch: " + yItem);
533 }
534 #endif
536
537 #ifdef DEVELOPER
539 {
540 float dbgProb;
543 }
544 #endif
545 }
546
548 {
550
551 return true;
552 }
553
555 {
558 }
559
561 {
563 {
565 m_Bait.SetQuantityNormalized((
m_Bait.GetQuantityNormalized() - qtyNorm));
566 else
568 }
569 }
570}
571
573{
575 {
576 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_SMALL;
577 }
578}
579
581{
583 {
584 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_LARGE;
585 }
586}
587
589{
591 {
592 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_LANDTRAP_SNARE;
593 }
594}
ref map< int, ref BaitData > m_BaitCompatibilityMap
class BaitData m_MainItem
ref CatchingResultBasic m_Result
float m_QualityDispersionMinMod
void InitCatchingItemData()
void CatchingContextBase(Param par)
float m_QualityDispersionMaxMod
void SetupProbabilityArray()
void InitItemValues(EntityAI item)
override to init context-specific values
float AdjustBaitItemChance(EntityAI item)
Allows for adjustment of all catch probabilities from item qualities (damage, qty....
void SetTrapEnviroMask(int value)
CatchingContextTrapsBase CatchingContextBase InitCatchMethodMask()
int UpdateTrapEnviroMask()
void UpdateDataAndMasks()
void UpdateUsedBait(ECatchingBaitCategories type)
if non-empty bait type is used, some 'Bait' attachment is picked as an active bait (currently no dire...
void ClearCatchingItemData()
void InitCatchEnviroMask()
void CreateResultDataStructure()
void DeserializeData(Param par)
override bool ModifySignalProbability(inout float probability)
void ReduceBaitQty(float qtyNorm)
float m_CumulativeTrappingSuccess
after N attempts, the chance to catch should be this. Only highest one applies. @NOTE: Take care,...
override void UpdateBaseProbability(YieldItemBase yItem)
updates base probability when catching the specific item (some context subclasses only)
static const int MASK_ENVIRO_POND
static const int MASK_ENVIRO_LAND_ALL
static const int MASK_ENVIRO_SEA
proto native float ConfigGetFloat(string path)
Get float value from config on path.
proto native void ConfigGetIntArray(string path, out TIntArray values)
Get array of integers from config on path.
proto native void ConfigGetFloatArray(string path, out TFloatArray values)
Get array of floats from config on path.
static ref TIntArray ARRAY_INT
static ref TFloatArray ARRAY_FLOAT
void InitCatchMethodMask()
Super root of all classes in Enforce script.
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
float GetBaitTypeSensitivity(ECatchingBaitCategories type)
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float Pow(float v, float power)
Return power of v ^ power.
proto native bool IsCLIParam(string param)
Returns if command line argument is present.