Пример #1
0
        private void Joystick_EndOfRouteReached(object sender, NpcMovementController.EndOfRouteReachedEventArgs e)
        {
            if (this.ai.CurrentController != this)
            {
                return;
            }

            if (this.targetObject != null)
            {
                this.targetObject.performUseAction(this.Forager.getTileLocation(), this.Forager.currentLocation);
                this.ignoreList.Add(this.targetObject);
            }
            else
            {
                this.Forager.currentLocation.localSound("leafrustle");
                this.Forager.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite("TileSheets\\animations", new Rectangle(0, 1085, 58, 58), 60f, 8, 0, this.Forager.GetGrabTile() * 64, false, this.Forager.FacingDirection == 3, 1f, 0.0f, Color.White, 1f, 0.0f, 0.0f, 0.0f, false));
            }

            double potentialChance = 0.02 + 1.0 / (this.foragedObjects.Count + 1) + this.Leader.LuckLevel / 100.0 + this.Leader.DailyLuck;
            double boost           = this.Leader.professions.Contains(Farmer.gatherer) ? 2.0 : 1.0;
            double realChance      = potentialChance * 0.33 + (this.ForagingLevel + 1) * 0.005 * boost;
            double current         = this.r.NextDouble();

            if (this.ai.Monitor.IsVerbose)
            {
                this.ai.Monitor.VerboseLog($"(Pick forage) Companion foraging level: {this.ForagingLevel} " +
                                           $"| potential chance: {potentialChance} " +
                                           $"| boost: {boost} " +
                                           $"| real chance: {realChance} " +
                                           $"| current: {current} " +
                                           $"| passed: {(current < realChance ? "Yes" : "No")}");
            }

            if (current < realChance || NpcAdventureMod.DebugFlags.Contains("forager.pickAlways"))
            {
                this.PickForageObject(this.targetObject);
            }

            this.targetObject = null;
            this.IsIdle       = true;
        }
Пример #2
0
 private void ArrivedFishingSpot(object sender, NpcMovementController.EndOfRouteReachedEventArgs e)
 {
     this.StartFishing();
 }