mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-04-19 21:33:15 +02:00
Stat refactoring part 1.
This commit is contained in:
parent
df8331e07f
commit
7224490a99
@ -256,10 +256,10 @@ void Entity::setup() {
|
||||
|
||||
void Entity::_setup() {
|
||||
if (_s_entity_data.is_valid()) {
|
||||
_s_entity_data->setup_resources(this);
|
||||
|
||||
sinitialize_stats();
|
||||
|
||||
_s_entity_data->setup_resources(this);
|
||||
|
||||
sets_entity_data_id(_s_entity_data->get_id());
|
||||
|
||||
sets_entity_type(_s_entity_data->get_entity_type());
|
||||
@ -505,7 +505,7 @@ void Entity::_from_dict(const Dictionary &dict) {
|
||||
|
||||
for (int i = 0; i < Stat::STAT_ID_TOTAL_STATS; ++i) {
|
||||
Ref<Stat> s = _stats[i];
|
||||
|
||||
|
||||
s->from_dict(stats.get(String::num(i), Dictionary()));
|
||||
}
|
||||
|
||||
@ -832,6 +832,7 @@ Entity::Entity() {
|
||||
_stats[i] = s;
|
||||
}
|
||||
|
||||
/*
|
||||
get_stat_enum(Stat::STAT_ID_HEALTH)->set_base(10000);
|
||||
get_stat_enum(Stat::STAT_ID_MANA)->set_base(100);
|
||||
get_stat_enum(Stat::STAT_ID_RAGE)->set_base(100);
|
||||
@ -844,7 +845,7 @@ Entity::Entity() {
|
||||
get_stat_enum(Stat::STAT_ID_SPELL_CRIT_BONUS)->set_base(50);
|
||||
get_stat_enum(Stat::STAT_ID_BLOCK)->set_base(10);
|
||||
get_stat_enum(Stat::STAT_ID_PARRY)->set_base(15);
|
||||
get_stat_enum(Stat::STAT_ID_MELEE_DAMAGE_REDUCTION)->set_base(15);
|
||||
get_stat_enum(Stat::STAT_ID_MELEE_DAMAGE_REDUCTION)->set_base(15);*/
|
||||
|
||||
SET_RPC_REMOTE("crequest_spell_cast");
|
||||
SET_RPC_REMOTE("csend_request_rank_increase");
|
||||
@ -1019,24 +1020,9 @@ void Entity::sinitialize_stats() {
|
||||
|
||||
ERR_FAIL_COND(!cc.is_valid());
|
||||
|
||||
cc->get_stat_data()->get_stat_for_stat(get_health());
|
||||
cc->get_stat_data()->get_stat_for_stat(get_mana());
|
||||
cc->get_stat_data()->get_stat_for_stat(get_rage());
|
||||
cc->get_stat_data()->get_stat_for_stat(get_energy());
|
||||
cc->get_stat_data()->get_stat_for_stat(get_speed());
|
||||
cc->get_stat_data()->get_stat_for_stat(get_gcd());
|
||||
cc->get_stat_data()->get_stat_for_stat(get_melee_crit());
|
||||
cc->get_stat_data()->get_stat_for_stat(get_melee_crit_bonus());
|
||||
cc->get_stat_data()->get_stat_for_stat(get_spell_crit());
|
||||
cc->get_stat_data()->get_stat_for_stat(get_spell_crit_bonus());
|
||||
cc->get_stat_data()->get_stat_for_stat(get_block());
|
||||
cc->get_stat_data()->get_stat_for_stat(get_parry());
|
||||
cc->get_stat_data()->get_stat_for_stat(get_melee_damage_reduction());
|
||||
cc->get_stat_data()->get_stat_for_stat(get_spell_damage_reduction());
|
||||
cc->get_stat_data()->get_stat_for_stat(get_damage_taken());
|
||||
cc->get_stat_data()->get_stat_for_stat(get_heal_taken());
|
||||
cc->get_stat_data()->get_stat_for_stat(get_melee_damage());
|
||||
cc->get_stat_data()->get_stat_for_stat(get_spell_damage());
|
||||
for (int i = 0; i < Stat::STAT_ID_TOTAL_STATS; ++i) {
|
||||
cc->get_stat_data()->get_stat_for_stat(_stats[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < cc->get_num_auras(); ++i) {
|
||||
Ref<Aura> a = cc->get_aura(i);
|
||||
@ -4299,6 +4285,22 @@ void Entity::update(float delta) {
|
||||
sfinish_cast();
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < Stat::MAIN_STAT_ID_MAX; ++i) {
|
||||
Ref<Stat> s = _stats[i];
|
||||
|
||||
if (!s.is_valid())
|
||||
continue;
|
||||
|
||||
if (s->get_dirty_mods())
|
||||
s->apply_modifiers();
|
||||
|
||||
if (s->get_dirty()) {
|
||||
//send target is nout public
|
||||
s->setc_values(s->gets_current(), s->gets_max());
|
||||
s->set_dirty(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String Entity::random_name() {
|
||||
@ -4821,7 +4823,7 @@ void Entity::_bind_methods() {
|
||||
ADD_SIGNAL(MethodInfo("con_equip_success", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "equip_slot"), PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "ItemInstance"), PropertyInfo(Variant::OBJECT, "old_item", PROPERTY_HINT_RESOURCE_TYPE, "ItemInstance"), PropertyInfo(Variant::INT, "bag_slot")));
|
||||
ADD_SIGNAL(MethodInfo("con_equip_fail", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "equip_slot"), PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "ItemInstance"), PropertyInfo(Variant::OBJECT, "old_item", PROPERTY_HINT_RESOURCE_TYPE, "ItemInstance"), PropertyInfo(Variant::INT, "bag_slot")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::BOOL, "ret") , "_should_deny_equip", PropertyInfo(Variant::INT, "equip_slot"), PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "ItemInstance")));
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::BOOL, "ret"), "_should_deny_equip", PropertyInfo(Variant::INT, "equip_slot"), PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "ItemInstance")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_son_equip_success", PropertyInfo(Variant::INT, "equip_slot"), PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "ItemInstance"), PropertyInfo(Variant::OBJECT, "old_item", PROPERTY_HINT_RESOURCE_TYPE, "ItemInstance"), PropertyInfo(Variant::INT, "bag_slot")));
|
||||
BIND_VMETHOD(MethodInfo("_son_equip_fail", PropertyInfo(Variant::INT, "equip_slot"), PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "ItemInstance"), PropertyInfo(Variant::OBJECT, "old_item", PROPERTY_HINT_RESOURCE_TYPE, "ItemInstance"), PropertyInfo(Variant::INT, "bag_slot")));
|
||||
|
@ -103,32 +103,10 @@ String Stat::stat_id_name(int stat_id) {
|
||||
return "";
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ Vector<Ref<StatModifier> > *Stat::get_modifiers() {
|
||||
return &_modifiers;
|
||||
}
|
||||
|
||||
int Stat::get_modifier_count() {
|
||||
return _modifiers.size();
|
||||
}
|
||||
|
||||
Ref<StatModifier> Stat::get_modifier(int index) {
|
||||
return _modifiers.get(index);
|
||||
}
|
||||
|
||||
void Stat::set_dependency(Ref<Stat> other, Ref<Curve> curve) {
|
||||
_dependency = other;
|
||||
_dependency_curve = curve;
|
||||
}
|
||||
|
||||
void Stat::remove_dependencies() {
|
||||
_dependency = Ref<Stat>(NULL);
|
||||
_dependency_curve = Ref<Curve>(NULL);
|
||||
}
|
||||
|
||||
Stat::StatId Stat::get_id() {
|
||||
return _id;
|
||||
}
|
||||
|
||||
void Stat::set_id(Stat::StatId id) {
|
||||
_id = id;
|
||||
}
|
||||
@ -136,11 +114,18 @@ void Stat::set_id(Stat::StatId id) {
|
||||
Stat::StatModifierApplyType Stat::get_stat_modifier_type() {
|
||||
return _modifier_apply_type;
|
||||
}
|
||||
|
||||
void Stat::set_stat_modifier_type(Stat::StatModifierApplyType value) {
|
||||
_modifier_apply_type = value;
|
||||
}
|
||||
|
||||
|
||||
bool Stat::get_public() {
|
||||
return _public;
|
||||
}
|
||||
void Stat::set_public(bool value) {
|
||||
_public = value;
|
||||
}
|
||||
|
||||
bool Stat::get_locked() {
|
||||
return _locked;
|
||||
}
|
||||
@ -155,178 +140,26 @@ void Stat::set_dirty(bool value) {
|
||||
_dirty = value;
|
||||
}
|
||||
|
||||
void Stat::add_modifier(int id, float base_mod, float bonus_mod, float percent_mod, bool apply) {
|
||||
Ref<StatModifier> statModifier = Ref<StatModifier>(memnew(StatModifier(id, base_mod, bonus_mod, percent_mod)));
|
||||
|
||||
if (apply) {
|
||||
apply_modifier(statModifier);
|
||||
}
|
||||
|
||||
_modifiers.push_back(statModifier);
|
||||
bool Stat::get_dirty_mods() {
|
||||
return _dirty_mods;
|
||||
}
|
||||
void Stat::set_dirty_mods(bool value) {
|
||||
_dirty_mods = value;
|
||||
}
|
||||
|
||||
void Stat::remove_modifier(int id, bool apply) {
|
||||
for (int i = 0; i < _modifiers.size(); i += 1) {
|
||||
if (_modifiers.get(i)->get_id() == id) {
|
||||
Ref<StatModifier> modifier = _modifiers.get(i);
|
||||
_modifiers.remove(i);
|
||||
|
||||
if (apply) {
|
||||
de_apply_modifier(modifier);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
float Stat::get_base() {
|
||||
return _base;
|
||||
}
|
||||
|
||||
void Stat::apply_modifier(Ref<StatModifier> modifier) {
|
||||
if (_modifier_apply_type == MODIFIER_APPLY_TYPE_STANDARD) {
|
||||
_base += modifier->get_base_mod();
|
||||
_bonus += modifier->get_bonus_mod();
|
||||
_percent += modifier->get_percent_mod();
|
||||
} else {
|
||||
if (modifier->get_percent_mod() >= (float)0) {
|
||||
_base += modifier->get_base_mod();
|
||||
_bonus += modifier->get_bonus_mod();
|
||||
_percent += modifier->get_percent_mod();
|
||||
} else {
|
||||
int num = -1;
|
||||
if (get_modifiers()->size() > 0) {
|
||||
float percent_mod = get_modifiers()->get(0)->get_percent_mod();
|
||||
for (int i = 1; i < get_modifiers()->size(); i += 1) {
|
||||
if ((_modifiers.get(i)->get_percent_mod() < (float)0) && (_modifiers.get(i)->get_percent_mod() < percent_mod)) {
|
||||
num = i;
|
||||
percent_mod = _modifiers.get(i)->get_percent_mod();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (num != -1) {
|
||||
if (modifier->get_percent_mod() < _modifiers.get(num)->get_percent_mod()) {
|
||||
_percent -= _modifiers.get(num)->get_percent_mod();
|
||||
}
|
||||
|
||||
_percent += modifier->get_percent_mod();
|
||||
} else {
|
||||
|
||||
_percent += modifier->get_percent_mod();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
recalculate();
|
||||
emit_signal("s_changed", Ref<Stat>(this));
|
||||
send();
|
||||
// emit_signal("s_changed", Ref<Stat>(this));
|
||||
float Stat::get_bonus() {
|
||||
return _bonus;
|
||||
}
|
||||
|
||||
void Stat::de_apply_modifier(Ref<StatModifier> modifier) {
|
||||
if (_modifier_apply_type == MODIFIER_APPLY_TYPE_STANDARD) {
|
||||
_base -= modifier->get_base_mod();
|
||||
_bonus -= modifier->get_bonus_mod();
|
||||
_percent -= modifier->get_percent_mod();
|
||||
} else {
|
||||
if (modifier->get_percent_mod() >= (float)0) {
|
||||
_base -= modifier->get_base_mod();
|
||||
_bonus -= modifier->get_bonus_mod();
|
||||
_percent -= modifier->get_percent_mod();
|
||||
} else {
|
||||
int num = -1;
|
||||
|
||||
if (get_modifiers()->size() > 0) {
|
||||
float percent_mod = get_modifiers()->get(0)->get_percent_mod();
|
||||
|
||||
for (int i = 1; i < get_modifiers()->size(); i += 1) {
|
||||
if ((_modifiers.get(i)->get_percent_mod() < (float)0) && (_modifiers.get(i)->get_percent_mod() < percent_mod)) {
|
||||
num = i;
|
||||
percent_mod = _modifiers.get(i)->get_percent_mod();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (num != -1 && _modifiers[num] == modifier) {
|
||||
_percent -= modifier->get_percent_mod();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
recalculate();
|
||||
emit_signal("s_changed", Ref<Stat>(this));
|
||||
send();
|
||||
|
||||
// emit_signal("s_changed", Ref<Stat>(this));
|
||||
float Stat::get_percent() {
|
||||
return _percent;
|
||||
}
|
||||
|
||||
void Stat::re_apply_modifiers() {
|
||||
reset_values();
|
||||
|
||||
if (_modifier_apply_type == MODIFIER_APPLY_TYPE_STANDARD) {
|
||||
for (int i = 0; i < _modifiers.size(); i += 1) {
|
||||
Ref<StatModifier> mod = _modifiers.get(i);
|
||||
|
||||
_base += mod->get_base_mod();
|
||||
_bonus += mod->get_bonus_mod();
|
||||
_percent += mod->get_percent_mod();
|
||||
}
|
||||
} else {
|
||||
re_apply_modifier_not_negative_stacking_percents();
|
||||
}
|
||||
|
||||
recalculate();
|
||||
emit_signal("s_changed", Ref<Stat>(this));
|
||||
send();
|
||||
|
||||
// emit_signal("s_changed", Ref<Stat>(this));
|
||||
}
|
||||
|
||||
void Stat::re_apply_modifier_not_negative_stacking_percents() {
|
||||
reset_values();
|
||||
|
||||
for (int i = 1; i < get_modifiers()->size(); i += 1) {
|
||||
if (_modifiers.get(i)->get_percent_mod() > (float)0) {
|
||||
Ref<StatModifier> mod = _modifiers.get(i);
|
||||
|
||||
_base += mod->get_base_mod();
|
||||
_bonus += mod->get_bonus_mod();
|
||||
_percent += mod->get_percent_mod();
|
||||
}
|
||||
}
|
||||
|
||||
int num = -1;
|
||||
if (get_modifiers()->size() > 0) {
|
||||
float percent_mod = get_modifiers()->get(0)->get_percent_mod();
|
||||
|
||||
for (int j = 1; j < get_modifiers()->size(); ++j) {
|
||||
|
||||
if ((_modifiers.get(j)->get_percent_mod() < (float)0) && (_modifiers.get(j)->get_percent_mod() < percent_mod)) {
|
||||
num = j;
|
||||
percent_mod = _modifiers.get(j)->get_percent_mod();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (num != -1) {
|
||||
Ref<StatModifier> mod = _modifiers.get(num);
|
||||
|
||||
_base += mod->get_base_mod();
|
||||
_bonus += mod->get_bonus_mod();
|
||||
_percent += mod->get_percent_mod();
|
||||
}
|
||||
|
||||
recalculate();
|
||||
emit_signal("s_changed", Ref<Stat>(this));
|
||||
send();
|
||||
|
||||
// emit_signal("s_changed", Ref<Stat>(this));
|
||||
}
|
||||
|
||||
//Stat
|
||||
|
||||
float Stat::gets_current() {
|
||||
return _s_current;
|
||||
}
|
||||
|
||||
void Stat::sets_current(float value) {
|
||||
if (_locked) {
|
||||
return;
|
||||
@ -334,25 +167,21 @@ void Stat::sets_current(float value) {
|
||||
|
||||
_s_current = value;
|
||||
|
||||
emit_signal("s_changed", Ref<Stat>(this));
|
||||
send();
|
||||
_dirty = true;
|
||||
}
|
||||
|
||||
float Stat::gets_max() {
|
||||
return _s_max;
|
||||
}
|
||||
|
||||
void Stat::sets_max(float value) {
|
||||
_s_max = value;
|
||||
|
||||
emit_signal("s_changed", Ref<Stat>(this));
|
||||
send();
|
||||
_dirty = true;
|
||||
}
|
||||
|
||||
float Stat::getc_current() {
|
||||
return _c_current;
|
||||
}
|
||||
|
||||
void Stat::setc_current(float value) {
|
||||
_c_current = value;
|
||||
|
||||
@ -362,48 +191,113 @@ void Stat::setc_current(float value) {
|
||||
float Stat::getc_max() {
|
||||
return _c_max;
|
||||
}
|
||||
|
||||
void Stat::setc_max(float value) {
|
||||
_s_current = value;
|
||||
|
||||
emit_signal("c_changed", Ref<Stat>(this));
|
||||
}
|
||||
|
||||
float Stat::get_base() {
|
||||
return _base;
|
||||
void Stat::setc_values(int ccurrent, int cmax) {
|
||||
_c_current = ccurrent;
|
||||
_c_max = cmax;
|
||||
|
||||
emit_signal("c_changed", Ref<Stat>(this));
|
||||
}
|
||||
|
||||
void Stat::set_base(float value) {
|
||||
_base = value;
|
||||
recalculate();
|
||||
_FORCE_INLINE_ Vector<Ref<StatModifier> > *Stat::get_modifiers() {
|
||||
return &_modifiers;
|
||||
}
|
||||
|
||||
int Stat::get_modifier_count() {
|
||||
return _modifiers.size();
|
||||
}
|
||||
|
||||
void Stat::clear_modifiers() {
|
||||
_modifiers.clear();
|
||||
|
||||
_dirty = true;
|
||||
_dirty_mods = true;
|
||||
}
|
||||
|
||||
Ref<StatModifier> Stat::get_modifier(int index) {
|
||||
return _modifiers.get(index);
|
||||
}
|
||||
|
||||
Ref<StatModifier> Stat::add_modifier(int id, float base_mod, float bonus_mod, float percent_mod) {
|
||||
Ref<StatModifier> stat_modifier = Ref<StatModifier>(memnew(StatModifier(id, base_mod, bonus_mod, percent_mod, this)));
|
||||
|
||||
_modifiers.push_back(stat_modifier);
|
||||
|
||||
_dirty = true;
|
||||
_dirty_mods = true;
|
||||
|
||||
return stat_modifier;
|
||||
}
|
||||
|
||||
void Stat::remove_modifier(int id) {
|
||||
for (int i = 0; i < _modifiers.size(); i += 1) {
|
||||
if (_modifiers.get(i)->get_id() == id) {
|
||||
Ref<StatModifier> modifier = _modifiers.get(i);
|
||||
_modifiers.remove(i);
|
||||
|
||||
_dirty_mods = true;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Stat::apply_modifiers() {
|
||||
reset_values();
|
||||
|
||||
if (_modifier_apply_type == MODIFIER_APPLY_TYPE_STANDARD) {
|
||||
for (int i = 0; i < _modifiers.size(); i += 1) {
|
||||
Ref<StatModifier> mod = _modifiers.get(i);
|
||||
print_error("apply " + String::num(mod->get_base_mod()));
|
||||
_base += mod->get_base_mod();
|
||||
_bonus += mod->get_bonus_mod();
|
||||
_percent += mod->get_percent_mod();
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < _modifiers.size(); i += 1) {
|
||||
Ref<StatModifier> modifier = _modifiers.get(i);
|
||||
|
||||
if (modifier->get_percent_mod() >= (float)0) {
|
||||
_base += modifier->get_base_mod();
|
||||
_bonus += modifier->get_bonus_mod();
|
||||
_percent += modifier->get_percent_mod();
|
||||
} else {
|
||||
|
||||
int num = -1;
|
||||
if (get_modifiers()->size() > 0) {
|
||||
float percent_mod = get_modifiers()->get(0)->get_percent_mod();
|
||||
for (int i = 1; i < get_modifiers()->size(); i += 1) {
|
||||
if ((_modifiers.get(i)->get_percent_mod() < (float)0) && (_modifiers.get(i)->get_percent_mod() < percent_mod)) {
|
||||
num = i;
|
||||
percent_mod = _modifiers.get(i)->get_percent_mod();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (num != -1) {
|
||||
if (modifier->get_percent_mod() < _modifiers.get(num)->get_percent_mod()) {
|
||||
_percent -= _modifiers.get(num)->get_percent_mod();
|
||||
}
|
||||
|
||||
_percent += modifier->get_percent_mod();
|
||||
} else {
|
||||
|
||||
_percent += modifier->get_percent_mod();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_dirty_mods = false;
|
||||
|
||||
emit_signal("s_changed", Ref<Stat>(this));
|
||||
send();
|
||||
}
|
||||
|
||||
float Stat::get_bonus() {
|
||||
return _bonus;
|
||||
}
|
||||
|
||||
void Stat::set_bonus(float value) {
|
||||
_bonus = value;
|
||||
recalculate();
|
||||
|
||||
emit_signal("s_changed", Ref<Stat>(this));
|
||||
send();
|
||||
}
|
||||
|
||||
float Stat::get_percent() {
|
||||
return _percent;
|
||||
}
|
||||
|
||||
void Stat::set_percent(float value) {
|
||||
_percent = value;
|
||||
recalculate();
|
||||
|
||||
emit_signal("s_changed", Ref<Stat>(this));
|
||||
send();
|
||||
}
|
||||
|
||||
void Stat::reset_values() {
|
||||
_percent = 100;
|
||||
@ -411,12 +305,10 @@ void Stat::reset_values() {
|
||||
_percent = 0;
|
||||
|
||||
_dirty = true;
|
||||
|
||||
emit_signal("s_changed", Ref<Stat>(this));
|
||||
send();
|
||||
_dirty_mods = true;
|
||||
}
|
||||
|
||||
void Stat::recalculate() {
|
||||
void Stat::refresh_currmax() {
|
||||
float diff = _s_current / _s_max;
|
||||
|
||||
_s_max = (_base + _bonus) * (_percent / 100.0);
|
||||
@ -430,13 +322,6 @@ void Stat::recalculate() {
|
||||
_dirty = true;
|
||||
}
|
||||
|
||||
void Stat::send() {
|
||||
_c_current = _s_current;
|
||||
_c_max = _s_max;
|
||||
|
||||
emit_signal("c_changed", Ref<Stat>(this));
|
||||
}
|
||||
|
||||
bool Stat::iss_current_zero() {
|
||||
return (fabs(_s_current) < .000001);
|
||||
}
|
||||
@ -448,49 +333,16 @@ bool Stat::isc_current_zero() {
|
||||
void Stat::set_to_max() {
|
||||
_s_current = _s_max;
|
||||
|
||||
emit_signal("s_changed", Ref<Stat>(this));
|
||||
send();
|
||||
}
|
||||
|
||||
void Stat::set_values(float base, float bonus, float percent) {
|
||||
_base = base;
|
||||
_bonus = bonus;
|
||||
_percent = percent;
|
||||
|
||||
recalculate();
|
||||
|
||||
emit_signal("s_changed", Ref<Stat>(this));
|
||||
send();
|
||||
}
|
||||
|
||||
void Stat::set_from_stat(Ref<Stat> other) {
|
||||
_s_current = other->_s_current;
|
||||
_s_max = other->_s_max;
|
||||
_c_current = other->_c_current;
|
||||
_c_max = other->_c_max;
|
||||
_base = other->_base;
|
||||
_bonus = other->_bonus;
|
||||
_percent = other->_percent;
|
||||
set_dirty(true);
|
||||
|
||||
emit_signal("s_changed", Ref<Stat>(this));
|
||||
send();
|
||||
}
|
||||
|
||||
void Stat::set(float current, float max, float base, float bonus, float percent) {
|
||||
_s_current = current;
|
||||
_s_max = max;
|
||||
_c_current = current;
|
||||
_c_max = max;
|
||||
_base = base;
|
||||
_bonus = bonus;
|
||||
_percent = percent;
|
||||
_dirty = true;
|
||||
|
||||
emit_signal("s_changed", Ref<Stat>(this));
|
||||
send();
|
||||
}
|
||||
|
||||
void Stat::modifier_changed(Ref<StatModifier> modifier) {
|
||||
_dirty_mods = true;
|
||||
}
|
||||
|
||||
|
||||
Dictionary Stat::to_dict() {
|
||||
return call("_to_dict");
|
||||
}
|
||||
@ -504,8 +356,10 @@ Dictionary Stat::_to_dict() {
|
||||
dict["id"] = _id;
|
||||
dict["modifier_apply_type"] = _modifier_apply_type;
|
||||
|
||||
dict["public"] = _public;
|
||||
dict["locked"] = _locked;
|
||||
dict["dirty"] = _dirty;
|
||||
dict["dirty_mods"] = _dirty_mods;
|
||||
|
||||
dict["base"] = _base;
|
||||
dict["bonus"] = _bonus;
|
||||
@ -530,8 +384,11 @@ void Stat::_from_dict(const Dictionary &dict) {
|
||||
_id = (Stat::StatId)((int)dict.get("id", 0));
|
||||
_modifier_apply_type = (StatModifierApplyType)((int)dict.get("modifier_apply_type", 0));
|
||||
|
||||
_public = dict.get("public", false);
|
||||
_locked = dict.get("locked", false);
|
||||
_dirty = dict.get("dirty", false);
|
||||
_dirty_mods = dict.get("dirty_mods", false);
|
||||
|
||||
|
||||
_base = dict.get("base", 0);
|
||||
_bonus = dict.get("bonus", 0);
|
||||
@ -550,8 +407,9 @@ void Stat::_from_dict(const Dictionary &dict) {
|
||||
for (int i = 0; i < modifiers.size(); ++i) {
|
||||
Ref<StatModifier> sm;
|
||||
sm.instance();
|
||||
|
||||
|
||||
sm->from_dict(modifiers.get(i, Dictionary()));
|
||||
sm->set_owner(this);
|
||||
|
||||
_modifiers.push_back(sm);
|
||||
}
|
||||
@ -562,6 +420,9 @@ Stat::Stat() {
|
||||
|
||||
_modifier_apply_type = MODIFIER_APPLY_TYPE_STANDARD;
|
||||
|
||||
_public = false;
|
||||
_dirty_mods = false;
|
||||
|
||||
_locked = false;
|
||||
_dirty = true;
|
||||
|
||||
@ -581,6 +442,9 @@ Stat::Stat(Stat::StatId id) {
|
||||
|
||||
_modifier_apply_type = MODIFIER_APPLY_TYPE_STANDARD;
|
||||
|
||||
_public = false;
|
||||
_dirty_mods = false;
|
||||
|
||||
_locked = false;
|
||||
_dirty = true;
|
||||
|
||||
@ -600,6 +464,9 @@ Stat::Stat(Stat::StatId id, StatModifierApplyType modifier_apply_type) {
|
||||
|
||||
_modifier_apply_type = modifier_apply_type;
|
||||
|
||||
_public = false;
|
||||
_dirty_mods = false;
|
||||
|
||||
_locked = false;
|
||||
_dirty = true;
|
||||
|
||||
@ -614,44 +481,6 @@ Stat::Stat(Stat::StatId id, StatModifierApplyType modifier_apply_type) {
|
||||
_c_max = 0;
|
||||
}
|
||||
|
||||
//Stat
|
||||
Stat::Stat(Stat::StatId id, StatModifierApplyType modifier_apply_type, float base, float bonus, float percent) {
|
||||
_id = id;
|
||||
|
||||
_modifier_apply_type = modifier_apply_type;
|
||||
|
||||
_locked = false;
|
||||
_dirty = true;
|
||||
|
||||
_base = base;
|
||||
_bonus = bonus;
|
||||
_percent = percent;
|
||||
|
||||
_s_current = 0;
|
||||
_s_max = 0;
|
||||
|
||||
_c_current = 0;
|
||||
_c_max = 0;
|
||||
}
|
||||
|
||||
Stat::Stat(Stat::StatId id, StatModifierApplyType modifier_apply_type, float base) {
|
||||
_id = id;
|
||||
|
||||
_modifier_apply_type = modifier_apply_type;
|
||||
|
||||
_locked = false;
|
||||
_dirty = true;
|
||||
|
||||
_base = base;
|
||||
_bonus = 0;
|
||||
_percent = 100;
|
||||
|
||||
_s_current = 0;
|
||||
_s_max = 0;
|
||||
|
||||
_c_current = 0;
|
||||
_c_max = 0;
|
||||
}
|
||||
|
||||
Stat::~Stat() {
|
||||
_modifiers.clear();
|
||||
@ -663,12 +492,16 @@ void Stat::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_id"), &Stat::get_id);
|
||||
ClassDB::bind_method(D_METHOD("set_id", "id"), &Stat::set_id);
|
||||
//ADD_PROPERTY(PropertyInfo(Variant::INT, "id", PROPERTY_HINT_ENUM, STAT_BINDING_STRING), "set_id", "get_id");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "id", PROPERTY_HINT_ENUM, STAT_BINDING_STRING), "set_id", "get_id");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_stat_modifier_type"), &Stat::get_stat_modifier_type);
|
||||
ClassDB::bind_method(D_METHOD("set_stat_modifier_type", "value"), &Stat::set_stat_modifier_type);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "stat_type", PROPERTY_HINT_ENUM, "Standard, Min Modifier, Max modifier"), "set_stat_modifier_type", "get_stat_modifier_type");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_public"), &Stat::get_public);
|
||||
ClassDB::bind_method(D_METHOD("set_public", "value"), &Stat::set_public);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "public"), "set_public", "get_public");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_locked"), &Stat::get_locked);
|
||||
ClassDB::bind_method(D_METHOD("set_locked", "value"), &Stat::set_locked);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "locked"), "set_locked", "get_locked");
|
||||
@ -677,14 +510,18 @@ void Stat::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_dirty", "value"), &Stat::set_dirty);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "is_dirty"), "set_dirty", "get_dirty");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_dirty_mods"), &Stat::get_dirty_mods);
|
||||
ClassDB::bind_method(D_METHOD("set_dirty_mods", "value"), &Stat::set_dirty_mods);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "dirty_mods"), "set_dirty_mods", "get_dirty_mods");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_base"), &Stat::get_base);
|
||||
ClassDB::bind_method(D_METHOD("get_bonus"), &Stat::get_bonus);
|
||||
ClassDB::bind_method(D_METHOD("get_percent"), &Stat::get_percent);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("gets_current"), &Stat::gets_current);
|
||||
ClassDB::bind_method(D_METHOD("sets_current", "value"), &Stat::sets_current);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "scurrent"), "sets_current", "gets_current");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("getc_current"), &Stat::getc_current);
|
||||
ClassDB::bind_method(D_METHOD("setc_current", "value"), &Stat::setc_current);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "ccurrent"), "setc_current", "getc_current");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("gets_max"), &Stat::gets_max);
|
||||
ClassDB::bind_method(D_METHOD("sets_max"), &Stat::sets_max);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "smax"), "sets_max", "gets_max");
|
||||
@ -693,43 +530,28 @@ void Stat::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("setc_max"), &Stat::setc_max);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "cmax"), "setc_max", "getc_max");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_base"), &Stat::get_base);
|
||||
ClassDB::bind_method(D_METHOD("set_base", "value"), &Stat::set_base);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "base"), "set_base", "get_base");
|
||||
ClassDB::bind_method(D_METHOD("getc_current"), &Stat::getc_current);
|
||||
ClassDB::bind_method(D_METHOD("setc_current", "value"), &Stat::setc_current);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "ccurrent"), "setc_current", "getc_current");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_bonus"), &Stat::get_bonus);
|
||||
ClassDB::bind_method(D_METHOD("set_bonus", "value"), &Stat::set_bonus);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "bonus"), "set_bonus", "get_bonus");
|
||||
ClassDB::bind_method(D_METHOD("setc_values", "ccurrent", "cmax"), &Stat::setc_values);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_percent"), &Stat::get_percent);
|
||||
ClassDB::bind_method(D_METHOD("set_percent", "value"), &Stat::set_percent);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "percent"), "set_percent", "get_percent");
|
||||
ClassDB::bind_method(D_METHOD("add_modifier", "id", "base_mod", "bonus_mod", "percent_mod"), &Stat::add_modifier);
|
||||
ClassDB::bind_method(D_METHOD("remove_modifier", "id"), &Stat::remove_modifier);
|
||||
ClassDB::bind_method(D_METHOD("get_modifier_count"), &Stat::get_modifier_count);
|
||||
ClassDB::bind_method(D_METHOD("clear_modifiers"), &Stat::clear_modifiers);
|
||||
ClassDB::bind_method(D_METHOD("get_modifier", "index"), &Stat::get_modifier);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("apply_modifiers"), &Stat::apply_modifiers);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("reset_values"), &Stat::reset_values);
|
||||
ClassDB::bind_method(D_METHOD("recalculate"), &Stat::recalculate);
|
||||
ClassDB::bind_method(D_METHOD("refresh_currmax"), &Stat::refresh_currmax);
|
||||
ClassDB::bind_method(D_METHOD("iss_current_zero"), &Stat::iss_current_zero);
|
||||
ClassDB::bind_method(D_METHOD("isc_current_zero"), &Stat::isc_current_zero);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_from_stat", "stat"), &Stat::set_from_stat);
|
||||
|
||||
//ClassDB::bind_method(D_METHOD("set", "current", "max", "modCurrent", "modMax", "modPercent", "nomodCurrent", "nomodMax", "nomodPercent"), &Stat::set);
|
||||
//ClassDB::bind_method(D_METHOD("set_from_stat", "stat"), &Stat::set_from_stat);
|
||||
//ClassDB::bind_method(D_METHOD("copy_values_from", "stat"), &Stat::copy_values_from);
|
||||
ClassDB::bind_method(D_METHOD("set_to_max"), &Stat::set_to_max);
|
||||
ClassDB::bind_method(D_METHOD("set_values", "current", "base", "percent"), &Stat::set_values);
|
||||
|
||||
//ClassDB::bind_method(D_METHOD("apply_modifier", "modifier"), &Stat::apply_modifier);
|
||||
//ClassDB::bind_method(D_METHOD("de_apply_modifier", "modifier"), &Stat::de_apply_modifier);
|
||||
ClassDB::bind_method(D_METHOD("re_apply_modifier_not_negative_stacking_percents"), &Stat::re_apply_modifier_not_negative_stacking_percents);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("add_modifier", "id", "base_mod", "bonus_mod", "percent_mod", "apply"), &Stat::add_modifier);
|
||||
ClassDB::bind_method(D_METHOD("remove_modifier", "id", "apply"), &Stat::remove_modifier);
|
||||
ClassDB::bind_method(D_METHOD("re_apply_modifiers"), &Stat::re_apply_modifiers);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_dependency", "stat", "curve"), &Stat::set_dependency);
|
||||
ClassDB::bind_method(D_METHOD("remove_dependencies"), &Stat::remove_dependencies);
|
||||
|
||||
//ClassDB::bind_method(D_METHOD("stat_id_name", "stat_id"), &Stat::stat_id_name);
|
||||
ClassDB::bind_method(D_METHOD("modifier_changed", "modifier"), &Stat::modifier_changed);
|
||||
|
||||
//Serialization
|
||||
BIND_VMETHOD(MethodInfo("_from_dict", PropertyInfo(Variant::DICTIONARY, "dict")));
|
||||
|
@ -99,31 +99,27 @@ public:
|
||||
static String stat_id_name(int stat_id);
|
||||
|
||||
public:
|
||||
Stat();
|
||||
Stat(Stat::StatId id);
|
||||
Stat(Stat::StatId id, StatModifierApplyType modifier_apply_type);
|
||||
Stat(Stat::StatId id, StatModifierApplyType modifier_apply_type, float base, float bonus, float percent);
|
||||
Stat(Stat::StatId id, StatModifierApplyType modifier_apply_type, float base);
|
||||
~Stat();
|
||||
|
||||
Stat::StatId get_id();
|
||||
void set_id(Stat::StatId id);
|
||||
|
||||
StatModifierApplyType get_stat_modifier_type();
|
||||
void set_stat_modifier_type(StatModifierApplyType value);
|
||||
|
||||
bool get_public();
|
||||
void set_public(bool value);
|
||||
|
||||
bool get_locked();
|
||||
void set_locked(bool value);
|
||||
|
||||
bool get_dirty();
|
||||
void set_dirty(bool value);
|
||||
|
||||
bool get_dirty_mods();
|
||||
void set_dirty_mods(bool value);
|
||||
|
||||
float get_base();
|
||||
void set_base(float value);
|
||||
float get_bonus();
|
||||
void set_bonus(float value);
|
||||
float get_percent();
|
||||
void set_percent(float value);
|
||||
|
||||
float gets_current();
|
||||
void sets_current(float value);
|
||||
@ -135,31 +131,25 @@ public:
|
||||
float getc_max();
|
||||
void setc_max(float value);
|
||||
|
||||
void reset_values();
|
||||
void recalculate();
|
||||
bool iss_current_zero();
|
||||
bool isc_current_zero();
|
||||
void set(float current, float max, float base, float bonus, float percent);
|
||||
void set_from_stat(Ref<Stat> other);
|
||||
|
||||
void set_to_max();
|
||||
void set_values(float current, float base, float percent);
|
||||
|
||||
void apply_modifier(Ref<StatModifier> modifier);
|
||||
void de_apply_modifier(Ref<StatModifier> modifier);
|
||||
void re_apply_modifier_not_negative_stacking_percents();
|
||||
void setc_values(int ccurrent, int cmax);
|
||||
|
||||
Vector<Ref<StatModifier> > *get_modifiers();
|
||||
void add_modifier(int id, float base_mod, float bonus_mod, float percent_mod, bool apply = true);
|
||||
void remove_modifier(int id, bool apply = true);
|
||||
void re_apply_modifiers();
|
||||
Ref<StatModifier> add_modifier(int id, float base_mod, float bonus_mod, float percent_mod);
|
||||
void remove_modifier(int id);
|
||||
int get_modifier_count();
|
||||
void clear_modifiers();
|
||||
Ref<StatModifier> get_modifier(int index);
|
||||
|
||||
void set_dependency(Ref<Stat> other, Ref<Curve> curve);
|
||||
void remove_dependencies();
|
||||
void apply_modifiers();
|
||||
|
||||
void send();
|
||||
void reset_values();
|
||||
void refresh_currmax();
|
||||
bool iss_current_zero();
|
||||
bool isc_current_zero();
|
||||
|
||||
void set_to_max();
|
||||
|
||||
void modifier_changed(Ref<StatModifier> modifier);
|
||||
|
||||
Dictionary to_dict();
|
||||
void from_dict(const Dictionary &dict);
|
||||
@ -167,6 +157,11 @@ public:
|
||||
Dictionary _to_dict();
|
||||
void _from_dict(const Dictionary &dict);
|
||||
|
||||
Stat();
|
||||
Stat(Stat::StatId id);
|
||||
Stat(Stat::StatId id, StatModifierApplyType modifier_apply_type);
|
||||
~Stat();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
@ -177,8 +172,10 @@ private:
|
||||
|
||||
Vector<Ref<StatModifier> > _modifiers;
|
||||
|
||||
bool _public;
|
||||
bool _locked;
|
||||
bool _dirty;
|
||||
bool _dirty_mods;
|
||||
|
||||
float _base;
|
||||
float _bonus;
|
||||
@ -189,9 +186,6 @@ private:
|
||||
|
||||
float _c_current;
|
||||
float _c_max;
|
||||
|
||||
Ref<Stat> _dependency;
|
||||
Ref<Curve> _dependency_curve;
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(Stat::StatId);
|
||||
|
@ -31,14 +31,16 @@ public:
|
||||
Stat::StatId get_depends_on() { return _depends_on; }
|
||||
void set_depends_on(Stat::StatId value) { _depends_on = value; }
|
||||
|
||||
Ref<LevelStatData> get_dependdency_curve() { return _dependdency_curve; }
|
||||
void set_dependdency_curve(Ref<LevelStatData> curve) { _dependdency_curve = curve; }
|
||||
Ref<Curve> get_dependdency_curve() { return _dependdency_curve; }
|
||||
void set_dependdency_curve(Ref<Curve> curve) { _dependdency_curve = curve; }
|
||||
|
||||
|
||||
void get_stats_for_stat(Ref<Stat> stat) {
|
||||
stat->set_stat_modifier_type(get_modifier_apply_type());
|
||||
stat->set_values(get_base(), get_bonus(), get_percent());
|
||||
stat->set_stat_modifier_type(get_modifier_apply_type());
|
||||
|
||||
stat->clear_modifiers();
|
||||
|
||||
stat->add_modifier(0, get_base(), get_bonus(), get_percent());
|
||||
|
||||
stat->set_to_max();
|
||||
}
|
||||
|
@ -1,5 +1,55 @@
|
||||
#include "stat_modifier.h"
|
||||
|
||||
#include "stat.h"
|
||||
|
||||
Ref<Stat> StatModifier::get_owner() {
|
||||
return Ref<Stat>(_owner);
|
||||
}
|
||||
void StatModifier::set_owner(Ref<Stat> stat) {
|
||||
_owner = stat.ptr();
|
||||
}
|
||||
|
||||
int StatModifier::get_id() {
|
||||
return _id;
|
||||
}
|
||||
void StatModifier::set_id(int value) {
|
||||
_id = value;
|
||||
}
|
||||
|
||||
float StatModifier::get_base_mod() {
|
||||
return _base_mod;
|
||||
}
|
||||
void StatModifier::set_base_mod(float value) {
|
||||
_base_mod = value;
|
||||
|
||||
if (_owner) {
|
||||
_owner->modifier_changed(Ref<StatModifier>(this));
|
||||
}
|
||||
}
|
||||
|
||||
float StatModifier::get_bonus_mod() {
|
||||
return _bonus_mod;
|
||||
}
|
||||
void StatModifier::set_bonus_mod(float value) {
|
||||
_bonus_mod = value;
|
||||
|
||||
if (_owner) {
|
||||
_owner->modifier_changed(Ref<StatModifier>(this));
|
||||
}
|
||||
}
|
||||
|
||||
float StatModifier::get_percent_mod() {
|
||||
return _percent_mod;
|
||||
}
|
||||
void StatModifier::set_percent_mod(float value) {
|
||||
_percent_mod = value;
|
||||
|
||||
if (_owner) {
|
||||
_owner->modifier_changed(Ref<StatModifier>(this));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Dictionary StatModifier::to_dict() {
|
||||
return call("_to_dict");
|
||||
}
|
||||
@ -21,6 +71,24 @@ void StatModifier::_from_dict(const Dictionary &dict) {
|
||||
ERR_FAIL_COND(dict.empty());
|
||||
}
|
||||
|
||||
StatModifier::StatModifier() {
|
||||
_id = 0;
|
||||
_base_mod = 0;
|
||||
_bonus_mod = 0;
|
||||
_percent_mod = 0;
|
||||
|
||||
_owner = NULL;
|
||||
}
|
||||
|
||||
StatModifier::StatModifier(int i, float base_mod, float bonus_mod, float percent_mod, Stat *owner) {
|
||||
_id = i;
|
||||
_base_mod = base_mod;
|
||||
_bonus_mod = bonus_mod;
|
||||
_percent_mod = percent_mod;
|
||||
|
||||
_owner = owner;
|
||||
}
|
||||
|
||||
void StatModifier::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_id"), &StatModifier::get_id);
|
||||
ClassDB::bind_method(D_METHOD("set_id", "value"), &StatModifier::set_id);
|
||||
|
@ -3,35 +3,30 @@
|
||||
|
||||
#include "core/reference.h"
|
||||
|
||||
class Stat;
|
||||
|
||||
class StatModifier : public Reference {
|
||||
GDCLASS(StatModifier, Reference);
|
||||
|
||||
public:
|
||||
StatModifier() {
|
||||
_id = 0;
|
||||
_base_mod = 0;
|
||||
_bonus_mod = 0;
|
||||
_percent_mod = 0;
|
||||
}
|
||||
StatModifier();
|
||||
|
||||
StatModifier(int i, float base_mod, float bonus_mod, float percent_mod) {
|
||||
_id = i;
|
||||
_base_mod = base_mod;
|
||||
_bonus_mod = bonus_mod;
|
||||
_percent_mod = percent_mod;
|
||||
}
|
||||
StatModifier(int i, float base_mod, float bonus_mod, float percent_mod, Stat *owner);
|
||||
|
||||
int get_id() { return _id; }
|
||||
void set_id(int value) { _id = value; }
|
||||
Ref<Stat> get_owner();
|
||||
void set_owner(Ref<Stat> stat);
|
||||
|
||||
int get_id();
|
||||
void set_id(int value);
|
||||
|
||||
float get_base_mod() { return _base_mod; }
|
||||
void set_base_mod(float value) { _base_mod = value; }
|
||||
float get_base_mod();
|
||||
void set_base_mod(float value);
|
||||
|
||||
float get_bonus_mod() { return _bonus_mod; }
|
||||
void set_bonus_mod(float value) { _bonus_mod = value; }
|
||||
float get_bonus_mod();
|
||||
void set_bonus_mod(float value);
|
||||
|
||||
float get_percent_mod() { return _percent_mod; }
|
||||
void set_percent_mod(float value) { _percent_mod = value; }
|
||||
float get_percent_mod();
|
||||
void set_percent_mod(float value);
|
||||
|
||||
Dictionary to_dict();
|
||||
void from_dict(const Dictionary &dict);
|
||||
@ -47,6 +42,8 @@ private:
|
||||
float _base_mod;
|
||||
float _bonus_mod;
|
||||
float _percent_mod;
|
||||
|
||||
Stat *_owner;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user