Merged SpellProjectile and WorldEffect into a new WorldSpell class.

This commit is contained in:
Relintai 2019-12-09 21:23:57 +01:00
parent e0d733eb54
commit 7f3b1eecdd
18 changed files with 107 additions and 209 deletions

6
SCsub
View File

@ -65,10 +65,8 @@ module_env.add_source_files(env.modules_sources,"entities/stats/complex_level_st
module_env.add_source_files(env.modules_sources,"data/spell_effect_visual.cpp")
module_env.add_source_files(env.modules_sources,"data/spell_effect_visual_simple.cpp")
module_env.add_source_files(env.modules_sources,"world_spells/spell_projectile_data.cpp")
module_env.add_source_files(env.modules_sources,"world_spells/world_effect_data.cpp")
module_env.add_source_files(env.modules_sources,"world_spells/spell_projectile.cpp")
module_env.add_source_files(env.modules_sources,"world_spells/world_spell_effect.cpp")
module_env.add_source_files(env.modules_sources,"world_spells/world_spell_data.cpp")
module_env.add_source_files(env.modules_sources,"world_spells/world_spell.cpp")
module_env.add_source_files(env.modules_sources,"entities/player_talent.cpp")
module_env.add_source_files(env.modules_sources,"inventory/bag.cpp")

View File

@ -80,18 +80,11 @@ void Aura::set_visual_spell_effects(Ref<SpellEffectVisual> value) {
_visual_spell_effects = value;
}
Ref<SpellProjectileData> Aura::get_spell_projectile_data() {
return _spell_projectile_data;
Ref<WorldSpellData> Aura::get_world_spell_data() {
return _world_spell_data;
}
void Aura::set_spell_projectile_data(Ref<SpellProjectileData> value) {
_spell_projectile_data = value;
}
Ref<WorldEffectData> Aura::get_world_effect_data() {
return _world_effect_data;
}
void Aura::set_world_effect_data(Ref<WorldEffectData> value) {
_world_effect_data = value;
void Aura::set_world_spell_data(Ref<WorldSpellData> value) {
_world_spell_data = value;
}
int Aura::get_ability_scale_data_id() {
@ -314,8 +307,8 @@ Aura::~Aura() {
_teaches_spell.unref();
_visual_spell_effects.unref();
_spell_projectile_data.unref();
_world_effect_data.unref();
_world_spell_data.unref();
_damage_scaling_curve.unref();
_absorb_scaling_curve.unref();
@ -1409,13 +1402,9 @@ void Aura::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_visual_spell_effects", "value"), &Aura::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");
ClassDB::bind_method(D_METHOD("get_spell_projectile_data"), &Aura::get_spell_projectile_data);
ClassDB::bind_method(D_METHOD("set_spell_projectile_data", "value"), &Aura::set_spell_projectile_data);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "spell_projectile_data", PROPERTY_HINT_RESOURCE_TYPE, "SpellProjectileData"), "set_spell_projectile_data", "get_spell_projectile_data");
ClassDB::bind_method(D_METHOD("get_world_effect_data"), &Aura::get_world_effect_data);
ClassDB::bind_method(D_METHOD("set_world_effect_data", "value"), &Aura::set_world_effect_data);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "world_effect_data", PROPERTY_HINT_RESOURCE_TYPE, "WorldEffectData"), "set_world_effect_data", "get_world_effect_data");
ClassDB::bind_method(D_METHOD("get_world_spell_data"), &Aura::get_world_spell_data);
ClassDB::bind_method(D_METHOD("set_world_spell_data", "value"), &Aura::set_world_spell_data);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "world_spell_data", PROPERTY_HINT_RESOURCE_TYPE, "WorldSpellData"), "set_world_spell_data", "get_world_spell_data");
ClassDB::bind_method(D_METHOD("get_teaches_spell"), &Aura::get_teaches_spell);
ClassDB::bind_method(D_METHOD("set_teaches_spell", "next_rank"), &Aura::set_teaches_spell);

View File

@ -26,8 +26,8 @@
#include "../utility/category_cooldown.h"
#include "spell_effect_visual.h"
#include "../world_spells/spell_projectile_data.h"
#include "../world_spells/world_effect_data.h"
#include "../world_spells/world_spell_data.h"
class AuraApplyInfo;
class AuraScript;
@ -72,11 +72,8 @@ public:
Ref<SpellEffectVisual> get_visual_spell_effects();
void set_visual_spell_effects(Ref<SpellEffectVisual> value);
Ref<SpellProjectileData> get_spell_projectile_data();
void set_spell_projectile_data(Ref<SpellProjectileData> value);
Ref<WorldEffectData> get_world_effect_data();
void set_world_effect_data(Ref<WorldEffectData> value);
Ref<WorldSpellData> get_world_spell_data();
void set_world_spell_data(Ref<WorldSpellData> value);
int get_ability_scale_data_id();
void set_ability_scale_data_id(int value);
@ -368,8 +365,8 @@ private:
int _rank;
Ref<SpellEffectVisual> _visual_spell_effects;
Ref<SpellProjectileData> _spell_projectile_data;
Ref<WorldEffectData> _world_effect_data;
Ref<WorldSpellData> _world_spell_data;
bool _damage_enabled;
int _damage_type;

View File

@ -138,18 +138,11 @@ void Spell::set_visual_spell_effects(Ref<SpellEffectVisual> value) {
_visual_spell_effects = value;
}
Ref<SpellProjectileData> Spell::get_spell_projectile_data() {
return _spell_projectile_data;
Ref<WorldSpellData> Spell::get_world_spell_data() {
return _world_spell_data;
}
void Spell::set_spell_projectile_data(Ref<SpellProjectileData> value) {
_spell_projectile_data = value;
}
Ref<WorldEffectData> Spell::get_world_effect_data() {
return _world_effect_data;
}
void Spell::set_world_effect_data(Ref<WorldEffectData> value) {
_world_effect_data = value;
void Spell::set_world_spell_data(Ref<WorldSpellData> value) {
_world_spell_data = value;
}
Ref<CraftRecipe> Spell::get_teaches_craft_recipe() {
@ -800,8 +793,9 @@ Spell::~Spell() {
_icon.unref();
_visual_spell_effects.unref();
_spell_projectile_data.unref();
_world_effect_data.unref();
_world_spell_data.unref();
_teaches_craft_recipe.unref();
_damage_scaling_curve.unref();
_heal_scaling_curve.unref();
@ -905,13 +899,9 @@ void Spell::_bind_methods() {
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");
ClassDB::bind_method(D_METHOD("get_spell_projectile_data"), &Spell::get_spell_projectile_data);
ClassDB::bind_method(D_METHOD("set_spell_projectile_data", "value"), &Spell::set_spell_projectile_data);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "spell_projectile_data", PROPERTY_HINT_RESOURCE_TYPE, "SpellProjectileData"), "set_spell_projectile_data", "get_spell_projectile_data");
ClassDB::bind_method(D_METHOD("get_world_effect_data"), &Spell::get_world_effect_data);
ClassDB::bind_method(D_METHOD("set_world_effect_data", "value"), &Spell::set_world_effect_data);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "world_effect_data", PROPERTY_HINT_RESOURCE_TYPE, "WorldEffectData"), "set_world_effect_data", "get_world_effect_data");
ClassDB::bind_method(D_METHOD("get_world_spell_data"), &Spell::get_world_spell_data);
ClassDB::bind_method(D_METHOD("set_world_spell_data", "value"), &Spell::set_world_spell_data);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "world_spell_data", PROPERTY_HINT_RESOURCE_TYPE, "WorldSpellData"), "set_world_spell_data", "get_world_spell_data");
ClassDB::bind_method(D_METHOD("get_teaches_craft_recipe"), &Spell::get_teaches_craft_recipe);
ClassDB::bind_method(D_METHOD("set_teaches_craft_recipe", "value"), &Spell::set_teaches_craft_recipe);

View File

@ -16,8 +16,8 @@
#include "../infos/aura_infos.h"
#include "spell_effect_visual.h"
#include "../world_spells/spell_projectile_data.h"
#include "../world_spells/world_effect_data.h"
#include "../world_spells/world_spell_data.h"
class Entity;
class Aura;
@ -142,11 +142,8 @@ public:
Ref<SpellEffectVisual> get_visual_spell_effects();
void set_visual_spell_effects(Ref<SpellEffectVisual> value);
Ref<SpellProjectileData> get_spell_projectile_data();
void set_spell_projectile_data(Ref<SpellProjectileData> value);
Ref<WorldEffectData> get_world_effect_data();
void set_world_effect_data(Ref<WorldEffectData> value);
Ref<WorldSpellData> get_world_spell_data();
void set_world_spell_data(Ref<WorldSpellData> value);
Ref<CraftRecipe> get_teaches_craft_recipe();
void set_teaches_craft_recipe(Ref<CraftRecipe> value);
@ -363,8 +360,8 @@ private:
String _text_description;
Ref<SpellEffectVisual> _visual_spell_effects;
Ref<SpellProjectileData> _spell_projectile_data;
Ref<WorldEffectData> _world_effect_data;
Ref<WorldSpellData> _world_spell_data;
Ref<CraftRecipe> _teaches_craft_recipe;
bool _has_range;

View File

@ -98,10 +98,8 @@
#include "data/spell_effect_visual.h"
#include "data/spell_effect_visual_simple.h"
#include "world_spells/spell_projectile_data.h"
#include "world_spells/world_effect_data.h"
#include "world_spells/spell_projectile.h"
#include "world_spells/world_spell_effect.h"
#include "world_spells/world_spell_data.h"
#include "world_spells/world_spell.h"
#include "entities/ai/entity_ai.h"
@ -231,10 +229,8 @@ void register_entity_spell_system_types() {
ClassDB::register_class<SpellEffectVisual>();
ClassDB::register_class<SpellEffectVisualSimple>();
ClassDB::register_class<SpellProjectileData>();
ClassDB::register_class<WorldEffectData>();
ClassDB::register_class<SpellProjectile>();
ClassDB::register_class<WorldSpellEffect>();
ClassDB::register_class<WorldSpellData>();
ClassDB::register_class<WorldSpell>();
//AI
ClassDB::register_class<EntityAI>();

View File

@ -1,11 +0,0 @@
#include "spell_projectile.h"
SpellProjectile::SpellProjectile() {
}
SpellProjectile::~SpellProjectile() {
}
void SpellProjectile::_bind_methods() {
}

View File

@ -1,29 +0,0 @@
#ifndef SPELL_PROJECTILE_H
#define SPELL_PROJECTILE_H
#ifdef ENTITIES_2D
#include "scene/2d/node_2d.h"
#else
#include "scene/3d/spatial.h"
#endif
#ifdef ENTITIES_2D
class SpellProjectile : public Node2D {
GDCLASS(SpellProjectile, Node2D);
#else
class SpellProjectile : public Spatial {
GDCLASS(SpellProjectile, Spatial);
#endif
public:
SpellProjectile();
~SpellProjectile();
protected:
static void _bind_methods();
//private:
};
#endif

View File

@ -1,10 +0,0 @@
#include "spell_projectile_data.h"
SpellProjectileData::SpellProjectileData() {
}
SpellProjectileData::~SpellProjectileData() {
}
void SpellProjectileData::_bind_methods() {
}

View File

@ -1,19 +0,0 @@
#ifndef SPELL_PROJECTILE_DATA_H
#define SPELL_PROJECTILE_DATA_H
#include "core/resource.h"
class SpellProjectileData : public Resource {
GDCLASS(SpellProjectileData, Resource);
public:
SpellProjectileData();
~SpellProjectileData();
protected:
static void _bind_methods();
//private:
};
#endif

View File

@ -1,11 +0,0 @@
#include "world_effect_data.h"
WorldEffectData::WorldEffectData() {
}
WorldEffectData::~WorldEffectData() {
}
void WorldEffectData::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text_name"), "set_name", "get_name");
}

View File

@ -1,19 +0,0 @@
#ifndef WORLD_EFFECT_DATA_H
#define WORLD_EFFECT_DATA_H
#include "core/resource.h"
class WorldEffectData : public Resource {
GDCLASS(WorldEffectData, Resource);
public:
WorldEffectData();
~WorldEffectData();
protected:
static void _bind_methods();
private:
};
#endif

View File

@ -0,0 +1,10 @@
#include "world_spell.h"
WorldSpell::WorldSpell() {
}
WorldSpell::~WorldSpell() {
}
void WorldSpell::_bind_methods() {
}

View File

@ -0,0 +1,30 @@
#ifndef WORLD_SPELL_H
#define WORLD_SPELL_H
#ifdef ENTITIES_2D
#include "scene/2d/node_2d.h"
#else
#include "scene/3d/spatial.h"
#endif
#include "world_spell_data.h"
#ifdef ENTITIES_2D
class WorldSpell : public Node2D {
GDCLASS(WorldSpell, Node2D);
#else
class WorldSpell : public Spatial {
GDCLASS(WorldSpell, Spatial);
#endif
public:
WorldSpell();
~WorldSpell();
protected:
static void _bind_methods();
private:
};
#endif

View File

@ -0,0 +1,11 @@
#include "world_spell_data.h"
WorldSpellData::WorldSpellData() {
}
WorldSpellData::~WorldSpellData() {
}
void WorldSpellData::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text_name"), "set_name", "get_name");
}

View File

@ -0,0 +1,19 @@
#ifndef WORLD_SPELL_DATA_H
#define WORLD_SPELL_DATA_H
#include "core/resource.h"
class WorldSpellData : public Resource {
GDCLASS(WorldSpellData, Resource);
public:
WorldSpellData();
~WorldSpellData();
protected:
static void _bind_methods();
private:
};
#endif

View File

@ -1,10 +0,0 @@
#include "world_spell_effect.h"
WorldSpellEffect::WorldSpellEffect() {
}
WorldSpellEffect::~WorldSpellEffect() {
}
void WorldSpellEffect::_bind_methods() {
}

View File

@ -1,30 +0,0 @@
#ifndef WORLD_SPELL_EFFECT_H
#define WORLD_SPELL_EFFECT_H
#ifdef ENTITIES_2D
#include "scene/2d/node_2d.h"
#else
#include "scene/3d/spatial.h"
#endif
//#include "../entities/entity.h"
#ifdef ENTITIES_2D
class WorldSpellEffect : public Node2D {
GDCLASS(WorldSpellEffect, Node2D);
#else
class WorldSpellEffect : public Spatial {
GDCLASS(WorldSpellEffect, Spatial);
#endif
public:
WorldSpellEffect();
~WorldSpellEffect();
protected:
static void _bind_methods();
private:
};
#endif