This commit is contained in:
aozhiwei 2019-07-18 11:55:52 +08:00
parent bf24b15380
commit 8df475806c
6 changed files with 39 additions and 19 deletions

View File

@ -53,5 +53,6 @@ void Android::GiveEquip()
weapons[GUN_SLOT1].meta = weapon_meta;
weapons[GUN_SLOT1].Recalc();
curr_weapon = &weapons[GUN_SLOT1];
DirectReload();
}
}

View File

@ -246,10 +246,22 @@ void Bullet::ProcMissible(const a8::XParams& param)
if (target && !target->dead) {
if (bullet_meta->i->equip_subtype() == BulletType_Trace) {
if (src_pos.Distance(target->pos) < bullet_meta->i->range()) {
target->DecHP(bullet_meta->i->atk(), sender->entity_uniid, sender->name, bullet_meta->i->id());
if (!target->HasBuffEffect(BET_Invincible)) {
target->DecHP(bullet_meta->i->atk(),
sender->entity_uniid,
sender->name,
bullet_meta->i->id()
);
}
}
} else {
target->DecHP(bullet_meta->i->atk(), sender->entity_uniid, sender->name, bullet_meta->i->id());
if (!target->HasBuffEffect(BET_Invincible)) {
target->DecHP(bullet_meta->i->atk(),
sender->entity_uniid,
sender->name,
bullet_meta->i->id()
);
}
}
}
}

View File

@ -1152,22 +1152,7 @@ void Human::UpdateAction()
curr_weapon->weapon_id == action_item_id
) {
{
int ammo = curr_weapon->ammo;
if (ammo < curr_weapon->GetClipVolume()) {
if (GetInventory(WEAPON_SLOT) > 0) {
int add_num = 0;
if (GetInventory(WEAPON_SLOT) <=
curr_weapon->GetClipVolume() - ammo) {
add_num = GetInventory(WEAPON_SLOT);
DecInventory(WEAPON_SLOT, add_num);
} else {
add_num = curr_weapon->GetClipVolume() - ammo;
DecInventory(WEAPON_SLOT, add_num);
}
curr_weapon->ammo += add_num;
need_sync_active_player = true;;
}
}
DirectReload();
}
}
}
@ -1272,6 +1257,26 @@ void Human::UpdateAction()
}
}
void Human::DirectReload()
{
int ammo = curr_weapon->ammo;
if (ammo < curr_weapon->GetClipVolume()) {
if (GetInventory(WEAPON_SLOT) > 0) {
int add_num = 0;
if (GetInventory(WEAPON_SLOT) <=
curr_weapon->GetClipVolume() - ammo) {
add_num = GetInventory(WEAPON_SLOT);
DecInventory(WEAPON_SLOT, add_num);
} else {
add_num = curr_weapon->GetClipVolume() - ammo;
DecInventory(WEAPON_SLOT, add_num);
}
curr_weapon->ammo += add_num;
need_sync_active_player = true;;
}
}
}
void Human::SendUIUpdate()
{
cs::SMUiUpdate notifymsg;

View File

@ -188,6 +188,7 @@ class Human : public Entity
void SendDebugMsg(const std::string& debug_msg);
void SendRollMsg(const std::string& roll_msg);
void UpdateAction();
void DirectReload();
void SendUIUpdate();
void SendWxVoip();
int GetWeaponConfigLv(int weapon_id);

View File

@ -203,7 +203,7 @@ void Obstacle::Explosion()
case ET_Player:
{
Human* hum = (Human*)target;
if (!hum->dead) {
if (!hum->dead && hum != master) {
float dmg = meta->i->damage();
float def = hum->ability.def + hum->ability.def_add;
float finaly_dmg = dmg * (1 - def/MetaMgr::Instance()->K);

View File

@ -43,6 +43,7 @@ void Player::Initialize()
weapons[GUN_SLOT1].meta = weapon_meta;
weapons[GUN_SLOT1].Recalc();
curr_weapon = &weapons[GUN_SLOT1];
DirectReload();
}
}
RecalcBaseAttr();