33 lines
1.8 KiB
C++
33 lines
1.8 KiB
C++
#include "../../src/Library/Items/Item.hpp"
|
|
#include <Arbutils/StringView.hpp>
|
|
#include "../Core.hpp"
|
|
using namespace PkmnLib::Library;
|
|
|
|
export Item* PkmnLib_Item_Construct(const char* name, CreatureLib::Library::ItemCategory category,
|
|
CreatureLib::Library::BattleItemCategory battleCategory, int32_t price,
|
|
const char* effectName, CreatureLib::Library::EffectParameter* effectParameters[],
|
|
size_t effectParameterCount, const char* battleTriggerEffectName,
|
|
CreatureLib::Library::EffectParameter* battleTriggerEffectParameters[],
|
|
size_t battleTriggerEffectParameterCount, const char* flags[], size_t flagsCount,
|
|
uint8_t flingPower) {
|
|
std::unordered_set<uint32_t> conversedFlags(flagsCount);
|
|
for (size_t i = 0; i < flagsCount; i++) {
|
|
conversedFlags.insert(ArbUt::StringView::CalculateHash(flags[i]));
|
|
}
|
|
|
|
return new Item(
|
|
ArbUt::StringView(name), category, battleCategory, price,
|
|
new CreatureLib::Library::SecondaryEffect(100, effectName,
|
|
ArbUt::List<CreatureLib::Library::EffectParameter*>(
|
|
effectParameters, effectParameters + effectParameterCount)),
|
|
new CreatureLib::Library::SecondaryEffect(
|
|
100, battleTriggerEffectName,
|
|
ArbUt::List<CreatureLib::Library::EffectParameter*>(
|
|
battleTriggerEffectParameters, battleTriggerEffectParameters + battleTriggerEffectParameterCount)),
|
|
|
|
conversedFlags, flingPower);
|
|
};
|
|
|
|
export void PkmnLib_Item_Destruct(const Item* p) { delete p; }
|
|
|
|
SIMPLE_GET_FUNC(Item, GetFlingPower, uint8_t) |