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,72 +3529,108 @@ void Human::GMAddItem(int item_id, int item_num)
|
||||
if (!item_meta) {
|
||||
return;
|
||||
}
|
||||
if (item_meta->i->_inventory_slot() >= 0 &&
|
||||
item_meta->i->_inventory_slot() < IS_END) {
|
||||
if (GetInventory(item_meta->i->_inventory_slot()) >=
|
||||
GetVolume(item_meta->i->_inventory_slot())
|
||||
) {
|
||||
/*
|
||||
cs::SMPickup notifymsg;
|
||||
notifymsg.set_error_code(1);
|
||||
SendNotifyMsg(notifymsg);
|
||||
*/
|
||||
return;
|
||||
}
|
||||
int add_num = GetVolume(item_meta->i->_inventory_slot()) -
|
||||
GetInventory(item_meta->i->_inventory_slot());
|
||||
add_num = std::min(item_num, add_num);
|
||||
|
||||
AddInventory(item_meta->i->_inventory_slot(), add_num);
|
||||
switch (item_meta->i->_inventory_slot()) {
|
||||
case IS_FRAG:
|
||||
case IS_SMOKE:
|
||||
{
|
||||
Weapon* weapon = &weapons[SPEC1_SLOT_BEGIN +
|
||||
(item_meta->i->_inventory_slot() - SPEC1_IS_BEGIN)
|
||||
];
|
||||
weapon->weapon_id = item_id;
|
||||
weapon->weapon_lv = 1;
|
||||
weapon->ammo += item_num;
|
||||
weapon->meta = item_meta;
|
||||
weapon->Recalc();
|
||||
DecInventory(item_meta->i->_inventory_slot(), add_num);
|
||||
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();
|
||||
}
|
||||
break;
|
||||
case IS_1XSCOPE:
|
||||
case IS_2XSCOPE:
|
||||
case IS_4XSCOPE:
|
||||
case IS_8XSCOPE:
|
||||
case IS_15XSCOPE:
|
||||
{
|
||||
if (item_meta->i->_inventory_slot() - IS_1XSCOPE > curr_scope_idx) {
|
||||
curr_scope_idx = item_meta->i->_inventory_slot() - IS_1XSCOPE;
|
||||
} 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]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IS_POSION_GAS_BOMB:
|
||||
case IS_MOLOTOR_COCKTAIL:
|
||||
case IS_TRAP:
|
||||
case IS_MINE:
|
||||
{
|
||||
Weapon* weapon = &weapons[SPEC2_SLOT_BEGIN +
|
||||
(item_meta->i->_inventory_slot() - SPEC2_IS_BEGIN)
|
||||
];
|
||||
if (weapon) {
|
||||
weapon->weapon_id = item_id;
|
||||
weapon->weapon_lv = 1;
|
||||
weapon->ammo += item_num;
|
||||
weapon->weapon_lv = std::max(1, 1);
|
||||
weapon->ammo = 0;
|
||||
weapon->meta = item_meta;
|
||||
weapon->Recalc();
|
||||
DecInventory(item_meta->i->_inventory_slot(), add_num);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
} else {
|
||||
if (item_meta->i->_inventory_slot() >= 0 &&
|
||||
item_meta->i->_inventory_slot() < IS_END) {
|
||||
if (GetInventory(item_meta->i->_inventory_slot()) >=
|
||||
GetVolume(item_meta->i->_inventory_slot())
|
||||
) {
|
||||
/*
|
||||
cs::SMPickup notifymsg;
|
||||
notifymsg.set_error_code(1);
|
||||
SendNotifyMsg(notifymsg);
|
||||
*/
|
||||
return;
|
||||
}
|
||||
int add_num = GetVolume(item_meta->i->_inventory_slot()) -
|
||||
GetInventory(item_meta->i->_inventory_slot());
|
||||
add_num = std::min(item_num, add_num);
|
||||
|
||||
AddInventory(item_meta->i->_inventory_slot(), add_num);
|
||||
switch (item_meta->i->_inventory_slot()) {
|
||||
case IS_FRAG:
|
||||
case IS_SMOKE:
|
||||
{
|
||||
Weapon* weapon = &weapons[SPEC1_SLOT_BEGIN +
|
||||
(item_meta->i->_inventory_slot() - SPEC1_IS_BEGIN)
|
||||
];
|
||||
weapon->weapon_id = item_id;
|
||||
weapon->weapon_lv = 1;
|
||||
weapon->ammo += item_num;
|
||||
weapon->meta = item_meta;
|
||||
weapon->Recalc();
|
||||
DecInventory(item_meta->i->_inventory_slot(), add_num);
|
||||
}
|
||||
break;
|
||||
case IS_1XSCOPE:
|
||||
case IS_2XSCOPE:
|
||||
case IS_4XSCOPE:
|
||||
case IS_8XSCOPE:
|
||||
case IS_15XSCOPE:
|
||||
{
|
||||
if (item_meta->i->_inventory_slot() - IS_1XSCOPE > curr_scope_idx) {
|
||||
curr_scope_idx = item_meta->i->_inventory_slot() - IS_1XSCOPE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IS_POSION_GAS_BOMB:
|
||||
case IS_MOLOTOR_COCKTAIL:
|
||||
case IS_TRAP:
|
||||
case IS_MINE:
|
||||
{
|
||||
Weapon* weapon = &weapons[SPEC2_SLOT_BEGIN +
|
||||
(item_meta->i->_inventory_slot() - SPEC2_IS_BEGIN)
|
||||
];
|
||||
weapon->weapon_id = item_id;
|
||||
weapon->weapon_lv = 1;
|
||||
weapon->ammo += item_num;
|
||||
weapon->meta = item_meta;
|
||||
weapon->Recalc();
|
||||
DecInventory(item_meta->i->_inventory_slot(), add_num);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
#if 0
|
||||
abort();
|
||||
abort();
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
need_sync_active_player = true;
|
||||
|
@ -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