rezecib Posted October 26, 2014 Share Posted October 26, 2014 Bug Submission:Category: GameplayIssue Title: Krampus spawns only ramp up to 2-3 instead of 3-4Issue Description: Krampus is supposed to increase to 1-2 spawns after day 50, and 2-3 after day 100. Currently it only ever executes the first case. The code in kramped right now is: if day > TUNING.KRAMPUS_INCREASE_LVL1 then num_krampii = num_krampii + math.random(TUNING.KRAMPUS_INCREASE_RAMP) elseif day > TUNING.KRAMPUS_INCREASE_LVL2 then num_krampii = num_krampii + 1 + math.random(TUNING.KRAMPUS_INCREASE_RAMP) endbut if day > 100, then day is also greater than 50, so only the first case ever occurs. It should be flipped to: if day > TUNING.KRAMPUS_INCREASE_LVL2 then num_krampii = num_krampii + 1 + math.random(TUNING.KRAMPUS_INCREASE_RAMP) elseif day > TUNING.KRAMPUS_INCREASE_LVL1 then num_krampii = num_krampii + math.random(TUNING.KRAMPUS_INCREASE_RAMP) endSteps to Reproduce: You don't really need to, but have a world with lots of days... kill some birds (e.g. with Wickerbottom's Birds of the World + Sleepytime Stories), etc. Edit: added code snippetsEdit2: I had been assuming math.random(m) worked like math.random()*m, but upon looking it up I see it generates an integer in the range [1,m]. I updated the krampus numbers to match in the issue description, but the title is wrong. Link to comment Share on other sites More sharing options...
Clwnbaby Posted October 26, 2014 Share Posted October 26, 2014 Hey after you discovered this I started spawning 3 Krampuses btw. I guess I passed the # of days to get 3 after you saw me get 2 a bunch. Link to comment Share on other sites More sharing options...
rezecib Posted October 26, 2014 Author Share Posted October 26, 2014 @Clwnbaby Looks like I misinterpreted the way that it handles math.random(m). So you should be getting 3-4, but you're getting 2-3. Link to comment Share on other sites More sharing options...
Developer bizziboi Posted October 27, 2014 Developer Share Posted October 27, 2014 @rezecib, Good spot - I actually wonder if the elseif was intended to be just another if. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.