mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-02-20 17:14:44 +01:00
Moved StatData from EntityData to EntityClassData.
This commit is contained in:
parent
fe16d4573f
commit
ee099a0f0e
@ -26,6 +26,7 @@ SOFTWARE.
|
||||
#include "../../data/items/craft_recipe.h"
|
||||
#include "../../data/items/item_instance.h"
|
||||
#include "../../data/spells/spell.h"
|
||||
#include "../../entities/stats/stat_data.h"
|
||||
#include "../../infos/spell_cast_info.h"
|
||||
#include "../ai/entity_ai.h"
|
||||
#include "../entity.h"
|
||||
@ -70,6 +71,14 @@ void EntityClassData::set_playstyle_type(EntityEnums::EntityClassPlaystyleType p
|
||||
_playstyle_type = playstyle_type;
|
||||
}
|
||||
|
||||
Ref<StatData> EntityClassData::get_stat_data() {
|
||||
return _stat_data;
|
||||
}
|
||||
|
||||
void EntityClassData::set_stat_data(Ref<StatData> value) {
|
||||
_stat_data = value;
|
||||
}
|
||||
|
||||
//// Entity Resources ////
|
||||
|
||||
int EntityClassData::get_num_entity_resources() {
|
||||
@ -355,6 +364,8 @@ EntityClassData::EntityClassData() {
|
||||
}
|
||||
|
||||
EntityClassData::~EntityClassData() {
|
||||
_stat_data.unref();
|
||||
|
||||
_spells.clear();
|
||||
_specs.clear();
|
||||
_auras.clear();
|
||||
@ -392,6 +403,10 @@ void EntityClassData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_playstyle_type", "value"), &EntityClassData::set_playstyle_type);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "playstyle_type", PROPERTY_HINT_ENUM, EntityEnums::BINDING_STRING_ENTITY_PLAYSTYLE_TYPE), "set_playstyle_type", "get_playstyle_type");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_stat_data"), &EntityClassData::get_stat_data);
|
||||
ClassDB::bind_method(D_METHOD("set_stat_data", "value"), &EntityClassData::set_stat_data);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stat_data", PROPERTY_HINT_RESOURCE_TYPE, "StatData"), "set_stat_data", "get_stat_data");
|
||||
|
||||
//// Entity Resources ////
|
||||
ClassDB::bind_method(D_METHOD("get_num_entity_resources"), &EntityClassData::get_num_entity_resources);
|
||||
ClassDB::bind_method(D_METHOD("set_num_entity_resources", "value"), &EntityClassData::set_num_entity_resources);
|
||||
|
@ -51,6 +51,7 @@ class EntityAI;
|
||||
class VendorItemData;
|
||||
class ItemContainerData;
|
||||
class CraftRecipe;
|
||||
class StatData;
|
||||
|
||||
class EntityClassData : public Resource {
|
||||
GDCLASS(EntityClassData, Resource);
|
||||
@ -71,6 +72,9 @@ public:
|
||||
EntityEnums::EntityClassPlaystyleType get_playstyle_type();
|
||||
void set_playstyle_type(EntityEnums::EntityClassPlaystyleType playstyle_type);
|
||||
|
||||
Ref<StatData> get_stat_data();
|
||||
void set_stat_data(Ref<StatData> value);
|
||||
|
||||
//Entity Resources
|
||||
int get_num_entity_resources();
|
||||
void set_num_entity_resources(int value);
|
||||
@ -174,6 +178,8 @@ private:
|
||||
|
||||
EntityEnums::EntityClassPlaystyleType _playstyle_type;
|
||||
|
||||
Ref<StatData> _stat_data;
|
||||
|
||||
Vector<Ref<EntityResource> > _entity_resources;
|
||||
Vector<Ref<CharacterSpec> > _specs;
|
||||
Vector<Ref<Spell> > _spells;
|
||||
|
@ -103,14 +103,6 @@ void EntityData::set_bag_size(const int value) {
|
||||
_bag_size = value;
|
||||
}
|
||||
|
||||
Ref<StatData> EntityData::get_stat_data() {
|
||||
return _stat_data;
|
||||
}
|
||||
|
||||
void EntityData::set_stat_data(Ref<StatData> value) {
|
||||
_stat_data = value;
|
||||
}
|
||||
|
||||
Ref<EntitySpeciesData> EntityData::get_entity_species_data() const {
|
||||
return _entity_species_data;
|
||||
}
|
||||
@ -319,10 +311,6 @@ void EntityData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_bag_size", "value"), &EntityData::set_bag_size);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "bag_size"), "set_bag_size", "get_bag_size");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_stat_data"), &EntityData::get_stat_data);
|
||||
ClassDB::bind_method(D_METHOD("set_stat_data", "value"), &EntityData::set_stat_data);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stat_data", PROPERTY_HINT_RESOURCE_TYPE, "StatData"), "set_stat_data", "get_stat_data");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_entity_species_data"), &EntityData::get_entity_species_data);
|
||||
ClassDB::bind_method(D_METHOD("set_entity_species_data", "value"), &EntityData::set_entity_species_data);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "entity_species_data", PROPERTY_HINT_RESOURCE_TYPE, "EntitySpeciesData"), "set_entity_species_data", "get_entity_species_data");
|
||||
|
@ -28,7 +28,6 @@ SOFTWARE.
|
||||
#include "core/vector.h"
|
||||
#include "scene/resources/texture.h"
|
||||
|
||||
#include "../../entities/stats/stat_data.h"
|
||||
#include "../../entity_enums.h"
|
||||
|
||||
#include "../../entities/auras/aura_data.h"
|
||||
@ -88,9 +87,6 @@ public:
|
||||
int get_bag_size() const;
|
||||
void set_bag_size(const int value);
|
||||
|
||||
Ref<StatData> get_stat_data();
|
||||
void set_stat_data(Ref<StatData> value);
|
||||
|
||||
Ref<EntitySpeciesData> get_entity_species_data() const;
|
||||
void set_entity_species_data(const Ref<EntitySpeciesData> &value);
|
||||
|
||||
@ -145,7 +141,6 @@ private:
|
||||
int _money;
|
||||
int _bag_size;
|
||||
|
||||
Ref<StatData> _stat_data;
|
||||
Ref<EntityClassData> _entity_class_data;
|
||||
Ref<EntitySpeciesData> _entity_species_data;
|
||||
Ref<EquipmentData> _equipment_data;
|
||||
|
@ -698,7 +698,7 @@ void Entity::_setup() {
|
||||
ERR_FAIL_COND(!cc.is_valid());
|
||||
|
||||
for (int i = 0; i < ESS::get_singleton()->stat_get_count(); ++i) {
|
||||
stat_set_base(i, _s_entity_data->get_stat_data()->get_base(i));
|
||||
stat_set_base(i, cc->get_stat_data()->get_base(i));
|
||||
}
|
||||
|
||||
for (int i = 0; i < ESS::get_singleton()->stat_get_count(); ++i) {
|
||||
@ -6181,7 +6181,7 @@ void Entity::_notification_slevel_up(int level) {
|
||||
return;
|
||||
|
||||
for (int i = 0; i < ESS::get_singleton()->stat_get_main_stat_count(); ++i) {
|
||||
int st = gets_entity_data()->get_stat_data()->get_level_stat_data()->get_stat_diff(i, gets_level() - level, gets_level());
|
||||
int st = ecd->get_stat_data()->get_level_stat_data()->get_stat_diff(i, gets_level() - level, gets_level());
|
||||
|
||||
stat_mod_base(i, st);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user