rename buff_vec2_param1->context_pos

This commit is contained in:
aozhiwei 2021-06-29 09:15:07 +00:00
parent 84adf74342
commit 80c8f92d37
4 changed files with 12 additions and 12 deletions

View File

@ -448,8 +448,8 @@ 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_buff_vec2_param1 = sender.Get()->buff_vec2_param1; a8::Vec2 old_context_pos = sender.Get()->context_pos;
sender.Get()->buff_vec2_param1 = GetPos(); sender.Get()->context_pos = GetPos();
MetaData::Buff * buff_meta = MetaMgr::Instance()->GetBuff(gun_meta->i->buffid()); MetaData::Buff * buff_meta = MetaMgr::Instance()->GetBuff(gun_meta->i->buffid());
if (buff_meta) { if (buff_meta) {
sender.Get()->AddBuff(sender.Get(), sender.Get()->AddBuff(sender.Get(),
@ -457,7 +457,7 @@ void Bullet::AddGunBuff()
1 1
); );
} }
sender.Get()->buff_vec2_param1 = old_buff_vec2_param1; sender.Get()->context_pos = old_context_pos;
sender.Get()->context_ability = old_context_ability; sender.Get()->context_ability = old_context_ability;
} }
} }

View File

@ -23,8 +23,8 @@ 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_buff_vec2_param1 = c->buff_vec2_param1; a8::Vec2 old_context_pos = c->context_pos;
c->buff_vec2_param1 = 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) {
c->AddBuff(c, c->AddBuff(c,
@ -32,7 +32,7 @@ void InternalShot(Creature* c,
1 1
); );
} }
c->buff_vec2_param1 = old_buff_vec2_param1; c->context_pos = old_context_pos;
return; return;
} }
for (auto& tuple : weapon_meta->bullet_born_offset) { for (auto& tuple : weapon_meta->bullet_born_offset) {
@ -571,7 +571,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;
buff_vec2_param1 = 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
) { ) {
@ -927,7 +927,7 @@ void Creature::ProcBuffEffect(Creature* caster, Buff* buff)
case kBET_SummonObstacle: case kBET_SummonObstacle:
{ {
if (!dead) { if (!dead) {
SummonObstacle(buff, buff->meta->param1, buff_vec2_param1); SummonObstacle(buff, buff->meta->param1, context_pos);
} }
} }
break; break;

View File

@ -69,7 +69,7 @@ class Creature : public MoveableEntity
int power_idx = -1; int power_idx = -1;
Weapon second_weapon; Weapon second_weapon;
a8::Vec2 buff_vec2_param1; a8::Vec2 context_pos;
std::shared_ptr<Ability> context_ability; std::shared_ptr<Ability> context_ability;
bool need_sync_active_player = false; bool need_sync_active_player = false;

View File

@ -764,12 +764,12 @@ std::tuple<long long, a8::Vec2>* Obstacle::GetInteractionData(Human* sender)
void Obstacle::AddObstacleBuff(Creature* c) void Obstacle::AddObstacleBuff(Creature* c)
{ {
a8::Vec2 old_buff_vec2_param1 = c->buff_vec2_param1; a8::Vec2 old_context_pos = c->context_pos;
c->buff_vec2_param1 = 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->buff_vec2_param1 = old_buff_vec2_param1; c->context_pos = old_context_pos;
} }
void Obstacle::ClearObstacleBuff(Creature* c) void Obstacle::ClearObstacleBuff(Creature* c)