Demoslayer mode now has "ammo orbs" as well.
This commit is contained in:
parent
94e421aca1
commit
7d6562c326
6 changed files with 75 additions and 46 deletions
|
|
@ -218,6 +218,7 @@ extend Class SWWMHandler
|
|||
if ( src.Health < 100 )
|
||||
{
|
||||
int amt = clamp(e.Thing.SpawnHealth()/20,1,10);
|
||||
if ( e.Thing.bBOSS || e.Thing.FindInventory("BossMarker") ) amt *= 2;
|
||||
if ( e.Thing.Health < (e.Thing.GetGibHealth()*2) ) amt *= 3;
|
||||
else if ( e.Thing.Health < e.Thing.GetGibHealth() ) amt *= 2;
|
||||
for ( int i=0; i<amt; i++ )
|
||||
|
|
@ -231,7 +232,8 @@ extend Class SWWMHandler
|
|||
}
|
||||
if ( src.CountInv("ArmorNugget") < 100 )
|
||||
{
|
||||
int amt = clamp(e.Thing.SpawnHealth()/40,1,5);
|
||||
int amt = clamp(e.Thing.SpawnHealth()/30,1,10);
|
||||
if ( e.Thing.bBOSS || e.Thing.FindInventory("BossMarker") ) amt *= 2;
|
||||
if ( e.Thing.Health < (e.Thing.GetGibHealth()*2) ) amt *= 3;
|
||||
else if ( e.Thing.Health < e.Thing.GetGibHealth() ) amt *= 2;
|
||||
for ( int i=0; i<amt; i++ )
|
||||
|
|
@ -243,6 +245,28 @@ extend Class SWWMHandler
|
|||
a.vel.xy = (cos(ang),sin(ang))*FRandom[Junk](4,8);
|
||||
}
|
||||
}
|
||||
bool needsammo = false;
|
||||
for ( Inventory i=src.Inv; i; i=i.inv )
|
||||
{
|
||||
if ( !(i is 'SWWMAmmo') || (i.Stamina <= 0) || (i.Stamina > 50000) || (i.Amount >= i.MaxAmount) ) continue;
|
||||
needsammo = true;
|
||||
break;
|
||||
}
|
||||
if ( needsammo )
|
||||
{
|
||||
int amt = clamp(e.Thing.SpawnHealth()/40,1,10);
|
||||
if ( e.Thing.bBOSS || e.Thing.FindInventory("BossMarker") ) amt *= 2;
|
||||
if ( e.Thing.Health < (e.Thing.GetGibHealth()*2) ) amt *= 3;
|
||||
else if ( e.Thing.Health < e.Thing.GetGibHealth() ) amt *= 2;
|
||||
for ( int i=0; i<amt; i++ )
|
||||
{
|
||||
if ( Random[Junk](0,1) ) continue;
|
||||
let a = Actor.Spawn("AmmoOrb",e.Thing.Vec3Offset(0,0,e.Thing.Height/2));
|
||||
a.vel.z = FRandom[Junk](4,16);
|
||||
double ang = FRandom[Junk](0,360);
|
||||
a.vel.xy = (cos(ang),sin(ang))*FRandom[Junk](4,8);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// no credits unless it's a counted kill or marine (that isn't friendly) or another player in DM
|
||||
|
|
|
|||
|
|
@ -111,20 +111,6 @@ Class AmmoFabricator : Inventory abstract
|
|||
|
||||
bool FabricateAmmo()
|
||||
{
|
||||
// first we must build an array of all valid weapons, this saves time instead of doing recursive loops
|
||||
Array<Class<Weapon> > validweapons;
|
||||
for ( int i=0; i<AllActorClasses.Size(); i++ )
|
||||
{
|
||||
let type2 = (class<Weapon>)(AllActorClasses[i]);
|
||||
if ( !type2 ) continue;
|
||||
let rep = GetReplacement(type2);
|
||||
if ( (rep != type2) && !(rep is "DehackedPickup") ) continue;
|
||||
readonly<Weapon> weap = GetDefaultByType(type2);
|
||||
if ( !Owner.player || !Owner.player.weapons.LocateWeapon(type2) || weap.bCheatNotWeapon || !weap.CanPickup(Owner) ) continue;
|
||||
let ready = weap.FindState("Ready");
|
||||
if ( !ready || !ready.ValidateSpriteFrame() ) continue;
|
||||
validweapons.Push(type2);
|
||||
}
|
||||
Array<Class<SWWMAmmo> > available;
|
||||
// populate ammo production list
|
||||
for ( int i=0; i<AllActorClasses.Size(); i++ )
|
||||
|
|
@ -136,23 +122,6 @@ Class AmmoFabricator : Inventory abstract
|
|||
if ( !a || (a.GetParentClass() != 'SWWMAmmo') ) continue;
|
||||
let def = GetDefaultByType(a);
|
||||
if ( (def.Stamina <= 0) || (def.Stamina > maxunitprice) ) continue;
|
||||
// only ammo for weapons that are valid (can be used)
|
||||
bool isvalid = false;
|
||||
for ( int j=0; j<validweapons.Size(); j++ )
|
||||
{
|
||||
readonly<Weapon> weap = GetDefaultByType(validweapons[j]);
|
||||
if ( (validweapons[j] is 'SWWMWeapon') && SWWMWeapon(weap).UsesAmmo(a) )
|
||||
{
|
||||
isvalid = true;
|
||||
break;
|
||||
}
|
||||
if ( (weap.AmmoType1 == a) || (weap.AmmoType2 == a) )
|
||||
{
|
||||
isvalid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( !isvalid ) continue;
|
||||
let f = Owner.FindInventory(a);
|
||||
// don't include maxed out ammo
|
||||
if ( f && (f.Amount >= f.MaxAmount) ) continue;
|
||||
|
|
@ -228,7 +197,7 @@ Class AmmoFabricator : Inventory abstract
|
|||
{
|
||||
if ( FabricateAmmo() )
|
||||
{
|
||||
if ( pickup && ((Owner.player == players[consoleplayer]) || bBigPowerup) ) Owner.A_StartSound(UseSound,CHAN_ITEMEXTRA);
|
||||
if ( pickup && ((Owner.player == players[consoleplayer]) || bBigPowerup) && !bQUIET ) Owner.A_StartSound(UseSound,CHAN_ITEMEXTRA);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -270,8 +239,8 @@ Class FabricatorTier1 : AmmoFabricator
|
|||
Inventory.PickupMessage "$T_FABRICATOR1";
|
||||
AmmoFabricator.Budget 3000;
|
||||
AmmoFabricator.PerType 1;
|
||||
AmmoFabricator.MaxUnits 1;
|
||||
AmmoFabricator.MaxTypes 1;
|
||||
AmmoFabricator.MaxUnits 2;
|
||||
AmmoFabricator.MaxTypes 2;
|
||||
AmmoFabricator.MaxUnitPrice 2500;
|
||||
AmmoFabricator.ChanceFactor 1;
|
||||
AmmoFabricator.TextColor Font.CR_BLUE;
|
||||
|
|
@ -286,9 +255,9 @@ Class FabricatorTier2 : AmmoFabricator
|
|||
Tag "$T_FABRICATOR2";
|
||||
Inventory.PickupMessage "$T_FABRICATOR2";
|
||||
AmmoFabricator.Budget 20000;
|
||||
AmmoFabricator.PerType 1;
|
||||
AmmoFabricator.MaxUnits 2;
|
||||
AmmoFabricator.MaxTypes 2;
|
||||
AmmoFabricator.PerType 2;
|
||||
AmmoFabricator.MaxUnits 5;
|
||||
AmmoFabricator.MaxTypes 3;
|
||||
AmmoFabricator.MaxUnitPrice 18000;
|
||||
AmmoFabricator.ChanceFactor 2;
|
||||
AmmoFabricator.TextColor Font.CR_GREEN;
|
||||
|
|
@ -303,9 +272,9 @@ Class FabricatorTier3 : AmmoFabricator
|
|||
Tag "$T_FABRICATOR3";
|
||||
Inventory.PickupMessage "$T_FABRICATOR3";
|
||||
AmmoFabricator.Budget 60000;
|
||||
AmmoFabricator.PerType 2;
|
||||
AmmoFabricator.MaxUnits 4;
|
||||
AmmoFabricator.MaxTypes 3;
|
||||
AmmoFabricator.PerType -25;
|
||||
AmmoFabricator.MaxUnits 10;
|
||||
AmmoFabricator.MaxTypes 4;
|
||||
AmmoFabricator.MaxUnitPrice 50000;
|
||||
AmmoFabricator.ChanceFactor 4;
|
||||
AmmoFabricator.TextColor Font.CR_RED;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
// player effects
|
||||
|
||||
// drop from monsters when using "Demoslayer" fun option
|
||||
// heals up to 100 HP when touched
|
||||
Class SlayerOrb : Actor abstract
|
||||
{
|
||||
Class<Actor> tclass;
|
||||
|
|
@ -138,6 +137,34 @@ Class ArmorOrb : SlayerOrb
|
|||
|
||||
}
|
||||
}
|
||||
Class AmmoOrb : SlayerOrb
|
||||
{
|
||||
Default
|
||||
{
|
||||
SlayerOrb.TrailClass "AmmoOrbTrail";
|
||||
}
|
||||
override void PickedUp( int np, PlayerPawn mo )
|
||||
{
|
||||
int flg = CHANF_OVERLAP|CHANF_MAYBE_LOCAL;
|
||||
if ( mo.CheckLocalView() ) flg |= CHANF_NOPAUSE;
|
||||
mo.A_StartSound("misc/ammo_pkup",CHAN_ITEM,flg);
|
||||
int tier = int(ceil(abs(scale.x*10)));
|
||||
Class<Inventory> cls = "FabricatorTier1";
|
||||
if ( tier >= 4 ) cls = "FabricatorTier3";
|
||||
else if ( tier >= 2 ) cls = "FabricatorTier2";
|
||||
let f = Inventory(Spawn(cls));
|
||||
f.bQUIET = true;
|
||||
if ( !f.CallTryPickup(mo) ) f.Destroy();
|
||||
mo.player.bonuscount = Inventory.BONUSADD;
|
||||
}
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
BLPF A -1 Bright;
|
||||
Stop;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Class SlayerOrbTrail : Actor abstract
|
||||
{
|
||||
|
|
@ -186,6 +213,15 @@ Class ArmorOrbTrail : SlayerOrbTrail
|
|||
Stop;
|
||||
}
|
||||
}
|
||||
Class AmmoOrbTrail : SlayerOrbTrail
|
||||
{
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
BLPS A -1 Bright;
|
||||
Stop;
|
||||
}
|
||||
}
|
||||
|
||||
Class DashTrail : Actor
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue