Fixes for corner cases related to sell-only items.

This commit is contained in:
Mari the Deer 2022-06-07 13:42:13 +02:00
commit eb2e023c58
8 changed files with 15 additions and 15 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r98 \cu(Tue 7 Jun 13:33:10 CEST 2022)\c-";
SWWM_SHORTVER="\cw1.3pre r98 \cu(2022-06-07 13:33:10)\c-";
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r99 \cu(Tue 7 Jun 13:42:13 CEST 2022)\c-";
SWWM_SHORTVER="\cw1.3pre r99 \cu(2022-06-07 13:42:13)\c-";

View file

@ -27,7 +27,7 @@ Class ArmorNuggetItem : SWWMSpareArmor
// sell excess
if ( !bUsed )
{
int sellprice = int(abs(Stamina)*.5);
int sellprice = abs(Stamina)/2;
SWWMScoreObj.Spawn(sellprice,Owner.Vec3Offset(FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8)+Owner.Height/2));
SWWMCredits.Give(Owner.player,sellprice);
if ( Owner.player )

View file

@ -15,7 +15,7 @@ Mixin Class SWWMAutoUseFix
// sell excess if there's a price
if ( !deathmatch && bALWAYSPICKUP && (Amount+item.Amount > MaxAmount) && (Stamina != 0) )
{
int sellprice = int(abs(Stamina)*.5);
int sellprice = abs(Stamina)/2;
SWWMScoreObj.Spawn(sellprice,Owner.Vec3Offset(FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8)+Owner.Height/2));
SWWMCredits.Give(Owner.player,sellprice);
if ( Owner.player )

View file

@ -73,7 +73,7 @@ Class HealthNuggetItem : SWWMHealth
// sell excess
if ( !bUsed )
{
int sellprice = int(abs(Stamina)*.5);
int sellprice = abs(Stamina)/2;
SWWMScoreObj.Spawn(sellprice,Owner.Vec3Offset(FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8)+Owner.Height/2));
SWWMCredits.Give(Owner.player,sellprice);
if ( Owner.player )

View file

@ -1896,7 +1896,7 @@ Class SWWMLamp : Inventory
if ( (Charge >= Default.Charge) && (Amount+item.Amount > MaxAmount) )
{
// sell excess
int sellprice = SWWMUtility.Round100(Stamina*.7);
int sellprice = SWWMUtility.Round100(abs(Stamina)*.7);
SWWMScoreObj.Spawn(sellprice,Owner.Vec3Offset(FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8)+Owner.Height/2));
SWWMCredits.Give(Owner.player,sellprice);
if ( Owner.player )

View file

@ -193,10 +193,10 @@ Class SWWMWeapon : Weapon abstract
{
// subtract price of ammo we don't give
int ammonotgiven = default.AmmoGive1-AmmoGive1;
if ( ammonotgiven > 0 ) Stamina -= int(ownedWeapon.Ammo1.Stamina*(1.+.75*(ammonotgiven-1)));
if ( ammonotgiven > 0 ) Stamina -= int(abs(ownedWeapon.Ammo1.Stamina)*(1.+.75*(ammonotgiven-1)));
// subtract price of given ammo
int ammogiven = ownedWeapon.Ammo1.Amount-oldamount1;
if ( ammogiven > 0 ) Stamina -= int(ownedWeapon.Ammo1.Stamina*(1.+.75*(ammogiven-1)));
if ( ammogiven > 0 ) Stamina -= int(abs(ownedWeapon.Ammo1.Stamina)*(1.+.75*(ammogiven-1)));
// drop excess
int dropme = AmmoGive1-ammogiven;
if ( dropme > 0 )
@ -210,10 +210,10 @@ Class SWWMWeapon : Weapon abstract
{
// subtract price of ammo we don't give
int ammonotgiven = default.AmmoGive2-AmmoGive2;
if ( ammonotgiven > 0 ) Stamina -= int(ownedWeapon.Ammo2.Stamina*(1.+.75*(ammonotgiven-1)));
if ( ammonotgiven > 0 ) Stamina -= int(abs(ownedWeapon.Ammo2.Stamina)*(1.+.75*(ammonotgiven-1)));
// subtract price of given ammo
int ammogiven = ownedWeapon.Ammo2.Amount-oldamount2;
if ( ammogiven > 0 ) Stamina -= int(ownedWeapon.Ammo2.Stamina*(1.+.75*(ammogiven-1)));
if ( ammogiven > 0 ) Stamina -= int(abs(ownedWeapon.Ammo2.Stamina)*(1.+.75*(ammogiven-1)));
// drop excess
int dropme = AmmoGive2-ammogiven;
if ( dropme > 0 )
@ -234,10 +234,10 @@ Class SWWMWeapon : Weapon abstract
{
if ( SWWMWeapon(item).PickupForAmmoSWWM(self) )
item.bPickupGood = true;
if ( !deathmatch && (Amount+item.Amount > MaxAmount) && (item.Stamina > 0) )
if ( !deathmatch && (Amount+item.Amount > MaxAmount) && (item.Stamina != 0) )
{
// sell excess
int sellprice = item.Stamina/2;
int sellprice = abs(item.Stamina)/2;
SWWMScoreObj.Spawn(sellprice,Owner.Vec3Offset(FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8)+Owner.Height/2));
SWWMCredits.Give(Owner.player,sellprice);
if ( Owner.player )

View file

@ -40,10 +40,10 @@ Class ExplodiumGun : SWWMWeapon
return true;
if ( (item.GetClass() == 'ExplodiumGun') && !item.ShouldStay() )
{
if ( !deathmatch && (Amount+item.Amount > MaxAmount) && (Stamina > 0) )
if ( !deathmatch && (Amount+item.Amount > MaxAmount) && (item.Stamina != 0) )
{
// sell excess
int sellprice = int(Stamina*.5);
int sellprice = abs(item.Stamina)/2;
SWWMScoreObj.Spawn(sellprice,Owner.Vec3Offset(FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8)+Owner.Height/2));
SWWMCredits.Give(Owner.player,sellprice);
if ( Owner.player )

View file

@ -23,7 +23,7 @@ Class CandyGun : SWWMWeapon
if ( !deathmatch && !spareget )
{
// sell excess
int sellprice = item.Stamina/2;
int sellprice = abs(item.Stamina)/2;
SWWMScoreObj.Spawn(sellprice,Owner.Vec3Offset(FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8)+Owner.Height/2));
SWWMCredits.Give(Owner.player,sellprice);
if ( Owner.player )