Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
6f769757f3
|
|||
|
56055641c1
|
|||
|
64b92b009c
|
@@ -2,9 +2,10 @@ cmake_minimum_required(VERSION 3.18)
|
|||||||
project(PokemonScriptTester)
|
project(PokemonScriptTester)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
set(BUILD_SHARED_LIBS OFF)
|
||||||
|
|
||||||
option(WINDOWS "Whether the build target is Windows or not." OFF)
|
option(WINDOWS "Whether the build target is Windows or not." OFF)
|
||||||
set(STATICC TRUE)
|
set(SHARED OFF)
|
||||||
|
|
||||||
include(CMakeLists.txt.in)
|
include(CMakeLists.txt.in)
|
||||||
include_pkmnlib()
|
include_pkmnlib()
|
||||||
@@ -13,12 +14,17 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|||||||
add_compile_options(-fconcepts)
|
add_compile_options(-fconcepts)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
|
add_link_options(-fuse-ld=lld)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
file(GLOB_RECURSE SRC_FILES src/*.cpp src/*.hpp)
|
file(GLOB_RECURSE SRC_FILES src/*.cpp src/*.hpp)
|
||||||
add_executable(PokemonScriptTester ${SRC_FILES})
|
add_executable(PokemonScriptTester ${SRC_FILES})
|
||||||
target_precompile_headers(PokemonScriptTester PUBLIC src/Precompiled.hxx)
|
target_precompile_headers(PokemonScriptTester PUBLIC src/Precompiled.hxx)
|
||||||
add_definitions(-DLEVEL_U8)
|
add_definitions(-DLEVEL_U8)
|
||||||
|
|
||||||
SET(_LINKS Arbutils CreatureLib pkmnLib -lpthread)
|
SET(_LINKS -static pkmnLib)
|
||||||
target_link_libraries(PokemonScriptTester PUBLIC ${_LINKS})
|
target_link_libraries(PokemonScriptTester PUBLIC ${_LINKS})
|
||||||
target_compile_options(PokemonScriptTester PRIVATE -Wall -Wextra -Werror)
|
target_compile_options(PokemonScriptTester PRIVATE -Wall -Wextra -Werror)
|
||||||
|
|
||||||
@@ -30,6 +36,6 @@ if (WINDOWS)
|
|||||||
add_compile_options(-m64)
|
add_compile_options(-m64)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-allow-multiple-definition")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-allow-multiple-definition")
|
||||||
if (SHARED)
|
if (SHARED)
|
||||||
set_target_properties(PokemonScriptTester PROPERTIES SUFFIX ".dll")
|
set_target_properties(PokemonScriptTester PROPERTIES SUFFIX ".exe")
|
||||||
endif(SHARED)
|
endif(SHARED)
|
||||||
endif (WINDOWS)
|
endif (WINDOWS)
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
#include <CreatureLib/Battling/TurnChoices/PassTurnChoice.hpp>
|
#include <CreatureLib/Battling/TurnChoices/PassTurnChoice.hpp>
|
||||||
#include <PkmnLib/Battling/Battle/Battle.hpp>
|
#include <PkmnLib/Battling/Battle/Battle.hpp>
|
||||||
#include <PkmnLib/Battling/Pokemon/CreatePokemon.hpp>
|
#include <PkmnLib/Battling/Pokemon/CreatePokemon.hpp>
|
||||||
|
#include <PkmnLib/Battling/Pokemon/PokemonParty.hpp>
|
||||||
#include <angelscript.h>
|
#include <angelscript.h>
|
||||||
#include "../TestEnvironment.hpp"
|
#include "../TestEnvironment.hpp"
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ class BattleFunctions {
|
|||||||
TestEnvironment* env = static_cast<TestEnvironment*>(ctx->GetUserData());
|
TestEnvironment* env = static_cast<TestEnvironment*>(ctx->GetUserData());
|
||||||
|
|
||||||
auto lib = Globals::Library.GetValue();
|
auto lib = Globals::Library.GetValue();
|
||||||
auto p1 = new CreatureLib::Battling::CreatureParty(species->GetSize());
|
auto p1 = new PkmnLib::Battling::PokemonParty(species->GetSize());
|
||||||
for (u32 i = 0; i < species->GetSize(); ++i) {
|
for (u32 i = 0; i < species->GetSize(); ++i) {
|
||||||
auto s = reinterpret_cast<const ArbUt::StringView*>(species->At(i));
|
auto s = reinterpret_cast<const ArbUt::StringView*>(species->At(i));
|
||||||
auto mon1 = PkmnLib::Battling::CreatePokemon(lib, *s, level)
|
auto mon1 = PkmnLib::Battling::CreatePokemon(lib, *s, level)
|
||||||
@@ -43,7 +44,7 @@ class BattleFunctions {
|
|||||||
.WithGender(CreatureLib::Library::Gender::Male)
|
.WithGender(CreatureLib::Library::Gender::Male)
|
||||||
.IsAllowedExperienceGain(false)
|
.IsAllowedExperienceGain(false)
|
||||||
.Build();
|
.Build();
|
||||||
auto p1 = new CreatureLib::Battling::CreatureParty(1);
|
auto p1 = new PkmnLib::Battling::PokemonParty(1);
|
||||||
p1->SwapInto(0, mon1);
|
p1->SwapInto(0, mon1);
|
||||||
|
|
||||||
auto mon2 = PkmnLib::Battling::CreatePokemon(lib, species2, level)
|
auto mon2 = PkmnLib::Battling::CreatePokemon(lib, species2, level)
|
||||||
@@ -53,7 +54,7 @@ class BattleFunctions {
|
|||||||
.WithGender(CreatureLib::Library::Gender::Male)
|
.WithGender(CreatureLib::Library::Gender::Male)
|
||||||
.IsAllowedExperienceGain(false)
|
.IsAllowedExperienceGain(false)
|
||||||
.Build();
|
.Build();
|
||||||
auto p2 = new CreatureLib::Battling::CreatureParty(1);
|
auto p2 = new PkmnLib::Battling::PokemonParty(1);
|
||||||
p2->SwapInto(0, mon2);
|
p2->SwapInto(0, mon2);
|
||||||
|
|
||||||
auto battle = new PkmnLib::Battling::Battle(
|
auto battle = new PkmnLib::Battling::Battle(
|
||||||
@@ -75,8 +76,8 @@ class BattleFunctions {
|
|||||||
return battle;
|
return battle;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PkmnLib::Battling::Battle* CreateSimpleBattleFromParties(u32 seed, CreatureLib::Battling::CreatureParty* p1,
|
static PkmnLib::Battling::Battle* CreateSimpleBattleFromParties(u32 seed, PkmnLib::Battling::PokemonParty* p1,
|
||||||
CreatureLib::Battling::CreatureParty* p2) {
|
PkmnLib::Battling::PokemonParty* p2) {
|
||||||
auto* ctx = asGetActiveContext();
|
auto* ctx = asGetActiveContext();
|
||||||
TestEnvironment* env = static_cast<TestEnvironment*>(ctx->GetUserData());
|
TestEnvironment* env = static_cast<TestEnvironment*>(ctx->GetUserData());
|
||||||
auto lib = Globals::Library.GetValue();
|
auto lib = Globals::Library.GetValue();
|
||||||
@@ -91,7 +92,7 @@ class BattleFunctions {
|
|||||||
seed // with seed
|
seed // with seed
|
||||||
);
|
);
|
||||||
battle->SwitchCreature(0, 0, p1->GetAtIndex(0));
|
battle->SwitchCreature(0, 0, p1->GetAtIndex(0));
|
||||||
battle->SwitchCreature(1, 0, p2->GetAtIndex(1));
|
battle->SwitchCreature(1, 0, p2->GetAtIndex(0));
|
||||||
|
|
||||||
env->AddGarbage(battle);
|
env->AddGarbage(battle);
|
||||||
return battle;
|
return battle;
|
||||||
|
|||||||
Reference in New Issue
Block a user