Now the default value for the spell scaling variable in spells, and auras (just added it) is a project setting.

This commit is contained in:
Relintai 2020-03-10 13:24:14 +01:00
parent a53115e26f
commit 0bf97e57da
5 changed files with 64 additions and 26 deletions

View File

@ -23,6 +23,7 @@ SOFTWARE.
#include "aura.h"
#include "../../entities/resources/entity_resource_cost_data.h"
#include "../../singletons/entity_data_manager.h"
int Aura::get_id() const {
return _id;
@ -80,6 +81,13 @@ void Aura::set_rank(const int value) {
_rank = value;
}
bool Aura::get_scale_with_level() const {
return _scale_with_level;
}
void Aura::set_scale_with_level(const bool value) {
_scale_with_level = value;
}
String Aura::get_text_translation_key() const {
return _text_translation_key;
}
@ -153,13 +161,13 @@ void Aura::set_teaches_spell(const Ref<Spell> &spell) {
/*
void Aura::SetScalingData(AbilityScalingData *scalingData) {
scalingData->getDamageCurve();
scalingData->getAbsorbCurve();
scalingData->getHealingCurve();
scalingData->getDamageCurve();
scalingData->getAbsorbCurve();
scalingData->getHealingCurve();
}*/
/*
void Aura::OnAuraAbilityScalingDataLoaded(AbilityScalingDataLoaderHelper *h) {
this->SetScalingData(h->getData());
this->SetScalingData(h->getData());
}
*/
@ -325,6 +333,7 @@ Aura::Aura() {
_is_debuff = false;
_hide = false;
_rank = 0;
_scale_with_level = EntityDataManager::get_instance()->get_scale_spells_by_default();
_damage_enabled = false;
_damage_type = 0;
@ -1571,6 +1580,10 @@ void Aura::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_rank", "value"), &Aura::set_rank);
ADD_PROPERTY(PropertyInfo(Variant::INT, "rank"), "set_rank", "get_rank");
ClassDB::bind_method(D_METHOD("get_scale_with_level"), &Aura::get_scale_with_level);
ClassDB::bind_method(D_METHOD("set_scale_with_level", "value"), &Aura::set_scale_with_level);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scale_with_level"), "set_scale_with_level", "get_scale_with_level");
ClassDB::bind_method(D_METHOD("get_aura_type"), &Aura::get_aura_type);
ClassDB::bind_method(D_METHOD("set_aura_type", "value"), &Aura::set_aura_type);
ADD_PROPERTY(PropertyInfo(Variant::INT, "aura_type", PROPERTY_HINT_ENUM, SpellEnums::BINDING_STRING_AURA_TYPES), "set_aura_type", "get_aura_type");

View File

@ -85,6 +85,9 @@ public:
int get_rank() const;
void set_rank(const int value);
bool get_scale_with_level() const;
void set_scale_with_level(const bool value);
String get_text_translation_key() const;
void set_text_translation_key(const String &value);
@ -404,6 +407,7 @@ private:
String _text_description;
int ability_scale_data_id;
int _rank;
bool _scale_with_level;
Ref<SpellEffectVisual> _visual_spell_effects;

View File

@ -30,6 +30,8 @@ SOFTWARE.
#include "../../entities/auras/aura_data.h"
#include "../../singletons/entity_data_manager.h"
int Spell::get_id() const {
return _id;
}
@ -794,7 +796,7 @@ Spell::Spell() {
_level = 1;
_rank = 0;
_scale_with_level = true;
_scale_with_level = EntityDataManager::get_instance()->get_scale_spells_by_default();
_global_cooldown_enabled = true;
_is_local_spell = false;
@ -1137,6 +1139,10 @@ void Spell::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_needs_target", "value"), &Spell::set_needs_target);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "needs_target"), "set_needs_target", "get_needs_target");
ClassDB::bind_method(D_METHOD("get_scale_with_level"), &Spell::get_scale_with_level);
ClassDB::bind_method(D_METHOD("set_scale_with_level", "value"), &Spell::set_scale_with_level);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scale_with_level"), "set_scale_with_level", "get_scale_with_level");
ClassDB::bind_method(D_METHOD("get_visual_spell_effects"), &Spell::get_visual_spell_effects);
ClassDB::bind_method(D_METHOD("set_visual_spell_effects", "value"), &Spell::set_visual_spell_effects);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "visual_spell_effects", PROPERTY_HINT_RESOURCE_TYPE, "SpellEffectVisual"), "set_visual_spell_effects", "get_visual_spell_effects");
@ -1199,11 +1205,6 @@ void Spell::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_description", "class_level", "character_level"), &Spell::get_description);
ClassDB::bind_method(D_METHOD("_get_description", "class_level", "character_level"), &Spell::_get_description);
ADD_GROUP("Scaling", "scale");
ClassDB::bind_method(D_METHOD("get_scale_with_level"), &Spell::get_scale_with_level);
ClassDB::bind_method(D_METHOD("set_scale_with_level", "value"), &Spell::set_scale_with_level);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scale_with_level"), "set_scale_with_level", "get_scale_with_level");
ADD_GROUP("Cooldown", "cooldown");
ClassDB::bind_method(D_METHOD("get_cooldown"), &Spell::get_cooldown);
ClassDB::bind_method(D_METHOD("set_cooldown", "value"), &Spell::set_cooldown);

View File

@ -36,26 +36,33 @@ EntityDataManager *EntityDataManager::get_instance() {
return instance;
}
bool EntityDataManager::get_use_spell_points() {
bool EntityDataManager::get_use_spell_points() const {
return _use_spell_points;
}
void EntityDataManager::set_use_spell_points(bool value) {
void EntityDataManager::set_use_spell_points(const bool value) {
_use_spell_points = value;
}
bool EntityDataManager::get_automatic_load() {
bool EntityDataManager::get_scale_spells_by_default() const {
return _scale_spells_by_default;
}
void EntityDataManager::set_scale_spells_by_default(const bool value) {
_scale_spells_by_default = value;
}
bool EntityDataManager::get_automatic_load() const {
return _automatic_load;
}
void EntityDataManager::set_automatic_load(bool load) {
void EntityDataManager::set_automatic_load(const bool load) {
_automatic_load = load;
}
Ref<Aura> EntityDataManager::get_skill_for_armor_type(int index) {
Ref<Aura> EntityDataManager::get_skill_for_armor_type(const int index) {
ERR_FAIL_INDEX_V(index, ItemEnums::ARMOR_TYPE_MAX, Ref<Aura>());
return _armor_type_skills[index];
}
void EntityDataManager::set_skill_for_armor_type(int index, const Ref<Aura> &aura) {
void EntityDataManager::set_skill_for_armor_type(const int index, const Ref<Aura> &aura) {
ERR_FAIL_INDEX(index, ItemEnums::ARMOR_TYPE_MAX);
_armor_type_skills[index] = aura;
@ -954,6 +961,18 @@ void EntityDataManager::request_world_spell_spawn_deferred(const Ref<WorldSpellD
}
void EntityDataManager::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_use_spell_points"), &EntityDataManager::get_use_spell_points);
ClassDB::bind_method(D_METHOD("set_use_spell_points", "value"), &EntityDataManager::set_use_spell_points);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_spell_points"), "set_use_spell_points", "get_use_spell_points");
ClassDB::bind_method(D_METHOD("get_scale_spells_by_default"), &EntityDataManager::get_scale_spells_by_default);
ClassDB::bind_method(D_METHOD("set_scale_spells_by_default", "value"), &EntityDataManager::set_scale_spells_by_default);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scale_spells_by_default"), "set_scale_spells_by_default", "get_scale_spells_by_default");
ClassDB::bind_method(D_METHOD("get_automatic_load"), &EntityDataManager::get_automatic_load);
ClassDB::bind_method(D_METHOD("set_automatic_load", "load"), &EntityDataManager::set_automatic_load);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "automatic_load"), "set_automatic_load", "get_automatic_load");
ClassDB::bind_method(D_METHOD("get_skill_for_armor_type", "index"), &EntityDataManager::get_skill_for_armor_type);
ClassDB::bind_method(D_METHOD("set_skill_for_armor_type", "index", "aura"), &EntityDataManager::set_skill_for_armor_type);
@ -961,10 +980,6 @@ void EntityDataManager::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "skill_for_armor_type_" + itos(i), PROPERTY_HINT_RESOURCE_TYPE, "Aura"), "set_skill_for_armor_type", "get_skill_for_armor_type", i);
}
ClassDB::bind_method(D_METHOD("get_automatic_load"), &EntityDataManager::get_automatic_load);
ClassDB::bind_method(D_METHOD("set_automatic_load", "load"), &EntityDataManager::set_automatic_load);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "automatic_load"), "set_automatic_load", "get_automatic_load");
//XPData
ClassDB::bind_method(D_METHOD("get_xp_data_path"), &EntityDataManager::get_xp_data_path);
ClassDB::bind_method(D_METHOD("set_xp_data_path", "path"), &EntityDataManager::set_xp_data_path);
@ -1110,6 +1125,7 @@ EntityDataManager::EntityDataManager() {
instance = this;
_use_spell_points = GLOBAL_DEF("ess/spells/use_spell_points", false);
_scale_spells_by_default = GLOBAL_DEF("ess/spells/scale_spells_by_default", false);
_automatic_load = GLOBAL_DEF("ess/data/automatic_load", false);
_xp_data_path = GLOBAL_DEF("ess/data/xp_data_path", "");

View File

@ -62,14 +62,17 @@ class EntityDataManager : public Object {
public:
static EntityDataManager *get_instance();
bool get_use_spell_points();
void set_use_spell_points(bool value);
bool get_use_spell_points() const;
void set_use_spell_points(const bool value);
bool get_automatic_load();
void set_automatic_load(bool load);
bool get_scale_spells_by_default() const;
void set_scale_spells_by_default(const bool value);
Ref<Aura> get_skill_for_armor_type(int index);
void set_skill_for_armor_type(int index, const Ref<Aura> &aura);
bool get_automatic_load() const;
void set_automatic_load(const bool load);
Ref<Aura> get_skill_for_armor_type(const int index);
void set_skill_for_armor_type(const int index, const Ref<Aura> &aura);
String get_xp_data_path();
void set_xp_data_path(String path);
@ -241,6 +244,7 @@ private:
static EntityDataManager *instance;
bool _use_spell_points;
bool _scale_spells_by_default;
bool _automatic_load;
};