Initial commit; Load Species and Types, test all type effectivenesses.
This commit is contained in:
commit
bb5ae114c4
|
@ -0,0 +1,121 @@
|
|||
# ClangFormatConfigureSource: 'LLVM'
|
||||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlines: Right
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: MultiLine
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakInheritanceList: BeforeColon
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 120
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: false
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IncludeBlocks: Merge
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||
Priority: 1
|
||||
- Regex: '.*'
|
||||
Priority: 3
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IndentCaseLabels: true
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: All
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PointerAlignment: Left
|
||||
ReflowComments: true
|
||||
SortIncludes: true
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Cpp11
|
||||
StatementMacros:
|
||||
- Q_UNUSED
|
||||
- QT_REQUIRE_VERSION
|
||||
TabWidth: 8
|
||||
UseTab: Never
|
||||
...
|
|
@ -0,0 +1,3 @@
|
|||
/cmake-build-debug/
|
||||
/cmake-build-release/
|
||||
/.idea/
|
|
@ -0,0 +1,45 @@
|
|||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
# Make warnings trigger errors.
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
|
||||
|
||||
project(Gen7Tests)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
if (NOT EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
message(WARNING "The file conanbuildinfo.cmake doesn't exist, running conan install.")
|
||||
string(REPLACE "." ";" VERSION_LIST "${CMAKE_C_COMPILER_VERSION}")
|
||||
list(GET VERSION_LIST 0 VERSION)
|
||||
list(GET VERSION_LIST 1 MINOR)
|
||||
if (NOT MINOR MATCHES 0)
|
||||
SET(VERSION ${VERSION}.${MINOR})
|
||||
endif()
|
||||
if (NOT WINDOWS)
|
||||
execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build missing
|
||||
-s compiler=clang -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION} -s build_type=Debug)
|
||||
else()
|
||||
execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build missing
|
||||
-s compiler=gcc -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION} -s os=Windows)
|
||||
endif()
|
||||
endif ()
|
||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
conan_basic_setup()
|
||||
|
||||
message(STATUS "Using Conan Libs:")
|
||||
foreach (_conanLib ${CONAN_LIBS})
|
||||
message(STATUS "\t ${_conanLib}")
|
||||
endforeach()
|
||||
|
||||
SET(FILE_SOURCE
|
||||
"src/*.cpp"
|
||||
"src/*.hpp"
|
||||
)
|
||||
file(GLOB_RECURSE CORE_SRC_FILES ${FILE_SOURCE})
|
||||
add_executable(Gen7Tests ${CORE_SRC_FILES})
|
||||
|
||||
SET(_LINKS CreatureLibCore CreatureLibLibrary CreatureLibBattling pkmnLib)
|
||||
|
||||
target_link_libraries(Gen7Tests PUBLIC ${_LINKS})
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
SkipAngelScriptMemCheck
|
||||
Memcheck:Cond
|
||||
fun:_ZN10asCContext11ExecuteNextEv
|
||||
fun:_ZN10asCContext7ExecuteEv
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
from conans import ConanFile, CMake
|
||||
from conans.errors import ConanInvalidConfiguration
|
||||
|
||||
|
||||
class PkmnLibConan(ConanFile):
|
||||
name = "PkmnLib-Gen7"
|
||||
license = "TODO"
|
||||
url = "https://git.p-epsilon.com/Deukhoofd/PkmnLib"
|
||||
description = "An implementation of CreatureLib to handle Pokemon battling."
|
||||
settings = "os", "compiler", "build_type"
|
||||
generators = "cmake"
|
||||
exports_sources = "*"
|
||||
compiler = "clang"
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
self.output.info("Target OS: %s." % self.settings.os)
|
||||
if self.settings.os == "Windows":
|
||||
self.output.warn("Noticed Windows target, setting Cmake WINDOWS=On.")
|
||||
cmake.definitions["WINDOWS"] = "On"
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def imports(self):
|
||||
if self.settings.os == "Windows":
|
||||
self.copy("*.dll", "bin", "bin")
|
||||
|
||||
def requirements(self):
|
||||
self.requires("PkmnLib/4ee5a14b4c58b97fa511aad4be7cc0cb039bc634@pkmnlib/master")
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,104 @@
|
|||
#include "BuildSpecies.hpp"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#define GET(o, objectKey, key) \
|
||||
auto _##objectKey = o[#objectKey]; \
|
||||
if (_##objectKey.is_null()) { \
|
||||
std::cout << "Failed to retrieve key '" << #objectKey << "' for object with key '" << key << "' in file '" \
|
||||
<< path << "'\n"; \
|
||||
return nullptr; \
|
||||
}
|
||||
|
||||
PkmnLib::Library::SpeciesLibrary* BuildSpecies::BuildLibrary(const std::string& path,
|
||||
const CreatureLib::Library::TypeLibrary* types) {
|
||||
std::ifstream fileStream(path.c_str());
|
||||
if (fileStream.fail()) {
|
||||
std::cout << "Failed to load Pokemon data file at '" << path << "'\n";
|
||||
return nullptr;
|
||||
}
|
||||
auto lib = new PkmnLib::Library::SpeciesLibrary();
|
||||
json j;
|
||||
fileStream >> j;
|
||||
|
||||
for (json::iterator it = j.begin(); it != j.end(); ++it) {
|
||||
auto val = it.value();
|
||||
GET(val, id, it.key());
|
||||
GET(val, species, it.key());
|
||||
GET(val, genderRatio, it.key());
|
||||
GET(val, growthRate, it.key());
|
||||
GET(val, baseHappiness, it.key());
|
||||
GET(val, catchRate, it.key());
|
||||
GET(val, color, it.key());
|
||||
GET(val, genderDifference, it.key());
|
||||
GET(val, eggGroups, it.key());
|
||||
GET(val, eggCycles, it.key());
|
||||
GET(val, tags, it.key());
|
||||
GET(val, formes, it.key());
|
||||
|
||||
PkmnLib::Library::PokemonSpecies* species = nullptr;
|
||||
|
||||
auto defaultForme = _formes["default"];
|
||||
if (!defaultForme.is_null()) {
|
||||
auto forme = BuildForme("default", defaultForme, it.key(), path, types);
|
||||
species = new PkmnLib::Library::PokemonSpecies(_id.get<uint16_t>(), _species.get<std::string>(), forme,
|
||||
_genderRatio.get<int8_t>() / static_cast<float>(100),
|
||||
_growthRate.get<std::string>(), _catchRate.get<uint8_t>(),
|
||||
_baseHappiness.get<uint8_t>());
|
||||
}
|
||||
|
||||
for (json::iterator formeIt = _formes.begin(); formeIt != _formes.end(); ++formeIt) {
|
||||
if (formeIt.key() == "default") {
|
||||
continue;
|
||||
}
|
||||
auto forme = BuildForme(formeIt.key(), formeIt.value(), it.key(), path, types);
|
||||
if (forme == nullptr)
|
||||
return nullptr;
|
||||
if (species == nullptr) {
|
||||
species = new PkmnLib::Library::PokemonSpecies(
|
||||
_id.get<uint16_t>(), _species.get<std::string>(), forme,
|
||||
static_cast<float>(_genderRatio.get<int8_t>()) / static_cast<float>(100),
|
||||
_growthRate.get<std::string>(), _catchRate.get<uint8_t>(), _baseHappiness.get<uint8_t>());
|
||||
} else {
|
||||
species->SetVariant(formeIt.key(), forme);
|
||||
}
|
||||
}
|
||||
if (species == nullptr) {
|
||||
std::cout << "Pokemon with key '" << it.key() << "' does not have any formes.\n";
|
||||
return nullptr;
|
||||
}
|
||||
lib->LoadSpecies(it.key(), species);
|
||||
}
|
||||
return lib;
|
||||
}
|
||||
|
||||
static CreatureLib::Core::StatisticSet<uint16_t> ParseStatistics(json& json) {
|
||||
return CreatureLib::Core::StatisticSet<uint16_t>(
|
||||
json["hp"].get<uint16_t>(), json["attack"].get<uint16_t>(), json["defense"].get<uint16_t>(),
|
||||
json["specialAttack"].get<uint16_t>(), json["specialDefense"].get<uint16_t>(), json["speed"].get<uint16_t>());
|
||||
}
|
||||
|
||||
const PkmnLib::Library::PokemonForme* BuildSpecies::BuildForme(const std::string& name, json& forme,
|
||||
const std::string& baseKeyName, const std::string& path,
|
||||
const CreatureLib::Library::TypeLibrary* typeLibrary) {
|
||||
GET(forme, abilities, baseKeyName << " -> " << name);
|
||||
GET(forme, hiddenAbilities, baseKeyName << " -> " << name);
|
||||
GET(forme, baseStats, baseKeyName << " -> " << name);
|
||||
GET(forme, evReward, baseKeyName << " -> " << name);
|
||||
GET(forme, types, baseKeyName << " -> " << name);
|
||||
GET(forme, height, baseKeyName << " -> " << name);
|
||||
GET(forme, weight, baseKeyName << " -> " << name);
|
||||
GET(forme, baseExp, baseKeyName << " -> " << name);
|
||||
GET(forme, moves, baseKeyName << " -> " << name);
|
||||
|
||||
auto typeStrings = _types.get<std::vector<std::string>>();
|
||||
auto types = std::vector<uint8_t>(typeStrings.size());
|
||||
for (auto i = 0; i < typeStrings.size(); i++) {
|
||||
types[i] = typeLibrary->GetTypeId(typeStrings[i]);
|
||||
}
|
||||
auto stats = ParseStatistics(_baseStats);
|
||||
|
||||
return new PkmnLib::Library::PokemonForme(
|
||||
name, _height.get<float>(), _weight.get<float>(), _baseExp.get<uint32_t>(), types, stats,
|
||||
_abilities.get<std::vector<std::string>>(), _hiddenAbilities.get<std::vector<std::string>>(), nullptr);
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef GEN7TESTS_BUILDSPECIES_HPP
|
||||
#define GEN7TESTS_BUILDSPECIES_HPP
|
||||
#include <PkmnLib/Library/PokemonLibrary.hpp>
|
||||
#include <CreatureLib/Library/TypeLibrary.hpp>
|
||||
#include <string>
|
||||
#include "../../extern/json.hpp"
|
||||
using json = nlohmann::json;
|
||||
|
||||
class BuildSpecies {
|
||||
static const PkmnLib::Library::PokemonForme* BuildForme(const std::string& name, json& forme,
|
||||
const std::string& baseKeyName, const std::string& path,
|
||||
const CreatureLib::Library::TypeLibrary* typeLibrary);
|
||||
|
||||
public:
|
||||
static PkmnLib::Library::SpeciesLibrary* BuildLibrary(const std::string& path,
|
||||
const CreatureLib::Library::TypeLibrary* types);
|
||||
};
|
||||
|
||||
#endif // GEN7TESTS_BUILDSPECIES_HPP
|
|
@ -0,0 +1 @@
|
|||
#include "BuildTypes.hpp"
|
|
@ -0,0 +1,81 @@
|
|||
#ifndef GEN7TESTS_BUILDTYPES_HPP
|
||||
#define GEN7TESTS_BUILDTYPES_HPP
|
||||
#include <CreatureLib/Library/TypeLibrary.hpp>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
class BuildTypes {
|
||||
public:
|
||||
static CreatureLib::Library::TypeLibrary* Build(const std::string& path) {
|
||||
std::ifstream file(path);
|
||||
if (file.fail()) {
|
||||
std::cout << "Failed to load Types data file at '" << path << "'\n";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::string line;
|
||||
if (!std::getline(file, line)) {
|
||||
std::cout << "Failed to read Types data file at '" << path << "'\n";
|
||||
return nullptr;
|
||||
}
|
||||
auto divider = ',';
|
||||
if (strncmp(line.c_str(), "sep=", 4) == 0) {
|
||||
divider = line[4];
|
||||
std::getline(file, line);
|
||||
}
|
||||
auto library = new CreatureLib::Library::TypeLibrary();
|
||||
|
||||
bool hasSkippedFirst = false;
|
||||
size_t lastStart = 0;
|
||||
std::vector<uint8_t > types;
|
||||
for (size_t i = 0; i < line.length(); i++) {
|
||||
if (line[i] == divider) {
|
||||
auto substr = line.substr(lastStart, i - lastStart);
|
||||
lastStart = i + 1;
|
||||
if (hasSkippedFirst) {
|
||||
std::cout << "Registered type: " << substr << "\n";
|
||||
auto val = library->RegisterType(substr);
|
||||
types.push_back(val);
|
||||
} else {
|
||||
hasSkippedFirst = true;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
auto substr = line.substr(lastStart, line.length() - lastStart);
|
||||
std::cout << "Registered type: " << substr << "\n";
|
||||
auto val = library->RegisterType(substr);
|
||||
types.push_back(val);
|
||||
|
||||
|
||||
while (std::getline(file, line)) {
|
||||
uint8_t attackingType = 0;
|
||||
bool gotType = false;
|
||||
lastStart = 0;
|
||||
int current = 0;
|
||||
for (size_t i = 0; i < line.length(); i++) {
|
||||
if (line[i] == divider) {
|
||||
substr = line.substr(lastStart, i - lastStart);
|
||||
lastStart = i + 1;
|
||||
if (gotType) {
|
||||
auto eff = std::atof(substr.c_str());
|
||||
library->SetEffectiveness(attackingType, types[current], eff);
|
||||
current++;
|
||||
} else {
|
||||
gotType = true;
|
||||
attackingType = library->GetTypeId(substr);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
substr = line.substr(lastStart, line.length() - lastStart);
|
||||
auto eff = std::atof(substr.c_str());
|
||||
library->SetEffectiveness(attackingType, types[current], eff);
|
||||
}
|
||||
|
||||
return library;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // GEN7TESTS_BUILDTYPES_HPP
|
|
@ -0,0 +1,4 @@
|
|||
#include "Library.hpp"
|
||||
|
||||
PkmnLib::Library::PokemonLibrary* Library::_staticLib = nullptr;
|
||||
PkmnLib::Battling::BattleLibrary* Library::_library = nullptr;
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef GEN7TESTS_LIBRARY_HPP
|
||||
#define GEN7TESTS_LIBRARY_HPP
|
||||
|
||||
#include <PkmnLib/Battling/Library/BattleLibrary.hpp>
|
||||
#include <PkmnLib/Library/PokemonLibrary.hpp>
|
||||
class Library {
|
||||
static PkmnLib::Library::PokemonLibrary* _staticLib;
|
||||
static PkmnLib::Battling::BattleLibrary* _library;
|
||||
|
||||
public:
|
||||
static const PkmnLib::Library::PokemonLibrary* GetStaticLib() { return _staticLib; }
|
||||
static const PkmnLib::Battling::BattleLibrary* GetLibrary() { return _library; }
|
||||
|
||||
static void SetStaticLib(PkmnLib::Library::PokemonLibrary* lib) { _staticLib = lib; }
|
||||
static void SetLibrary(PkmnLib::Battling::BattleLibrary* lib) { _library = lib; }
|
||||
};
|
||||
|
||||
|
||||
#endif // GEN7TESTS_LIBRARY_HPP
|
|
@ -0,0 +1,407 @@
|
|||
#include "../../extern/catch.hpp"
|
||||
#include "../Library.hpp"
|
||||
|
||||
#define CHECK_EFFECTIVENESS(attack, defense, expected) \
|
||||
CHECK(typeLib->GetSingleEffectiveness(typeLib->GetTypeId(#attack), typeLib->GetTypeId(#defense)) == expected);
|
||||
|
||||
TEST_CASE("Type Effectiveness - Normal Attacking", "[type]") {
|
||||
auto typeLib = Library::GetStaticLib()->GetTypeLibrary();
|
||||
CHECK_EFFECTIVENESS(Normal, Normal, 1);
|
||||
CHECK_EFFECTIVENESS(Normal, Fighting, 1);
|
||||
CHECK_EFFECTIVENESS(Normal, Flying, 1);
|
||||
CHECK_EFFECTIVENESS(Normal, Poison, 1);
|
||||
CHECK_EFFECTIVENESS(Normal, Ground, 1);
|
||||
CHECK_EFFECTIVENESS(Normal, Rock, 0.5);
|
||||
CHECK_EFFECTIVENESS(Normal, Bug, 1);
|
||||
CHECK_EFFECTIVENESS(Normal, Ghost, 0);
|
||||
CHECK_EFFECTIVENESS(Normal, Steel, 0.5)
|
||||
CHECK_EFFECTIVENESS(Normal, Fire, 1);
|
||||
CHECK_EFFECTIVENESS(Normal, Water, 1);
|
||||
CHECK_EFFECTIVENESS(Normal, Grass, 1);
|
||||
CHECK_EFFECTIVENESS(Normal, Electric, 1);
|
||||
CHECK_EFFECTIVENESS(Normal, Psychic, 1);
|
||||
CHECK_EFFECTIVENESS(Normal, Ice, 1);
|
||||
CHECK_EFFECTIVENESS(Normal, Dragon, 1);
|
||||
CHECK_EFFECTIVENESS(Normal, Dark, 1);
|
||||
CHECK_EFFECTIVENESS(Normal, Fairy, 1);
|
||||
}
|
||||
|
||||
TEST_CASE("Type Effectiveness - Fighting Attacking", "[type]") {
|
||||
auto typeLib = Library::GetStaticLib()->GetTypeLibrary();
|
||||
CHECK_EFFECTIVENESS(Fighting, Normal, 2);
|
||||
CHECK_EFFECTIVENESS(Fighting, Fighting, 1);
|
||||
CHECK_EFFECTIVENESS(Fighting, Flying, 0.5);
|
||||
CHECK_EFFECTIVENESS(Fighting, Poison, 0.5);
|
||||
CHECK_EFFECTIVENESS(Fighting, Ground, 1);
|
||||
CHECK_EFFECTIVENESS(Fighting, Rock, 2);
|
||||
CHECK_EFFECTIVENESS(Fighting, Bug, 0.5);
|
||||
CHECK_EFFECTIVENESS(Fighting, Ghost, 0);
|
||||
CHECK_EFFECTIVENESS(Fighting, Steel, 2);
|
||||
CHECK_EFFECTIVENESS(Fighting, Fire, 1);
|
||||
CHECK_EFFECTIVENESS(Fighting, Water, 1);
|
||||
CHECK_EFFECTIVENESS(Fighting, Grass, 1);
|
||||
CHECK_EFFECTIVENESS(Fighting, Electric, 1);
|
||||
CHECK_EFFECTIVENESS(Fighting, Psychic, 0.5);
|
||||
CHECK_EFFECTIVENESS(Fighting, Ice, 2);
|
||||
CHECK_EFFECTIVENESS(Fighting, Dragon, 1);
|
||||
CHECK_EFFECTIVENESS(Fighting, Dark, 2);
|
||||
CHECK_EFFECTIVENESS(Fighting, Fairy, 0.5);
|
||||
}
|
||||
|
||||
TEST_CASE("Type Effectiveness - Flying Attacking", "[type]") {
|
||||
auto typeLib = Library::GetStaticLib()->GetTypeLibrary();
|
||||
CHECK_EFFECTIVENESS(Flying, Normal, 1);
|
||||
CHECK_EFFECTIVENESS(Flying, Fighting, 2);
|
||||
CHECK_EFFECTIVENESS(Flying, Flying, 1);
|
||||
CHECK_EFFECTIVENESS(Flying, Poison, 1);
|
||||
CHECK_EFFECTIVENESS(Flying, Ground, 1);
|
||||
CHECK_EFFECTIVENESS(Flying, Rock, 0.5);
|
||||
CHECK_EFFECTIVENESS(Flying, Bug, 2);
|
||||
CHECK_EFFECTIVENESS(Flying, Ghost, 1);
|
||||
CHECK_EFFECTIVENESS(Flying, Steel, 0.5);
|
||||
CHECK_EFFECTIVENESS(Flying, Fire, 1);
|
||||
CHECK_EFFECTIVENESS(Flying, Water, 1);
|
||||
CHECK_EFFECTIVENESS(Flying, Grass, 2);
|
||||
CHECK_EFFECTIVENESS(Flying, Electric, 0.5);
|
||||
CHECK_EFFECTIVENESS(Flying, Psychic, 1);
|
||||
CHECK_EFFECTIVENESS(Flying, Ice, 1);
|
||||
CHECK_EFFECTIVENESS(Flying, Dragon, 1);
|
||||
CHECK_EFFECTIVENESS(Flying, Dark, 1);
|
||||
CHECK_EFFECTIVENESS(Flying, Fairy, 1);
|
||||
}
|
||||
|
||||
TEST_CASE("Type Effectiveness - Poison Attacking", "[type]") {
|
||||
auto typeLib = Library::GetStaticLib()->GetTypeLibrary();
|
||||
CHECK_EFFECTIVENESS(Poison, Normal, 1);
|
||||
CHECK_EFFECTIVENESS(Poison, Fighting, 1);
|
||||
CHECK_EFFECTIVENESS(Poison, Flying, 1);
|
||||
CHECK_EFFECTIVENESS(Poison, Poison, 0.5);
|
||||
CHECK_EFFECTIVENESS(Poison, Ground, 0.5);
|
||||
CHECK_EFFECTIVENESS(Poison, Rock, 0.5);
|
||||
CHECK_EFFECTIVENESS(Poison, Bug, 1);
|
||||
CHECK_EFFECTIVENESS(Poison, Ghost, 0.5);
|
||||
CHECK_EFFECTIVENESS(Poison, Steel, 0);
|
||||
CHECK_EFFECTIVENESS(Poison, Fire, 1);
|
||||
CHECK_EFFECTIVENESS(Poison, Water, 1);
|
||||
CHECK_EFFECTIVENESS(Poison, Grass, 2);
|
||||
CHECK_EFFECTIVENESS(Poison, Electric, 1);
|
||||
CHECK_EFFECTIVENESS(Poison, Psychic, 1);
|
||||
CHECK_EFFECTIVENESS(Poison, Ice, 1);
|
||||
CHECK_EFFECTIVENESS(Poison, Dragon, 1);
|
||||
CHECK_EFFECTIVENESS(Poison, Dark, 1);
|
||||
CHECK_EFFECTIVENESS(Poison, Fairy, 2);
|
||||
}
|
||||
|
||||
TEST_CASE("Type Effectiveness - Ground Attacking", "[type]") {
|
||||
auto typeLib = Library::GetStaticLib()->GetTypeLibrary();
|
||||
CHECK_EFFECTIVENESS(Ground, Normal, 1);
|
||||
CHECK_EFFECTIVENESS(Ground, Fighting, 1);
|
||||
CHECK_EFFECTIVENESS(Ground, Flying, 0);
|
||||
CHECK_EFFECTIVENESS(Ground, Poison, 2);
|
||||
CHECK_EFFECTIVENESS(Ground, Ground, 1);
|
||||
CHECK_EFFECTIVENESS(Ground, Rock, 2);
|
||||
CHECK_EFFECTIVENESS(Ground, Bug, 0.5);
|
||||
CHECK_EFFECTIVENESS(Ground, Ghost, 1);
|
||||
CHECK_EFFECTIVENESS(Ground, Steel, 2);
|
||||
CHECK_EFFECTIVENESS(Ground, Fire, 2);
|
||||
CHECK_EFFECTIVENESS(Ground, Water, 1);
|
||||
CHECK_EFFECTIVENESS(Ground, Grass, 0.5);
|
||||
CHECK_EFFECTIVENESS(Ground, Electric, 2);
|
||||
CHECK_EFFECTIVENESS(Ground, Psychic, 1);
|
||||
CHECK_EFFECTIVENESS(Ground, Ice, 1);
|
||||
CHECK_EFFECTIVENESS(Ground, Dragon, 1);
|
||||
CHECK_EFFECTIVENESS(Ground, Dark, 1);
|
||||
CHECK_EFFECTIVENESS(Ground, Fairy, 1);
|
||||
}
|
||||
|
||||
TEST_CASE("Type Effectiveness - Rock Attacking", "[type]") {
|
||||
auto typeLib = Library::GetStaticLib()->GetTypeLibrary();
|
||||
CHECK_EFFECTIVENESS(Rock, Normal, 1);
|
||||
CHECK_EFFECTIVENESS(Rock, Fighting, 0.5);
|
||||
CHECK_EFFECTIVENESS(Rock, Flying, 2);
|
||||
CHECK_EFFECTIVENESS(Rock, Poison, 1);
|
||||
CHECK_EFFECTIVENESS(Rock, Ground, 0.5);
|
||||
CHECK_EFFECTIVENESS(Rock, Rock, 1);
|
||||
CHECK_EFFECTIVENESS(Rock, Bug, 2);
|
||||
CHECK_EFFECTIVENESS(Rock, Ghost, 1);
|
||||
CHECK_EFFECTIVENESS(Rock, Steel, 0.5);
|
||||
CHECK_EFFECTIVENESS(Rock, Fire, 2);
|
||||
CHECK_EFFECTIVENESS(Rock, Water, 1);
|
||||
CHECK_EFFECTIVENESS(Rock, Grass, 1);
|
||||
CHECK_EFFECTIVENESS(Rock, Electric, 1);
|
||||
CHECK_EFFECTIVENESS(Rock, Psychic, 1);
|
||||
CHECK_EFFECTIVENESS(Rock, Ice, 2);
|
||||
CHECK_EFFECTIVENESS(Rock, Dragon, 1);
|
||||
CHECK_EFFECTIVENESS(Rock, Dark, 1);
|
||||
CHECK_EFFECTIVENESS(Rock, Fairy, 1);
|
||||
}
|
||||
|
||||
TEST_CASE("Type Effectiveness - Bug Attacking", "[type]") {
|
||||
auto typeLib = Library::GetStaticLib()->GetTypeLibrary();
|
||||
CHECK_EFFECTIVENESS(Bug, Normal, 1);
|
||||
CHECK_EFFECTIVENESS(Bug, Fighting, 0.5);
|
||||
CHECK_EFFECTIVENESS(Bug, Flying, 0.5);
|
||||
CHECK_EFFECTIVENESS(Bug, Poison, 0.5);
|
||||
CHECK_EFFECTIVENESS(Bug, Ground, 1);
|
||||
CHECK_EFFECTIVENESS(Bug, Rock, 1);
|
||||
CHECK_EFFECTIVENESS(Bug, Bug, 1);
|
||||
CHECK_EFFECTIVENESS(Bug, Ghost, 0.5);
|
||||
CHECK_EFFECTIVENESS(Bug, Steel, 0.5);
|
||||
CHECK_EFFECTIVENESS(Bug, Fire, 0.5);
|
||||
CHECK_EFFECTIVENESS(Bug, Water, 1);
|
||||
CHECK_EFFECTIVENESS(Bug, Grass, 2);
|
||||
CHECK_EFFECTIVENESS(Bug, Electric, 1);
|
||||
CHECK_EFFECTIVENESS(Bug, Psychic, 2);
|
||||
CHECK_EFFECTIVENESS(Bug, Ice, 1);
|
||||
CHECK_EFFECTIVENESS(Bug, Dragon, 1);
|
||||
CHECK_EFFECTIVENESS(Bug, Dark, 2);
|
||||
CHECK_EFFECTIVENESS(Bug, Fairy, 0.5);
|
||||
}
|
||||
|
||||
TEST_CASE("Type Effectiveness - Ghost Attacking", "[type]") {
|
||||
auto typeLib = Library::GetStaticLib()->GetTypeLibrary();
|
||||
CHECK_EFFECTIVENESS(Ghost, Normal, 0);
|
||||
CHECK_EFFECTIVENESS(Ghost, Fighting, 1);
|
||||
CHECK_EFFECTIVENESS(Ghost, Flying, 1);
|
||||
CHECK_EFFECTIVENESS(Ghost, Poison, 1);
|
||||
CHECK_EFFECTIVENESS(Ghost, Ground, 1);
|
||||
CHECK_EFFECTIVENESS(Ghost, Rock, 1);
|
||||
CHECK_EFFECTIVENESS(Ghost, Bug, 1);
|
||||
CHECK_EFFECTIVENESS(Ghost, Ghost, 2);
|
||||
CHECK_EFFECTIVENESS(Ghost, Steel, 1);
|
||||
CHECK_EFFECTIVENESS(Ghost, Fire, 1);
|
||||
CHECK_EFFECTIVENESS(Ghost, Water, 1);
|
||||
CHECK_EFFECTIVENESS(Ghost, Grass, 1);
|
||||
CHECK_EFFECTIVENESS(Ghost, Electric, 1);
|
||||
CHECK_EFFECTIVENESS(Ghost, Psychic, 2);
|
||||
CHECK_EFFECTIVENESS(Ghost, Ice, 1);
|
||||
CHECK_EFFECTIVENESS(Ghost, Dragon, 1);
|
||||
CHECK_EFFECTIVENESS(Ghost, Dark, 0.5);
|
||||
CHECK_EFFECTIVENESS(Ghost, Fairy, 1);
|
||||
}
|
||||
|
||||
TEST_CASE("Type Effectiveness - Steel Attacking", "[type]") {
|
||||
auto typeLib = Library::GetStaticLib()->GetTypeLibrary();
|
||||
CHECK_EFFECTIVENESS(Steel, Normal, 1);
|
||||
CHECK_EFFECTIVENESS(Steel, Fighting, 1);
|
||||
CHECK_EFFECTIVENESS(Steel, Flying, 1);
|
||||
CHECK_EFFECTIVENESS(Steel, Poison, 1);
|
||||
CHECK_EFFECTIVENESS(Steel, Ground, 1);
|
||||
CHECK_EFFECTIVENESS(Steel, Rock, 2);
|
||||
CHECK_EFFECTIVENESS(Steel, Bug, 1);
|
||||
CHECK_EFFECTIVENESS(Steel, Ghost, 1);
|
||||
CHECK_EFFECTIVENESS(Steel, Steel, 0.5);
|
||||
CHECK_EFFECTIVENESS(Steel, Fire, 0.5);
|
||||
CHECK_EFFECTIVENESS(Steel, Water, 0.5);
|
||||
CHECK_EFFECTIVENESS(Steel, Grass, 1);
|
||||
CHECK_EFFECTIVENESS(Steel, Electric, 0.5);
|
||||
CHECK_EFFECTIVENESS(Steel, Psychic, 1);
|
||||
CHECK_EFFECTIVENESS(Steel, Ice, 2);
|
||||
CHECK_EFFECTIVENESS(Steel, Dragon, 1);
|
||||
CHECK_EFFECTIVENESS(Steel, Dark, 1);
|
||||
CHECK_EFFECTIVENESS(Steel, Fairy, 2);
|
||||
}
|
||||
|
||||
TEST_CASE("Type Effectiveness - Fire Attacking", "[type]") {
|
||||
auto typeLib = Library::GetStaticLib()->GetTypeLibrary();
|
||||
CHECK_EFFECTIVENESS(Fire, Normal, 1);
|
||||
CHECK_EFFECTIVENESS(Fire, Fighting, 1);
|
||||
CHECK_EFFECTIVENESS(Fire, Flying, 1);
|
||||
CHECK_EFFECTIVENESS(Fire, Poison, 1);
|
||||
CHECK_EFFECTIVENESS(Fire, Ground, 1);
|
||||
CHECK_EFFECTIVENESS(Fire, Rock, 0.5);
|
||||
CHECK_EFFECTIVENESS(Fire, Bug, 2);
|
||||
CHECK_EFFECTIVENESS(Fire, Ghost, 1);
|
||||
CHECK_EFFECTIVENESS(Fire, Steel, 2);
|
||||
CHECK_EFFECTIVENESS(Fire, Fire, 0.5);
|
||||
CHECK_EFFECTIVENESS(Fire, Water, 0.5);
|
||||
CHECK_EFFECTIVENESS(Fire, Grass, 2);
|
||||
CHECK_EFFECTIVENESS(Fire, Electric, 1);
|
||||
CHECK_EFFECTIVENESS(Fire, Psychic, 1);
|
||||
CHECK_EFFECTIVENESS(Fire, Ice, 2);
|
||||
CHECK_EFFECTIVENESS(Fire, Dragon, 0.5);
|
||||
CHECK_EFFECTIVENESS(Fire, Dark, 1);
|
||||
CHECK_EFFECTIVENESS(Fire, Fairy, 1);
|
||||
}
|
||||
|
||||
TEST_CASE("Type Effectiveness - Water Attacking", "[type]") {
|
||||
auto typeLib = Library::GetStaticLib()->GetTypeLibrary();
|
||||
CHECK_EFFECTIVENESS(Water, Normal, 1);
|
||||
CHECK_EFFECTIVENESS(Water, Fighting, 1);
|
||||
CHECK_EFFECTIVENESS(Water, Flying, 1);
|
||||
CHECK_EFFECTIVENESS(Water, Poison, 1);
|
||||
CHECK_EFFECTIVENESS(Water, Ground, 2);
|
||||
CHECK_EFFECTIVENESS(Water, Rock, 2);
|
||||
CHECK_EFFECTIVENESS(Water, Bug, 1);
|
||||
CHECK_EFFECTIVENESS(Water, Ghost, 1);
|
||||
CHECK_EFFECTIVENESS(Water, Steel, 1);
|
||||
CHECK_EFFECTIVENESS(Water, Fire, 2);
|
||||
CHECK_EFFECTIVENESS(Water, Water, 0.5);
|
||||
CHECK_EFFECTIVENESS(Water, Grass, 0.5);
|
||||
CHECK_EFFECTIVENESS(Water, Electric, 1);
|
||||
CHECK_EFFECTIVENESS(Water, Psychic, 1);
|
||||
CHECK_EFFECTIVENESS(Water, Ice, 1);
|
||||
CHECK_EFFECTIVENESS(Water, Dragon, 0.5);
|
||||
CHECK_EFFECTIVENESS(Water, Dark, 1);
|
||||
CHECK_EFFECTIVENESS(Water, Fairy, 1);
|
||||
}
|
||||
|
||||
TEST_CASE("Type Effectiveness - Grass Attacking", "[type]") {
|
||||
auto typeLib = Library::GetStaticLib()->GetTypeLibrary();
|
||||
CHECK_EFFECTIVENESS(Grass, Normal, 1);
|
||||
CHECK_EFFECTIVENESS(Grass, Fighting, 1);
|
||||
CHECK_EFFECTIVENESS(Grass, Flying, 0.5);
|
||||
CHECK_EFFECTIVENESS(Grass, Poison, 0.5);
|
||||
CHECK_EFFECTIVENESS(Grass, Ground, 2);
|
||||
CHECK_EFFECTIVENESS(Grass, Rock, 2);
|
||||
CHECK_EFFECTIVENESS(Grass, Bug, 0.5);
|
||||
CHECK_EFFECTIVENESS(Grass, Ghost, 1);
|
||||
CHECK_EFFECTIVENESS(Grass, Steel, 0.5);
|
||||
CHECK_EFFECTIVENESS(Grass, Fire, 0.5);
|
||||
CHECK_EFFECTIVENESS(Grass, Water, 2);
|
||||
CHECK_EFFECTIVENESS(Grass, Grass, 0.5);
|
||||
CHECK_EFFECTIVENESS(Grass, Electric, 1);
|
||||
CHECK_EFFECTIVENESS(Grass, Psychic, 1);
|
||||
CHECK_EFFECTIVENESS(Grass, Ice, 1);
|
||||
CHECK_EFFECTIVENESS(Grass, Dragon, 0.5);
|
||||
CHECK_EFFECTIVENESS(Grass, Dark, 1);
|
||||
CHECK_EFFECTIVENESS(Grass, Fairy, 1);
|
||||
}
|
||||
|
||||
TEST_CASE("Type Effectiveness - Electric Attacking", "[type]") {
|
||||
auto typeLib = Library::GetStaticLib()->GetTypeLibrary();
|
||||
CHECK_EFFECTIVENESS(Electric, Normal, 1);
|
||||
CHECK_EFFECTIVENESS(Electric, Fighting, 1);
|
||||
CHECK_EFFECTIVENESS(Electric, Flying, 2);
|
||||
CHECK_EFFECTIVENESS(Electric, Poison, 1);
|
||||
CHECK_EFFECTIVENESS(Electric, Ground, 0);
|
||||
CHECK_EFFECTIVENESS(Electric, Rock, 1);
|
||||
CHECK_EFFECTIVENESS(Electric, Bug, 1);
|
||||
CHECK_EFFECTIVENESS(Electric, Ghost, 1);
|
||||
CHECK_EFFECTIVENESS(Electric, Steel, 1);
|
||||
CHECK_EFFECTIVENESS(Electric, Fire, 1);
|
||||
CHECK_EFFECTIVENESS(Electric, Water, 2);
|
||||
CHECK_EFFECTIVENESS(Electric, Grass, 0.5);
|
||||
CHECK_EFFECTIVENESS(Electric, Electric, 0.5);
|
||||
CHECK_EFFECTIVENESS(Electric, Psychic, 1);
|
||||
CHECK_EFFECTIVENESS(Electric, Ice, 1);
|
||||
CHECK_EFFECTIVENESS(Electric, Dragon, 0.5);
|
||||
CHECK_EFFECTIVENESS(Electric, Dark, 1);
|
||||
CHECK_EFFECTIVENESS(Electric, Fairy, 1);
|
||||
}
|
||||
|
||||
TEST_CASE("Type Effectiveness - Psychic Attacking", "[type]") {
|
||||
auto typeLib = Library::GetStaticLib()->GetTypeLibrary();
|
||||
CHECK_EFFECTIVENESS(Psychic, Normal, 1);
|
||||
CHECK_EFFECTIVENESS(Psychic, Fighting, 2);
|
||||
CHECK_EFFECTIVENESS(Psychic, Flying, 1);
|
||||
CHECK_EFFECTIVENESS(Psychic, Poison, 2);
|
||||
CHECK_EFFECTIVENESS(Psychic, Ground, 1);
|
||||
CHECK_EFFECTIVENESS(Psychic, Rock, 1);
|
||||
CHECK_EFFECTIVENESS(Psychic, Bug, 1);
|
||||
CHECK_EFFECTIVENESS(Psychic, Ghost, 1);
|
||||
CHECK_EFFECTIVENESS(Psychic, Steel, 0.5);
|
||||
CHECK_EFFECTIVENESS(Psychic, Fire, 1);
|
||||
CHECK_EFFECTIVENESS(Psychic, Water, 1);
|
||||
CHECK_EFFECTIVENESS(Psychic, Grass, 1);
|
||||
CHECK_EFFECTIVENESS(Psychic, Electric, 1);
|
||||
CHECK_EFFECTIVENESS(Psychic, Psychic, 0.5);
|
||||
CHECK_EFFECTIVENESS(Psychic, Ice, 1);
|
||||
CHECK_EFFECTIVENESS(Psychic, Dragon, 1);
|
||||
CHECK_EFFECTIVENESS(Psychic, Dark, 0);
|
||||
CHECK_EFFECTIVENESS(Psychic, Fairy, 1);
|
||||
}
|
||||
|
||||
TEST_CASE("Type Effectiveness - Ice Attacking", "[type]") {
|
||||
auto typeLib = Library::GetStaticLib()->GetTypeLibrary();
|
||||
CHECK_EFFECTIVENESS(Ice, Normal, 1);
|
||||
CHECK_EFFECTIVENESS(Ice, Fighting, 1);
|
||||
CHECK_EFFECTIVENESS(Ice, Flying, 2);
|
||||
CHECK_EFFECTIVENESS(Ice, Poison, 1);
|
||||
CHECK_EFFECTIVENESS(Ice, Ground, 2);
|
||||
CHECK_EFFECTIVENESS(Ice, Rock, 1);
|
||||
CHECK_EFFECTIVENESS(Ice, Bug, 1);
|
||||
CHECK_EFFECTIVENESS(Ice, Ghost, 1);
|
||||
CHECK_EFFECTIVENESS(Ice, Steel, 0.5);
|
||||
CHECK_EFFECTIVENESS(Ice, Fire, 0.5);
|
||||
CHECK_EFFECTIVENESS(Ice, Water, 0.5);
|
||||
CHECK_EFFECTIVENESS(Ice, Grass, 2);
|
||||
CHECK_EFFECTIVENESS(Ice, Electric, 1);
|
||||
CHECK_EFFECTIVENESS(Ice, Psychic, 1);
|
||||
CHECK_EFFECTIVENESS(Ice, Ice, 0.5);
|
||||
CHECK_EFFECTIVENESS(Ice, Dragon, 2);
|
||||
CHECK_EFFECTIVENESS(Ice, Dark, 1);
|
||||
CHECK_EFFECTIVENESS(Ice, Fairy, 1);
|
||||
}
|
||||
|
||||
TEST_CASE("Type Effectiveness - Dragon Attacking", "[type]") {
|
||||
auto typeLib = Library::GetStaticLib()->GetTypeLibrary();
|
||||
CHECK_EFFECTIVENESS(Dragon, Normal, 1);
|
||||
CHECK_EFFECTIVENESS(Dragon, Fighting, 1);
|
||||
CHECK_EFFECTIVENESS(Dragon, Flying, 1);
|
||||
CHECK_EFFECTIVENESS(Dragon, Poison, 1);
|
||||
CHECK_EFFECTIVENESS(Dragon, Ground, 1);
|
||||
CHECK_EFFECTIVENESS(Dragon, Rock, 1);
|
||||
CHECK_EFFECTIVENESS(Dragon, Bug, 1);
|
||||
CHECK_EFFECTIVENESS(Dragon, Ghost, 1);
|
||||
CHECK_EFFECTIVENESS(Dragon, Steel, 0.5);
|
||||
CHECK_EFFECTIVENESS(Dragon, Fire, 1);
|
||||
CHECK_EFFECTIVENESS(Dragon, Water, 1);
|
||||
CHECK_EFFECTIVENESS(Dragon, Grass, 1);
|
||||
CHECK_EFFECTIVENESS(Dragon, Electric, 1);
|
||||
CHECK_EFFECTIVENESS(Dragon, Psychic, 1);
|
||||
CHECK_EFFECTIVENESS(Dragon, Ice, 1);
|
||||
CHECK_EFFECTIVENESS(Dragon, Dragon, 2);
|
||||
CHECK_EFFECTIVENESS(Dragon, Dark, 1);
|
||||
CHECK_EFFECTIVENESS(Dragon, Fairy, 0);
|
||||
}
|
||||
|
||||
TEST_CASE("Type Effectiveness - Dark Attacking", "[type]") {
|
||||
auto typeLib = Library::GetStaticLib()->GetTypeLibrary();
|
||||
CHECK_EFFECTIVENESS(Dark, Normal, 1);
|
||||
CHECK_EFFECTIVENESS(Dark, Fighting, 0.5);
|
||||
CHECK_EFFECTIVENESS(Dark, Flying, 1);
|
||||
CHECK_EFFECTIVENESS(Dark, Poison, 1);
|
||||
CHECK_EFFECTIVENESS(Dark, Ground, 1);
|
||||
CHECK_EFFECTIVENESS(Dark, Rock, 1);
|
||||
CHECK_EFFECTIVENESS(Dark, Bug, 1);
|
||||
CHECK_EFFECTIVENESS(Dark, Ghost, 2);
|
||||
CHECK_EFFECTIVENESS(Dark, Steel, 1);
|
||||
CHECK_EFFECTIVENESS(Dark, Fire, 1);
|
||||
CHECK_EFFECTIVENESS(Dark, Water, 1);
|
||||
CHECK_EFFECTIVENESS(Dark, Grass, 1);
|
||||
CHECK_EFFECTIVENESS(Dark, Electric, 1);
|
||||
CHECK_EFFECTIVENESS(Dark, Psychic, 2);
|
||||
CHECK_EFFECTIVENESS(Dark, Ice, 1);
|
||||
CHECK_EFFECTIVENESS(Dark, Dragon, 1);
|
||||
CHECK_EFFECTIVENESS(Dark, Dark, 0.5);
|
||||
CHECK_EFFECTIVENESS(Dark, Fairy, 0.5);
|
||||
}
|
||||
|
||||
TEST_CASE("Type Effectiveness - Fairy Attacking", "[type]") {
|
||||
auto typeLib = Library::GetStaticLib()->GetTypeLibrary();
|
||||
CHECK_EFFECTIVENESS(Fairy, Normal, 1);
|
||||
CHECK_EFFECTIVENESS(Fairy, Fighting, 2);
|
||||
CHECK_EFFECTIVENESS(Fairy, Flying, 1);
|
||||
CHECK_EFFECTIVENESS(Fairy, Poison, 0.5);
|
||||
CHECK_EFFECTIVENESS(Fairy, Ground, 1);
|
||||
CHECK_EFFECTIVENESS(Fairy, Rock, 1);
|
||||
CHECK_EFFECTIVENESS(Fairy, Bug, 1);
|
||||
CHECK_EFFECTIVENESS(Fairy, Ghost, 1);
|
||||
CHECK_EFFECTIVENESS(Fairy, Steel, 0.5);
|
||||
CHECK_EFFECTIVENESS(Fairy, Fire, 0.5);
|
||||
CHECK_EFFECTIVENESS(Fairy, Water, 1);
|
||||
CHECK_EFFECTIVENESS(Fairy, Grass, 1);
|
||||
CHECK_EFFECTIVENESS(Fairy, Electric, 1);
|
||||
CHECK_EFFECTIVENESS(Fairy, Psychic, 1);
|
||||
CHECK_EFFECTIVENESS(Fairy, Ice, 1);
|
||||
CHECK_EFFECTIVENESS(Fairy, Dragon, 2);
|
||||
CHECK_EFFECTIVENESS(Fairy, Dark, 2);
|
||||
CHECK_EFFECTIVENESS(Fairy, Fairy, 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#undef CHECK_EFFECTIVENESS
|
|
@ -0,0 +1,34 @@
|
|||
#define CATCH_CONFIG_RUNNER
|
||||
#include "../extern/catch.hpp"
|
||||
#include "BuildData/BuildSpecies.hpp"
|
||||
#include "BuildData/BuildTypes.hpp"
|
||||
#include "Library.hpp"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
Catch::Session session;
|
||||
|
||||
std::string typesFile = "Types.csv";
|
||||
std::string pokemonFile = "Pokemon.json";
|
||||
|
||||
using namespace Catch::clara;
|
||||
auto cli = session.cli()
|
||||
| Opt(pokemonFile, "Species")["--species"]("Which species file to load.")
|
||||
| Opt(typesFile, "Types")["--types"]("Which Types file to load.");
|
||||
|
||||
session.cli(cli);
|
||||
|
||||
int returnCode = session.applyCommandLine(argc, argv);
|
||||
if (returnCode != 0) // Indicates a command line error
|
||||
return returnCode;
|
||||
|
||||
auto typesLibrary = BuildTypes::Build(typesFile);
|
||||
auto speciesLibrary = BuildSpecies::BuildLibrary(pokemonFile, typesLibrary);
|
||||
|
||||
auto settings = new PkmnLib::Library::LibrarySettings(100, 4, 4096);
|
||||
auto library = new PkmnLib::Library::PokemonLibrary(settings, speciesLibrary,nullptr,nullptr, nullptr,typesLibrary,
|
||||
nullptr);
|
||||
|
||||
Library::SetStaticLib(library);
|
||||
|
||||
return session.run();
|
||||
}
|
Loading…
Reference in New Issue