1
This commit is contained in:
parent
9376761336
commit
88f9102ea2
@ -1637,7 +1637,7 @@ void Creature::SlaveOnRemove(Entity* slave)
|
||||
|
||||
void Creature::RemoveSurplusHero(int buff_id, int id, int num)
|
||||
{
|
||||
if (slave_heros_.size() >= num) {
|
||||
if (slave_heros_.size() >= num && num > 0) {
|
||||
std::vector<Hero*> matched_heros;
|
||||
for (auto& itr : slave_heros_) {
|
||||
if (std::get<0>(itr) == buff_id &&
|
||||
@ -1645,7 +1645,7 @@ void Creature::RemoveSurplusHero(int buff_id, int id, int num)
|
||||
matched_heros.push_back(std::get<1>(itr));
|
||||
}
|
||||
}
|
||||
if (matched_heros.size() >= num) {
|
||||
while (matched_heros.size() >= num) {
|
||||
|
||||
}
|
||||
}
|
||||
@ -1653,7 +1653,7 @@ void Creature::RemoveSurplusHero(int buff_id, int id, int num)
|
||||
|
||||
void Creature::RemoveSurplusObstacle(int buff_id, int id, int num)
|
||||
{
|
||||
if (slave_things_.size() >= num) {
|
||||
if (slave_things_.size() >= num && num > 0) {
|
||||
std::vector<RoomObstacle*> matched_things;
|
||||
for (auto& itr : slave_things_) {
|
||||
if (std::get<0>(itr) == buff_id &&
|
||||
@ -1661,7 +1661,7 @@ void Creature::RemoveSurplusObstacle(int buff_id, int id, int num)
|
||||
matched_things.push_back(std::get<1>(itr));
|
||||
}
|
||||
}
|
||||
if (matched_things.size() >= num) {
|
||||
while (matched_things.size() >= num) {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -3529,6 +3529,41 @@ void Human::GMAddItem(int item_id, int item_num)
|
||||
if (!item_meta) {
|
||||
return;
|
||||
}
|
||||
if (item_meta->i->equip_type() == EQUIP_TYPE_WEAPON) {
|
||||
if (item_meta->i->equip_subtype() == 1) {
|
||||
if (default_weapon.weapon_id != weapons[0].weapon_id) {
|
||||
} else {
|
||||
weapons[0].weapon_idx = 0;
|
||||
weapons[0].weapon_id = item_id;
|
||||
weapons[0].weapon_lv = std::max(1, 1);
|
||||
weapons[0].ammo = 0;
|
||||
weapons[0].meta = item_meta;
|
||||
weapons[0].Recalc();
|
||||
}
|
||||
} else {
|
||||
Weapon* weapon = nullptr;
|
||||
if (weapons[GUN_SLOT1].weapon_id == 0) {
|
||||
weapon = &weapons[GUN_SLOT1];
|
||||
weapon->weapon_idx = GUN_SLOT1;
|
||||
if (GetCurrWeapon() != &weapons[GUN_SLOT2] && !FreezeOperate()) {
|
||||
SetCurrWeapon(&weapons[GUN_SLOT1]);
|
||||
}
|
||||
} else if (weapons[GUN_SLOT2].weapon_id == 0) {
|
||||
weapon = &weapons[GUN_SLOT2];
|
||||
weapon->weapon_idx = GUN_SLOT2;
|
||||
if (GetCurrWeapon() != &weapons[GUN_SLOT1] && !FreezeOperate()) {
|
||||
SetCurrWeapon(&weapons[GUN_SLOT2]);
|
||||
}
|
||||
}
|
||||
if (weapon) {
|
||||
weapon->weapon_id = item_id;
|
||||
weapon->weapon_lv = std::max(1, 1);
|
||||
weapon->ammo = 0;
|
||||
weapon->meta = item_meta;
|
||||
weapon->Recalc();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (item_meta->i->_inventory_slot() >= 0 &&
|
||||
item_meta->i->_inventory_slot() < IS_END) {
|
||||
if (GetInventory(item_meta->i->_inventory_slot()) >=
|
||||
@ -3597,6 +3632,7 @@ void Human::GMAddItem(int item_id, int item_num)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
need_sync_active_player = true;
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
|
@ -1605,7 +1605,7 @@ void Player::UpdateAiming()
|
||||
abort();
|
||||
} else if (power_idx + 1 == p_weapon->meta->power_charge.size()) {
|
||||
} else {
|
||||
long long passed_time = room->GetFrameNo() - aiming_frameno * FRAME_RATE_MS;
|
||||
long long passed_time = (room->GetFrameNo() - aiming_frameno) * FRAME_RATE_MS;
|
||||
if (passed_time >= std::get<0>(p_weapon->meta->power_charge[power_idx + 1])) {
|
||||
++power_idx;
|
||||
RemoveBuffByEffectId(kBET_ShotCharge);
|
||||
|
Loading…
x
Reference in New Issue
Block a user