Merge branch '1.4' of https://github.com/CalamityTeam/CalamityMod into 1.4
This commit is contained in:
commit
c4ceff6a67
9 files changed
+101
-80
No files matched your search
@@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories
|
||||
DisplayName.SetDefault("Ink Bomb");
|
||||
Tooltip.SetDefault("Throws several ink bombs when hit that explode in a confusing cloud of ink\n" +
|
||||
"Gain a lot of stealth when struck\n" +
|
||||
"This effect has a 20s cooldown before it can occur again");
|
||||
"This effect has a 25s cooldown before it can occur again");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories.Wings
|
||||
SacrificeTotal = 1;
|
||||
DisplayName.SetDefault("Elysian Wings");
|
||||
Tooltip.SetDefault("Blessed by the Profaned Flame\n" +
|
||||
"Horizontal speed: 9.75\n" +
|
||||
"Horizontal speed: 9.50\n" +
|
||||
"Acceleration multiplier: 2.7\n" +
|
||||
"Great vertical speed\n" +
|
||||
"Flight time: 240\n" +
|
||||
|
||||
@@ -324,22 +324,29 @@ namespace CalamityMod.Items
|
||||
#region Miscellaneous
|
||||
// Bat Hook is now acquired from Vampires.
|
||||
case ItemID.GoodieBag:
|
||||
SequentialRulesNotScalingWithLuckRule spaghettiBag = null;
|
||||
foreach (IItemDropRule rule in rules)
|
||||
if (rule is SequentialRulesNotScalingWithLuckRule s)
|
||||
spaghettiBag = s;
|
||||
if (spaghettiBag is null)
|
||||
break;
|
||||
foreach (IItemDropRule rule in spaghettiBag.rules)
|
||||
if (rule is CommonDropNotScalingWithLuck WHY && WHY.itemId == ItemID.BatHook)
|
||||
{
|
||||
WHY.chanceNumerator = 0;
|
||||
WHY.chanceDenominator = 1;
|
||||
}
|
||||
RemoveBatHookFromGoodieBag(rules);
|
||||
break;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Goodie Bag Bat Hook
|
||||
private static void RemoveBatHookFromGoodieBag(IList<IItemDropRule> rules)
|
||||
{
|
||||
SequentialRulesNotScalingWithLuckRule rule1 = null;
|
||||
foreach (IItemDropRule rule in rules)
|
||||
if (rule is SequentialRulesNotScalingWithLuckRule s)
|
||||
rule1 = s;
|
||||
if (rule1 is null)
|
||||
return;
|
||||
foreach (IItemDropRule rule in rule1.rules)
|
||||
if (rule is CommonDropNotScalingWithLuck rule2 && rule2.itemId == ItemID.BatHook)
|
||||
{
|
||||
rule2.chanceNumerator = 0;
|
||||
rule2.chanceDenominator = 1;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,10 @@
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Audio;
|
||||
using System.Linq;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
@@ -14,31 +13,38 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
public static readonly SoundStyle RouletteSound = new("CalamityMod/Sounds/Item/SevensStrikerRoulette") { Volume = 0.6f, SoundLimitBehavior = SoundLimitBehavior.ReplaceOldest};
|
||||
public static readonly SoundStyle RouletteTickSound = new("CalamityMod/Sounds/Item/SevensStrikerRouletteTick") { Volume = 0.5f};
|
||||
|
||||
public static readonly SoundStyle BustSound = new("CalamityMod/Sounds/Item/SevensStrikerBust");
|
||||
public static readonly SoundStyle DoublesSound = new("CalamityMod/Sounds/Item/SevensStrikerDoubles");
|
||||
public static readonly SoundStyle TriplesSound = new("CalamityMod/Sounds/Item/SevensStrikerTriples");
|
||||
public static readonly SoundStyle JackpotSound = new("CalamityMod/Sounds/Item/SevensStrikerJackpot");
|
||||
public static readonly SoundStyle CoinSound = new("CalamityMod/Sounds/Item/SevensStrikerCoinShot") { MaxInstances = 0, PitchVariance = 0.5f };
|
||||
|
||||
public static int ShotCoin = 0;
|
||||
public static int ShotCoin = 0; // projectile ID to use for right click, affects damage multiplier
|
||||
public static readonly float RightClickCopperMultiplier = 0.04f;
|
||||
public static readonly float RightClickSilverMultiplier = 0.08f;
|
||||
public static readonly float RightClickGoldMultiplier = 0.16f;
|
||||
|
||||
public static readonly float DoublesMultiplier = 2f; // Doubles means double damage!
|
||||
public static readonly float TriplesCherryMultiplier = 1f;
|
||||
public static readonly float TriplesGrapeMultiplier = 0.333f; // fixed the grapes interfering with each other's iframes
|
||||
public static readonly float JackpotMultiplier = 0.5f; // Jackpot fires 49 shots total and thus needs to be reduced somehow
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
SacrificeTotal = 1;
|
||||
DisplayName.SetDefault("The Sevens Striker");
|
||||
Tooltip.SetDefault("'A gun given to a great gunslinger\n"+
|
||||
"Forged by the arms of a man given no name'\n"+
|
||||
"Consumes coins to power a slot machine with several different outcomes\n"+
|
||||
"Quality of the outcome depends on the coin inputted\n"+
|
||||
"Right click to rapidly fire a spread of coins\n"+
|
||||
"The gun refuses to fire platinum coins for its right click");
|
||||
Tooltip.SetDefault("Left click to consume 1 coin and play a slot machine\n" +
|
||||
"Quality of the outcome depends on the coin used\n" +
|
||||
"Right click to rapidly fire a barrage of coins\n" +
|
||||
"Right click has an 80% chance to not consume coins and will not fire platinum coins\n" +
|
||||
"'A gun given to a great gunslinger\n" +
|
||||
"Forged by the arms of a man given no name'");
|
||||
ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 2777;
|
||||
Item.damage = 777;
|
||||
Item.knockBack = 9f;
|
||||
Item.useTime = 30;
|
||||
Item.useAnimation = 30;
|
||||
@@ -53,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
Item.useAmmo = AmmoID.Coin;
|
||||
Item.shootSpeed = 24f;
|
||||
Item.reuseDelay = 0;
|
||||
Item.shoot = ProjectileID.PurificationPowder;
|
||||
Item.shoot = ProjectileID.PlatinumCoin;
|
||||
Item.value = CalamityGlobalItem.Rarity12BuyPrice;
|
||||
Item.Calamity().customRarity = CalamityRarity.Turquoise;
|
||||
Item.Calamity().donorItem = true;
|
||||
@@ -63,40 +69,47 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
|
||||
public override bool? UseItem(Player player)
|
||||
{
|
||||
// Right click has a 20% chance to consume money
|
||||
if (player.altFunctionUse == 2)
|
||||
{
|
||||
bool consumeCoin = Main.rand.NextFloat() > 0.8f;
|
||||
long coinCount = Utils.CoinsCount(out bool overflow, player.inventory);
|
||||
int price;
|
||||
|
||||
if (overflow || coinCount > 10000)
|
||||
{
|
||||
player.BuyItem(10000);
|
||||
price = 10000;
|
||||
ShotCoin = ProjectileID.GoldCoin;
|
||||
}
|
||||
else if (coinCount > 100)
|
||||
{
|
||||
player.BuyItem(100);
|
||||
price = 100;
|
||||
ShotCoin = ProjectileID.SilverCoin;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.BuyItem(1);
|
||||
price = 1;
|
||||
ShotCoin = ProjectileID.CopperCoin;
|
||||
}
|
||||
|
||||
if (consumeCoin)
|
||||
player.BuyItem(price);
|
||||
}
|
||||
|
||||
// Left click does nothing, it just spawns the holdout
|
||||
else
|
||||
{
|
||||
Item.shoot = ModContent.ProjectileType<SevensStrikerHoldout>();
|
||||
}
|
||||
|
||||
return base.UseItem(player);
|
||||
}
|
||||
public override bool CanConsumeAmmo(Item ammo, Player player) => player.altFunctionUse == 2 ? false : true;
|
||||
|
||||
public override Vector2? HoldoutOffset() => new Vector2(-30, -11);
|
||||
|
||||
|
||||
// Left click spawns a holdout, so the item must not appear normally.
|
||||
// Right click uses the item like a standard gun, so draw it normally.
|
||||
public override void UseAnimation(Player player)
|
||||
{
|
||||
if (player.altFunctionUse == 2f)
|
||||
if (player.altFunctionUse == 2)
|
||||
{
|
||||
Item.UseSound = CoinSound;
|
||||
Item.noUseGraphic = false;
|
||||
@@ -108,20 +121,18 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
}
|
||||
}
|
||||
|
||||
public override float UseTimeMultiplier(Player player)
|
||||
{
|
||||
if (player.altFunctionUse == 2f)
|
||||
return 0.1f;
|
||||
|
||||
return 1f;
|
||||
}
|
||||
// Right click fires coins extremely rapidly (3 use time)
|
||||
public override float UseTimeMultiplier(Player player) => player.altFunctionUse == 2 ? 0.1f : 1f;
|
||||
|
||||
// Right click consumes coins manually instead of using Terraria's ammo system
|
||||
// (otherwise it could shoot Platinum Coins)
|
||||
public override bool CanConsumeAmmo(Item ammo, Player player) => player.altFunctionUse == 2 ? false : true;
|
||||
|
||||
public override bool CanUseItem(Player player)
|
||||
{
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<SevensStrikerHoldout>()] <= 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (player.altFunctionUse == 2)
|
||||
{
|
||||
Utils.CoinsCount(out bool overflow, player.inventory);
|
||||
@@ -132,25 +143,27 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
if (player.altFunctionUse == 2f)
|
||||
// Right click damage multiplier varies by coin type
|
||||
if (player.altFunctionUse == 2)
|
||||
{
|
||||
Vector2 shootVelocity = velocity;
|
||||
Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction);
|
||||
Vector2 shootDirection = velocity.SafeNormalize(Vector2.UnitX * player.direction);
|
||||
Vector2 gunTip = position + shootDirection * Item.scale * 90f;
|
||||
gunTip.Y -= 20f;
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
float SpeedX = velocity.X + Main.rand.Next(-15, 16) * 0.05f;
|
||||
float SpeedY = velocity.Y + Main.rand.Next(-15, 16) * 0.05f;
|
||||
// spread copied from Onyxia, angular conic spread instead of Terraria's square spread
|
||||
float randAngle = Main.rand.NextFloat(-0.05f, 0.05f);
|
||||
float randVelMultiplier = Main.rand.NextFloat(0.92f, 1.08f);
|
||||
Vector2 finalVelocity = velocity.RotatedBy(randAngle) * randVelMultiplier;
|
||||
float damageMult = ShotCoin == ProjectileID.GoldCoin
|
||||
? RightClickGoldMultiplier : ShotCoin == ProjectileID.SilverCoin
|
||||
? RightClickSilverMultiplier : RightClickCopperMultiplier;
|
||||
int finalDamage = (int)(damage * damageMult);
|
||||
Projectile.NewProjectile(source, gunTip, finalVelocity, ShotCoin, finalDamage, knockback, player.whoAmI);
|
||||
}
|
||||
|
||||
Projectile.NewProjectile(source, gunTip.X, gunTip.Y, SpeedX, SpeedY, ShotCoin, (int)(damage * 0.02f), knockback, player.whoAmI);
|
||||
}
|
||||
}
|
||||
// Left click just spawns the holdout
|
||||
else
|
||||
{
|
||||
Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType<SevensStrikerHoldout>(), damage, knockback, player.whoAmI, type, 0f);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,11 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
Projectile.height = 20;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 480;
|
||||
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
Vector2 playerpos = player.RotatedRelativePoint(player.MountedCenter, true);
|
||||
bool shouldBeHeld = player.channel && !player.noItems && !player.CCed;
|
||||
|
||||
int shot = ProjectileID.CopperCoin;
|
||||
int shot;
|
||||
float scaleFactor = 14f;
|
||||
int weaponDamage = player.GetWeaponDamage(player.ActiveItem());
|
||||
float weaponKnockback = player.ActiveItem().knockBack;
|
||||
@@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
// If the animation isn't playing and the cooldown timer is at or below 0
|
||||
if (!rolling && rolltimer <= 0)
|
||||
{
|
||||
//Jackpot gets special benefits since it shoots multiple rounds
|
||||
// Jackpot gets special benefits since it shoots multiple rounds
|
||||
if (Projectile.ai[1] == 4)
|
||||
{
|
||||
shottimer++;
|
||||
@@ -139,7 +139,8 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
// Every 5 frames, shoot 7 coins. The first 5 frames are excluded for timing purposes
|
||||
if (shottimer % 5 == 0 && shottimer > 5)
|
||||
{
|
||||
Shoot(7, ModContent.ProjectileType<SevensStrikerPlatinumCoin>(), weaponDamage, weaponKnockback, (int)scaleFactor * 2f, 0.2f);
|
||||
int jackpotDamage = (int)(weaponDamage * TheSevensStriker.JackpotMultiplier);
|
||||
Shoot(7, ModContent.ProjectileType<SevensStrikerPlatinumCoin>(), jackpotDamage, weaponKnockback, (int)scaleFactor * 2f, 0.2f);
|
||||
SoundEngine.PlaySound(TheSevensStriker.CoinSound, Projectile.Center);
|
||||
}
|
||||
// After 7 waves have been shot, reset the gun and roll again
|
||||
@@ -160,22 +161,26 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
// The other three outcomes
|
||||
switch (Projectile.ai[1])
|
||||
{
|
||||
// A single brick that deals 10% damage
|
||||
// A single brick with 100% damage
|
||||
case 1:
|
||||
Shoot(1, ModContent.ProjectileType<SevensStrikerBrick>(), Projectile.damage, 0, 2f, 0);
|
||||
Shoot(1, ModContent.ProjectileType<SevensStrikerBrick>(), weaponDamage, 0, 2f, 0);
|
||||
CombatText.NewText(player.getRect(), Color.Gray, "Bust!", true);
|
||||
SoundEngine.PlaySound(TheSevensStriker.BustSound, Projectile.Center);
|
||||
break;
|
||||
// 7 exploding oranges
|
||||
// 7 exploding oranges with 200% damage
|
||||
case 2:
|
||||
Shoot(7, ModContent.ProjectileType<SevensStrikerOrange>(), Projectile.damage, Projectile.knockBack, 2f, 0.1f);
|
||||
int doublesDamage = (int)(weaponDamage * TheSevensStriker.DoublesMultiplier);
|
||||
Shoot(7, ModContent.ProjectileType<SevensStrikerOrange>(), doublesDamage, weaponKnockback, 2f, 0.1f);
|
||||
CombatText.NewText(player.getRect(), Color.Orange, "Doubles!", true);
|
||||
SoundEngine.PlaySound(TheSevensStriker.DoublesSound, Projectile.Center);
|
||||
break;
|
||||
// 7 piercing grapes with 7 tighter splitting cherries
|
||||
// 7 piercing grapes with X% damage
|
||||
// Also fires 7 splitting cherries in a tighter spread with Y% damage
|
||||
case 3:
|
||||
Shoot(7, ModContent.ProjectileType<SevensStrikerCherry>(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, 1.5f, 0.1f);
|
||||
Shoot(7, ModContent.ProjectileType<SevensStrikerGrape>(), Projectile.damage, Projectile.knockBack, 2f, 0.2f);
|
||||
int cherryDamage = (int)(weaponDamage * TheSevensStriker.TriplesCherryMultiplier);
|
||||
int grapeDamage = (int)(weaponDamage * TheSevensStriker.TriplesGrapeMultiplier);
|
||||
Shoot(7, ModContent.ProjectileType<SevensStrikerCherry>(), cherryDamage, weaponKnockback, 1.5f, 0.1f);
|
||||
Shoot(7, ModContent.ProjectileType<SevensStrikerGrape>(), grapeDamage, weaponKnockback, 2f, 0.2f);
|
||||
CombatText.NewText(player.getRect(), Color.Red, "Triples!", true);
|
||||
SoundEngine.PlaySound(TheSevensStriker.TriplesSound, Projectile.Center);
|
||||
break;
|
||||
@@ -327,16 +332,16 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
return false;
|
||||
}
|
||||
|
||||
// When the gun disappears, stop any in-progress slots sounds and set a cooldown of 12 frames.
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
if (SoundEngine.TryGetActiveSound(RouletteSoundSlot, out var dringdring))
|
||||
{
|
||||
dringdring.Stop();
|
||||
}
|
||||
|
||||
Main.player[Projectile.owner].SetDummyItemTime(12);
|
||||
}
|
||||
|
||||
// This gun does not deal melee damage, thanks.
|
||||
public override bool? CanDamage() => false;
|
||||
}
|
||||
}
|
||||
@@ -35,12 +35,9 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
Projectile.position = Projectile.Center;
|
||||
Projectile.width = Projectile.height = 48;
|
||||
Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2);
|
||||
Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2);
|
||||
Projectile.ExpandHitboxBy(48, 48);
|
||||
SoundEngine.PlaySound(SoundID.Item14, Projectile.Center);
|
||||
//Explosion copied over from another ranged orange explosive gravity-affected plant projectile
|
||||
// Iban copied the explosion from Pumpler
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
Particle smoke = new SmallSmokeParticle(Projectile.Center + Main.rand.NextVector2Circular(15f, 15f), Vector2.Zero, Color.Orange, new Color(40, 40, 40), Main.rand.NextFloat(0.8f, 1.6f), 145 - Main.rand.Next(30));
|
||||
|
||||
@@ -17,9 +17,8 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.aiStyle = 1;
|
||||
AIType = ProjectileID.PlatinumCoin;
|
||||
Projectile.width = 10; //Cool gaming facts: the vanilla coin projectiles are literally 4 pixels in hitbox size
|
||||
Projectile.width = 10; // Cool gaming facts: the vanilla coin projectiles are literally 4 pixels in hitbox size
|
||||
Projectile.height = 10;
|
||||
Projectile.CritChance = 50;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
|
||||
@@ -390,12 +390,9 @@ namespace CalamityMod.World
|
||||
contents.Insert(0, new ChestItem(ModContent.ItemType<DraedonsLogSnowBiome>(), 1));
|
||||
contents.Insert(1, new ChestItem(ModContent.ItemType<EncryptedSchematicIce>(), 1));
|
||||
}
|
||||
// If it's a frozen chest.
|
||||
// If it's a frozen chest, add Arctic Diving Gear to it.
|
||||
if (type == TileID.Containers)
|
||||
{
|
||||
int specialItem = Utils.SelectRandom(WorldGen.genRand, ItemID.ArcticDivingGear, ItemID.BlizzardinaBalloon, ItemID.FrozenTurtleShell);
|
||||
contents.Insert(0, new ChestItem(specialItem, 1));
|
||||
}
|
||||
contents.Insert(0, new ChestItem(ItemID.ArcticDivingGear, 1));
|
||||
for (int i = 0; i < contents.Count; i++)
|
||||
{
|
||||
chest.item[i].SetDefaults(contents[i].Type);
|
||||
|
||||
Reference in new issue
Block a user