This commit is contained in:
aozhiwei 2021-04-07 15:46:53 +08:00
parent 52144aacad
commit b4f4b9cdfd
5 changed files with 32 additions and 1 deletions

View File

@ -503,6 +503,9 @@ void Creature::DoSkill(int skill_id,
skill_target_id_ = GetEntityUniId();
}
if (CurrentSkill()->meta->i->skill_target() == kST_SpecDir) {
std::set<Creature*> target_list;
SelectSkillTargets(CurrentSkill(), GetPos(), target_list);
TriggerBuff(CurrentSkill(), target_list, kBTT_UseSkill);
UpdateSkill();
} else {
Entity* entity = room->GetEntityByUniId(skill_target_id_);

View File

@ -264,6 +264,14 @@ void RoomObstacle::Explosion()
}
}
void RoomObstacle::SpecExplosion()
{
++explosion_times_;
if (explosion_times_ >= meta->i->explosion_times()) {
room->xtimer.DeleteTimer(room->xtimer.GetRunningTimer());
}
}
void RoomObstacle::Active()
{
switch (meta->i->thing_type()) {
@ -277,7 +285,18 @@ void RoomObstacle::Active()
[] (const a8::XParams& param)
{
RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData();
obstacle->Explosion();
obstacle->room->xtimer.AddRepeatTimerAndAttach
(
obstacle->meta->i->explosion_interval() / FRAME_RATE_MS,
a8::XParams()
.SetSender(obstacle),
[] (const a8::XParams& param)
{
RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData();
obstacle->SpecExplosion();
},
&obstacle->xtimer_attacher.timer_list_
);
},
&xtimer_attacher.timer_list_
);

View File

@ -24,10 +24,12 @@ class RoomObstacle : public Obstacle
private:
void Explosion();
void SpecExplosion();
protected:
bool temp_through_ = false;
std::set<GridCell*>* grid_list_ = nullptr;
int explosion_times_ = 0;
RoomObstacle();

View File

@ -115,6 +115,11 @@ void Creature::SelectSkillTargets(Skill* skill, const a8::Vec2& target_pos, std:
target_list.insert(this);
}
break;
case kST_SpecDir:
{
target_list.insert(this);
}
break;
default:
break;
}

View File

@ -55,6 +55,8 @@ message MapThing
optional int32 house_id = 13; //id
optional string buff_list = 14;
optional int32 explosion_effect = 15;
optional int32 explosion_interval = 18;
optional int32 explosion_times = 19;
}
message SafeArea