bool GiveBuff(entity e, Buff thebuff, int op, int val)
{
bool had_buff = StatusEffects_active(thebuff, e);
- float new_buff_time = ((had_buff) ? StatusEffects_gettime(thebuff, e) : 0);
+ float new_buff_time = ((had_buff) ? StatusEffects_gettime(thebuff, e) : time);
switch (op)
{
case OP_SET:
- new_buff_time = val;
+ new_buff_time = time + val;
break;
case OP_MIN:
- new_buff_time = max(new_buff_time, val);
+ new_buff_time = max(new_buff_time, time + val);
break;
case OP_MAX:
- new_buff_time = min(new_buff_time, val);
+ new_buff_time = min(new_buff_time, time + val);
break;
case OP_PLUS:
new_buff_time += val;
new_buff_time -= val;
break;
}
- if(new_buff_time <= 0)
+ if(new_buff_time <= time)
{
if(had_buff) // only trigger removal mechanics if there is an effect to remove!
StatusEffects_remove(thebuff, e, STATUSEFFECT_REMOVE_NORMAL);
bool GiveStatusEffect(entity e, StatusEffects this, int op, float val)
{
bool had_eff = StatusEffects_active(this, e);
- float new_eff_time = ((had_eff) ? StatusEffects_gettime(this, e) : 0);
+ float new_eff_time = ((had_eff) ? StatusEffects_gettime(this, e) : time);
switch (op)
{
case OP_SET:
- new_eff_time = val;
+ new_eff_time = time + val;
break;
case OP_MIN:
- new_eff_time = max(new_eff_time, val);
+ new_eff_time = max(new_eff_time, time + val);
break;
case OP_MAX:
- new_eff_time = min(new_eff_time, val);
+ new_eff_time = min(new_eff_time, time + val);
break;
case OP_PLUS:
new_eff_time += val;
new_eff_time -= val;
break;
}
- if(new_eff_time <= 0)
+ if(new_eff_time <= time)
{
if(had_eff) // only trigger removal mechanics if there is an effect to remove!
StatusEffects_remove(this, e, STATUSEFFECT_REMOVE_NORMAL);
}
}
- if(e.statuseffects)
- {
- FOREACH(StatusEffect, true,
- {
- e.statuseffects.statuseffect_time[it.m_id] = max(0, e.statuseffects.statuseffect_time[it.m_id] - time);
- });
- }
-
PREGIVE(e, items);
PREGIVE_WEAPONS(e);
PREGIVE_STATUSEFFECT(e, STATUSEFFECT_Strength);
break;
});
FOREACH(Weapons, it != WEP_Null && (cmd == it.netname || cmd == it.m_deprecated_netname), {
- got += GiveWeapon(e, it.m_id, op, val);
- break;
+ got += GiveWeapon(e, it.m_id, op, val);
+ break;
});
break;
}
if(!StatusEffects_active(STATUSEFFECT_Superweapons, e))
{
if(!g_weaponarena && (STAT(WEAPONS, e) & WEPSET_SUPERWEAPONS))
- StatusEffects_apply(STATUSEFFECT_Superweapons, e, autocvar_g_balance_superweapons_time, 0);
+ StatusEffects_apply(STATUSEFFECT_Superweapons, e, time + autocvar_g_balance_superweapons_time, 0);
}
if(e.statuseffects)
- {
- FOREACH(StatusEffect, true,
- {
- if(e.statuseffects.statuseffect_time[it.m_id] <= 0)
- e.statuseffects.statuseffect_time[it.m_id] = 0;
- else
- e.statuseffects.statuseffect_time[it.m_id] += time;
- });
-
StatusEffects_update(e);
- }
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{