This commit is contained in:
aozhiwei 2023-06-19 17:54:30 +08:00
parent 1218520980
commit 93bb206c07
4 changed files with 28 additions and 8 deletions

View File

@ -51,6 +51,7 @@ class Car : public Creature
bool IsSingle(); bool IsSingle();
bool CanOn(Human* hum); bool CanOn(Human* hum);
void SetSpecialOperators(std::set<int>& special_operators); void SetSpecialOperators(std::set<int>& special_operators);
std::set<int>& GetSpecialOperators() { return special_operators_; };
private: private:
int AllocSeat(); int AllocSeat();

View File

@ -114,13 +114,18 @@ public:
}); });
RegisterCProc RegisterCProc
( (
"caster.get_hero_atk", "myself.get_init_max_hp",
[this] (const a8::lisp::List& params) -> std::shared_ptr<a8::lisp::Value> [this] (const a8::lisp::List& params) -> std::shared_ptr<a8::lisp::Value>
{ {
double result = 0.0f; double result = context_.buff->owner->GetBattleContext()->GetMaxHP();
if (context_.buff->GetCaster().Get()) { return std::make_shared<a8::lisp::Value>(a8::lisp::Atom(result));
result = context_.buff->GetCaster().Get()->GetBattleContext()->GetHeroTotalAtk(); });
} RegisterCProc
(
"myself.get_uniid",
[this] (const a8::lisp::List& params) -> std::shared_ptr<a8::lisp::Value>
{
double result = context_.buff->owner->GetUniId();
return std::make_shared<a8::lisp::Value>(a8::lisp::Atom(result)); return std::make_shared<a8::lisp::Value>(a8::lisp::Atom(result));
}); });
RegisterCProc RegisterCProc
@ -224,6 +229,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_hero_atk",
[this] (const a8::lisp::List& params) -> std::shared_ptr<a8::lisp::Value>
{
double result = 0.0f;
if (context_.buff->GetCaster().Get()) {
result = context_.buff->GetCaster().Get()->GetBattleContext()->GetHeroTotalAtk();
}
return std::make_shared<a8::lisp::Value>(a8::lisp::Atom(result));
});
} }
float Eval(std::shared_ptr<a8::lisp::Value> expr, float Eval(std::shared_ptr<a8::lisp::Value> expr,

View File

@ -453,7 +453,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", 36, 0); meta_class = new a8::reflect::Class("Buff", 38, 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_));
@ -490,8 +490,8 @@ namespace mtb
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_)); meta_class->SetSimpleField(35, "tenacity", a8::reflect::ET_INT32, my_offsetof2(Buff, tenacity_));
meta_class->SetSimpleField(36, "buff_param6", a8::reflect::ET_STRING, my_offsetof2(Buff, buff_param7_)); meta_class->SetSimpleField(36, "buff_param7", a8::reflect::ET_STRING, my_offsetof2(Buff, buff_param7_));
meta_class->SetSimpleField(37, "buff_param6", a8::reflect::ET_STRING, my_offsetof2(Buff, buff_param8_)); meta_class->SetSimpleField(37, "buff_param8", a8::reflect::ET_STRING, my_offsetof2(Buff, buff_param8_));
} }
return meta_class; return meta_class;
} }

View File

@ -379,6 +379,9 @@ void Car::FillMFObjectFull(Room* room, Human* hum, cs::MFObjectFull* full_data)
if (GetDriver()) { if (GetDriver()) {
Creature_FillSkillList(this, p->mutable_skill_list()); Creature_FillSkillList(this, p->mutable_skill_list());
} }
for (int op_id : GetSpecialOperators()) {
p->add_special_operators(op_id);
}
} }
void Hero::FillMFObjectPart(Room* room, Human* hum, cs::MFObjectPart* part_data) void Hero::FillMFObjectPart(Room* room, Human* hum, cs::MFObjectPart* part_data)