add context_dir
This commit is contained in:
parent
5d5837abb2
commit
7d50b5df6f
@ -78,7 +78,9 @@ void Buff::ProcIntervalAddBuff()
|
|||||||
void Buff::ProcBatchAddBuff()
|
void Buff::ProcBatchAddBuff()
|
||||||
{
|
{
|
||||||
std::shared_ptr<Ability> old_context_ability = owner->context_ability;
|
std::shared_ptr<Ability> old_context_ability = owner->context_ability;
|
||||||
|
a8::Vec2 old_context_dir = owner->context_dir;
|
||||||
a8::Vec2 old_context_pos = owner->context_pos;
|
a8::Vec2 old_context_pos = owner->context_pos;
|
||||||
|
owner->context_dir = owner->GetAttackDir()();
|
||||||
owner->context_pos = owner->GetPos();
|
owner->context_pos = owner->GetPos();
|
||||||
|
|
||||||
for (auto& tuple : meta->batch_add_list) {
|
for (auto& tuple : meta->batch_add_list) {
|
||||||
@ -112,6 +114,7 @@ void Buff::ProcBatchAddBuff()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
owner->context_dir = old_context_dir;
|
||||||
owner->context_pos = old_context_pos;
|
owner->context_pos = old_context_pos;
|
||||||
owner->context_ability = old_context_ability;
|
owner->context_ability = old_context_ability;
|
||||||
}
|
}
|
||||||
@ -128,7 +131,9 @@ void Buff::InternalTimerAddBuff()
|
|||||||
SkillCasterState* caster_state = (SkillCasterState*)param.param1.GetUserData();
|
SkillCasterState* caster_state = (SkillCasterState*)param.param1.GetUserData();
|
||||||
if (caster_state->caster.Get()) {
|
if (caster_state->caster.Get()) {
|
||||||
std::shared_ptr<Ability> old_context_ability = receiver->context_ability;
|
std::shared_ptr<Ability> old_context_ability = receiver->context_ability;
|
||||||
|
a8::Vec2 old_context_dir = receiver->context_dir;
|
||||||
a8::Vec2 old_context_pos = receiver->context_pos;
|
a8::Vec2 old_context_pos = receiver->context_pos;
|
||||||
|
receiver->context_dir = receiver->GetAttackDir();
|
||||||
receiver->context_pos = receiver->GetPos();
|
receiver->context_pos = receiver->GetPos();
|
||||||
|
|
||||||
int buff_id = param.param2;
|
int buff_id = param.param2;
|
||||||
@ -142,6 +147,7 @@ void Buff::InternalTimerAddBuff()
|
|||||||
caster_state->caster.Get()->RecoverSkillCasterState(&old_caster_state);
|
caster_state->caster.Get()->RecoverSkillCasterState(&old_caster_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
receiver->context_dir = old_context_dir;
|
||||||
receiver->context_pos = old_context_pos;
|
receiver->context_pos = old_context_pos;
|
||||||
receiver->context_ability = old_context_ability;
|
receiver->context_ability = old_context_ability;
|
||||||
}
|
}
|
||||||
|
@ -531,7 +531,9 @@ void Bullet::AddGunBuff()
|
|||||||
{
|
{
|
||||||
if (sender.Get()) {
|
if (sender.Get()) {
|
||||||
std::shared_ptr<Ability> old_context_ability = sender.Get()->context_ability;
|
std::shared_ptr<Ability> old_context_ability = sender.Get()->context_ability;
|
||||||
|
a8::Vec2 old_context_dir = sender.Get()->context_dir;
|
||||||
a8::Vec2 old_context_pos = sender.Get()->context_pos;
|
a8::Vec2 old_context_pos = sender.Get()->context_pos;
|
||||||
|
sender.Get()->context_dir = dir;
|
||||||
sender.Get()->context_pos = GetPos();
|
sender.Get()->context_pos = GetPos();
|
||||||
if (IsCurrWeapon()) {
|
if (IsCurrWeapon()) {
|
||||||
sender.Get()->context_ability = ability_;
|
sender.Get()->context_ability = ability_;
|
||||||
@ -545,6 +547,7 @@ void Bullet::AddGunBuff()
|
|||||||
1
|
1
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
sender.Get()->context_dir = old_context_dir;
|
||||||
sender.Get()->context_pos = old_context_pos;
|
sender.Get()->context_pos = old_context_pos;
|
||||||
sender.Get()->context_ability = old_context_ability;
|
sender.Get()->context_ability = old_context_ability;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,9 @@ void InternalShot(Creature* c,
|
|||||||
{
|
{
|
||||||
if (weapon_meta->i->_inventory_slot() == IS_TRAP ||
|
if (weapon_meta->i->_inventory_slot() == IS_TRAP ||
|
||||||
weapon_meta->i->_inventory_slot() == IS_MINE) {
|
weapon_meta->i->_inventory_slot() == IS_MINE) {
|
||||||
|
a8::Vec2 old_context_dir = c->context_dir;
|
||||||
a8::Vec2 old_context_pos = c->context_pos;
|
a8::Vec2 old_context_pos = c->context_pos;
|
||||||
|
c->context_dir =c->GetAttackDir();
|
||||||
c->context_pos = c->GetPos() + c->GetAttackDir() * fly_distance;
|
c->context_pos = c->GetPos() + c->GetAttackDir() * fly_distance;
|
||||||
MetaData::Buff * buff_meta = MetaMgr::Instance()->GetBuff(bullet_meta->i->buffid());
|
MetaData::Buff * buff_meta = MetaMgr::Instance()->GetBuff(bullet_meta->i->buffid());
|
||||||
if (buff_meta) {
|
if (buff_meta) {
|
||||||
@ -111,6 +113,7 @@ void InternalShot(Creature* c,
|
|||||||
1
|
1
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
c->context_dir = old_context_dir;
|
||||||
c->context_pos = old_context_pos;
|
c->context_pos = old_context_pos;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -747,6 +750,7 @@ void Creature::DoSkill(int skill_id,
|
|||||||
skill_distance_ = skill_distance;
|
skill_distance_ = skill_distance;
|
||||||
curr_skill_ = skill;
|
curr_skill_ = skill;
|
||||||
playing_skill = true;
|
playing_skill = true;
|
||||||
|
context_dir = skill_dir_;
|
||||||
context_pos = GetPos() + skill_dir_ * skill_distance_;
|
context_pos = GetPos() + skill_dir_ * skill_distance_;
|
||||||
CurrentSkill()->last_use_frameno = room->GetFrameNo();
|
CurrentSkill()->last_use_frameno = room->GetFrameNo();
|
||||||
if (CurrentSkill()->meta->i->skill_target() == kST_Self
|
if (CurrentSkill()->meta->i->skill_target() == kST_Self
|
||||||
|
@ -69,6 +69,7 @@ class Creature : public MoveableEntity
|
|||||||
|
|
||||||
Weapon second_weapon;
|
Weapon second_weapon;
|
||||||
a8::Vec2 context_pos;
|
a8::Vec2 context_pos;
|
||||||
|
a8::Vec2 context_dir;
|
||||||
std::shared_ptr<Ability> context_ability;
|
std::shared_ptr<Ability> context_ability;
|
||||||
|
|
||||||
bool need_sync_active_player = false;
|
bool need_sync_active_player = false;
|
||||||
|
@ -764,12 +764,15 @@ std::tuple<long long, a8::Vec2>* Obstacle::GetInteractionData(Human* sender)
|
|||||||
|
|
||||||
void Obstacle::AddObstacleBuff(Creature* c)
|
void Obstacle::AddObstacleBuff(Creature* c)
|
||||||
{
|
{
|
||||||
|
a8::Vec2 old_context_dir = c->context_dir;
|
||||||
a8::Vec2 old_context_pos = c->context_pos;
|
a8::Vec2 old_context_pos = c->context_pos;
|
||||||
|
c->context_dir = c->GetAttackDir();
|
||||||
c->context_pos = c->GetPos();
|
c->context_pos = c->GetPos();
|
||||||
for (int buff_id : meta->buff_list) {
|
for (int buff_id : meta->buff_list) {
|
||||||
c->TryAddBuff(c, buff_id);
|
c->TryAddBuff(c, buff_id);
|
||||||
}
|
}
|
||||||
c->context_pos = old_context_pos;
|
c->context_pos = old_context_pos;
|
||||||
|
c->context_dir = old_context_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Obstacle::ClearObstacleBuff(Creature* c)
|
void Obstacle::ClearObstacleBuff(Creature* c)
|
||||||
|
@ -219,7 +219,9 @@ void Trigger::TraverseCondBuffs(int cond, std::function<void (Buff*, bool&)> fun
|
|||||||
void Trigger::TriggeCondBuffAll(int cond)
|
void Trigger::TriggeCondBuffAll(int cond)
|
||||||
{
|
{
|
||||||
std::shared_ptr<Ability> old_context_ability = owner_->context_ability;
|
std::shared_ptr<Ability> old_context_ability = owner_->context_ability;
|
||||||
|
a8::Vec2 old_context_dir = owner_->context_dir;
|
||||||
a8::Vec2 old_context_pos = owner_->context_pos;
|
a8::Vec2 old_context_pos = owner_->context_pos;
|
||||||
|
owner_->context_dir = owner_->GetAttackDir();
|
||||||
owner_->context_pos = owner_->GetPos();
|
owner_->context_pos = owner_->GetPos();
|
||||||
TraverseCondBuffs
|
TraverseCondBuffs
|
||||||
(cond,
|
(cond,
|
||||||
@ -227,6 +229,7 @@ void Trigger::TriggeCondBuffAll(int cond)
|
|||||||
{
|
{
|
||||||
AddBuffs(cond, buff->meta->param4_int_list);
|
AddBuffs(cond, buff->meta->param4_int_list);
|
||||||
});
|
});
|
||||||
|
owner_->context_dir = old_context_dir;
|
||||||
owner_->context_pos = old_context_pos;
|
owner_->context_pos = old_context_pos;
|
||||||
owner_->context_ability = old_context_ability;
|
owner_->context_ability = old_context_ability;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user