This commit is contained in:
aozhiwei 2022-10-25 18:19:27 +08:00
parent 59734add35
commit a38c7b3fa6
3 changed files with 51 additions and 4 deletions

View File

@ -1035,8 +1035,11 @@ void Creature::ProcSkillPhase(MetaData::SkillPhase* phase)
a8::Vec2 old_dir = GetMoveDir();
a8::Vec2 old_pos = GetPos();
if (CurrentSkill()->GetMinorType() == SMT_NONE) {
int buff_id = phase->param3.GetInt();
TryAddBuff(this, buff_id);
int buff_id1 = phase->param3_ints.size() > 0 ? phase->param3_ints[0] : 0;
int buff_id2 = phase->param3_ints.size() > 1 ? phase->param3_ints[1] : 0;
int buff_id3 = phase->param3_ints.size() > 2 ? phase->param3_ints[2] : 0;
TryAddBuff(this, buff_id1);
int land_effect_buff_uniid = TryAddBuff(this, buff_id3);
#ifdef DEBUG
a8::XPrintf("old_pos:%f,%f\n", {GetPos().x, GetPos().y});
#endif
@ -1061,15 +1064,17 @@ void Creature::ProcSkillPhase(MetaData::SkillPhase* phase)
#else
phase->param2.GetInt() * 1000,
#endif
[this, pre_pos, pre_dir, buff_id, skill_meta] () {
[this, pre_pos, pre_dir, buff_id1, buff_id2, buff_id3, land_effect_buff_uniid,
skill_meta] () {
a8::Vec2 old_dir = GetMoveDir();
a8::Vec2 old_pos = GetPos();
float distance = GetPos().Distance(pre_pos);
RemoveBuffByUniId(land_effect_buff_uniid);
if (distance > 0.0001f) {
a8::Vec2 new_dir = pre_pos - GetPos();
new_dir.Normalize();
SetMoveDir(new_dir);
TryAddBuff(this, buff_id);
TryAddBuff(this, buff_id2);
_UpdateMove(distance);
}
SetMoveDir(old_dir);
@ -1079,6 +1084,23 @@ void Creature::ProcSkillPhase(MetaData::SkillPhase* phase)
skill_meta);
}
);
room->xtimer.AddDeadLineTimerAndAttach
(
#if 1
skill_meta->number_meta->float_time * 1000,
#else
phase->param2.GetInt() * 1000,
#endif
a8::XParams()
.SetSender(this)
.SetParam1(land_effect_buff_uniid),
[] (const a8::XParams& param)
{
Creature* c = (Creature*)param.sender.GetUserData();
int land_effect_buff_uniid = param.param1;
c->RemoveBuffByUniId(land_effect_buff_uniid);
},
&xtimer_attacher.timer_list_);
}
SetMoveDir(old_dir);
}

View File

@ -1001,6 +1001,27 @@ namespace MetaData
phase.param1 = a8::XValue(phase.param1_str);
phase.param2 = a8::XValue(phase.param2_str);
phase.param3 = a8::XValue(phase.param3_str);
{
std::vector<std::string> strings;
a8::Split(phase.param1_str, strings, '|');
for (auto& str : strings) {
phase.param1_ints.push_back(a8::XValue(str));
}
}
{
std::vector<std::string> strings;
a8::Split(phase.param2_str, strings, '|');
for (auto& str : strings) {
phase.param2_ints.push_back(a8::XValue(str));
}
}
{
std::vector<std::string> strings;
a8::Split(phase.param3_str, strings, '|');
for (auto& str : strings) {
phase.param3_ints.push_back(a8::XValue(str));
}
}
phases.push_back(phase);
}
}

View File

@ -303,6 +303,10 @@ namespace MetaData
std::string param1_str;
std::string param2_str;
std::string param3_str;
std::vector<int> param1_ints;
std::vector<int> param2_ints;
std::vector<int> param3_ints;
};
struct Skill