1
This commit is contained in:
parent
83a971edc8
commit
7901b273c4
@ -12,6 +12,7 @@
|
||||
#include "skill.h"
|
||||
#include "incubator.h"
|
||||
#include "car.h"
|
||||
#include "frameevent.h"
|
||||
|
||||
Buff::Buff()
|
||||
{
|
||||
@ -961,7 +962,12 @@ void Buff::ProcReserveMove()
|
||||
|
||||
void Buff::ProcHoldShield()
|
||||
{
|
||||
owner->hold_shield_hp = meta->int_param2;
|
||||
owner->shield_hp_ = meta->int_param2;
|
||||
owner->shield_max_hp_ = meta->int_param2;
|
||||
owner->room->frame_event.AddPropChg(owner->GetWeakPtrRef(),
|
||||
kPropShieldHp,
|
||||
owner->shield_max_hp_,
|
||||
owner->shield_hp_);
|
||||
}
|
||||
|
||||
void Buff::ProcRemoveHoldShield()
|
||||
|
@ -512,24 +512,13 @@ void Bullet::Check(float distance)
|
||||
{
|
||||
Buff* hold_shield_buff = c->GetBuffByEffectId(kBET_HoldShield);
|
||||
if (hold_shield_buff && !IsBomb() && !c->dead && c != sender.Get()) {
|
||||
float shot_angle = 0.0f;
|
||||
if (c->GetMoveDir().IsZero()) {
|
||||
shot_angle = dir.CalcAngleEx(a8::Vec2::UP);
|
||||
} else {
|
||||
shot_angle = dir.CalcAngleEx(c->GetMoveDir());
|
||||
}
|
||||
float shot_angle = shot_angle = dir.CalcAngleEx(c->GetAttackDir());
|
||||
CircleCollider collider;
|
||||
collider.owner = c;
|
||||
collider.rad = hold_shield_buff->meta->param1;
|
||||
if (shot_angle < A8_PI / 4) {
|
||||
if (TestCollision(room, &collider)) {
|
||||
eat = true;
|
||||
stop = true;
|
||||
return;
|
||||
}
|
||||
} else if (fabs(shot_angle) < 0.000001f &&
|
||||
shot_angle + A8_PI < A8_PI / 4){
|
||||
if (shot_angle * 180 < 90.0f) {
|
||||
if (TestCollision(room, &collider)) {
|
||||
c->OnBulletHit(this);
|
||||
eat = true;
|
||||
stop = true;
|
||||
return;
|
||||
|
@ -286,6 +286,7 @@ enum PropertyType_e
|
||||
kPropDive = 31,
|
||||
|
||||
kPropSkillExp = 32,
|
||||
kPropShieldHp = 33,
|
||||
};
|
||||
|
||||
enum MapObjectType_e
|
||||
|
@ -87,7 +87,6 @@ class Creature : public MoveableEntity
|
||||
long long poisoning_time = 0;
|
||||
bool playing_skill = false;
|
||||
int power_idx = -1;
|
||||
int hold_shield_hp = 0;
|
||||
|
||||
Weapon second_weapon;
|
||||
a8::Vec2 context_pos;
|
||||
@ -103,6 +102,9 @@ class Creature : public MoveableEntity
|
||||
int turn_over_times = 0;
|
||||
a8::Vec2 last_turn_over_pos;
|
||||
|
||||
int shield_hp_ = 0;
|
||||
int shield_max_hp_ = 0;
|
||||
|
||||
Creature();
|
||||
virtual ~Creature() override;
|
||||
virtual void Initialize() override;
|
||||
|
@ -555,6 +555,10 @@ void Human::FillMFObjectFull(Room* room, Human* hum, cs::MFObjectFull* full_data
|
||||
p->set_car_uniid(0);
|
||||
p->set_car_seat(0);
|
||||
}
|
||||
if (GetBuffByEffectId(kBET_HoldShield)) {
|
||||
p->set_shield_hp(shield_hp_);
|
||||
p->set_shield_max_hp(shield_max_hp_);
|
||||
}
|
||||
}
|
||||
|
||||
void Human::FillMFPlayerStats(cs::MFPlayerStats* stats_pb)
|
||||
@ -1597,6 +1601,10 @@ void Human::FillMFActivePlayerData(cs::MFActivePlayerData* player_data)
|
||||
player_data->set_shoot_offset_x(shoot_offset.x);
|
||||
player_data->set_shoot_offset_y(shoot_offset.y);
|
||||
GetAbility()->FillMFAttrAdditionList(room, this, player_data->mutable_attr_addition());
|
||||
if (GetBuffByEffectId(kBET_HoldShield)) {
|
||||
player_data->set_shield_hp(shield_hp_);
|
||||
player_data->set_shield_max_hp(shield_max_hp_);
|
||||
}
|
||||
}
|
||||
|
||||
void Human::FillMFGasData(cs::MFGasData* gas_data)
|
||||
@ -3495,6 +3503,21 @@ void Human::OnBulletHit(Bullet* bullet)
|
||||
return;
|
||||
}
|
||||
}
|
||||
{
|
||||
Buff* buff = GetBuffByEffectId(kBET_HoldShield);
|
||||
if (buff) {
|
||||
float finaly_dmg = bullet->sender.Get()->GetBattleContext()->CalcDmg(this, bullet);
|
||||
shield_hp_ = std::max(0.0f, shield_hp_ - finaly_dmg);
|
||||
room->frame_event.AddPropChg(GetWeakPtrRef(),
|
||||
kPropShieldHp,
|
||||
shield_max_hp_,
|
||||
shield_hp_);
|
||||
if (shield_hp_ <= 0) {
|
||||
RemoveBuffByUniId(buff->buff_uniid);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
#if 0
|
||||
if (IsPlayer()) {
|
||||
|
@ -149,6 +149,9 @@ message MFVec2
|
||||
property_type: 32 更新技能经验(需要容错,skill_id可能在本地找不到)
|
||||
property_subtype: skill_id
|
||||
valule: 经验
|
||||
property_type: 33 更新盾牌血量
|
||||
property_subtype: 血量上限
|
||||
valule: 当前血量
|
||||
*/
|
||||
message MFPropertyChg
|
||||
{
|
||||
@ -267,6 +270,9 @@ message MFPlayerFull
|
||||
optional float shoot_offset_y = 51 [default = 0]; //射击偏移量-y
|
||||
|
||||
optional string user_data = 60 [default = ""]; //用户自定义数据
|
||||
|
||||
optional int32 shield_hp = 65; //护盾血量
|
||||
optional int32 shield_max_hp = 66; //护盾血量上限
|
||||
}
|
||||
|
||||
//阻挡物-部分
|
||||
@ -485,6 +491,9 @@ message MFActivePlayerData
|
||||
optional int32 energy_shield = 40; //能量护盾
|
||||
optional int32 max_energy_shield = 41; //最大能量护盾
|
||||
|
||||
optional int32 shield_hp = 65; //护盾血量
|
||||
optional int32 shield_max_hp = 66; //护盾血量上限
|
||||
|
||||
optional int32 spectator_count = 20;
|
||||
repeated MFBodyState states = 27; //角色状态
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user