From 68e7dd5f08eb0a41ab8e749e1eb959e630b62bec Mon Sep 17 00:00:00 2001 From: Deukhoofd <Deukhoofd@gmail.com> Date: Sat, 26 Jun 2021 16:20:25 +0200 Subject: [PATCH] Adds a bunch of new evolution methods. --- CInterface/Library/EvolutionData.cpp | 19 ++++++++++++++++--- src/Library/Evolutions/EvolutionData.cpp | 12 ++++++++++++ src/Library/Evolutions/EvolutionData.hpp | 20 ++++++++++++++++++-- src/Library/Evolutions/EvolutionMethod.hpp | 4 ++-- 4 files changed, 48 insertions(+), 7 deletions(-) diff --git a/CInterface/Library/EvolutionData.cpp b/CInterface/Library/EvolutionData.cpp index 89e00be..20dd054 100644 --- a/CInterface/Library/EvolutionData.cpp +++ b/CInterface/Library/EvolutionData.cpp @@ -9,6 +9,12 @@ export const EvolutionData* PkmnLib_EvolutionData_CreateFriendshipEvolution(uint const PokemonSpecies* into) { return EvolutionData::CreateFriendshipEvolution(friendship, into); } +export const EvolutionData* PkmnLib_EvolutionData_CreateFriendshipTimeEvolution(uint8_t friendship, TimeOfDay startTime, + TimeOfDay endTime, + const PokemonSpecies* into) { + return EvolutionData::CreateFriendshipTimeEvolution(friendship, startTime, endTime, into); +} + export const EvolutionData* PkmnLib_EvolutionData_CreateKnownMoveEvolution(const MoveData* move, const PokemonSpecies* into) { return EvolutionData::CreateKnownMoveEvolution(move, into); @@ -17,12 +23,19 @@ export const EvolutionData* PkmnLib_EvolutionData_CreateLocationEvolution(const const PokemonSpecies* into) { return EvolutionData::CreateLocationEvolution(ArbUt::StringView(location), into); } -export const EvolutionData* PkmnLib_EvolutionData_CreateTimeEvolution(TimeOfDay time, const PokemonSpecies* into) { - return EvolutionData::CreateTimeEvolution(time, into); +export const EvolutionData* PkmnLib_EvolutionData_CreateTimeEvolution(TimeOfDay startTime, TimeOfDay endTime, + const PokemonSpecies* into) { + return EvolutionData::CreateTimeEvolution(startTime, endTime, into); } -export const EvolutionData* PkmnLib_EvolutionData_CreateItemEvolution(const Item* item, const PokemonSpecies* into) { +export const EvolutionData* PkmnLib_EvolutionData_CreateHeldItemEvolution(const Item* item, + const PokemonSpecies* into) { return EvolutionData::CreateHeldItemEvolution(item, into); } +export const EvolutionData* PkmnLib_EvolutionData_CreateHeldItemTimeEvolution(const Item* item, TimeOfDay startTime, + TimeOfDay endTime, + const PokemonSpecies* into) { + return EvolutionData::CreateHeldItemTimeEvolution(item, startTime, endTime, into); +} export const EvolutionData* PkmnLib_EvolutionData_CreateGenderBasedEvolution(CreatureLib::Library::Gender gender, uint8_t level, const PokemonSpecies* into) { diff --git a/src/Library/Evolutions/EvolutionData.cpp b/src/Library/Evolutions/EvolutionData.cpp index 536c9a6..043f911 100644 --- a/src/Library/Evolutions/EvolutionData.cpp +++ b/src/Library/Evolutions/EvolutionData.cpp @@ -13,6 +13,18 @@ const EvolutionData* EvolutionData::CreateHeldItemEvolution(const Item* item, co return new EvolutionData(EvolutionMethod::HoldsItem, {new CreatureLib::Library::EffectParameter(item->GetName())}, into); } + +const EvolutionData* EvolutionData::CreateHeldItemTimeEvolution(const Item* item, TimeOfDay startTime, + TimeOfDay endTime, const PokemonSpecies* into) { + return new EvolutionData(EvolutionMethod::HoldsItemTime, + { + new CreatureLib::Library::EffectParameter(item->GetName()), + new CreatureLib::Library::EffectParameter((i64)startTime), + new CreatureLib::Library::EffectParameter((i64)endTime), + }, + into); +} + const EvolutionData* EvolutionData::CreateItemUseEvolution(const Item* item, const PokemonSpecies* into) { return new EvolutionData(EvolutionMethod::EvolutionItemUse, {new CreatureLib::Library::EffectParameter(item->GetName())}, into); diff --git a/src/Library/Evolutions/EvolutionData.hpp b/src/Library/Evolutions/EvolutionData.hpp index 88a5692..f8aa7f7 100644 --- a/src/Library/Evolutions/EvolutionData.hpp +++ b/src/Library/Evolutions/EvolutionData.hpp @@ -32,17 +32,33 @@ namespace PkmnLib::Library { return new EvolutionData(EvolutionMethod::HighFriendship, {new CreatureLib::Library::EffectParameter((int64_t)friendship)}, into); } + static inline const EvolutionData* CreateFriendshipTimeEvolution(uint8_t friendship, TimeOfDay startTime, + TimeOfDay endTime, + const PokemonSpecies* into) { + return new EvolutionData(EvolutionMethod::HighFriendshipTime, + {new CreatureLib::Library::EffectParameter((int64_t)friendship), + new CreatureLib::Library::EffectParameter((int64_t)startTime), + new CreatureLib::Library::EffectParameter((int64_t)endTime)}, + into); + } static const EvolutionData* CreateKnownMoveEvolution(const MoveData* move, const PokemonSpecies* into); static inline const EvolutionData* CreateLocationEvolution(const ArbUt::StringView& location, const PokemonSpecies* into) { return new EvolutionData(EvolutionMethod::LocationBased, {new CreatureLib::Library::EffectParameter(location)}, into); } - static inline const EvolutionData* CreateTimeEvolution(TimeOfDay time, const PokemonSpecies* into) { + static inline const EvolutionData* CreateTimeEvolution(TimeOfDay startTime, TimeOfDay endTime, + const PokemonSpecies* into) { return new EvolutionData(EvolutionMethod::TimeBased, - {new CreatureLib::Library::EffectParameter((int64_t)time)}, into); + { + new CreatureLib::Library::EffectParameter((int64_t)startTime), + new CreatureLib::Library::EffectParameter((int64_t)endTime), + }, + into); } static const EvolutionData* CreateHeldItemEvolution(const Item* item, const PokemonSpecies* into); + static const EvolutionData* CreateHeldItemTimeEvolution(const Item* item, TimeOfDay startTime, + TimeOfDay endTime, const PokemonSpecies* into); static inline const EvolutionData* CreateGenderBasedEvolution(CreatureLib::Library::Gender gender, uint8_t level, const PokemonSpecies* into) { return new EvolutionData(EvolutionMethod::IsGenderAndLevel, diff --git a/src/Library/Evolutions/EvolutionMethod.hpp b/src/Library/Evolutions/EvolutionMethod.hpp index 6ecfb1c..9b58f36 100644 --- a/src/Library/Evolutions/EvolutionMethod.hpp +++ b/src/Library/Evolutions/EvolutionMethod.hpp @@ -2,8 +2,8 @@ #define PKMNLIB_EVOLUTIONMETHOD_HPP namespace PkmnLib::Library { - ENUM(EvolutionMethod, uint8_t, Level, HighFriendship, KnownMove, LocationBased, TimeBased, HoldsItem, - IsGenderAndLevel, EvolutionItemUse, EvolutionItemUseWithGender, Trade, TradeWithHeldItem, + ENUM(EvolutionMethod, uint8_t, Level, HighFriendship, HighFriendshipTime, KnownMove, LocationBased, TimeBased, + HoldsItem, HoldsItemTime, IsGenderAndLevel, EvolutionItemUse, EvolutionItemUseWithGender, Trade, TradeWithHeldItem, TradeWithSpecificPokemon, Custom) }