12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889 |
- #include "BasicTool.h"
- #include <numeric>
- #include "Block.h"
- #include "Dimension.h"
- #include "Entity.h"
- #include "Game.h"
- #undef max
- XPBasedLevelUpRule::XPBasedLevelUpRule()
- : ItemSkillLevelUpRule(),
- xpIncrease(0.0),
- xpMultiplier(2.0),
- levelIncrease(1.0),
- levelMultiplier(1.0),
- maxLevel(std::numeric_limits<float>::max())
- {}
- void XPBasedLevelUpRule::applyOn(ItemSkill* zSkill)
- {
- if (zSkill->getXp() >= zSkill->getMaxXp())
- {
- zSkill->setXp(zSkill->getXp() - zSkill->getMaxXp());
- zSkill->setLevel(MIN(
- (zSkill->getLevel() + levelIncrease) * levelMultiplier, maxLevel));
- zSkill->setMaxXp((zSkill->getMaxXp() + xpIncrease) * xpMultiplier);
- }
- }
- void XPBasedLevelUpRule::setXpIncrease(float xpIncrease)
- {
- this->xpIncrease = xpIncrease;
- }
- float XPBasedLevelUpRule::getXpIncrease() const
- {
- return xpIncrease;
- }
- void XPBasedLevelUpRule::setXpMultiplier(float xpMultiplier)
- {
- this->xpMultiplier = xpMultiplier;
- }
- float XPBasedLevelUpRule::getXpMultiplier() const
- {
- return xpMultiplier;
- }
- void XPBasedLevelUpRule::setLevelIncrease(float levelIncrease)
- {
- this->levelIncrease = levelIncrease;
- }
- float XPBasedLevelUpRule::getLevelIncrease() const
- {
- return levelIncrease;
- }
- void XPBasedLevelUpRule::setLevelMultiplier(float levelMultiplier)
- {
- this->levelMultiplier = levelMultiplier;
- }
- float XPBasedLevelUpRule::getLevelMultiplier() const
- {
- return levelMultiplier;
- }
- void XPBasedLevelUpRule::setMaxLevel(float maxLevel)
- {
- this->maxLevel = maxLevel;
- }
- float XPBasedLevelUpRule::getMaxLevel() const
- {
- return maxLevel;
- }
- XPBasedLevelUpRuleFactory::XPBasedLevelUpRuleFactory()
- : SubTypeFactory()
- {}
- XPBasedLevelUpRule* XPBasedLevelUpRuleFactory::createValue(
- Framework::JSON::JSONObject* zJson) const
- {
- return new XPBasedLevelUpRule();
- }
- void XPBasedLevelUpRuleFactory::fromJson(
- XPBasedLevelUpRule* zResult, Framework::JSON::JSONObject* zJson) const
- {
- if (zJson->hasValue("maxLevel"))
- {
- zResult->setMaxLevel(
- (float)zJson->zValue("maxLevel")->asNumber()->getNumber());
- }
- zResult->setXpIncrease(
- (float)zJson->zValue("xpIncrease")->asNumber()->getNumber());
- zResult->setXpMultiplier(
- (float)zJson->zValue("xpMultiplier")->asNumber()->getNumber());
- zResult->setLevelIncrease(
- (float)zJson->zValue("levelIncrease")->asNumber()->getNumber());
- zResult->setLevelMultiplier(
- (float)zJson->zValue("levelMultiplier")->asNumber()->getNumber());
- }
- void XPBasedLevelUpRuleFactory::toJson(
- XPBasedLevelUpRule* zObject, Framework::JSON::JSONObject* zResult) const
- {
- zResult->addValue("xpIncrease",
- new Framework::JSON::JSONNumber(zObject->getXpIncrease()));
- zResult->addValue("xpMultiplier",
- new Framework::JSON::JSONNumber(zObject->getXpMultiplier()));
- zResult->addValue("levelIncrease",
- new Framework::JSON::JSONNumber(zObject->getLevelIncrease()));
- zResult->addValue("levelMultiplier",
- new Framework::JSON::JSONNumber(zObject->getLevelMultiplier()));
- zResult->addValue(
- "maxLevel", new Framework::JSON::JSONNumber(zObject->getMaxLevel()));
- }
- JSONObjectValidationBuilder* XPBasedLevelUpRuleFactory::addToValidator(
- JSONObjectValidationBuilder* builder) const
- {
- return builder->withRequiredNumber("xpIncrease")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.0)
- ->finishNumber()
- ->withRequiredNumber("xpMultiplier")
- ->whichIsGreaterThen(0.0)
- ->withDefault(2.0)
- ->finishNumber()
- ->withRequiredNumber("levelIncrease")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(1.0)
- ->finishNumber()
- ->withRequiredNumber("levelMultiplier")
- ->whichIsGreaterThen(0.0)
- ->withDefault(1.0)
- ->finishNumber()
- ->withRequiredNumber("maxLevel")
- ->whichIsOptional()
- ->finishNumber();
- }
- Framework::Text XPBasedLevelUpRuleFactory::getTypeToken() const
- {
- return "xpBased";
- }
- BasicToolItem::BasicToolItem(
- int itemTypeId, Framework::Text name, float maxHp, float maxDurability)
- : Item(itemTypeId, name),
- headMaterialHardness(0.0),
- rodMaterialHardness(0.0),
- handleMaterialHardness(0.0)
- {
- hp = maxHp;
- this->maxHp = maxHp;
- durability = maxDurability;
- this->maxDurability = maxDurability;
- eatable = 0;
- placeable = 0;
- equippable = 0;
- solid = 1;
- usable = 1;
- }
- void BasicToolItem::setHeadMaterialHardness(float hardness)
- {
- headMaterialHardness = hardness;
- }
- void BasicToolItem::setRodMaterialHardness(float hardness)
- {
- rodMaterialHardness = hardness;
- }
- void BasicToolItem::setHandleMaterialHardness(float hardness)
- {
- handleMaterialHardness = hardness;
- }
- float BasicToolItem::getHeadMaterialHardness() const
- {
- return headMaterialHardness;
- }
- float BasicToolItem::getRodMaterialHardness() const
- {
- return rodMaterialHardness;
- }
- float BasicToolItem::getHandleMaterialHardness() const
- {
- return handleMaterialHardness;
- }
- BasicToolItemType::BasicToolItemType()
- : ItemType(),
- headMaterialHardness(1.f),
- rodMaterialHardness(1.f),
- handleMaterialHardness(1.f),
- baseDurability(10.f),
- baseDurabilityMultiplier(1.f),
- headMaterialDurability(10.f),
- headMaterialDurabilityMultiplier(0.f),
- rodMaterialDurability(10.f),
- rodMaterialDurabilityMultiplier(0.f),
- handleMaterialDurability(10.f),
- handleMaterialDurabilityMultiplier(0.0),
- levelUpRule(0),
- brokenItemTypeName(),
- itemSkillConfigJson(0),
- brokenItemTypeId(-1)
- {}
- BasicToolItemType::~BasicToolItemType()
- {
- if (levelUpRule) levelUpRule->release();
- if (itemSkillConfigJson) itemSkillConfigJson->release();
- }
- void BasicToolItemType::loadSuperItem(
- Item* zItem, Framework::StreamReader* zReader) const
- {
- BasicToolItem* item = dynamic_cast<BasicToolItem*>(zItem);
- float data;
- zReader->lese((char*)&data, 4);
- item->setHeadMaterialHardness(data);
- zReader->lese((char*)&data, 4);
- item->setRodMaterialHardness(data);
- zReader->lese((char*)&data, 4);
- item->setHandleMaterialHardness(data);
- ItemType::loadSuperItem(item, zReader);
- }
- void BasicToolItemType::saveSuperItem(
- const Item* zItem, Framework::StreamWriter* zWriter) const
- {
- const BasicToolItem* item = dynamic_cast<const BasicToolItem*>(zItem);
- float data = item->getHeadMaterialHardness();
- zWriter->schreibe((char*)&data, 4);
- data = item->getRodMaterialHardness();
- zWriter->schreibe((char*)&data, 4);
- data = item->getHandleMaterialHardness();
- zWriter->schreibe((char*)&data, 4);
- ItemType::saveSuperItem(item, zWriter);
- }
- bool BasicToolItemType::initialize(Game* zGame)
- {
- brokenItemTypeId = zGame->getItemTypeId(brokenItemTypeName);
- return brokenItemTypeId >= 0 && ItemType::initialize(zGame);
- }
- const ItemType* BasicToolItemType::zBrokenItemType() const
- {
- return Game::INSTANCE->zItemType(brokenItemTypeId);
- }
- Item* BasicToolItemType::createItem() const
- {
- BasicToolItem* item = new BasicToolItem(getId(),
- getName(),
- 1.f,
- (baseDurability + headMaterialDurability * headMaterialHardness
- + rodMaterialDurability * rodMaterialHardness
- + handleMaterialDurability * handleMaterialHardness)
- * (baseDurabilityMultiplier
- + headMaterialDurabilityMultiplier * headMaterialHardness
- + rodMaterialDurabilityMultiplier * rodMaterialHardness
- + handleMaterialDurabilityMultiplier * handleMaterialHardness));
- item->setHandleMaterialHardness(headMaterialHardness);
- item->setRodMaterialHardness(rodMaterialHardness);
- item->setHandleMaterialHardness(handleMaterialHardness);
- return item;
- }
- void BasicToolItemType::levelUpItemSkill(ItemSkill* zSkill) const
- {
- levelUpRule->applyOn(zSkill);
- }
- void BasicToolItemType::setItemAttribute(
- Item* zItem, Framework::Text name, Framework::JSON::JSONValue* zValue) const
- {
- BasicToolItem* item = dynamic_cast<BasicToolItem*>(zItem);
- if (name.istGleich("headMaterialHardness")
- && zValue->getType() == Framework::JSON::JSONType::NUMBER)
- {
- item->setHeadMaterialHardness((float)zValue->asNumber()->getNumber());
- }
- else if (name.istGleich("rodMaterialHardness")
- && zValue->getType() == Framework::JSON::JSONType::NUMBER)
- {
- item->setRodMaterialHardness((float)zValue->asNumber()->getNumber());
- }
- else if (name.istGleich("handleMaterialHardness")
- && zValue->getType() == Framework::JSON::JSONType::NUMBER)
- {
- item->setHandleMaterialHardness((float)zValue->asNumber()->getNumber());
- }
- else
- {
- ItemType::setItemAttribute(item, name, zValue);
- }
- item->setMaxDurability(
- (baseDurability
- + headMaterialDurability * item->getHandleMaterialHardness()
- + rodMaterialDurability * item->getRodMaterialHardness()
- + handleMaterialDurability * item->getHandleMaterialHardness())
- * (baseDurabilityMultiplier
- + headMaterialDurabilityMultiplier * item->getHeadMaterialHardness()
- + rodMaterialDurabilityMultiplier * item->getRodMaterialHardness()
- + handleMaterialDurabilityMultiplier
- * item->getHandleMaterialHardness()));
- }
- void BasicToolItemType::addItemAttributes(
- Item* zItem, Framework::JSON::JSONObject* zItemObjet) const
- {
- BasicToolItem* item = dynamic_cast<BasicToolItem*>(zItem);
- zItemObjet->addValue("headMaterialHardness",
- new Framework::JSON::JSONNumber(item->getHeadMaterialHardness()));
- zItemObjet->addValue("rodMaterialHardness",
- new Framework::JSON::JSONNumber(item->getRodMaterialHardness()));
- zItemObjet->addValue("handleMaterialHardness",
- new Framework::JSON::JSONNumber(item->getHandleMaterialHardness()));
- ItemType::addItemAttributes(item, zItemObjet);
- }
- ItemSkill* BasicToolItemType::createDefaultItemSkill() const
- {
- return Game::INSTANCE->zTypeRegistry()->fromJson<ItemSkill>(
- itemSkillConfigJson);
- }
- void BasicToolItemType::setBrokenItemTypeName(
- Framework::Text brokenItemTypeName)
- {
- this->brokenItemTypeName = brokenItemTypeName;
- }
- Framework::Text BasicToolItemType::getBrokenItemTypeName() const
- {
- return brokenItemTypeName;
- }
- void BasicToolItemType::setHeadMaterialHardness(float hardness)
- {
- headMaterialHardness = hardness;
- }
- float BasicToolItemType::getHeadMaterialHardness() const
- {
- return headMaterialHardness;
- }
- void BasicToolItemType::setRodMaterialHardness(float hardness)
- {
- rodMaterialHardness = hardness;
- }
- float BasicToolItemType::getRodMaterialHardness() const
- {
- return rodMaterialHardness;
- }
- void BasicToolItemType::setHandleMaterialHardness(float hardness)
- {
- handleMaterialHardness = hardness;
- }
- float BasicToolItemType::getHandleMaterialHardness() const
- {
- return handleMaterialHardness;
- }
- void BasicToolItemType::setBaseDurability(float durability)
- {
- baseDurability = durability;
- }
- float BasicToolItemType::getBaseDurablility() const
- {
- return baseDurability;
- }
- void BasicToolItemType::setBaseDurabilityMultiplier(float multiplier)
- {
- baseDurabilityMultiplier = multiplier;
- }
- float BasicToolItemType::getBaseDurabilityMultiplier() const
- {
- return baseDurabilityMultiplier;
- }
- void BasicToolItemType::setHeadMaterialDurability(float durability)
- {
- headMaterialDurability = durability;
- }
- float BasicToolItemType::getHeadMaterialDurability() const
- {
- return headMaterialDurability;
- }
- void BasicToolItemType::setHeadMaterialDurabilityMultiplier(float multiplier)
- {
- headMaterialDurabilityMultiplier = multiplier;
- }
- float BasicToolItemType::getHeadMaterialDurabilityMultiplier() const
- {
- return headMaterialDurabilityMultiplier;
- }
- void BasicToolItemType::setRodMaterialDurability(float durability)
- {
- rodMaterialDurability = durability;
- }
- float BasicToolItemType::getRodMaterialDurability() const
- {
- return rodMaterialDurability;
- }
- void BasicToolItemType::setRodMaterialDurabilityMultiplier(float multiplier)
- {
- rodMaterialDurabilityMultiplier = multiplier;
- }
- float BasicToolItemType::getRodMaterialDurabilityMultiplier() const
- {
- return rodMaterialDurabilityMultiplier;
- }
- void BasicToolItemType::setHandleMaterialDurability(float durability)
- {
- handleMaterialDurability = durability;
- }
- float BasicToolItemType::getHandleMaterialDurability() const
- {
- return handleMaterialDurability;
- }
- void BasicToolItemType::setHandleMaterialDurabilityMultiplier(float multiplier)
- {
- handleMaterialDurabilityMultiplier = multiplier;
- }
- float BasicToolItemType::getHandleMaterialDurabilityMultiplier() const
- {
- return handleMaterialDurabilityMultiplier;
- }
- void BasicToolItemType::setLevelUpRule(ItemSkillLevelUpRule* rule)
- {
- if (levelUpRule) levelUpRule->release();
- levelUpRule = rule;
- }
- ItemSkillLevelUpRule* BasicToolItemType::zLevelUpRule() const
- {
- return levelUpRule;
- }
- void BasicToolItemType::setItemSkillConfigJson(
- Framework::JSON::JSONObject* zJson)
- {
- if (itemSkillConfigJson) itemSkillConfigJson->release();
- itemSkillConfigJson = zJson;
- }
- Framework::JSON::JSONObject* BasicToolItemType::getItemSkillConfigJson() const
- {
- return dynamic_cast<Framework::JSON::JSONObject*>(
- itemSkillConfigJson->getThis());
- }
- BasicToolItemTypeFactory::BasicToolItemTypeFactory()
- : ItemTypeFactoryBase()
- {}
- BasicToolItemType* BasicToolItemTypeFactory::createValue(
- Framework::JSON::JSONObject* zJson) const
- {
- return new BasicToolItemType();
- }
- void BasicToolItemTypeFactory::fromJson(
- BasicToolItemType* zResult, Framework::JSON::JSONObject* zJson) const
- {
- zResult->setHandleMaterialHardness(
- (float)zJson->zValue("headMaterialHardness")->asNumber()->getNumber());
- zResult->setRodMaterialHardness(
- (float)zJson->zValue("rodMaterialHardness")->asNumber()->getNumber());
- zResult->setHandleMaterialHardness(
- (float)zJson->zValue("handleMaterialHardness")
- ->asNumber()
- ->getNumber());
- zResult->setBaseDurability(
- (float)zJson->zValue("baseDurability")->asNumber()->getNumber());
- zResult->setBaseDurabilityMultiplier(
- (float)zJson->zValue("baseDurabilityMultiplier")
- ->asNumber()
- ->getNumber());
- zResult->setHeadMaterialDurability(
- (float)zJson->zValue("headMaterialDurability")
- ->asNumber()
- ->getNumber());
- zResult->setHeadMaterialDurabilityMultiplier(
- (float)zJson->zValue("headMaterialDurabilityMultiplier")
- ->asNumber()
- ->getNumber());
- zResult->setRodMaterialDurability(
- (float)zJson->zValue("rodMaterialDurability")->asNumber()->getNumber());
- zResult->setRodMaterialDurabilityMultiplier(
- (float)zJson->zValue("rodMaterialDurabilityMultiplier")
- ->asNumber()
- ->getNumber());
- zResult->setHandleMaterialDurability(
- (float)zJson->zValue("handleMaterialDurability")
- ->asNumber()
- ->getNumber());
- zResult->setHandleMaterialDurabilityMultiplier(
- (float)zJson->zValue("handleMaterialDurabilityMultiplier")
- ->asNumber()
- ->getNumber());
- zResult->setLevelUpRule(
- Game::INSTANCE->zTypeRegistry()->fromJson<ItemSkillLevelUpRule>(
- zJson->zValue("levelUpRule")));
- zResult->setBrokenItemTypeName(
- zJson->zValue("brokenItemTypeName")->asString()->getString());
- zResult->setItemSkillConfigJson(zJson->getValue("itemSkill")->asObject());
- ItemTypeFactoryBase::fromJson(zResult, zJson);
- }
- void BasicToolItemTypeFactory::toJson(
- BasicToolItemType* zObject, Framework::JSON::JSONObject* zResult) const
- {
- zResult->addValue("headMaterialHardness",
- new Framework::JSON::JSONNumber(zObject->getHeadMaterialHardness()));
- zResult->addValue("rodMaterialHardness",
- new Framework::JSON::JSONNumber(zObject->getRodMaterialHardness()));
- zResult->addValue("handleMaterialHardness",
- new Framework::JSON::JSONNumber(zObject->getHandleMaterialHardness()));
- zResult->addValue("baseDurability",
- new Framework::JSON::JSONNumber(zObject->getBaseDurablility()));
- zResult->addValue("baseDurabilityMultiplier",
- new Framework::JSON::JSONNumber(
- zObject->getBaseDurabilityMultiplier()));
- zResult->addValue("headMaterialDurability",
- new Framework::JSON::JSONNumber(zObject->getHeadMaterialDurability()));
- zResult->addValue("headMaterialDurabilityMultiplier",
- new Framework::JSON::JSONNumber(
- zObject->getHeadMaterialDurabilityMultiplier()));
- zResult->addValue("rodMaterialDurability",
- new Framework::JSON::JSONNumber(zObject->getRodMaterialDurability()));
- zResult->addValue("rodMaterialDurabilityMultiplier",
- new Framework::JSON::JSONNumber(
- zObject->getRodMaterialDurabilityMultiplier()));
- zResult->addValue("handleMaterialDurability",
- new Framework::JSON::JSONNumber(
- zObject->getHandleMaterialDurability()));
- zResult->addValue("handleMaterialDurabilityMultiplier",
- new Framework::JSON::JSONNumber(
- zObject->getHandleMaterialDurabilityMultiplier()));
- zResult->addValue("levelUpRule",
- Game::INSTANCE->zTypeRegistry()->toJson(zObject->zLevelUpRule()));
- zResult->addValue("brokenItemTypeName",
- new Framework::JSON::JSONString(zObject->zBrokenItemType()->getName()));
- zResult->addValue("itemSkill", zObject->getItemSkillConfigJson());
- ItemTypeFactoryBase::toJson(zObject, zResult);
- }
- JSONObjectValidationBuilder* BasicToolItemTypeFactory::addToValidator(
- JSONObjectValidationBuilder* builder) const
- {
- return ItemTypeFactoryBase::addToValidator(
- builder->withRequiredNumber("headMaterialHardness")
- ->withDefault(1.0)
- ->whichIsGreaterOrEqual(0.0)
- ->finishNumber()
- ->withRequiredNumber("rodMaterialHardness")
- ->withDefault(1.0)
- ->whichIsGreaterOrEqual(0.0)
- ->finishNumber()
- ->withRequiredNumber("handleMaterialHardness")
- ->withDefault(1.0)
- ->whichIsGreaterOrEqual(0.0)
- ->finishNumber()
- ->withRequiredNumber("baseDurability")
- ->withDefault(10.0)
- ->whichIsGreaterOrEqual(0.0)
- ->finishNumber()
- ->withRequiredNumber("baseDurabilityMultiplier")
- ->withDefault(1.0)
- ->whichIsGreaterOrEqual(0.0)
- ->finishNumber()
- ->withRequiredNumber("headMaterialDurability")
- ->withDefault(10.0)
- ->whichIsGreaterOrEqual(0.0)
- ->finishNumber()
- ->withRequiredNumber("headMaterialDurabilityMultiplier")
- ->withDefault(0.0)
- ->whichIsGreaterOrEqual(0.0)
- ->finishNumber()
- ->withRequiredNumber("rodMaterialDurability")
- ->withDefault(10.0)
- ->whichIsGreaterOrEqual(0.0)
- ->finishNumber()
- ->withRequiredNumber("rodMaterialDurabilityMultiplier")
- ->withDefault(0.0)
- ->whichIsGreaterOrEqual(0.0)
- ->finishNumber()
- ->withRequiredNumber("handleMaterialDurability")
- ->withDefault(10.0)
- ->whichIsGreaterOrEqual(0.0)
- ->finishNumber()
- ->withRequiredNumber("handleMaterialDurabilityMultiplier")
- ->withDefault(0.0)
- ->whichIsGreaterOrEqual(0.0)
- ->finishNumber()
- ->withRequiredString("brokenItemTypeName")
- ->finishString()
- ->withRequiredAttribute("levelUpRule",
- Game::INSTANCE->zTypeRegistry()
- ->getValidator<ItemSkillLevelUpRule>())
- ->withRequiredAttribute("itemSkill",
- Game::INSTANCE->zTypeRegistry()->getValidator<ItemSkill>()));
- }
- Framework::Text BasicToolItemTypeFactory::getTypeToken() const
- {
- return "tool";
- }
- BlockReplaceItemSkillConfig::BlockReplaceItemSkillConfig()
- : ReferenceCounter(),
- targetBlockFilter(0),
- replacementBlockTypeId(-1),
- cooldownTicks(20),
- staminaCost(0.5f),
- staminaCostDevider(0.8f),
- additionalStaminaCostDeviderPerLevel(0.2f),
- durabilityCost(0.5f),
- durabilityCostDevider(0.89f),
- additionalDurabilityCostDeviderPerLevel(0.02f),
- xpGain(0.5f)
- {}
- BlockReplaceItemSkillConfig::~BlockReplaceItemSkillConfig()
- {
- if (targetBlockFilter) targetBlockFilter->release();
- }
- void BlockReplaceItemSkillConfig::setTargetBlockFilter(
- BlockFilter* targetBlockFilter)
- {
- this->targetBlockFilter = targetBlockFilter;
- }
- BlockFilter* BlockReplaceItemSkillConfig::zTargetBlockFilter() const
- {
- return targetBlockFilter;
- }
- void BlockReplaceItemSkillConfig::setReplacementBlockTypeId(
- int replacementBlockTypeId)
- {
- this->replacementBlockTypeId = replacementBlockTypeId;
- }
- int BlockReplaceItemSkillConfig::getReplacementBlockTypeId() const
- {
- return replacementBlockTypeId;
- }
- void BlockReplaceItemSkillConfig::setCooldownTicks(int cooldownTicks)
- {
- this->cooldownTicks = cooldownTicks;
- }
- int BlockReplaceItemSkillConfig::getCooldownTicks() const
- {
- return cooldownTicks;
- }
- void BlockReplaceItemSkillConfig::setStaminaCost(float staminaCost)
- {
- this->staminaCost = staminaCost;
- }
- float BlockReplaceItemSkillConfig::getStaminaCost() const
- {
- return staminaCost;
- }
- void BlockReplaceItemSkillConfig::setStaminaCostDevider(
- float staminaCostDevider)
- {
- this->staminaCostDevider = staminaCostDevider;
- }
- float BlockReplaceItemSkillConfig::getStaminaCostDevider() const
- {
- return staminaCostDevider;
- }
- void BlockReplaceItemSkillConfig::setAdditionalStaminaCostDeviderPerLevel(
- float additionalStaminaCostDeviderPerLevel)
- {
- this->additionalStaminaCostDeviderPerLevel
- = additionalStaminaCostDeviderPerLevel;
- }
- float BlockReplaceItemSkillConfig::getAdditionalStaminaCostDeviderPerLevel()
- const
- {
- return additionalStaminaCostDeviderPerLevel;
- }
- void BlockReplaceItemSkillConfig::setDurabilityCost(float durabilityCost)
- {
- this->durabilityCost = durabilityCost;
- }
- float BlockReplaceItemSkillConfig::getDurabilityCost() const
- {
- return durabilityCost;
- }
- void BlockReplaceItemSkillConfig::setDurabilityCostDevider(
- float durabilityCostDevider)
- {
- this->durabilityCostDevider = durabilityCostDevider;
- }
- float BlockReplaceItemSkillConfig::getDurabilityCostDevider() const
- {
- return durabilityCostDevider;
- }
- void BlockReplaceItemSkillConfig::setAdditionalDurabilityCostDeviderPerLevel(
- float additionalDurabilityCostDeviderPerLevel)
- {
- this->additionalDurabilityCostDeviderPerLevel
- = additionalDurabilityCostDeviderPerLevel;
- }
- float BlockReplaceItemSkillConfig::getAdditionalDurabilityCostDeviderPerLevel()
- const
- {
- return additionalDurabilityCostDeviderPerLevel;
- }
- void BlockReplaceItemSkillConfig::setXpGain(float xpGain)
- {
- this->xpGain = xpGain;
- }
- float BlockReplaceItemSkillConfig::getXpGain() const
- {
- return xpGain;
- }
- BlockReplaceItemSkillConfigFactory::BlockReplaceItemSkillConfigFactory()
- : TypeFactory()
- {}
- BlockReplaceItemSkillConfig* BlockReplaceItemSkillConfigFactory::createValue(
- Framework::JSON::JSONObject* zJson) const
- {
- return new BlockReplaceItemSkillConfig();
- }
- void BlockReplaceItemSkillConfigFactory::fromJson(
- BlockReplaceItemSkillConfig* zResult,
- Framework::JSON::JSONObject* zJson) const
- {
- zResult->setTargetBlockFilter(
- Game::INSTANCE->zTypeRegistry()->fromJson<BlockFilter>(
- zJson->asObject()->zValue("targetFilter")));
- zResult->setCooldownTicks((int)zJson->asObject()
- ->zValue("cooldownTicks")
- ->asNumber()
- ->getNumber());
- zResult->setReplacementBlockTypeId(
- Game::INSTANCE->getBlockTypeId(zJson->asObject()
- ->zValue("replacementBlockType")
- ->asString()
- ->getString()));
- zResult->setCooldownTicks((int)zJson->asObject()
- ->zValue("cooldownTicks")
- ->asNumber()
- ->getNumber());
- zResult->setStaminaCost((float)zJson->asObject()
- ->zValue("staminaCost")
- ->asNumber()
- ->getNumber());
- zResult->setStaminaCostDevider((float)zJson->asObject()
- ->zValue("staminaCostDevider")
- ->asNumber()
- ->getNumber());
- zResult->setAdditionalStaminaCostDeviderPerLevel(
- (float)zJson->asObject()
- ->zValue("additionalStaminaCostDeviderPerLevel")
- ->asNumber()
- ->getNumber());
- zResult->setDurabilityCost((float)zJson->asObject()
- ->zValue("durabilityCost")
- ->asNumber()
- ->getNumber());
- zResult->setDurabilityCostDevider((float)zJson->asObject()
- ->zValue("durabilityCostDevider")
- ->asNumber()
- ->getNumber());
- zResult->setAdditionalDurabilityCostDeviderPerLevel(
- (float)zJson->asObject()
- ->zValue("additionalDurabilityCostDeviderPerLevel")
- ->asNumber()
- ->getNumber());
- zResult->setXpGain(
- (float)zJson->asObject()->zValue("xpGain")->asNumber()->getNumber());
- }
- void BlockReplaceItemSkillConfigFactory::toJson(
- BlockReplaceItemSkillConfig* zObject,
- Framework::JSON::JSONObject* zResult) const
- {
- zResult->addValue("targetFilter",
- Game::INSTANCE->zTypeRegistry()->toJson(zObject->zTargetBlockFilter()));
- zResult->addValue("replacementBlockType",
- new Framework::JSON::JSONString(
- Game::INSTANCE->zBlockType(zObject->getReplacementBlockTypeId())
- ->getName()));
- zResult->addValue("cooldownTicks",
- new Framework::JSON::JSONNumber(zObject->getCooldownTicks()));
- zResult->addValue("staminaCost",
- new Framework::JSON::JSONNumber(zObject->getStaminaCost()));
- zResult->addValue("staminaCostDevider",
- new Framework::JSON::JSONNumber(zObject->getStaminaCostDevider()));
- zResult->addValue("additionalStaminaCostDeviderPerLevel",
- new Framework::JSON::JSONNumber(
- zObject->getAdditionalStaminaCostDeviderPerLevel()));
- zResult->addValue("durabilityCost",
- new Framework::JSON::JSONNumber(zObject->getDurabilityCost()));
- zResult->addValue("durabilityCostDevider",
- new Framework::JSON::JSONNumber(zObject->getDurabilityCostDevider()));
- zResult->addValue("additionalDurabilityCostDeviderPerLevel",
- new Framework::JSON::JSONNumber(
- zObject->getAdditionalDurabilityCostDeviderPerLevel()));
- zResult->addValue(
- "xpGain", new Framework::JSON::JSONNumber(zObject->getXpGain()));
- }
- JSONObjectValidationBuilder* BlockReplaceItemSkillConfigFactory::addToValidator(
- JSONObjectValidationBuilder* builder) const
- {
- return builder
- ->withRequiredAttribute("targetFilter",
- Game::INSTANCE->zTypeRegistry()->getValidator<BlockFilter>())
- ->withRequiredString("replacementBlockType")
- ->finishString()
- ->withRequiredNumber("cooldownTicks")
- ->whichIsGreaterOrEqual(0)
- ->withDefault(20)
- ->finishNumber()
- ->withRequiredNumber("staminaCost")
- ->whichIsGreaterOrEqual(0)
- ->withDefault(0.5)
- ->finishNumber()
- ->withRequiredNumber("staminaCostDevider")
- ->whichIsGreaterOrEqual(0)
- ->withDefault(0.8)
- ->finishNumber()
- ->withRequiredNumber("additionalStaminaCostDeviderPerLevel")
- ->whichIsGreaterOrEqual(0)
- ->withDefault(0.2)
- ->finishNumber()
- ->withRequiredNumber("durabilityCost")
- ->whichIsGreaterOrEqual(0)
- ->withDefault(0.5)
- ->finishNumber()
- ->withRequiredNumber("durabilityCostDevider")
- ->whichIsGreaterOrEqual(0)
- ->withDefault(0.98)
- ->finishNumber()
- ->withRequiredNumber("additionalDurabilityCostDeviderPerLevel")
- ->whichIsGreaterOrEqual(0)
- ->withDefault(0.02)
- ->finishNumber()
- ->withRequiredNumber("xpGain")
- ->whichIsGreaterOrEqual(0)
- ->withDefault(0.5)
- ->finishNumber();
- }
- BlockReplaceItemSkill::BlockReplaceItemSkill()
- : ItemSkill(),
- invalidUseConfig(0),
- configs(),
- cooldownTicks(20)
- {}
- BlockReplaceItemSkill::~BlockReplaceItemSkill()
- {
- if (invalidUseConfig) invalidUseConfig->release();
- }
- void BlockReplaceItemSkill::load(Framework::StreamReader* zReader)
- {
- zReader->lese((char*)&cooldownTicks, 4);
- ItemSkill::load(zReader);
- }
- void BlockReplaceItemSkill::save(Framework::StreamWriter* zWriter)
- {
- zWriter->schreibe((char*)&cooldownTicks, 4);
- ItemSkill::save(zWriter);
- }
- bool BlockReplaceItemSkill::use(Entity* zActor, Item* zUsedItem, Block* zTarget)
- {
- if (cooldownTicks > 0)
- {
- cooldownTicks--;
- return false;
- }
- BlockReplaceItemSkillConfig* usedConfig = 0;
- for (BlockReplaceItemSkillConfig* config : configs)
- {
- if (config->zTargetBlockFilter()->test(zTarget))
- {
- usedConfig = config;
- break;
- }
- }
- bool invalid = 0;
- if (usedConfig == 0)
- {
- usedConfig = invalidUseConfig;
- invalid = 1;
- }
- float staminaDevider
- = usedConfig->getStaminaCostDevider()
- + usedConfig->getAdditionalStaminaCostDeviderPerLevel() * getLevel();
- float staminaCost = usedConfig->getStaminaCost();
- if (staminaDevider != 0)
- {
- staminaCost /= staminaDevider;
- }
- if (zActor->getStamina() < staminaCost)
- {
- return false;
- }
- float durabilityDevider
- = usedConfig->getDurabilityCostDevider()
- + usedConfig->getAdditionalDurabilityCostDeviderPerLevel() * getLevel();
- float durabilityCost = usedConfig->getDurabilityCost();
- if (durabilityDevider != 0)
- {
- durabilityCost /= durabilityDevider;
- }
- zUsedItem->setDurability(zUsedItem->getDurability() - durabilityCost);
- zActor->setStamina(zActor->getStamina() - staminaCost);
- cooldownTicks = usedConfig->getCooldownTicks();
- setXp(getXp() + usedConfig->getXpGain());
- if (!invalid)
- {
- Framework::Vec3<int> pos = zTarget->getPos();
- int dimension = zTarget->getDimensionId();
- Game::INSTANCE->doLater([pos, dimension, usedConfig]() {
- Game::INSTANCE->zDimension(dimension)->placeBlock(
- pos, usedConfig->getReplacementBlockTypeId());
- });
- }
- return true;
- }
- bool BlockReplaceItemSkill::use(
- Entity* zActor, Item* zUsedItem, Entity* zTarget)
- {
- return false;
- }
- void BlockReplaceItemSkill::setInvalidUseConfig(
- BlockReplaceItemSkillConfig* config)
- {
- if (invalidUseConfig) invalidUseConfig->release();
- invalidUseConfig = config;
- }
- BlockReplaceItemSkillConfig* BlockReplaceItemSkill::zInvalidUseConfig() const
- {
- return invalidUseConfig;
- }
- void BlockReplaceItemSkill::addConfig(BlockReplaceItemSkillConfig* config)
- {
- configs.add(config);
- }
- const Framework::RCArray<BlockReplaceItemSkillConfig>&
- BlockReplaceItemSkill::getConfigs() const
- {
- return configs;
- }
- void BlockReplaceItemSkill::setCooldownTicks(int cooldownTicks)
- {
- this->cooldownTicks = cooldownTicks;
- }
- int BlockReplaceItemSkill::getCooldownTicks() const
- {
- return cooldownTicks;
- }
- BlockReplaceItemSkillFactory::BlockReplaceItemSkillFactory()
- : ItemSkillFactoryBase()
- {}
- BlockReplaceItemSkill* BlockReplaceItemSkillFactory::createValue(
- Framework::JSON::JSONObject* zJson) const
- {
- return new BlockReplaceItemSkill();
- }
- void BlockReplaceItemSkillFactory::fromJson(
- BlockReplaceItemSkill* zResult, Framework::JSON::JSONObject* zJson) const
- {
- BlockReplaceItemSkillConfig* invalidUseConfig
- = new BlockReplaceItemSkillConfig();
- invalidUseConfig->setStaminaCost(
- (float)zJson->zValue("invalidStaminaCost")->asNumber()->getNumber());
- invalidUseConfig->setStaminaCostDevider(
- (float)zJson->zValue("invalidStaminaCostDevider")
- ->asNumber()
- ->getNumber());
- invalidUseConfig->setAdditionalStaminaCostDeviderPerLevel(
- (float)zJson->zValue("invalidAdditionalStaminaCostDeviderPerLevel")
- ->asNumber()
- ->getNumber());
- invalidUseConfig->setDurabilityCost(
- (float)zJson->zValue("invalidDurabilityCost")->asNumber()->getNumber());
- invalidUseConfig->setDurabilityCostDevider(
- (float)zJson->zValue("invalidDurabilityCostDevider")
- ->asNumber()
- ->getNumber());
- invalidUseConfig->setAdditionalDurabilityCostDeviderPerLevel(
- (float)zJson->zValue("invalidAdditionalDurabilityCostDeviderPerLevel")
- ->asNumber()
- ->getNumber());
- invalidUseConfig->setCooldownTicks(
- (int)zJson->zValue("invalidCooldownTicks")->asNumber()->getNumber());
- invalidUseConfig->setXpGain(0.f);
- zResult->setInvalidUseConfig(invalidUseConfig);
- Framework::RCArray<BlockReplaceItemSkillConfig> configs;
- for (Framework::JSON::JSONValue* value :
- *zJson->zValue("configs")->asArray())
- {
- zResult->addConfig(Game::INSTANCE->zTypeRegistry()
- ->fromJson<BlockReplaceItemSkillConfig>(value));
- }
- ItemSkillFactoryBase::fromJson(zResult, zJson);
- }
- void BlockReplaceItemSkillFactory::toJson(
- BlockReplaceItemSkill* zObject, Framework::JSON::JSONObject* zResult) const
- {
- zResult->addValue("invalidStaminaCost",
- new Framework::JSON::JSONNumber(
- zObject->zInvalidUseConfig()->getStaminaCost()));
- zResult->addValue("invalidStaminaCostDevider",
- new Framework::JSON::JSONNumber(
- zObject->zInvalidUseConfig()->getStaminaCostDevider()));
- zResult->addValue("invalidAdditionalStaminaCostDeviderPerLevel",
- new Framework::JSON::JSONNumber(
- zObject->zInvalidUseConfig()
- ->getAdditionalStaminaCostDeviderPerLevel()));
- zResult->addValue("invalidDurabilityCost",
- new Framework::JSON::JSONNumber(
- zObject->zInvalidUseConfig()->getDurabilityCost()));
- zResult->addValue("invalidDurabilityCostDevider",
- new Framework::JSON::JSONNumber(
- zObject->zInvalidUseConfig()->getDurabilityCostDevider()));
- zResult->addValue("invalidAdditionalDurabilityCostDeviderPerLevel",
- new Framework::JSON::JSONNumber(
- zObject->zInvalidUseConfig()
- ->getAdditionalDurabilityCostDeviderPerLevel()));
- zResult->addValue("invalidCooldownTicks",
- new Framework::JSON::JSONNumber(
- zObject->zInvalidUseConfig()->getCooldownTicks()));
- Framework::JSON::JSONArray* configs = new Framework::JSON::JSONArray();
- for (BlockReplaceItemSkillConfig* config : zObject->getConfigs())
- {
- configs->addValue(Game::INSTANCE->zTypeRegistry()->toJson(config));
- }
- zResult->addValue("configs", configs);
- ItemSkillFactoryBase::toJson(zObject, zResult);
- }
- JSONObjectValidationBuilder* BlockReplaceItemSkillFactory::addToValidator(
- JSONObjectValidationBuilder* builder) const
- {
- return ItemSkillFactoryBase::addToValidator(
- builder->withRequiredNumber("invalidStaminaCost")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.5)
- ->finishNumber()
- ->withRequiredNumber("invalidStaminaCostDevider")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.8)
- ->finishNumber()
- ->withRequiredNumber("invalidAdditionalStaminaCostDeviderPerLevel")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.2)
- ->finishNumber()
- ->withRequiredNumber("invalidDurabilityCost")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.5)
- ->finishNumber()
- ->withRequiredNumber("invalidDurabilityCostDevider")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.98)
- ->finishNumber()
- ->withRequiredNumber(
- "invalidAdditionalDurabilityCostDeviderPerLevel")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.02)
- ->finishNumber()
- ->withRequiredNumber("invalidCooldownTicks")
- ->withDefault(20)
- ->finishNumber()
- ->withRequiredArray("configs")
- ->addAcceptedTypeInArray(
- Game::INSTANCE->zTypeRegistry()
- ->getValidator<BlockReplaceItemSkillConfig>())
- ->finishArray());
- }
- Framework::Text BlockReplaceItemSkillFactory::getTypeToken() const
- {
- return "replaceBlock";
- }
- DamagingItemSkillConfig::DamagingItemSkillConfig()
- : ReferenceCounter(),
- targetBlockFilter(0),
- damage(2.f),
- damagePerHeadHardness(1.f),
- baseDamageMultiplier(1.f),
- damageMultiplierPerHeadHardness(0.f),
- damagePerLevel(0.3f),
- damageMultiplierPerLevel(0.0f),
- damageDevider(1.0f),
- damageDeviderPerHardness(1.0f),
- staminaCost(0.00001f),
- staminaCostPerDamage(0.00001f),
- staminaCostPerHardness(0.001f),
- staminaCostDevider(0.9f),
- staminaCostDeviderPerLevel(0.1f),
- durabilityCost(0.1f),
- durabilityCostPerDamage(0.01f),
- durabilityCostPerHardness(0.01f),
- durabilityCostDevider(0.8f),
- additionalDurabilityCostDeviderPerLevel(0.2f),
- xpGainPerDamage(0.05f)
- {}
- DamagingItemSkillConfig::~DamagingItemSkillConfig()
- {
- if (targetBlockFilter) targetBlockFilter->release();
- }
- void DamagingItemSkillConfig::setTargetBlockFilter(
- BlockFilter* targetBlockFilter)
- {
- if (this->targetBlockFilter) this->targetBlockFilter->release();
- this->targetBlockFilter = targetBlockFilter;
- }
- BlockFilter* DamagingItemSkillConfig::zTargetBlockFilter() const
- {
- return targetBlockFilter;
- }
- void DamagingItemSkillConfig::setDamage(float damage)
- {
- this->damage = damage;
- }
- float DamagingItemSkillConfig::getDamage() const
- {
- return damage;
- }
- void DamagingItemSkillConfig::setDamagePerHeadHardness(
- float damagePerHeadHardness)
- {
- this->damagePerHeadHardness = damagePerHeadHardness;
- }
- float DamagingItemSkillConfig::getDamagePerHeadHardness() const
- {
- return damageDeviderPerHardness;
- }
- void DamagingItemSkillConfig::setBaseDamageMultiplier(
- float baseDamageMultiplier)
- {
- this->baseDamageMultiplier = baseDamageMultiplier;
- }
- float DamagingItemSkillConfig::getBaseDamageMultiplier() const
- {
- return baseDamageMultiplier;
- }
- void DamagingItemSkillConfig::setDamageMultiplierPerHeadHardness(
- float damageMupliplierPerHeadHardness)
- {
- this->damageMultiplierPerHeadHardness = damageMupliplierPerHeadHardness;
- }
- float DamagingItemSkillConfig::getDamageMultiplierPerHeadHardness() const
- {
- return damageMultiplierPerHeadHardness;
- }
- void DamagingItemSkillConfig::setDamagePerLevel(float damagePerLevel)
- {
- this->damagePerLevel = damagePerLevel;
- }
- float DamagingItemSkillConfig::getDamagePerLevel() const
- {
- return damagePerLevel;
- }
- void DamagingItemSkillConfig::setDamageMultiplierPerLevel(
- float damageMultiplierPerLevel)
- {
- this->damageMultiplierPerLevel = damageMultiplierPerLevel;
- }
- float DamagingItemSkillConfig::getDamageMultiplierPerLevel() const
- {
- return damageMultiplierPerLevel;
- }
- void DamagingItemSkillConfig::setDamageDevider(float damageDevider)
- {
- this->damageDevider = damageDevider;
- }
- float DamagingItemSkillConfig::getDamageDevider() const
- {
- return damageDevider;
- }
- void DamagingItemSkillConfig::setDamageDeviderPerHardness(
- float damageDeviderPerHardness)
- {
- this->damageDeviderPerHardness = damageDeviderPerHardness;
- }
- float DamagingItemSkillConfig::getDamageDeviderPerHardness() const
- {
- return damageDeviderPerHardness;
- }
- void DamagingItemSkillConfig::setStaminaCost(float staminaCost)
- {
- this->staminaCost = staminaCost;
- }
- float DamagingItemSkillConfig::getStaminaCost() const
- {
- return staminaCost;
- }
- void DamagingItemSkillConfig::setStaminaCostPerDamage(
- float staminaCostPerDamage)
- {
- this->staminaCostPerDamage = staminaCostPerDamage;
- }
- float DamagingItemSkillConfig::getStaminaCostPerDamage() const
- {
- return staminaCostPerDamage;
- }
- void DamagingItemSkillConfig::setStaminaCostPerHardness(
- float staminaCostPerHardness)
- {
- this->staminaCostPerHardness = staminaCostPerHardness;
- }
- float DamagingItemSkillConfig::getStaminaCostPerHardness() const
- {
- return staminaCostPerHardness;
- }
- void DamagingItemSkillConfig::setStaminaCostDevider(float staminaCostDevider)
- {
- this->staminaCostDevider = staminaCostDevider;
- }
- float DamagingItemSkillConfig::getStaminaCostDevider() const
- {
- return staminaCostDevider;
- }
- void DamagingItemSkillConfig::setStaminaCostDeviderPerLevel(
- float staminaCostDeviderPerLevel)
- {
- this->staminaCostDeviderPerLevel = staminaCostDeviderPerLevel;
- }
- float DamagingItemSkillConfig::getStaminaCostDeviderPerLevel() const
- {
- return staminaCostDeviderPerLevel;
- }
- void DamagingItemSkillConfig::setDurabilityCost(float durabilityCost)
- {
- this->durabilityCost = durabilityCost;
- }
- float DamagingItemSkillConfig::getDurabilityCost() const
- {
- return durabilityCost;
- }
- void DamagingItemSkillConfig::setDurabilityCostPerDamage(
- float durabilityCostPerDamage)
- {
- this->durabilityCostPerDamage = durabilityCostPerDamage;
- }
- float DamagingItemSkillConfig::getDurabilityCostPerDamage() const
- {
- return durabilityCostPerDamage;
- }
- void DamagingItemSkillConfig::setDurabilityCostPerHardness(
- float durabilityCostPerHardness)
- {
- this->durabilityCostPerHardness = durabilityCostPerHardness;
- }
- float DamagingItemSkillConfig::getDurabilityCostPerHardness() const
- {
- return durabilityCostPerHardness;
- }
- void DamagingItemSkillConfig::setDurabilityCostDevider(
- float durabilityCostDevider)
- {
- this->durabilityCostDevider = durabilityCostDevider;
- }
- float DamagingItemSkillConfig::getDurabilityCostDevider() const
- {
- return durabilityCostDevider;
- }
- void DamagingItemSkillConfig::setAdditionalDurabilityCostDeviderPerLevel(
- float additionalDurabilityCostDeviderPerLevel)
- {
- this->additionalDurabilityCostDeviderPerLevel
- = additionalDurabilityCostDeviderPerLevel;
- }
- float DamagingItemSkillConfig::getAdditionalDurabilityCostDeviderPerLevel()
- const
- {
- return additionalDurabilityCostDeviderPerLevel;
- }
- void DamagingItemSkillConfig::setXpGainPerDamage(float xpGainPerDamage)
- {
- this->xpGainPerDamage = xpGainPerDamage;
- }
- float DamagingItemSkillConfig::getXpGainPerDamage() const
- {
- return xpGainPerDamage;
- }
- DamagingItemSkillConfigFactory::DamagingItemSkillConfigFactory()
- : TypeFactory()
- {}
- DamagingItemSkillConfig* DamagingItemSkillConfigFactory::createValue(
- Framework::JSON::JSONObject* zJson) const
- {
- return new DamagingItemSkillConfig();
- }
- void DamagingItemSkillConfigFactory::fromJson(
- DamagingItemSkillConfig* zResult, Framework::JSON::JSONObject* zJson) const
- {
- zResult->setTargetBlockFilter(
- Game::INSTANCE->zTypeRegistry()->fromJson<BlockFilter>(
- zJson->zValue("targetFilter")));
- zResult->setDamage(
- (float)zJson->asObject()->zValue("damage")->asNumber()->getNumber());
- zResult->setDamagePerHeadHardness((float)zJson->asObject()
- ->zValue("damagePerHeadHardness")
- ->asNumber()
- ->getNumber());
- zResult->setBaseDamageMultiplier((float)zJson->asObject()
- ->zValue("baseDamageMultiplier")
- ->asNumber()
- ->getNumber());
- zResult->setDamageMultiplierPerHeadHardness(
- (float)zJson->asObject()
- ->zValue("damageMultiplierPerHeadHardness")
- ->asNumber()
- ->getNumber());
- zResult->setDamagePerLevel((float)zJson->asObject()
- ->zValue("damagePerLevel")
- ->asNumber()
- ->getNumber());
- zResult->setDamageMultiplierPerLevel(
- (float)zJson->asObject()
- ->zValue("damageMultiplierPerLevel")
- ->asNumber()
- ->getNumber());
- zResult->setDamageDevider((float)zJson->asObject()
- ->zValue("damageDevider")
- ->asNumber()
- ->getNumber());
- zResult->setDamageDeviderPerHardness(
- (float)zJson->asObject()
- ->zValue("damageDeviderPerHardness")
- ->asNumber()
- ->getNumber());
- zResult->setStaminaCost((float)zJson->asObject()
- ->zValue("staminaCost")
- ->asNumber()
- ->getNumber());
- zResult->setStaminaCostPerDamage((float)zJson->asObject()
- ->zValue("staminaCostPerDamage")
- ->asNumber()
- ->getNumber());
- zResult->setStaminaCostPerHardness((float)zJson->asObject()
- ->zValue("staminaCostPerHardness")
- ->asNumber()
- ->getNumber());
- zResult->setStaminaCostDevider((float)zJson->asObject()
- ->zValue("staminaCostDevider")
- ->asNumber()
- ->getNumber());
- zResult->setStaminaCostDeviderPerLevel(
- (float)zJson->asObject()
- ->zValue("staminaCostDeviderPerLevel")
- ->asNumber()
- ->getNumber());
- zResult->setDurabilityCost((float)zJson->asObject()
- ->zValue("durabilityCost")
- ->asNumber()
- ->getNumber());
- zResult->setDurabilityCostPerDamage((float)zJson->asObject()
- ->zValue("durabilityCostPerDamage")
- ->asNumber()
- ->getNumber());
- zResult->setDurabilityCostPerHardness(
- (float)zJson->asObject()
- ->zValue("durabilityCostPerHardness")
- ->asNumber()
- ->getNumber());
- zResult->setDurabilityCostDevider((float)zJson->asObject()
- ->zValue("durabilityCostDevider")
- ->asNumber()
- ->getNumber());
- zResult->setAdditionalDurabilityCostDeviderPerLevel(
- (float)zJson->asObject()
- ->zValue("additionalDurabilityCostDeviderPerLevel")
- ->asNumber()
- ->getNumber());
- zResult->setXpGainPerDamage((float)zJson->asObject()
- ->zValue("xpGainPerDamage")
- ->asNumber()
- ->getNumber());
- }
- void DamagingItemSkillConfigFactory::toJson(DamagingItemSkillConfig* zObject,
- Framework::JSON::JSONObject* zResult) const
- {
- zResult->addValue("targetFilter",
- Game::INSTANCE->zTypeRegistry()->toJson(zObject->zTargetBlockFilter()));
- zResult->addValue(
- "damage", new Framework::JSON::JSONNumber(zObject->getDamage()));
- zResult->addValue("damagePerHeadHardness",
- new Framework::JSON::JSONNumber(zObject->getDamagePerHeadHardness()));
- zResult->addValue("baseDamageMultiplier",
- new Framework::JSON::JSONNumber(zObject->getBaseDamageMultiplier()));
- zResult->addValue("damageMultiplierPerHeadHardness",
- new Framework::JSON::JSONNumber(
- zObject->getDamageMultiplierPerHeadHardness()));
- zResult->addValue("damagePerLevel",
- new Framework::JSON::JSONNumber(zObject->getDamagePerLevel()));
- zResult->addValue("damageMultiplierPerLevel",
- new Framework::JSON::JSONNumber(
- zObject->getDamageMultiplierPerLevel()));
- zResult->addValue("damageDevider",
- new Framework::JSON::JSONNumber(zObject->getDamageDevider()));
- zResult->addValue("damageDeviderPerHardness",
- new Framework::JSON::JSONNumber(
- zObject->getDamageDeviderPerHardness()));
- zResult->addValue("staminaCost",
- new Framework::JSON::JSONNumber(zObject->getStaminaCost()));
- zResult->addValue("staminaCostPerDamage",
- new Framework::JSON::JSONNumber(zObject->getStaminaCostPerDamage()));
- zResult->addValue("staminaCostPerHardness",
- new Framework::JSON::JSONNumber(zObject->getStaminaCostPerHardness()));
- zResult->addValue("staminaCostDevider",
- new Framework::JSON::JSONNumber(zObject->getStaminaCostDevider()));
- zResult->addValue("staminaCostDeviderPerLevel",
- new Framework::JSON::JSONNumber(
- zObject->getStaminaCostDeviderPerLevel()));
- zResult->addValue("durabilityCost",
- new Framework::JSON::JSONNumber(zObject->getDurabilityCost()));
- zResult->addValue("durabilityCostPerDamage",
- new Framework::JSON::JSONNumber(zObject->getDurabilityCostPerDamage()));
- zResult->addValue("durabilityCostPerHardness",
- new Framework::JSON::JSONNumber(
- zObject->getDurabilityCostPerHardness()));
- zResult->addValue("durabilityCostDevider",
- new Framework::JSON::JSONNumber(zObject->getDurabilityCostDevider()));
- zResult->addValue("additionalDurabilityCostDeviderPerLevel",
- new Framework::JSON::JSONNumber(
- zObject->getAdditionalDurabilityCostDeviderPerLevel()));
- zResult->addValue("xpGainPerDamage",
- new Framework::JSON::JSONNumber(zObject->getXpGainPerDamage()));
- }
- JSONObjectValidationBuilder* DamagingItemSkillConfigFactory::addToValidator(
- JSONObjectValidationBuilder* builder) const
- {
- return builder
- ->withRequiredAttribute("targetFilter",
- Game::INSTANCE->zTypeRegistry()->getValidator<BlockFilter>())
- ->withRequiredNumber("damage")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(2.0)
- ->finishNumber()
- ->withRequiredNumber("damagePerHeadHardness")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(1.0)
- ->finishNumber()
- ->withRequiredNumber("baseDamageMultiplier")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(1.0)
- ->finishNumber()
- ->withRequiredNumber("damageMultiplierPerHeadHardness")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.0)
- ->finishNumber()
- ->withRequiredNumber("damagePerLevel")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.3)
- ->finishNumber()
- ->withRequiredNumber("damageMultiplierPerLevel")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.0)
- ->finishNumber()
- ->withRequiredNumber("damageDevider")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(1.0)
- ->finishNumber()
- ->withRequiredNumber("damageDeviderPerHardness")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(1.0)
- ->finishNumber()
- ->withRequiredNumber("staminaCost")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.0001)
- ->finishNumber()
- ->withRequiredNumber("staminaCostPerDamage")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.00001)
- ->finishNumber()
- ->withRequiredNumber("staminaCostPerHardness")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.001)
- ->finishNumber()
- ->withRequiredNumber("staminaCostDevider")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.9)
- ->finishNumber()
- ->withRequiredNumber("staminaCostDeviderPerLevel")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.1)
- ->finishNumber()
- ->withRequiredNumber("durabilityCost")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.1)
- ->finishNumber()
- ->withRequiredNumber("durabilityCostPerDamage")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.01)
- ->finishNumber()
- ->withRequiredNumber("durabilityCostPerHardness")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.01)
- ->finishNumber()
- ->withRequiredNumber("durabilityCostDevider")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.8)
- ->finishNumber()
- ->withRequiredNumber("additionalDurabilityCostDeviderPerLevel")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.2)
- ->finishNumber()
- ->withRequiredNumber("xpGainPerDamage")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.05)
- ->finishNumber();
- }
- DamagingItemSkill::DamagingItemSkill()
- : ItemSkill(),
- invalidUseConfig(0)
- {}
- DamagingItemSkill::~DamagingItemSkill()
- {
- if (invalidUseConfig) invalidUseConfig->release();
- }
- bool DamagingItemSkill::use(Entity* zActor, Item* zUsedItem, Block* zTarget)
- {
- BasicToolItem* tool = dynamic_cast<BasicToolItem*>(zUsedItem);
- DamagingItemSkillConfig* usedConfig = 0;
- for (DamagingItemSkillConfig* config : configs)
- {
- if (config->zTargetBlockFilter()->test(zTarget))
- {
- usedConfig = config;
- break;
- }
- }
- bool invalid = 0;
- if (usedConfig == 0)
- {
- usedConfig = invalidUseConfig;
- invalid = 1;
- }
- float damage = usedConfig->getDamage()
- + usedConfig->getDamagePerHeadHardness()
- * (tool ? tool->getHeadMaterialHardness() : 0)
- + usedConfig->getDamagePerLevel() * getLevel();
- float damageMultiplier
- = usedConfig->getBaseDamageMultiplier()
- + usedConfig->getDamageMultiplierPerLevel() * getLevel()
- + usedConfig->getDamageMultiplierPerHeadHardness()
- * (tool ? tool->getHeadMaterialHardness() : 0);
- if (damageMultiplier != 0)
- {
- damage *= damageMultiplier;
- }
- float damageDevider
- = usedConfig->getDamageDevider()
- + usedConfig->getDamageDeviderPerHardness() * zTarget->getHardness();
- if (damageDevider != 0)
- {
- damage /= damageDevider;
- }
- float staminaCost
- = usedConfig->getStaminaCost()
- + usedConfig->getStaminaCostPerDamage() * damage
- + usedConfig->getStaminaCostPerHardness() * zTarget->getHardness();
- float staminaDevider
- = usedConfig->getStaminaCostDevider()
- + usedConfig->getStaminaCostDeviderPerLevel() * getLevel();
- if (staminaDevider != 0)
- {
- staminaCost /= staminaDevider;
- }
- if (zActor->getStamina() < staminaCost)
- {
- return false;
- }
- float durabilityCost
- = usedConfig->getDurabilityCost()
- + usedConfig->getDurabilityCostPerDamage() * damage
- + usedConfig->getDurabilityCostPerHardness() * zTarget->getHardness();
- float durabilityDevider
- = usedConfig->getDurabilityCostDevider()
- + usedConfig->getAdditionalDurabilityCostDeviderPerLevel() * getLevel();
- if (durabilityDevider != 0)
- {
- durabilityCost /= durabilityDevider;
- }
- zUsedItem->setDurability(zUsedItem->getDurability() - durabilityCost);
- zActor->setStamina(zActor->getStamina() - staminaCost);
- setXp(getXp() + usedConfig->getXpGainPerDamage() * damage);
- zTarget->setHP(zTarget->getHP() - damage);
- return true;
- }
- bool DamagingItemSkill::use(Entity* zActor, Item* zUsedItem, Entity* zTarget)
- {
- return false;
- }
- void DamagingItemSkill::setInvalidUseConfig(DamagingItemSkillConfig* config)
- {
- if (invalidUseConfig) invalidUseConfig->release();
- invalidUseConfig = config;
- }
- DamagingItemSkillConfig* DamagingItemSkill::zInvalidUseConfig() const
- {
- return invalidUseConfig;
- }
- void DamagingItemSkill::addConfig(DamagingItemSkillConfig* config)
- {
- configs.add(config);
- }
- const Framework::RCArray<DamagingItemSkillConfig>&
- DamagingItemSkill::getConfigs() const
- {
- return configs;
- }
- DamagingItemSkillFactory::DamagingItemSkillFactory()
- : ItemSkillFactoryBase()
- {}
- DamagingItemSkill* DamagingItemSkillFactory::createValue(
- Framework::JSON::JSONObject* zJson) const
- {
- return new DamagingItemSkill();
- }
- void DamagingItemSkillFactory::fromJson(
- DamagingItemSkill* zResult, Framework::JSON::JSONObject* zJson) const
- {
- for (Framework::JSON::JSONValue* configValue :
- *zJson->zValue("configs")->asArray())
- {
- zResult->addConfig(
- Game::INSTANCE->zTypeRegistry()->fromJson<DamagingItemSkillConfig>(
- configValue));
- }
- DamagingItemSkillConfig* invalidUseConfig = new DamagingItemSkillConfig();
- invalidUseConfig->setDamage(0.f);
- invalidUseConfig->setDamageDeviderPerHardness(0.f);
- invalidUseConfig->setBaseDamageMultiplier(0.f);
- invalidUseConfig->setDamageMultiplierPerHeadHardness(0.f);
- invalidUseConfig->setDamagePerLevel(0.f);
- invalidUseConfig->setDamageMultiplierPerLevel(0.f);
- invalidUseConfig->setDamageDevider(1.f);
- invalidUseConfig->setDamageDeviderPerHardness(0.f);
- invalidUseConfig->setStaminaCost(
- (float)zJson->zValue("invalidStaminaCost")->asNumber()->getNumber());
- invalidUseConfig->setStaminaCostPerDamage(0.f);
- invalidUseConfig->setStaminaCostPerHardness(
- (float)zJson->zValue("invalidStaminaCostPerHardness")
- ->asNumber()
- ->getNumber());
- invalidUseConfig->setStaminaCostDevider(
- (float)zJson->zValue("invalidStaminaCostDevider")
- ->asNumber()
- ->getNumber());
- invalidUseConfig->setStaminaCostDeviderPerLevel(
- (float)zJson->zValue("invalidStaminaCostDeviderPerLevel")
- ->asNumber()
- ->getNumber());
- invalidUseConfig->setDurabilityCost(
- (float)zJson->zValue("invalidDurabilityCost")->asNumber()->getNumber());
- invalidUseConfig->setDurabilityCostPerHardness(
- (float)zJson->zValue("invalidDurabilityCostPerHardness")
- ->asNumber()
- ->getNumber());
- invalidUseConfig->setDurabilityCostDevider(
- (float)zJson->zValue("invalidDurabilityCostDevider")
- ->asNumber()
- ->getNumber());
- invalidUseConfig->setAdditionalDurabilityCostDeviderPerLevel(
- (float)zJson->zValue("invalidDurabilityCostDeviderPerLevel")
- ->asNumber()
- ->getNumber());
- zResult->setInvalidUseConfig(invalidUseConfig);
- ItemSkillFactoryBase::fromJson(zResult, zJson);
- }
- void DamagingItemSkillFactory::toJson(
- DamagingItemSkill* zObject, Framework::JSON::JSONObject* zResult) const
- {
- zResult->addValue(
- "maxXp", new Framework::JSON::JSONNumber(zObject->getMaxXp()));
- zResult->addValue("invalidStaminaCost",
- new Framework::JSON::JSONNumber(
- zObject->zInvalidUseConfig()->getStaminaCost()));
- zResult->addValue("invalidStaminaCostPerHardness",
- new Framework::JSON::JSONNumber(
- zObject->zInvalidUseConfig()->getStaminaCostPerHardness()));
- zResult->addValue("invalidStaminaCostDevider",
- new Framework::JSON::JSONNumber(
- zObject->zInvalidUseConfig()->getStaminaCostDevider()));
- zResult->addValue("invalidStaminaCostDeviderPerLevel",
- new Framework::JSON::JSONNumber(
- zObject->zInvalidUseConfig()->getStaminaCostDeviderPerLevel()));
- zResult->addValue("invalidDurabilityCost",
- new Framework::JSON::JSONNumber(
- zObject->zInvalidUseConfig()->getDurabilityCost()));
- zResult->addValue("invalidDurabilityCostPerHardness",
- new Framework::JSON::JSONNumber(
- zObject->zInvalidUseConfig()->getDurabilityCostPerHardness()));
- zResult->addValue("invalidDurabilityCostDevider",
- new Framework::JSON::JSONNumber(
- zObject->zInvalidUseConfig()->getDurabilityCostDevider()));
- zResult->addValue("invalidDurabilityCostDeviderPerLevel",
- new Framework::JSON::JSONNumber(
- zObject->zInvalidUseConfig()
- ->getAdditionalDurabilityCostDeviderPerLevel()));
- Framework::JSON::JSONArray* configs = new Framework::JSON::JSONArray();
- for (DamagingItemSkillConfig* config : zObject->getConfigs())
- {
- configs->addValue(Game::INSTANCE->zTypeRegistry()->toJson(config));
- }
- zResult->addValue("configs", configs);
- ItemSkillFactoryBase::toJson(zObject, zResult);
- }
- JSONObjectValidationBuilder* DamagingItemSkillFactory::addToValidator(
- JSONObjectValidationBuilder* builder) const
- {
- return ItemSkillFactoryBase::addToValidator(
- builder->withRequiredNumber("invalidStaminaCost")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.5)
- ->finishNumber()
- ->withRequiredNumber("invalidStaminaCostPerHardness")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.001)
- ->finishNumber()
- ->withRequiredNumber("invalidStaminaCostDevider")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.8)
- ->finishNumber()
- ->withRequiredNumber("invalidAdditionalStaminaCostDeviderPerLevel")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.2)
- ->finishNumber()
- ->withRequiredNumber("invalidDurabilityCost")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.5)
- ->finishNumber()
- ->withRequiredNumber("invalidDurabilityCostPerHardness")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.01)
- ->finishNumber()
- ->withRequiredNumber("invalidDurabilityCostDevider")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.98)
- ->finishNumber()
- ->withRequiredNumber(
- "invalidAdditionalDurabilityCostDeviderPerLevel")
- ->whichIsGreaterOrEqual(0.0)
- ->withDefault(0.02)
- ->finishNumber()
- ->withRequiredArray("configs")
- ->addAcceptedTypeInArray(
- Game::INSTANCE->zTypeRegistry()
- ->getValidator<DamagingItemSkillConfig>())
- ->finishArray());
- }
- Framework::Text DamagingItemSkillFactory::getTypeToken() const
- {
- return "damaging";
- }
|