1
This commit is contained in:
parent
1bb875aa01
commit
b712fd0edc
@ -415,8 +415,28 @@ void Buff::ProcTurnOver(Creature* caster)
|
|||||||
//穿墙
|
//穿墙
|
||||||
} else {
|
} else {
|
||||||
owner->_UpdateMove(distance);
|
owner->_UpdateMove(distance);
|
||||||
if (!meta->param2_int_list.empty()) {
|
}
|
||||||
|
if (!meta->param2_int_list.empty()) {
|
||||||
|
int time = 0;
|
||||||
|
float moved_distance = owner->GetPos().Distance(old_pos);
|
||||||
|
if (std::abs(moved_distance) > 0.01f) {
|
||||||
|
time = ((moved_distance / distance) * meta->param3) / FRAME_RATE_MS;
|
||||||
}
|
}
|
||||||
|
owner->room->xtimer.AddDeadLineTimerAndAttach
|
||||||
|
(
|
||||||
|
time,
|
||||||
|
a8::XParams()
|
||||||
|
.SetSender(owner)
|
||||||
|
.SetParam1(meta),
|
||||||
|
[] (const a8::XParams& param)
|
||||||
|
{
|
||||||
|
Creature* c = (Creature*)param.sender.GetUserData();
|
||||||
|
MetaData::Buff* buff_meta = (MetaData::Buff*)param.param1.GetUserData();
|
||||||
|
for (int buff_id : buff_meta->param2_int_list) {
|
||||||
|
c->TryAddBuff(c, buff_id);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
&owner->xtimer_attacher.timer_list_
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1796,3 +1796,17 @@ void Creature::AddHp(float hp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Creature::TryMove(const a8::Vec2& target_pos, a8::Vec2& out_pos)
|
||||||
|
{
|
||||||
|
bool move_ok = false;
|
||||||
|
a8::Vec2 old_pos = GetPos();
|
||||||
|
out_pos = GetPos();
|
||||||
|
|
||||||
|
SetPos(target_pos);
|
||||||
|
if (CollisonDetection()) {
|
||||||
|
out_pos = target_pos;
|
||||||
|
move_ok = true;
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
return move_ok;
|
||||||
|
}
|
||||||
|
@ -174,6 +174,7 @@ class Creature : public MoveableEntity
|
|||||||
float GetHP();
|
float GetHP();
|
||||||
float GetMaxHP();
|
float GetMaxHP();
|
||||||
void GetHitEnemys(std::set<Creature*>& enemys);
|
void GetHitEnemys(std::set<Creature*>& enemys);
|
||||||
|
bool TryMove(const a8::Vec2& target_pos, a8::Vec2& out_pos);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user