Skip to content

Commit 9f6806b

Browse files
committed
fix: seo updates, slightly updated shiny chance article too
1 parent 4163432 commit 9f6806b

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

content/notes/2026-01-07-cobblemon-shiny-rates.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ These handy helpers are our bread and butter.
5353
For example, if I want to apply a flat bonus, I would do it this way:
5454

5555
```kotlin
56-
var shinyRate = Cobblemon.config.shinyRate
56+
val shinyRate = Cobblemon.config.shinyRate
5757
val event = ShinyChanceCalculationEvent(shinyRate, pokemon)
5858
event.addModifier(100f) // add flat 100 increase
5959
```
@@ -90,6 +90,23 @@ fun calculateShiny(player: ServerPlayer): Pokemon {
9090
val shinyRate = Cobblemon.config.shinyRate
9191
val event = ShinyChanceCalculationEvent(shinyRate, pokemon)
9292

93+
// Flat modifier
94+
event.addModifier(100f) // add flat 100 increase
95+
96+
// Callable modifier
97+
event.addModificationFunction { chance, player, pokemon ->
98+
// For example, in this case I want to
99+
// modify the rate if the pokemon is holding a diamond.
100+
101+
// Early bail if criteria not met
102+
if (pokemon.heldItem().item != Items.DIAMOND) {
103+
return@addModificationFunction chance
104+
}
105+
106+
// Return calculated chance otherwise
107+
return@addModificationFunction (chance + 100f)
108+
}
109+
93110
CobblemonEvents.SHINY_CHANCE_CALCULATION.post(event) { evt ->
94111
pokemon.shiny = evt.isShiny(player)
95112
}

src/routes/notes/[slug]/+page.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script lang="ts">
22
import DetailNote from '$lib/notes/DetailNote.svelte';
33
import type { PageProps } from './$types';
4+
import Seo from 'sk-seo';
45
56
let { data }: PageProps = $props();
67
@@ -12,7 +13,9 @@
1213
}
1314
</style>
1415

16+
<Seo />
17+
1518
<section>
1619
<h2 class="note__heading">{data.note.title}</h2>
1720
<DetailNote {...data.note}/>
18-
</section>
21+
</section>

0 commit comments

Comments
 (0)