- if(targ != attacker) // not for suicides
- if(g_weaponarena_random)
- {
- // after a frag, exchange the current weapon (or the culprit, if detectable) by a new random weapon
- Weapon culprit = DEATH_WEAPONOF(deathtype);
- if(!culprit) culprit = attacker.(weaponentity).m_weapon;
- else if(!(STAT(WEAPONS, attacker) & (culprit.m_wepset))) culprit = attacker.(weaponentity).m_weapon;
-
- if(g_weaponarena_random_with_blaster && culprit == WEP_BLASTER) // WEAPONTODO: Shouldn't this be in a mutator?
- {
- // no exchange
- }
- else
- {
- if(!GiveFrags_randomweapons)
- {
- GiveFrags_randomweapons = new(GiveFrags_randomweapons);
- }
-
- if(warmup_stage)
- STAT(WEAPONS, GiveFrags_randomweapons) = WARMUP_START_WEAPONS;
- else
- STAT(WEAPONS, GiveFrags_randomweapons) = start_weapons;
-
- // all others (including the culprit): remove
- STAT(WEAPONS, GiveFrags_randomweapons) &= ~STAT(WEAPONS, attacker);
- STAT(WEAPONS, GiveFrags_randomweapons) &= ~(culprit.m_wepset);
-
- // among the remaining ones, choose one by random
- STAT(WEAPONS, GiveFrags_randomweapons) = W_RandomWeapons(GiveFrags_randomweapons, STAT(WEAPONS, GiveFrags_randomweapons), 1);
-
- if(STAT(WEAPONS, GiveFrags_randomweapons))
- {
- STAT(WEAPONS, attacker) |= STAT(WEAPONS, GiveFrags_randomweapons);
- STAT(WEAPONS, attacker) &= ~(culprit.m_wepset);
- }
- }
-
- // after a frag, choose another random weapon set
- if (!(STAT(WEAPONS, attacker) & WepSet_FromWeapon(attacker.(weaponentity).m_weapon)))
- W_SwitchWeapon_Force(attacker, w_getbestweapon(attacker, weaponentity), weaponentity);
- }
-