This commit is contained in:
aozhiwei 2023-03-28 14:48:13 +08:00
parent 5f46eb1289
commit d4c8ce1939
8 changed files with 36 additions and 3 deletions

View File

@ -47,6 +47,7 @@ enum HumanAttrType_e
kHAT_CoolDownPct = 51, kHAT_CoolDownPct = 51,
kHAT_PickUpPct = 52, kHAT_PickUpPct = 52,
kHAT_Shield = 53, kHAT_Shield = 53,
kHAT_Tenacity = 54,
kHAT_End kHAT_End
}; };

View File

@ -912,3 +912,13 @@ float BattleDataContext::GetDrugEfficacyPct()
{ {
return 0.0f; return 0.0f;
} }
float BattleDataContext::GetTenacityPct()
{
return 0.0f;
}
float BattleDataContext::GetRecoverHpAdd()
{
return 0.0f;
}

View File

@ -66,6 +66,8 @@ struct BattleDataContext
float GetRescueTimePct(); float GetRescueTimePct();
float GetDrugTimePct(); float GetDrugTimePct();
float GetDrugEfficacyPct(); float GetDrugEfficacyPct();
float GetTenacityPct();
float GetRecoverHpAdd();
void SetReviveCoin(int num); void SetReviveCoin(int num);
int GetReviveCoin(); int GetReviveCoin();

View File

@ -272,9 +272,13 @@ int Creature::AddBuff(Creature* caster,
list_add_tail(&buff->depend_entry, &depend_effect_[buff->meta->depend_effect()]); list_add_tail(&buff->depend_entry, &depend_effect_[buff->meta->depend_effect()]);
} }
{ {
float dur_time = buff_meta->GetDurationTime(buff.get());
if (buff->meta->tenacity()) {
dur_time *= (1.0f - GetBattleContext()->GetTenacityPct());
}
buff->remover_timer = room->xtimer.SetTimeoutWpEx buff->remover_timer = room->xtimer.SetTimeoutWpEx
( (
buff_meta->GetDurationTime(buff.get()) * SERVER_FRAME_RATE, dur_time * SERVER_FRAME_RATE,
[buff_wp = (std::weak_ptr<Buff>)buff] (int event, const a8::Args* args) [buff_wp = (std::weak_ptr<Buff>)buff] (int event, const a8::Args* args)
{ {
if (a8::TIMER_EXEC_EVENT == event) { if (a8::TIMER_EXEC_EVENT == event) {

View File

@ -110,6 +110,17 @@ public:
} }
return std::make_shared<a8::lisp::Value>(a8::lisp::Atom(result)); return std::make_shared<a8::lisp::Value>(a8::lisp::Atom(result));
}); });
RegisterCProc
(
"caster.get_skill_recover_effect",
[this] (const a8::lisp::List& params) -> std::shared_ptr<a8::lisp::Value>
{
double result = 0.0f;
if (context_.buff->GetCaster().Get()) {
context_.buff->GetCaster().Get()->GetBattleContext()->GetRecoverHpAdd();
}
return std::make_shared<a8::lisp::Value>(a8::lisp::Atom(result));
});
RegisterCProc RegisterCProc
( (
"caster.get_skill_distance", "caster.get_skill_distance",

View File

@ -45,6 +45,7 @@ namespace mtb
int disable_useskill() const { return disable_useskill_; }; int disable_useskill() const { return disable_useskill_; };
const std::string effect_list() const { return effect_list_; }; const std::string effect_list() const { return effect_list_; };
const std::string res_scale() const { return res_scale_; }; const std::string res_scale() const { return res_scale_; };
int tenacity() const { return tenacity_; };
bool has_buff_id() const { return __flags__.test(0);}; bool has_buff_id() const { return __flags__.test(0);};
bool has_name() const { return __flags__.test(1);}; bool has_name() const { return __flags__.test(1);};
@ -81,6 +82,7 @@ namespace mtb
bool has_disable_useskill() const { return __flags__.test(32);}; bool has_disable_useskill() const { return __flags__.test(32);};
bool has_effect_list() const { return __flags__.test(33);}; bool has_effect_list() const { return __flags__.test(33);};
bool has_res_scale() const { return __flags__.test(34);}; bool has_res_scale() const { return __flags__.test(34);};
bool has_tenacity() const { return __flags__.test(35);};
protected: protected:
@ -119,9 +121,10 @@ namespace mtb
int disable_useskill_ = 0; int disable_useskill_ = 0;
std::string effect_list_; std::string effect_list_;
std::string res_scale_; std::string res_scale_;
int tenacity_ = 0;
public: public:
std::bitset<35> __flags__; std::bitset<36> __flags__;
}; };
}; };

View File

@ -445,7 +445,7 @@ namespace mtb
{ {
a8::reflect::Class* meta_class = nullptr; a8::reflect::Class* meta_class = nullptr;
if (!meta_class) { if (!meta_class) {
meta_class = new a8::reflect::Class("Buff", 35, 0); meta_class = new a8::reflect::Class("Buff", 36, 0);
meta_class->SetSimpleField(0, "buff_id", a8::reflect::ET_INT32, my_offsetof2(Buff, buff_id_)); meta_class->SetSimpleField(0, "buff_id", a8::reflect::ET_INT32, my_offsetof2(Buff, buff_id_));
meta_class->SetSimpleField(1, "name", a8::reflect::ET_STRING, my_offsetof2(Buff, name_)); meta_class->SetSimpleField(1, "name", a8::reflect::ET_STRING, my_offsetof2(Buff, name_));
meta_class->SetSimpleField(2, "buff_target", a8::reflect::ET_INT32, my_offsetof2(Buff, buff_target_)); meta_class->SetSimpleField(2, "buff_target", a8::reflect::ET_INT32, my_offsetof2(Buff, buff_target_));
@ -481,6 +481,7 @@ namespace mtb
meta_class->SetSimpleField(32, "disable_useskill", a8::reflect::ET_INT32, my_offsetof2(Buff, disable_useskill_)); meta_class->SetSimpleField(32, "disable_useskill", a8::reflect::ET_INT32, my_offsetof2(Buff, disable_useskill_));
meta_class->SetSimpleField(33, "effect_list", a8::reflect::ET_STRING, my_offsetof2(Buff, effect_list_)); meta_class->SetSimpleField(33, "effect_list", a8::reflect::ET_STRING, my_offsetof2(Buff, effect_list_));
meta_class->SetSimpleField(34, "res_scale", a8::reflect::ET_STRING, my_offsetof2(Buff, res_scale_)); meta_class->SetSimpleField(34, "res_scale", a8::reflect::ET_STRING, my_offsetof2(Buff, res_scale_));
meta_class->SetSimpleField(35, "tenacity", a8::reflect::ET_INT32, my_offsetof2(Buff, tenacity_));
} }
return meta_class; return meta_class;
} }

View File

@ -386,6 +386,7 @@ message Buff
optional int32 disable_useskill = 33; optional int32 disable_useskill = 33;
optional string effect_list = 35; optional string effect_list = 35;
optional string res_scale = 39; optional string res_scale = 39;
optional int32 tenacity = 40;
} }
message Drop message Drop