Skip to content

Commit

Permalink
Update pokemon.go
Browse files Browse the repository at this point in the history
  • Loading branch information
ReuschelCGN authored Nov 23, 2024
1 parent ba5f2a5 commit 961cf40
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions decoder/pokemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -771,11 +771,11 @@ func (pokemon *Pokemon) addEncounterPokemon(ctx context.Context, db db.DbDetails
}
}
pokemon.Level = null.IntFrom(level - 5)
pokemon.IvInactive = null.IntFrom(int64(
proto.IndividualAttack | proto.IndividualDefense<<4 | proto.IndividualStamina<<8))
//pokemon.IvInactive = null.IntFrom(int64(
// proto.IndividualAttack | proto.IndividualDefense<<4 | proto.IndividualStamina<<8))
} else {
if archive {
pokemon.IvInactive = pokemon.compressIv()
//pokemon.IvInactive = pokemon.compressIv()
}
pokemon.Level = null.IntFrom(level)
pokemon.calculateIv(int64(proto.IndividualAttack), int64(proto.IndividualDefense),
Expand All @@ -787,8 +787,8 @@ func (pokemon *Pokemon) addEncounterPokemon(ctx context.Context, db db.DbDetails
// when disguise is boosted, it has same IV as Ditto
if isUnboostedPartlyCloudy {
if pokemon.Level.Int64 == level-5 {
pokemon.IvInactive = null.IntFrom(int64(
proto.IndividualAttack | proto.IndividualDefense<<4 | proto.IndividualStamina<<8))
//pokemon.IvInactive = null.IntFrom(int64(
// proto.IndividualAttack | proto.IndividualDefense<<4 | proto.IndividualStamina<<8))
} else {
setDittoAttributes("0N", false, true, false)
}
Expand All @@ -797,8 +797,8 @@ func (pokemon *Pokemon) addEncounterPokemon(ctx context.Context, db db.DbDetails
oldWeather != uint8(pogo.GameplayWeatherProto_PARTLY_CLOUDY) &&
// at this point we are not sure if we are in 00 or 0P, so we guess 0P only if the last scanned level agrees
pokemon.Level.Int64 == level-5 {
pokemon.IvInactive = null.IntFrom(int64(
proto.IndividualAttack | proto.IndividualDefense<<4 | proto.IndividualStamina<<8))
//pokemon.IvInactive = null.IntFrom(int64(
// proto.IndividualAttack | proto.IndividualDefense<<4 | proto.IndividualStamina<<8))
} else if pokemon.Weather.Int64 != int64(pogo.GameplayWeatherProto_NONE) &&
pokemon.Weather.Int64 != int64(pogo.GameplayWeatherProto_PARTLY_CLOUDY) && pokemon.Level.Int64 != level {
setDittoAttributes("BN", false, true, false)
Expand Down Expand Up @@ -1028,7 +1028,7 @@ func (pokemon *Pokemon) setWeather(weather int64) bool {
reset = pokemon.Weather.ValueOrZero() != int64(pogo.GameplayWeatherProto_NONE) != isBoosted
}
if reset {
currentIv := pokemon.compressIv()
//currentIv := pokemon.compressIv()
if pokemon.IvInactive.Valid {
pokemon.calculateIv(pokemon.IvInactive.Int64&15, pokemon.IvInactive.Int64>>4&15,
pokemon.IvInactive.Int64>>8&15)
Expand All @@ -1051,15 +1051,9 @@ func (pokemon *Pokemon) setWeather(weather int64) bool {
pokemon.SeenType = null.StringFrom(SeenType_Wild)
}
}
pokemon.IvInactive = currentIv
//pokemon.IvInactive = currentIv
pokemon.Cp = null.NewInt(0, false)
if pokemon.Level.Valid {
if isBoosted {
pokemon.Level.Int64 += 5
} else {
pokemon.Level.Int64 -= 5
}
}
pokemon.Level = null.NewInt(0, false)
pokemon.Pvp = null.NewString("", false)
}
}
Expand Down

0 comments on commit 961cf40

Please sign in to comment.