Beispiel #1
0
        public override void DoFunction(GameLocation location, int x, int y, int power, StardewValley.Farmer who)
        {
            who.Stamina -= (float)(2 * power) - (float)who.GetCustomSkillLevel(BugCatchingMod.skill) * 0.1f;

            Log.info($"Doing a functions");
            if (caughtBug & CaughtCritter != null)
            {
                Log.info("yes the critter is gud");
                BugInNet = BugApi.getBugFromCritterType(CaughtCritter);
                getBugFromNet(location, who);
            }
        }
Beispiel #2
0
        public override void Entry(IModHelper helper)
        {
            instance = this;
            _helper  = helper;
            _monitor = Monitor;
            ModId    = _helper.ModRegistry.ModID;

            _helper.Events.GameLoop.UpdateTicked += LoadCritters;
            BugApi.init(_helper);

            new TileAction("disturbBug", DisturbBug).register();
            ButtonClick.UseToolButton.onClick(onDigBug);

            _helper.Events.GameLoop.DayStarted += createCritterLocationList;
            //_helper.Events.World.LocationListChanged += updateCritterLocationsList;
            _helper.Events.Player.Warped           += onLocationChanged;
            _helper.Events.World.DebrisListChanged += catchBugDebris;
            DataInjector = new DataInjector(_helper);
            Game1.ResetToolSpriteSheet();
            Skills.RegisterSkill(skill = new BugCatchingSkill());
        }
Beispiel #3
0
 public bool checkCatch(Critter critter, Rectangle catchZone)
 {
     caughtBug = false;
     Log.info($"checking the critter {critter.GetHashCode().ToString()}");
     if (critter.getBoundingBox(0, 0).Intersects(catchZone))
     {
         BugModel bug = BugApi.createBugModelFromCritter(critter);
         if (bug.Rarity < netModel.maxRarity)
         {
             CaughtCritter = critter;
             caughtBug     = true;
             Log.info($"Caught a bug {bug.Name}");
         }
         else
         {
             Game1.addHUDMessage(new HUDMessage($"The {bug.Name} escaped your {this.Name}"));
             //check for bugHasItem
         }
     }
     return(caughtBug);
 }