It prevents wrong usage of the returned value, e.g. in Fire_AddDamage mintime can be set to a negative value and used to apply a negative damage to the player
store = actor.statuseffects;
#endif
if(!store) return 0;
- return store.statuseffect_time[this.m_id];
+ float eff_time = store.statuseffect_time[this.m_id];
+ // if effect end time has passed and m_tick hasn't removed the effect yet
+ // return current time since the effect is actually still active in this frame
+ return (eff_time < time ? time : eff_time);
}
#endif
#ifdef SVQC
else
{
play_countdown(this, StatusEffects_gettime(STATUSEFFECT_Superweapons, this), SND_POWEROFF);
- if (time > StatusEffects_gettime(STATUSEFFECT_Superweapons, this))
+ if (time >= StatusEffects_gettime(STATUSEFFECT_Superweapons, this))
{
this.items = this.items - (this.items & IT_SUPERWEAPON);
STAT(WEAPONS, this) &= ~WEPSET_SUPERWEAPONS;