diff --git a/server/gameserver/buff.cc b/server/gameserver/buff.cc index 9f32895..5ca2c5a 100644 --- a/server/gameserver/buff.cc +++ b/server/gameserver/buff.cc @@ -78,7 +78,9 @@ void Buff::ProcIntervalAddBuff() void Buff::ProcBatchAddBuff() { std::shared_ptr old_context_ability = owner->context_ability; + a8::Vec2 old_context_dir = owner->context_dir; a8::Vec2 old_context_pos = owner->context_pos; + owner->context_dir = owner->GetAttackDir()(); owner->context_pos = owner->GetPos(); 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_ability = old_context_ability; } @@ -128,7 +131,9 @@ void Buff::InternalTimerAddBuff() SkillCasterState* caster_state = (SkillCasterState*)param.param1.GetUserData(); if (caster_state->caster.Get()) { std::shared_ptr old_context_ability = receiver->context_ability; + a8::Vec2 old_context_dir = receiver->context_dir; a8::Vec2 old_context_pos = receiver->context_pos; + receiver->context_dir = receiver->GetAttackDir(); receiver->context_pos = receiver->GetPos(); int buff_id = param.param2; @@ -142,6 +147,7 @@ void Buff::InternalTimerAddBuff() caster_state->caster.Get()->RecoverSkillCasterState(&old_caster_state); } + receiver->context_dir = old_context_dir; receiver->context_pos = old_context_pos; receiver->context_ability = old_context_ability; } diff --git a/server/gameserver/bullet.cc b/server/gameserver/bullet.cc index f69479c..ac9c471 100644 --- a/server/gameserver/bullet.cc +++ b/server/gameserver/bullet.cc @@ -531,7 +531,9 @@ void Bullet::AddGunBuff() { if (sender.Get()) { std::shared_ptr 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; + sender.Get()->context_dir = dir; sender.Get()->context_pos = GetPos(); if (IsCurrWeapon()) { sender.Get()->context_ability = ability_; @@ -545,6 +547,7 @@ void Bullet::AddGunBuff() 1 ); } + sender.Get()->context_dir = old_context_dir; sender.Get()->context_pos = old_context_pos; sender.Get()->context_ability = old_context_ability; } diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index 9f736d9..04b43e0 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -102,7 +102,9 @@ void InternalShot(Creature* c, { if (weapon_meta->i->_inventory_slot() == IS_TRAP || weapon_meta->i->_inventory_slot() == IS_MINE) { + a8::Vec2 old_context_dir = c->context_dir; a8::Vec2 old_context_pos = c->context_pos; + c->context_dir =c->GetAttackDir(); c->context_pos = c->GetPos() + c->GetAttackDir() * fly_distance; MetaData::Buff * buff_meta = MetaMgr::Instance()->GetBuff(bullet_meta->i->buffid()); if (buff_meta) { @@ -111,6 +113,7 @@ void InternalShot(Creature* c, 1 ); } + c->context_dir = old_context_dir; c->context_pos = old_context_pos; return; } @@ -747,6 +750,7 @@ void Creature::DoSkill(int skill_id, skill_distance_ = skill_distance; curr_skill_ = skill; playing_skill = true; + context_dir = skill_dir_; context_pos = GetPos() + skill_dir_ * skill_distance_; CurrentSkill()->last_use_frameno = room->GetFrameNo(); if (CurrentSkill()->meta->i->skill_target() == kST_Self diff --git a/server/gameserver/creature.h b/server/gameserver/creature.h index 4195fce..864e8ec 100644 --- a/server/gameserver/creature.h +++ b/server/gameserver/creature.h @@ -69,6 +69,7 @@ class Creature : public MoveableEntity Weapon second_weapon; a8::Vec2 context_pos; + a8::Vec2 context_dir; std::shared_ptr context_ability; bool need_sync_active_player = false; diff --git a/server/gameserver/obstacle.cc b/server/gameserver/obstacle.cc index 9bde65f..b27e8af 100644 --- a/server/gameserver/obstacle.cc +++ b/server/gameserver/obstacle.cc @@ -764,12 +764,15 @@ std::tuple* Obstacle::GetInteractionData(Human* sender) void Obstacle::AddObstacleBuff(Creature* c) { + a8::Vec2 old_context_dir = c->context_dir; a8::Vec2 old_context_pos = c->context_pos; + c->context_dir = c->GetAttackDir(); c->context_pos = c->GetPos(); for (int buff_id : meta->buff_list) { c->TryAddBuff(c, buff_id); } c->context_pos = old_context_pos; + c->context_dir = old_context_dir; } void Obstacle::ClearObstacleBuff(Creature* c) diff --git a/server/gameserver/trigger.cc b/server/gameserver/trigger.cc index 5c7de55..96f9e42 100644 --- a/server/gameserver/trigger.cc +++ b/server/gameserver/trigger.cc @@ -219,7 +219,9 @@ void Trigger::TraverseCondBuffs(int cond, std::function fun void Trigger::TriggeCondBuffAll(int cond) { std::shared_ptr old_context_ability = owner_->context_ability; + a8::Vec2 old_context_dir = owner_->context_dir; a8::Vec2 old_context_pos = owner_->context_pos; + owner_->context_dir = owner_->GetAttackDir(); owner_->context_pos = owner_->GetPos(); TraverseCondBuffs (cond, @@ -227,6 +229,7 @@ void Trigger::TriggeCondBuffAll(int cond) { AddBuffs(cond, buff->meta->param4_int_list); }); + owner_->context_dir = old_context_dir; owner_->context_pos = old_context_pos; owner_->context_ability = old_context_ability; }