This commit is contained in:
aozhiwei 2022-09-27 15:01:59 +08:00
parent dd8d08fbff
commit 8a17ecec4b
6 changed files with 32 additions and 6 deletions

View File

@ -491,6 +491,9 @@ float BattleDataContext::CalcDmg(Creature* target, Bullet* bullet)
{ {
float total_atk = GetTotalAtk(bullet); float total_atk = GetTotalAtk(bullet);
float normal_dmg = total_atk * (1 - target->GetBattleContext()->GetDef() / 1000); float normal_dmg = total_atk * (1 - target->GetBattleContext()->GetDef() / 1000);
if (bullet->strengthen_wall) {
normal_dmg *= 1.2f;
}
float crit = IsCrit(bullet) ? GetCritRate(bullet) : 0; float crit = IsCrit(bullet) ? GetCritRate(bullet) : 0;
float dodge = IsDodge(bullet) ? GetDodgeRuduce(bullet) : 0; float dodge = IsDodge(bullet) ? GetDodgeRuduce(bullet) : 0;
float finaly_dmg = normal_dmg * (1.0f + crit + dodge); float finaly_dmg = normal_dmg * (1.0f + crit + dodge);

View File

@ -85,6 +85,7 @@ void Bullet::OnHit(std::set<Entity*>& objects)
} else { } else {
for (auto& target : objects) { for (auto& target : objects) {
bool old_is_dead = target->IsDead(room); bool old_is_dead = target->IsDead(room);
TriggerHitBuff(target);
target->OnBulletHit(this); target->OnBulletHit(this);
if (target->IsDead(room) && !old_is_dead) { if (target->IsDead(room) && !old_is_dead) {
OnKillTarget(target); OnKillTarget(target);
@ -837,3 +838,20 @@ void Bullet::ForceRemove()
later_removed_ = true; later_removed_ = true;
} }
} }
void Bullet::TriggerHitBuff(Entity* e)
{
if (!e->IsDead(room) && e->IsCreature(room)) {
Creature* c = (Creature*)e;
for (int buff_id : gun_meta->hit_buff_list) {
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id);
if (buff_meta) {
c->AddBuff(
sender.Get(),
buff_meta,
skill_meta
);
}
}
}
}

View File

@ -33,6 +33,7 @@ class Bullet : public MoveableEntity
float fly_distance = 0.0f; float fly_distance = 0.0f;
MovementComponent* movement = nullptr; MovementComponent* movement = nullptr;
int trace_target_id = 0; int trace_target_id = 0;
int strengthen_wall = 0;
virtual ~Bullet() override; virtual ~Bullet() override;
virtual void Initialize() override; virtual void Initialize() override;
@ -45,6 +46,7 @@ class Bullet : public MoveableEntity
bool IsPreBattleBullet(); bool IsPreBattleBullet();
void ForceRemove(); void ForceRemove();
void OnHit(std::set<Entity*>& objects); void OnHit(std::set<Entity*>& objects);
void TriggerHitBuff(Entity* e);
protected: protected:
Bullet(); Bullet();

View File

@ -493,7 +493,7 @@ namespace MetaData
std::vector<std::string> strings; std::vector<std::string> strings;
a8::Split(i->hit_buff(), strings, '|'); a8::Split(i->hit_buff(), strings, '|');
for (auto& str : strings) { for (auto& str : strings) {
hit_buff_list.push(a8::XValue(str)); hit_buff_list.push_back(a8::XValue(str));
} }
} }
} }

View File

@ -109,7 +109,7 @@ namespace MetaData
std::vector<std::tuple<int, int, int>> power_charge; std::vector<std::tuple<int, int, int>> power_charge;
MetaData::Buff* buff_meta = nullptr; MetaData::Buff* buff_meta = nullptr;
std::vector<std::tuple<float, int>> car_buff_list; std::vector<std::tuple<float, int>> car_buff_list;
std::vector<int>> hit_buff_list; std::vector<int> hit_buff_list;
int car_active_buff_id = 0; int car_active_buff_id = 0;
int car_deactive_buff_id = 0; int car_deactive_buff_id = 0;
long long special_damage_type = 0; long long special_damage_type = 0;

View File

@ -1153,10 +1153,13 @@ void Player::_CMRequestBulletDmg(f8::MsgHdr& hdr, const cs::CMRequestBulletDmg&
} }
} }
if (!shield) { if (!shield) {
c->DecHP(dmg, bullet->strengthen_wall = msg.strengthen_wall_uniid() ? 1 : 0;
GetUniId(), std::set<Entity*> objects;
GetName(), objects.insert(c);
std::get<1>(tuple)); bullet->OnHit(objects);
#if 0
c->OnBulletHit(bullet);
#endif
} }
} }
#ifdef DEBUG #ifdef DEBUG