mirror of
https://gitlab.com/cable-mc/cobblemon.git
synced 2026-11-24 00:58:52 -05:00
Fix experience group deserialization
This commit is contained in:
1 parent
13e3ba28a0
commit
f8bfb5ad4d
3 files changed
+5
-4
No files matched your search
@@ -56,6 +56,7 @@
|
||||
- Fixed datapack Pokémon lang key generation, a Pokémon under the namespace ``example`` named ``Pogemon`` will now correctly look for the lang key ``example.species.pogemon.name``.
|
||||
- Fixed missing lang and interpretation for bide.
|
||||
- Fixed Pokémon always being created with a moveset as if they're level 1 instead of their current level.
|
||||
- Fixed the Medium Slow and Medium Fast experience group IDs, they're now ```medium_slow``` and ``medium_fast``, any custom datapack Pokémon will require an update.
|
||||
|
||||
### Developer
|
||||
- Reworked CatchRateModifier, as such, existing implementations need to be updated.
|
||||
|
||||
+3
-3
@@ -88,7 +88,7 @@ interface ExperienceGroup : LevelCurve {
|
||||
* @since March 21st, 2022
|
||||
*/
|
||||
abstract class CachedExperienceGroup : ExperienceGroup {
|
||||
private val thresholds = CachedLevelThresholds(experienceToLevel = this::getExperience)
|
||||
private val thresholds = CachedLevelThresholds(experienceToLevel = ::getExperience)
|
||||
override fun getLevel(experience: Int) = thresholds.getLevel(experience)
|
||||
}
|
||||
|
||||
@@ -111,12 +111,12 @@ object Fast : CachedExperienceGroup() {
|
||||
}
|
||||
|
||||
object MediumFast : CachedExperienceGroup() {
|
||||
override val name = "mediumfast"
|
||||
override val name = "medium_fast"
|
||||
override fun getExperience(level: Int) = if (level == 1) 0 else level.pow(3)
|
||||
}
|
||||
|
||||
object MediumSlow : CachedExperienceGroup() {
|
||||
override val name = "mediumslow"
|
||||
override val name = "medium_slow"
|
||||
override fun getExperience(level: Int) = max(0, level.pow(3) * 6 / 5 - 15 * level.pow(2) + 100 * level - 140)
|
||||
}
|
||||
|
||||
|
||||
@@ -959,7 +959,7 @@ open class Pokemon : ShowdownIdentifiable {
|
||||
event = ExperienceGainedPreEvent(this, source, appliedXP),
|
||||
ifSucceeded = { appliedXP = it.experience},
|
||||
ifCanceled = {
|
||||
return AddExperienceResult(level, level, emptySet(), appliedXP)
|
||||
return AddExperienceResult(level, level, emptySet(), 0)
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user