1
This commit is contained in:
commit
8adfe56d7b
@ -429,10 +429,13 @@ void Bullet::Check(float distance)
|
|||||||
}
|
}
|
||||||
bool need_remove = true;
|
bool need_remove = true;
|
||||||
if (distance < bullet_range) {
|
if (distance < bullet_range) {
|
||||||
if (!gun_meta->i->is_penetrate_thing() && t_hit_num > 0 ||
|
if (!gun_meta->i->is_penetrate_thing() && !gun_meta->i->ispenetrate()) {
|
||||||
!gun_meta->i->ispenetrate() && c_hit_num > 0) {
|
|
||||||
} else {
|
} else {
|
||||||
need_remove = false;
|
if ((!gun_meta->i->is_penetrate_thing() && (t_hit_num > 0)) ||
|
||||||
|
(!gun_meta->i->ispenetrate() && (c_hit_num > 0))) {
|
||||||
|
} else {
|
||||||
|
need_remove = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (need_remove) {
|
if (need_remove) {
|
||||||
|
@ -1699,7 +1699,26 @@ void Creature::Shot(a8::Vec2& target_dir, bool& shot_ok, float fly_distance)
|
|||||||
}
|
}
|
||||||
if (GetCurrWeapon()->weapon_idx != 0 &&
|
if (GetCurrWeapon()->weapon_idx != 0 &&
|
||||||
GetCurrWeapon()->ammo <= 0) {
|
GetCurrWeapon()->ammo <= 0) {
|
||||||
AutoLoadingBullet();
|
if (GetCurrWeapon()->meta->i->reload_delay_time() > 0) {
|
||||||
|
room->xtimer.AddDeadLineTimerAndAttach
|
||||||
|
(
|
||||||
|
GetCurrWeapon()->meta->i->reload_delay_time() / FRAME_RATE_MS,
|
||||||
|
a8::XParams()
|
||||||
|
.SetSender(this)
|
||||||
|
.SetParam1(GetCurrWeapon()->weapon_id),
|
||||||
|
[] (const a8::XParams& param)
|
||||||
|
{
|
||||||
|
Creature* c = (Creature*)param.sender.GetUserData();
|
||||||
|
int weapon_id = param.param1;
|
||||||
|
if (c->GetCurrWeapon()->weapon_id == weapon_id) {
|
||||||
|
c->AutoLoadingBullet();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
&xtimer_attacher.timer_list_
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
AutoLoadingBullet();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
last_shot_frameno_ = room->GetFrameNo();
|
last_shot_frameno_ = room->GetFrameNo();
|
||||||
if ((IsPlayer() || IsCar())) {
|
if ((IsPlayer() || IsCar())) {
|
||||||
|
@ -3536,6 +3536,8 @@ void Human::OnBulletHit(Bullet* bullet)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!dead && (bullet->IsBomb() || bullet->sender.Get()->team_id != team_id)) {
|
if (!dead && (bullet->IsBomb() || bullet->sender.Get()->team_id != team_id)) {
|
||||||
|
float old_hp = GetHP();
|
||||||
|
float old_max_hp = GetMaxHP();
|
||||||
float dmg = bullet->GetAtk();
|
float dmg = bullet->GetAtk();
|
||||||
float def = GetDef() * (1 + GetAbility()->GetAttrRate(kHAT_Def)) +
|
float def = GetDef() * (1 + GetAbility()->GetAttrRate(kHAT_Def)) +
|
||||||
GetAbility()->GetAttrAbs(kHAT_Def);
|
GetAbility()->GetAttrAbs(kHAT_Def);
|
||||||
@ -3560,10 +3562,16 @@ void Human::OnBulletHit(Bullet* bullet)
|
|||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
bullet->sender.Get()->SendDebugMsg
|
bullet->sender.Get()->SendDebugMsg
|
||||||
(a8::Format("bullet weapon_id:%d atk:%f",
|
(a8::Format("bullet uniid:%d weapon_id:%d atk:%f def:%f finaly_dmg:%f old_hp:%f old_maxhp:%f cur_hp:%f",
|
||||||
{
|
{
|
||||||
|
bullet->GetUniId(),
|
||||||
bullet->gun_meta->i->id(),
|
bullet->gun_meta->i->id(),
|
||||||
bullet->GetAtk()
|
bullet->GetAtk(),
|
||||||
|
def,
|
||||||
|
finaly_dmg,
|
||||||
|
old_hp,
|
||||||
|
old_max_hp,
|
||||||
|
GetHP()
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
@ -139,6 +139,7 @@ message Equip
|
|||||||
optional int32 use_scene = 60;
|
optional int32 use_scene = 60;
|
||||||
optional int32 ispenetrate = 61;
|
optional int32 ispenetrate = 61;
|
||||||
optional int32 is_penetrate_thing = 62;
|
optional int32 is_penetrate_thing = 62;
|
||||||
|
optional int32 reload_delay_time = 63;
|
||||||
|
|
||||||
optional string inventory_slot = 31; //库存槽位
|
optional string inventory_slot = 31; //库存槽位
|
||||||
optional int32 _inventory_slot = 32; //库存槽位
|
optional int32 _inventory_slot = 32; //库存槽位
|
||||||
|
Loading…
x
Reference in New Issue
Block a user