Skip to content

Fishing Seaweed & Caskets - #425

Open
Tomm0017 wants to merge 5 commits into
apollo-rsps:kotlin-experimentsfrom
Tomm0017:fishing_junk
Open

Fishing Seaweed & Caskets#425
Tomm0017 wants to merge 5 commits into
apollo-rsps:kotlin-experimentsfrom
Tomm0017:fishing_junk

Conversation

@Tomm0017

@Tomm0017 Tomm0017 commented Apr 25, 2019

Copy link
Copy Markdown

Addresses Issue #364 where fishing seaweed & caskets from big nets is requested

@codecov-io

codecov-io commented Apr 25, 2019

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 46.66667% with 8 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (kotlin-experiments@cd06a69). Learn more about missing BASE report.
⚠️ Report is 30 commits behind head on kotlin-experiments.

Files with missing lines Patch % Lines
...g/apollo/game/plugin/skills/fishing/FishingSpot.kt 33.33% 6 Missing and 2 partials ⚠️
Additional details and impacted files
@@                  Coverage Diff                  @@
##             kotlin-experiments     #425   +/-   ##
=====================================================
  Coverage                      ?   23.23%           
  Complexity                    ?      811           
=====================================================
  Files                         ?      643           
  Lines                         ?    11132           
  Branches                      ?     1636           
=====================================================
  Hits                          ?     2587           
  Misses                        ?     8256           
  Partials                      ?      289           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

*/
SEAWEED(id = 401, level = 16, experience = 1.0),
CASKET(id = 405, level = 16, experience = 1.0)
;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this semicolon back to the previous line.

* A [FishingSpot] [Option] that can provide a two different types of fish.
*/
private data class Pair(override val tool: FishingTool, val primary: Fish, val secondary: Fish) : Option() {
private class Pair(override val tool: FishingTool, val primary: Fish, val secondary: Fish, vararg val junk: Fish) : Option() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove the data modifier?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also no reason for junk to be variadic. This constructor isn't a user facing API.

@Tomm0017 Tomm0017 Apr 26, 2019

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The data modifier was removed as you can't have variadic values in a data class. I'll fix this though, thanks!

}

fun of(tool: FishingTool, primary: Fish, secondary: Fish, junk: Array<Fish>): Option {
return when {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write this as if-else instead

return valid[rand(valid.size)]
}
}
return when {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be if-else instead of when.

@garyttierney

Copy link
Copy Markdown
Contributor

Some style issues, otherwise LGTM

override val level = Math.min(primary.level, secondary.level)

override fun sample(level: Int): Fish {
if (junk.isNotEmpty() && rand(100) < JUNK_WEIGHTING) {

@garyttierney garyttierney Apr 26, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, we need a unit test for this, but I'm not quite sure how we go about stubbing the randomness in this case (cc @Major-).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants