123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353 |
- #pragma once
- #include "BasicItems.h"
- #include "BlockFilter.h"
- #include "Item.h"
- #include "ItemSkill.h"
- class BasicToolItemType;
- class XPBasedLevelUpRule : public ItemSkillLevelUpRule
- {
- private:
- float xpIncrease;
- float xpMultiplier;
- float levelIncrease;
- float levelMultiplier;
- float maxLevel;
- public:
- XPBasedLevelUpRule(float xpIncrease,
- float xpMultiplier,
- float levelIncrease,
- float levelMultiplier,
- float maxLevel);
- virtual void applyOn(ItemSkill* zSkill) override;
- float getXpIncrease() const;
- float getXpMultiplier() const;
- float getLevelIncrease() const;
- float getLevelMultiplier() const;
- float getMaxLevel() const;
- };
- class XPBasedLevelUpRuleFactory
- : public SubTypeFactory<ItemSkillLevelUpRule, XPBasedLevelUpRule>
- {
- public:
- XPBasedLevelUpRuleFactory();
- XPBasedLevelUpRule* fromJson(
- Framework::JSON::JSONObject* zJson) const override;
- Framework::JSON::JSONObject* toJson(
- XPBasedLevelUpRule* zObject) const override;
- Framework::JSON::Validator::JSONValidator* getValidator(
- Framework::JSON::Validator::ObjectValidationBuilder<
- Framework::JSON::Validator::JSONValidator>* builder) const override;
- Framework::Text getTypeToken() const override;
- };
- class BasicToolItem : public Item
- {
- private:
- float headMaterialHardness;
- float rodMaterialHardness;
- float handleMaterialHardness;
- public:
- BasicToolItem(int itemTypeId,
- Framework::Text name,
- float maxHp,
- float maxDurability);
- void setHeadMaterialHardness(float hardness);
- void setRodMaterialHardness(float hardness);
- void setHandleMaterialHardness(float hardness);
- float getHeadMaterialHardness() const;
- float getRodMaterialHardness() const;
- float getHandleMaterialHardness() const;
- };
- class BasicToolItemType : public ItemType
- {
- private:
- float headMaterialHardness;
- float rodMaterialHardness;
- float handleMaterialHardness;
- float baseDurability;
- float baseDurabilityMultiplier;
- float headMaterialDurability;
- float headMaterialDurabilityMultiplier;
- float rodMaterialDurability;
- float rodMaterialDurabilityMultiplier;
- float handleMaterialDurability;
- float handleMaterialDurabilityMultiplier;
- ItemSkillLevelUpRule* levelUpRule;
- int brokenItemTypeId;
- Framework::Text brokenItemTypeName;
- Framework::JSON::JSONObject* itemSkillConfigJson;
- public:
- BasicToolItemType(Framework::Text name,
- ModelInfo* model,
- float headMaterialHardness,
- float rodMaterialHardness,
- float handleMaterialHardness,
- float baseDurability,
- float baseDurabilityMultiplier,
- float headMaterialDurability,
- float headMaterialDurabilityMultiplier,
- float rodMaterialDurability,
- float rodMaterialDurabilityMultiplier,
- float handleMaterialDurability,
- float handleMaterialDurabilityMultiplier,
- ItemSkillLevelUpRule* levelUpRule,
- Framework::Text brokenItemTypeName,
- Framework::JSON::JSONObject* itemSkillConfigJson,
- int maxStackSize);
- ~BasicToolItemType();
- protected:
- virtual void loadSuperItem(
- Item* zItem, Framework::StreamReader* zReader) const override;
- virtual void saveSuperItem(
- const Item* zItem, Framework::StreamWriter* zWriter) const override;
- public:
- virtual bool initialize(Game* zGame) override;
- virtual const ItemType* zBrokenItemType() const override;
- virtual Item* createItem() const override;
- virtual void levelUpItemSkill(ItemSkill* zSkill) const override;
- virtual void setItemAttribute(Item* zItem,
- Framework::Text name,
- Framework::JSON::JSONValue* zValue) const override;
- virtual void addItemAttributes(
- Item* zItem, Framework::JSON::JSONObject* zItemObjet) const override;
- float getHeadMaterialHardness() const;
- float getRodMaterialHardness() const;
- float getHandleMaterialHardness() const;
- float getBaseDurablility() const;
- float getBaseDurabilityMultiplier() const;
- float getHeadMaterialDurability() const;
- float getHeadMaterialDurabilityMultiplier() const;
- float getRodMaterialDurability() const;
- float getRodMaterialDurabilityMultiplier() const;
- float getHandleMaterialDurability() const;
- float getHandleMaterialDurabilityMultiplier() const;
- ItemSkillLevelUpRule* zLevelUpRule() const;
- Framework::JSON::JSONObject* getItemSkillConfigJson() const;
- virtual ItemSkill* createDefaultItemSkill() const override;
- };
- class BasicToolItemTypeFactory
- : public SubTypeFactory<ItemType, BasicToolItemType>
- {
- public:
- BasicToolItemTypeFactory();
- BasicToolItemType* fromJson(
- Framework::JSON::JSONObject* zJson) const override;
- Framework::JSON::JSONObject* toJson(
- BasicToolItemType* zObject) const override;
- Framework::JSON::Validator::JSONValidator* getValidator(
- Framework::JSON::Validator::ObjectValidationBuilder<
- Framework::JSON::Validator::JSONValidator>* builder) const override;
- Framework::Text getTypeToken() const override;
- };
- class BlockReplaceItemSkillConfig : public Framework::ReferenceCounter
- {
- private:
- BlockFilter* targetBlockFilter;
- int replacementBlockTypeId;
- int cooldownTicks;
- float staminaCost;
- float staminaCostDevider;
- float additionalStaminaCostDeviderPerLevel;
- float durabilityCost;
- float durabilityCostDevider;
- float additionalDurabilityCostDeviderPerLevel;
- float xpGain;
- public:
- BlockReplaceItemSkillConfig(BlockFilter* targetBlockFilter,
- int replacementBlockTypeId,
- int cooldownTicks,
- float staminaCost,
- float staminaCostDevider,
- float additionalStaminaCostDeviderPerLevel,
- float durabilityCost,
- float durabilityCostDevider,
- float additionalDurabilityCostDeviderPerLevel,
- float xpGain);
- ~BlockReplaceItemSkillConfig();
- BlockFilter* zTargetBlockFilter() const;
- int getReplacementBlockTypeId() const;
- int getCooldownTicks() const;
- float getStaminaCost() const;
- float getStaminaCostDevider() const;
- float getAdditionalStaminaCostDeviderPerLevel() const;
- float getDurabilityCost() const;
- float getDurabilityCostDevider() const;
- float getAdditionalDurabilityCostDeviderPerLevel() const;
- float getXpGain() const;
- };
- class BlockReplaceItemSkillConfigFactory
- : public TypeFactory<BlockReplaceItemSkillConfig>
- {
- public:
- BlockReplaceItemSkillConfigFactory();
- BlockReplaceItemSkillConfig* fromJson(
- Framework::JSON::JSONValue* zJson) const override;
- Framework::JSON::JSONValue* toJson(
- BlockReplaceItemSkillConfig* zObject) const override;
- Framework::JSON::Validator::JSONValidator* getValidator() const override;
- };
- class BlockReplaceItemSkill : public ItemSkill
- {
- private:
- BlockReplaceItemSkillConfig* invalidUseConfig;
- Framework::RCArray<BlockReplaceItemSkillConfig> configs;
- int cooldownTicks;
- public:
- BlockReplaceItemSkill(float xp,
- float maxXp,
- float level,
- BlockReplaceItemSkillConfig* invalidUseConfig,
- Framework::RCArray<BlockReplaceItemSkillConfig> configs,
- int cooldownTicks);
- virtual void load(Framework::StreamReader* zReader) override;
- virtual void save(Framework::StreamWriter* zWriter) override;
- virtual bool use(Entity* zActor, Item* zUsedItem, Block* zTarget) override;
- virtual bool use(Entity* zActor, Item* zUsedItem, Entity* zTarget) override;
- BlockReplaceItemSkillConfig* zInvalidUseConfig() const;
- const Framework::RCArray<BlockReplaceItemSkillConfig>& getConfigs() const;
- int getCooldownTicks() const;
- };
- class BlockReplaceItemSkillFactory
- : public SubTypeFactory<ItemSkill, BlockReplaceItemSkill>
- {
- public:
- BlockReplaceItemSkillFactory();
- BlockReplaceItemSkill* fromJson(
- Framework::JSON::JSONObject* zJson) const override;
- Framework::JSON::JSONObject* toJson(
- BlockReplaceItemSkill* zObject) const override;
- Framework::JSON::Validator::JSONValidator* getValidator(
- Framework::JSON::Validator::ObjectValidationBuilder<
- Framework::JSON::Validator::JSONValidator>* builder) const override;
- Framework::Text getTypeToken() const override;
- };
- class DamagingItemSkillConfig : public Framework::ReferenceCounter
- {
- private:
- BlockFilter* targetBlockFilter;
- float damage;
- float damagePerHeadHardness;
- float baseDamageMultiplier;
- float damageMupliplierPerHeadHardness;
- float damagePerLevel;
- float damageMultiplierPerLevel;
- float damageDevider;
- float damageDeviderPerHardness;
- float staminaCost;
- float staminaCostPerDamage;
- float staminaCostPerHardness;
- float staminaCostDevider;
- float staminaCostDeviderPerLevel;
- float durabilityCost;
- float durabilityCostPerDamage;
- float durabilityCostPerHardness;
- float durabilityCostDevider;
- float additionalDurabilityCostDeviderPerLevel;
- float xpGainPerDamage;
- public:
- DamagingItemSkillConfig(BlockFilter* targetBlockFilter,
- float damage,
- float damagePerHeadHardness,
- float baseDamageMultiplier,
- float damageMupliplierPerHeadHardness,
- float damagePerLevel,
- float damageMultiplierPerLevel,
- float damageDevider,
- float damageDeviderPerHardness,
- float staminaCost,
- float staminaCostPerDamage,
- float staminaCostPerHardness,
- float staminaCostDevider,
- float staminaCostDeviderPerLevel,
- float durabilityCost,
- float durabilityCostPerDamage,
- float durabilityCostPerHardness,
- float durabilityCostDevider,
- float additionalDurabilityCostDeviderPerLevel,
- float xpGainPerDamage);
- ~DamagingItemSkillConfig();
- BlockFilter* zTargetBlockFilter() const;
- float getDamage() const;
- float getDamagePerHeadHardness() const;
- float getBaseDamageMultiplier() const;
- float getDamageMupliplierPerHeadHardness() const;
- float getDamagePerLevel() const;
- float getDamageMultiplierPerLevel() const;
- float getDamageDevider() const;
- float getDamageDeviderPerHardness() const;
- float getStaminaCost() const;
- float getStaminaCostPerDamage() const;
- float getStaminaCostPerHardness() const;
- float getStaminaCostDevider() const;
- float getStaminaCostDeviderPerLevel() const;
- float getDurabilityCost() const;
- float getDurabilityCostPerDamage() const;
- float getDurabilityCostPerHardness() const;
- float getDurabilityCostDevider() const;
- float getAdditionalDurabilityCostDeviderPerLevel() const;
- float getXpGainPerDamage() const;
- };
- class DamagingItemSkillConfigFactory
- : public TypeFactory<DamagingItemSkillConfig>
- {
- public:
- DamagingItemSkillConfigFactory();
- DamagingItemSkillConfig* fromJson(
- Framework::JSON::JSONValue* zJson) const override;
- Framework::JSON::JSONValue* toJson(
- DamagingItemSkillConfig* zObject) const override;
- Framework::JSON::Validator::JSONValidator* getValidator() const override;
- };
- class DamagingItemSkill : public ItemSkill
- {
- private:
- DamagingItemSkillConfig* invalidUseConfig;
- Framework::RCArray<DamagingItemSkillConfig> configs;
- public:
- DamagingItemSkill(float xp,
- float maxXp,
- float level,
- DamagingItemSkillConfig* invalidUseConfig,
- Framework::RCArray<DamagingItemSkillConfig> configs);
- virtual bool use(Entity* zActor, Item* zUsedItem, Block* zTarget) override;
- virtual bool use(Entity* zActor, Item* zUsedItem, Entity* zTarget) override;
- DamagingItemSkillConfig* zInvalidUseConfig() const;
- const Framework::RCArray<DamagingItemSkillConfig>& getConfigs() const;
- };
- class DamagingItemSkillFactory
- : public SubTypeFactory<ItemSkill, DamagingItemSkill>
- {
- public:
- DamagingItemSkillFactory();
- DamagingItemSkill* fromJson(
- Framework::JSON::JSONObject* zJson) const override;
- Framework::JSON::JSONObject* toJson(
- DamagingItemSkill* zObject) const override;
- Framework::JSON::Validator::JSONValidator* getValidator(
- Framework::JSON::Validator::ObjectValidationBuilder<
- Framework::JSON::Validator::JSONValidator>* builder) const override;
- Framework::Text getTypeToken() const override;
- };
|