This commit is contained in:
mountaindrew10 committed 2022-05-19 18:26:21 -05:00
commit 00a7b86621
88 files changed
+367 -184

No files matched your search

+9
View File
@@ -22,6 +22,15 @@
internal static readonly int DaedalusReflectCooldown = 5400;
internal static readonly int EvolutionReflectCooldown = 7200;
// Internal vanilla item damage variables
internal static readonly float LeatherWhipTagDamageMultiplier = 1.08f;
internal static readonly float SnapthornTagDamageMultiplier = 1.04f;
internal static readonly float SpinalTapTagDamageMultiplier = 1.08f;
internal static readonly float FirecrackerExplosionDamageMultiplier = 2.25f; // Relative to the whip, not the summon.
internal static readonly float DurendalTagDamageMultiplier = 1.09f;
internal static readonly float MorningStarTagDamageMultiplier = 1.11f;
internal static readonly float KaleidoscopeTagDamageMultiplier = 1.12f;
// TODO -- Add all balance related constants here that don't belong in other files.
// These constants were just the ones sitting in CalamityPlayer.
// Review all constants and static readonlys in the entire mod to find things to add.
-6
View File
@@ -86,8 +86,6 @@ namespace CalamityMod
public static Asset<Texture2D> rainOriginal;
public static Asset<Texture2D> manaOriginal;
public static Asset<Texture2D> carpetOriginal;
public static Texture2D AstralCactusTexture;
public static Texture2D AstralCactusGlowTexture;
public static Texture2D AstralSky;
// DR data structure
@@ -211,8 +209,6 @@ namespace CalamityMod
private void LoadClient()
{
AstralCactusTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Tiles/AstralCactus", AssetRequestMode.ImmediateLoad).Value;
AstralCactusGlowTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Tiles/AstralCactusGlow", AssetRequestMode.ImmediateLoad).Value;
AstralSky = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/AstralSky", AssetRequestMode.ImmediateLoad).Value;
Filters.Scene["CalamityMod:DevourerofGodsHead"] = new Filter(new DoGScreenShaderData("FilterMiniTower").UseColor(0.4f, 0.1f, 1.0f).UseOpacity(0.5f), EffectPriority.VeryHigh);
@@ -304,8 +300,6 @@ namespace CalamityMod
thorium = null;
varia = null;
AstralCactusTexture = null;
AstralCactusGlowTexture = null;
AstralSky = null;
DRValues?.Clear();
+2
View File
@@ -102,6 +102,7 @@ namespace CalamityMod.ILEditing
IL.Terraria.Projectile.CanExplodeTile += MakeMeteoriteExplodable;
IL.Terraria.Main.UpdateTime_StartNight += BloodMoonsRequire200MaxLife;
IL.Terraria.WorldGen.AttemptFossilShattering += PreventFossilShattering;
IL.Terraria.Projectile.Damage += MakeTagDamageMultiplicative;
// Fix vanilla bugs exposed by Calamity mechanics
IL.Terraria.NPC.NPCLoot += FixSplittingWormBannerDrops;
@@ -184,6 +185,7 @@ namespace CalamityMod.ILEditing
IL.Terraria.Projectile.CanExplodeTile -= MakeMeteoriteExplodable;
IL.Terraria.Main.UpdateTime_StartNight -= BloodMoonsRequire200MaxLife;
IL.Terraria.WorldGen.AttemptFossilShattering -= PreventFossilShattering;
IL.Terraria.Projectile.Damage -= MakeTagDamageMultiplicative;
// Fix vanilla bugs exposed by Calamity mechanics
// On.Terraria.Main.InitLifeBytes -= BossRushLifeBytes;
+94 -1
View File
@@ -1,8 +1,11 @@
using Mono.Cecil.Cil;
using CalamityMod.Balancing;
using Microsoft.Xna.Framework;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.ILEditing
{
@@ -220,6 +223,96 @@ namespace CalamityMod.ILEditing
}
#endregion
#region Make Tag Damage Multiplicative
private static void MakeTagDamageMultiplicative(ILContext il)
{
var cursor = new ILCursor(il);
int damageLocalIndex = 37;
bool replaceWithMultipler(int flagLocalIndex, float damageFactor, bool usesExtraVariableToStoreDamage = false)
{
// Move after the bool load and branch-if-false instruction.
cursor.Goto(0);
if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdloc(flagLocalIndex)))
{
LogFailure("Making Tag Damage Multiplicative", $"Could not locate the flag local index of '{flagLocalIndex}'.");
return false;
}
cursor.Index += 2;
// OPTIONAL case for if an extra variable to store damage is used:
// Load damage to add.
// Store damage to add as a variable.
// Load damage ->
// Load damage addition ->
// Add the two ->
// Store damage.
cursor.RemoveRange(usesExtraVariableToStoreDamage ? 6 : 4);
// Load damage ->
// Cast damage to float ->
// Load the damage factor ->
// Multiply the two ->
// Cast the result to int, removing the fractional part ->
// Store damage.
cursor.Emit(OpCodes.Ldloc, damageLocalIndex);
cursor.Emit(OpCodes.Conv_R4);
cursor.Emit(OpCodes.Ldc_R4, damageFactor);
cursor.Emit(OpCodes.Mul);
cursor.Emit(OpCodes.Conv_I4);
cursor.Emit(OpCodes.Stloc, damageLocalIndex);
return true;
}
// Leather whip.
replaceWithMultipler(50, BalancingConstants.LeatherWhipTagDamageMultiplier);
// Durendal.
replaceWithMultipler(51, BalancingConstants.DurendalTagDamageMultiplier);
// Snapthorn.
replaceWithMultipler(54, BalancingConstants.SnapthornTagDamageMultiplier);
// Spinal Tap.
replaceWithMultipler(55, BalancingConstants.SpinalTapTagDamageMultiplier);
// Morning Star.
replaceWithMultipler(56, BalancingConstants.MorningStarTagDamageMultiplier);
// Kaleidoscope.
replaceWithMultipler(57, BalancingConstants.KaleidoscopeTagDamageMultiplier, true);
// SPECIAL CASE: Firecracker's damage is fucking absurd and everything needs to go.
cursor.Goto(0);
if (!cursor.TryGotoNext(MoveType.After, i => i.MatchStloc(64)))
{
LogFailure("Making Tag Damage Multiplicative", $"Could not locate the flag local index of 52.");
return;
}
// Change the damage of the explosions.
cursor.Emit(OpCodes.Ldarg_0);
cursor.EmitDelegate<Func<Projectile, int>>(projectile =>
{
int damage = (int)(Main.player[projectile.owner].ActiveItem().damage * BalancingConstants.FirecrackerExplosionDamageMultiplier);
damage = (int)Main.player[projectile.owner].GetDamage(DamageClass.Summon).ApplyTo(damage);
return damage;
});
cursor.Emit(OpCodes.Stloc, 64);
// Change the x in damage += x; to zero.
if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchAdd()))
{
LogFailure("Making Tag Damage Multiplicative", $"Could not locate the damage additive value.");
return;
}
cursor.Index--;
cursor.Remove();
cursor.Emit(OpCodes.Ldc_I4_0);
}
#endregion Make Tag Damage Multiplicative
#region Fix Chlorophyte Crystal Attacking Where it Shouldn't
#endregion Fix Chlorophyte Crystal Attacking Where it Shouldn't
+1 -1
View File
@@ -30,7 +30,7 @@ namespace CalamityMod.Items.Ammo
return;
}
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
return !(player.itemAnimation < player.ActiveItem().useAnimation - 3);
}
+1 -1
View File
@@ -1576,7 +1576,7 @@ namespace CalamityMod.Items
#endregion
#region Ammo
public override bool CanConsumeAmmo(Item item, Player player) => Main.rand.NextFloat() <= player.Calamity().rangedAmmoCost;
public override bool CanConsumeAmmo(Item weapon, Item ammo, Player player) => Main.rand.NextFloat() <= player.Calamity().rangedAmmoCost;
public static bool HasEnoughAmmo(Player player, Item item, int ammoConsumed)
{
+1 -1
View File
@@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Magic
public override bool CanUseItem(Player player) => CalamityGlobalItem.HasEnoughAmmo(player, Item, 2);
public override bool CanConsumeAmmo(Player player) => false;
public override bool CanConsumeAmmo(Item ammo, Player player) => false;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
+1 -1
View File
@@ -87,7 +87,7 @@ Right click to fire a burst of bullets");
}
}
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 50)
return false;
+1 -1
View File
@@ -71,7 +71,7 @@ namespace CalamityMod.Items.Weapons.Ranged
public override Vector2? HoldoutOffset() => new Vector2(-10, 0);
public override bool CanConsumeAmmo(Player player) => Main.rand.Next(100) >= 50;
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.Next(100) >= 50;
public override void AddRecipes()
{
+1 -1
View File
@@ -55,6 +55,6 @@ namespace CalamityMod.Items.Weapons.Ranged
public override Vector2? HoldoutOffset() => new Vector2(-10, 0);
public override bool CanConsumeAmmo(Player player) => Main.rand.Next(100) >= 60;
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.Next(100) >= 60;
}
}
+1 -1
View File
@@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Ranged
public override bool CanUseItem(Player player) => CalamityGlobalItem.HasEnoughAmmo(player, Item, 5);
// Disable vanilla ammo consumption
public override bool CanConsumeAmmo(Player player) => false;
public override bool CanConsumeAmmo(Item ammo, Player player) => false;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
+1 -1
View File
@@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Ranged
public override bool AltFunctionUse(Player player) => true;
// Right click doesn't use ammo because it's a detonation signal.
public override bool CanConsumeAmmo(Player player) => player.altFunctionUse != 2;
public override bool CanConsumeAmmo(Item ammo, Player player) => player.altFunctionUse != 2;
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType<ChickenCannonHeld>()] <= 0 || player.altFunctionUse == 2;
+1 -1
View File
@@ -63,7 +63,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return new Vector2(-5, 0);
}
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 90)
return false;
+1 -1
View File
@@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return false;
}
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 33)
return false;
+1 -1
View File
@@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.Calamity().customRarity = CalamityRarity.Violet;
Item.value = CalamityGlobalItem.Rarity15BuyPrice;
}
public override bool CanConsumeAmmo(Player player) => Main.rand.NextFloat() > 0.66f;
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() > 0.66f;
public override Vector2? HoldoutOffset() => new Vector2(-5, 5);
+1 -1
View File
@@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return false;
}
public override bool CanConsumeAmmo(Player player) => Main.rand.NextFloat() > 0.9f;
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() > 0.9f;
public override void AddRecipes()
{
+1 -1
View File
@@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.Calamity().canFirePointBlankShots = true;
}
public override bool CanConsumeAmmo(Player player) => Main.rand.Next(100) > 40;
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.Next(100) > 40;
public override Vector2? HoldoutOffset() => new Vector2(-5, 0);
+1 -1
View File
@@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Ranged
public override Vector2? HoldoutOffset() => new Vector2(-10, 0);
public override bool CanConsumeAmmo(Player player) => Main.rand.Next(100) >= 70;
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.Next(100) >= 70;
public override bool AltFunctionUse(Player player) => true;
+1 -1
View File
@@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return false;
}
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 50)
return false;
+1 -1
View File
@@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Ranged
public override Vector2? HoldoutOffset() => new Vector2(-15, 0);
public override bool CanConsumeAmmo(Player player) => Main.rand.Next(100) >= 50;
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.Next(100) >= 50;
public override void AddRecipes()
{
+1 -1
View File
@@ -98,7 +98,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return false;
}
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 66)
return false;
+1 -1
View File
@@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return new Vector2(-10, 0);
}
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 50)
return false;
+1 -1
View File
@@ -65,7 +65,7 @@ namespace CalamityMod.Items.Weapons.Ranged
}
// Disable vanilla ammo consumption
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
return false;
}
+1 -1
View File
@@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return false;
}
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 66)
return false;
+1 -1
View File
@@ -71,7 +71,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return false;
}
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 50 || shotType % 2 == 0)
return false;
+1 -1
View File
@@ -66,7 +66,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return false;
}
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (shotType == 2)
return false;
+1 -1
View File
@@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return new Vector2(-10, 0);
}
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 50)
return false;
+1 -1
View File
@@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return false;
}
public override bool CanConsumeAmmo(Player player) => Main.rand.NextFloat() > 0.8f;
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() > 0.8f;
public override void AddRecipes()
{
+1 -1
View File
@@ -61,7 +61,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return false;
}
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 50)
return false;
+1 -1
View File
@@ -69,7 +69,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return false;
}
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < NotConsumeAmmo)
return false;
+1 -1
View File
@@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return new Vector2(-4, -5);
}
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 33)
return false;
+1 -1
View File
@@ -51,6 +51,6 @@ namespace CalamityMod.Items.Weapons.Ranged
return false;
}
public override bool CanConsumeAmmo(Player player) => Main.rand.NextFloat() < 0.5f;
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() < 0.5f;
}
}
+1 -1
View File
@@ -104,7 +104,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return false;
}
public override bool CanConsumeAmmo(Player player) => Main.rand.NextFloat() > AmmoNotConsumeChance;
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() > AmmoNotConsumeChance;
public override void AddRecipes()
{
@@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Ranged
public override Vector2? HoldoutOffset() => new Vector2(-12, -6);
public override bool CanConsumeAmmo(Player player) => Main.rand.Next(0, 100) >= 33;
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.Next(0, 100) >= 33;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
+1 -1
View File
@@ -60,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return false;
}
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 50)
return false;
+1 -1
View File
@@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return new Vector2(-10, 0);
}
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 50)
return false;
+1 -1
View File
@@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Ranged
}
// Consume two ammo per fire
public override bool CanConsumeAmmo(Player player) => counter % 2 == 0;
public override bool CanConsumeAmmo(Item ammo, Player player) => counter % 2 == 0;
public override Vector2? HoldoutOffset() => new Vector2(-30, 0);
+1 -1
View File
@@ -80,7 +80,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return false;
}
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (shotType % 2 == 0)
return false;
+1 -1
View File
@@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return new Vector2(-5, 0);
}
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 66)
return false;
+1 -1
View File
@@ -71,7 +71,7 @@ Replaces standard bullets with High Velocity Bullets
return false;
}
public override bool CanConsumeAmmo(Player player) => Main.rand.NextFloat() > 0.8f;
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() > 0.8f;
public override void AddRecipes()
{
+1 -1
View File
@@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Ranged
public override Vector2? HoldoutOffset() => new Vector2(-4, 0);
public override bool CanConsumeAmmo(Player player) => Main.rand.Next(100) >= 70;
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.Next(100) >= 70;
public override void AddRecipes()
{
+1 -1
View File
@@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Ranged
public override Vector2? HoldoutOffset() => new Vector2(-10, 0);
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 70)
return false;
+1 -1
View File
@@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return new Vector2(-5, 0);
}
public override bool CanConsumeAmmo(Player player) //consume ammo only once per round
public override bool CanConsumeAmmo(Item ammo, Player player) //consume ammo only once per round
{
if (counter == 1 || counter == 2 || counter == 4 || counter == 5 || counter == 7 || counter == 8 || counter == 10 || counter == 11)
return false;
+1 -1
View File
@@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return false;
}
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 90)
return false;
+1 -1
View File
@@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return new Vector2(-5, 0);
}
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 70)
return false;
+1 -1
View File
@@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return new Vector2(-10, 0);
}
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 80)
return false;
+1 -1
View File
@@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return new Vector2(-10, 0);
}
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 70)
return false;
+1 -1
View File
@@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return new Vector2(-10, 0);
}
public override bool CanConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 50)
return false;
+1 -1
View File
@@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return false;
}
public override bool CanConsumeAmmo(Player player) => Main.rand.Next(0, 100) >= 90;
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.Next(0, 100) >= 90;
public override void AddRecipes()
{
CreateRecipe().
+1 -1
View File
@@ -98,7 +98,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return false;
}
public override bool CanConsumeAmmo(Player player) => Main.rand.NextBool();
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextBool();
public override void AddRecipes()
{
+1 -1
View File
@@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Magic
private const int FramesPerFireRateIncrease = 36;
private Player Owner => Main.player[Projectile.owner];
private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed;
private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem()) && !Owner.noItems && !Owner.CCed;
private ref float DeployedFrames => ref Projectile.ai[0];
private ref float AnimationRate => ref Projectile.ai[1];
+1 -1
View File
@@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Magic
private static int[] LaserOffsetByAnimationFrame = { 4, 3, 0, 3 };
private Player Owner => Main.player[Projectile.owner];
private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed;
private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem()) && !Owner.noItems && !Owner.CCed;
private ref float DeployedFrames => ref Projectile.ai[0];
private ref float ChargeTowardsNextShot => ref Projectile.ai[1];
+1 -2
View File
@@ -187,10 +187,9 @@ namespace CalamityMod.Projectiles.Ranged
Player player = Main.player[Projectile.owner];
int projID = ProjectileID.RocketI;
float shootSpeed = 0f;
bool canShoot = true;
int damage = 0;
float kb = 0f;
player.PickAmmo(FalseLauncher, ref projID, ref shootSpeed, ref canShoot, ref damage, ref kb, out _, true);
player.PickAmmo(FalseLauncher, out projID, out shootSpeed, out damage, out kb, out _, true);
int blastRadius = 0;
if (projID == ProjectileID.RocketII)
blastRadius = 3;
+1 -1
View File
@@ -166,7 +166,7 @@ namespace CalamityMod.Projectiles.Ranged
bool canShoot = true;
int damage = 0;
float kb = 0f;
player.PickAmmo(FalseLauncher, ref projID, ref shootSpeed, ref canShoot, ref damage, ref kb, out _, true);
player.PickAmmo(FalseLauncher, out projID, out shootSpeed, out damage, out kb, out _, true);
CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 16);
+2 -2
View File
@@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Ranged
Projectile.ai[1] = (float)(shootDelayBase - incrementMult * incrementAmt);
willShoot = true;
}
bool canShoot = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed;
bool canShoot = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed;
if (Projectile.localAI[0] > 0f)
{
Projectile.localAI[0] -= 1f;
@@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Ranged
float kback = player.ActiveItem().knockBack;
if (canShoot)
{
player.PickAmmo(player.ActiveItem(), ref projType, ref speedMult, ref canShoot, ref damage, ref kback, out _);
player.PickAmmo(player.ActiveItem(), out projType, out speedMult, out damage, out kback, out _);
kback = player.GetWeaponKnockback(player.ActiveItem(), kback);
float speed = player.ActiveItem().shootSpeed * Projectile.scale;
Vector2 targetPos = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - source;
+2 -2
View File
@@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Ranged
FramesTillNextShot = FireRate;
shouldShoot = true;
}
bool canShoot = player.channel && (player.HasAmmo(player.ActiveItem(), true) || FreeShotLoaded > 0) && !player.noItems && !player.CCed;
bool canShoot = player.channel && (player.HasAmmo(player.ActiveItem()) || FreeShotLoaded > 0) && !player.noItems && !player.CCed;
if (Projectile.soundDelay <= 0 && canShoot)
{
Projectile.soundDelay = (int)FireRate;
@@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Ranged
if (FreeShotLoaded > 0)
FreeShotLoaded--;
else
player.PickAmmo(player.ActiveItem(), ref projType, ref speedMult2, ref canShoot, ref dmg, ref kBack, out _);
player.PickAmmo(player.ActiveItem(), out projType, out speedMult2, out dmg, out kBack, out _);
projType = ModContent.ProjectileType<ChickenRocket>();
kBack = player.GetWeaponKnockback(player.ActiveItem(), kBack);
+2 -2
View File
@@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Ranged
private Player Owner => Main.player[Projectile.owner];
private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed;
private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem()) && !Owner.noItems && !Owner.CCed;
private ref float CurrentChargingFrames => ref Projectile.ai[0];
private ref float LoadedBolts => ref Projectile.ai[1];
private ref float FramesToLoadBolt => ref Projectile.localAI[0];
@@ -150,7 +150,7 @@ namespace CalamityMod.Projectiles.Ranged
bool uselessFuckYou = OwnerCanShoot; //Not a very nice thing to say :/
int projectileType = 0;
Owner.PickAmmo(heldItem, ref projectileType, ref shootSpeed, ref uselessFuckYou, ref BoltDamage, ref knockback, out _, false);
Owner.PickAmmo(heldItem, out projectileType, out shootSpeed, out BoltDamage, out knockback, out _);
projectileType = ModContent.ProjectileType<PrecisionBolt>();
knockback = Owner.GetWeaponKnockback(heldItem, knockback);
+3 -7
View File
@@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Ranged
public class CondemnationHoldout : ModProjectile
{
private Player Owner => Main.player[Projectile.owner];
private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed;
private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem()) && !Owner.noItems && !Owner.CCed;
private ref float CurrentChargingFrames => ref Projectile.ai[0];
private ref float ArrowsLoaded => ref Projectile.ai[1];
private ref float FramesToLoadNextArrow => ref Projectile.localAI[0];
@@ -126,13 +126,9 @@ namespace CalamityMod.Projectiles.Ranged
Item heldItem = Owner.ActiveItem();
// calculate damage at the instant this arrow is fired
int arrowDamage = (int)(heldItem.damage * Owner.RangedDamage());
float shootSpeed = heldItem.shootSpeed * 1.5f; // Loaded arrows move faster than normal.
float knockback = heldItem.knockBack;
Owner.PickAmmo(heldItem, out int projectileType, out float shootSpeed, out int arrowDamage, out float knockback, out _);
shootSpeed *= 1.5f;
bool uselessFuckYou = OwnerCanShoot;
int projectileType = 0;
Owner.PickAmmo(heldItem, ref projectileType, ref shootSpeed, ref uselessFuckYou, ref arrowDamage, ref knockback, out _);
projectileType = ModContent.ProjectileType<CondemnationArrow>();
knockback = Owner.GetWeaponKnockback(heldItem, knockback);
+2 -2
View File
@@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Ranged
flag15 = true;
int arg_1EF4_0 = (int)Projectile.ai[0] / (num40 - num41 * num39);
}
bool flag16 = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed;
bool flag16 = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed;
if (Projectile.localAI[0] > 0f)
{
Projectile.localAI[0] -= 1f;
@@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Ranged
float weaponKnockback2 = player.ActiveItem().knockBack;
if (flag16)
{
player.PickAmmo(player.ActiveItem(), ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, out _);
player.PickAmmo(player.ActiveItem(), out num42, out scaleFactor11, out weaponDamage2, out weaponKnockback2, out _);
weaponKnockback2 = player.GetWeaponKnockback(player.ActiveItem(), weaponKnockback2);
float scaleFactor12 = player.ActiveItem().shootSpeed * Projectile.scale;
Vector2 vector19 = vector;
+2 -2
View File
@@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Ranged
timeToFire = true;
}
bool canFire = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed;
bool canFire = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed;
if (Projectile.soundDelay <= 0 && canFire)
{
@@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Ranged
int damage = player.GetWeaponDamage(player.ActiveItem());
float knockBack = player.ActiveItem().knockBack;
player.PickAmmo(player.ActiveItem(), ref type, ref scaleFactor, ref canFire, ref damage, ref knockBack, out _);
player.PickAmmo(player.ActiveItem(), out type, out scaleFactor, out damage, out knockBack, out _);
type = ModContent.ProjectileType<DrataliornusFlame>();
knockBack = player.GetWeaponKnockback(player.ActiveItem(), knockBack);
@@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Ranged
Projectile.ai[1] = (float)(initialRate - fireRateMult * fireRate);
shouldShoot = true;
}
bool canShoot = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed;
bool canShoot = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed;
if (Projectile.localAI[0] > 0f)
{
Projectile.localAI[0] -= 1f;
@@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Ranged
float kBack = player.ActiveItem().knockBack;
if (canShoot)
{
player.PickAmmo(player.ActiveItem(), ref projType, ref speedMult2, ref canShoot, ref dmg, ref kBack, out _);
player.PickAmmo(player.ActiveItem(), out projType, out speedMult2, out dmg, out kBack, out _);
kBack = player.GetWeaponKnockback(player.ActiveItem(), kBack);
float shootSpeed = player.ActiveItem().shootSpeed * Projectile.scale;
Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true);
+1 -2
View File
@@ -187,10 +187,9 @@ namespace CalamityMod.Projectiles.Ranged
Player player = Main.player[Projectile.owner];
int projID = ProjectileID.RocketI;
float shootSpeed = 0f;
bool canShoot = true;
int damage = 0;
float kb = 0f;
player.PickAmmo(FalseLauncher, ref projID, ref shootSpeed, ref canShoot, ref damage, ref kb, out _, true);
player.PickAmmo(FalseLauncher, out projID, out shootSpeed, out damage, out kb, out _, true);
int blastRadius = 0;
if (projID == ProjectileID.RocketII)
blastRadius = 6;
+1 -2
View File
@@ -187,10 +187,9 @@ namespace CalamityMod.Projectiles.Ranged
Player player = Main.player[Projectile.owner];
int projID = ProjectileID.RocketI;
float shootSpeed = 0f;
bool canShoot = true;
int damage = 0;
float kb = 0f;
player.PickAmmo(FalseLauncher, ref projID, ref shootSpeed, ref canShoot, ref damage, ref kb, out _, true);
player.PickAmmo(FalseLauncher, out projID, out shootSpeed, out damage, out kb, out _, true);
int blastRadius = 0;
if (projID == ProjectileID.RocketII)
blastRadius = 4;
+1 -2
View File
@@ -187,10 +187,9 @@ namespace CalamityMod.Projectiles.Ranged
Player player = Main.player[Projectile.owner];
int projID = ProjectileID.RocketI;
float shootSpeed = 0f;
bool canShoot = true;
int damage = 0;
float kb = 0f;
player.PickAmmo(FalseLauncher, ref projID, ref shootSpeed, ref canShoot, ref damage, ref kb, out _, true);
player.PickAmmo(FalseLauncher, out projID, out shootSpeed, out damage, out kb, out _, true);
int blastRadius = 0;
if (projID == ProjectileID.RocketII)
blastRadius = 5;
+2 -2
View File
@@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Ranged
public class MaelstromHoldout : ModProjectile
{
private Player Owner => Main.player[Projectile.owner];
private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed;
private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem()) && !Owner.noItems && !Owner.CCed;
private ref float CurrentChargingFrames => ref Projectile.ai[0];
private ref float ArrowsLoaded => ref Projectile.ai[1];
private ref float FramesToLoadNextArrow => ref Projectile.localAI[0];
@@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Ranged
bool uselessFuckYou = OwnerCanShoot;
int projectileType = 0;
Owner.PickAmmo(heldItem, ref projectileType, ref shootSpeed, ref uselessFuckYou, ref arrowDamage, ref knockback, out _);
Owner.PickAmmo(heldItem, out projectileType, out shootSpeed, out arrowDamage, out knockback, out _);
projectileType = ModContent.ProjectileType<TheMaelstromShark>();
knockback = Owner.GetWeaponKnockback(heldItem, knockback);
+1 -2
View File
@@ -156,10 +156,9 @@ namespace CalamityMod.Projectiles.Ranged
Player player = Main.player[Projectile.owner];
int projID = ProjectileID.RocketI;
float shootSpeed = 0f;
bool canShoot = true;
int damage = 0;
float kb = 0f;
player.PickAmmo(FalseLauncher, ref projID, ref shootSpeed, ref canShoot, ref damage, ref kb, out _, true);
player.PickAmmo(FalseLauncher, out projID, out shootSpeed, out damage, out kb, out _, true);
int blastRadius = 0;
if (projID == ProjectileID.RocketII)
blastRadius = 3;
+2 -2
View File
@@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Ranged
Projectile.ai[1] = baseUseTime - modifier * Projectile.localAI[0];
timeToFire = true;
}
bool canFire = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed;
bool canFire = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed;
if (Projectile.soundDelay <= 0 && canFire)
{
Projectile.soundDelay = baseUseTime - modifier * (int)Projectile.localAI[0];
@@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Ranged
float knockBack = player.ActiveItem().knockBack;
for (int i = 0; i < 5; i++)
{
player.PickAmmo(player.ActiveItem(), ref type, ref shootSpeed, ref canFire, ref damage, ref knockBack, out _);
player.PickAmmo(player.ActiveItem(), out type, out shootSpeed, out damage, out knockBack, out _);
knockBack = player.GetWeaponKnockback(player.ActiveItem(), knockBack);
Vector2 playerPosition = player.RotatedRelativePoint(player.MountedCenter, true);
Projectile.velocity = Main.screenPosition - playerPosition;
+1 -2
View File
@@ -161,10 +161,9 @@ namespace CalamityMod.Projectiles.Ranged
Player player = Main.player[Projectile.owner];
int projID = ProjectileID.RocketI;
float shootSpeed = 0f;
bool canShoot = true;
int damage = 0;
float kb = 0f;
player.PickAmmo(FalseLauncher, ref projID, ref shootSpeed, ref canShoot, ref damage, ref kb, out _, true);
player.PickAmmo(FalseLauncher, out projID, out shootSpeed, out damage, out kb, out _, true);
int blastRadius = 0;
if (projID == ProjectileID.RocketII)
blastRadius = 6;
+2 -2
View File
@@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Ranged
flag15 = true;
int arg_1EF4_0 = (int)Projectile.ai[0] / (num40 - num41 * num39);
}
bool flag16 = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed;
bool flag16 = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed;
if (Projectile.localAI[0] > 0f)
{
Projectile.localAI[0] -= 1f;
@@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Ranged
float weaponKnockback2 = player.ActiveItem().knockBack;
if (flag16)
{
player.PickAmmo(player.ActiveItem(), ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, out _);
player.PickAmmo(player.ActiveItem(), out num42, out scaleFactor11, out weaponDamage2, out weaponKnockback2, out _);
weaponKnockback2 = player.GetWeaponKnockback(player.ActiveItem(), weaponKnockback2);
float scaleFactor12 = player.ActiveItem().shootSpeed * Projectile.scale;
Vector2 vector19 = vector;
+2 -2
View File
@@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Ranged
Projectile.ai[1] = baseUseTime - modifier * Projectile.localAI[0];
timeToFire = true;
}
bool canFire = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed;
bool canFire = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed;
if (Projectile.soundDelay <= 0 && canFire)
{
Projectile.soundDelay = baseUseTime - modifier * (int)Projectile.localAI[0];
@@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Ranged
float shootSpeed = 16f;
int damage = player.GetWeaponDamage(player.ActiveItem());
float knockBack = player.ActiveItem().knockBack;
player.PickAmmo(player.ActiveItem(), ref type, ref shootSpeed, ref canFire, ref damage, ref knockBack, out _);
player.PickAmmo(player.ActiveItem(), out type, out shootSpeed, out damage, out knockBack, out _);
for (int i = 0; i < 5; i++)
{
knockBack = player.GetWeaponKnockback(player.ActiveItem(), knockBack);
+2 -2
View File
@@ -8,7 +8,7 @@ namespace CalamityMod.Projectiles.Ranged
public class SurgeDriverHoldout : ModProjectile
{
public Player Owner => Main.player[Projectile.owner];
public bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed;
public bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem()) && !Owner.noItems && !Owner.CCed;
public ref float ShootCountdown => ref Projectile.ai[0];
public override void SetStaticDefaults() => DisplayName.SetDefault("Surge Driver");
@@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Ranged
float knockback = heldItem.knockBack;
bool uselessFuckYou = OwnerCanShoot;
Owner.PickAmmo(heldItem, ref projectileType, ref shootSpeed, ref uselessFuckYou, ref damage, ref knockback, out _);
Owner.PickAmmo(heldItem, out projectileType, out shootSpeed, out damage, out knockback, out _);
projectileType = ModContent.ProjectileType<PrismaticEnergyBlast>();
knockback = Owner.GetWeaponKnockback(heldItem, knockback);
+2 -2
View File
@@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Ranged
public void AttemptToFireProjectiles(Player player)
{
bool canFire = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed;
bool canFire = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed;
if (!canFire)
{
Projectile.Kill();
@@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Ranged
int damage = player.GetWeaponDamage(player.ActiveItem());
float knockBack = player.ActiveItem().knockBack;
player.PickAmmo(player.ActiveItem(), ref type, ref shotSpeed, ref canFire, ref damage, ref knockBack, out _); // Pick ammo and consume it (this incorporates the bow's chance to not consume ammo).
player.PickAmmo(player.ActiveItem(), out type, out shotSpeed, out damage, out knockBack, out _); // Pick ammo and consume it (this incorporates the bow's chance to not consume ammo).
SoundEngine.PlaySound(player.ActiveItem().UseSound, Projectile.Center);
+5 -2
View File
@@ -43,6 +43,9 @@ namespace CalamityMod.Projectiles.Summon
int p90ID = ModContent.ItemType<Items.Weapons.Ranged.P90>();
FalseGun = new Item();
FalseGun.SetDefaults(p90ID, true);
FalseGun.consumeAmmoOnFirstShotOnly = false;
FalseGun.consumeAmmoOnLastShotOnly = false;
// FalseGun.ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ;
FalseGun.DamageType = DamageClass.Summon;
}
@@ -95,7 +98,7 @@ namespace CalamityMod.Projectiles.Summon
NPC potentialTarget = Projectile.Center.MinionHoming(1560f, player);
// If the jet has no target or is out of ammo, passively fly around the player.
if (potentialTarget is null || !player.HasAmmo(FalseGun, false))
if (potentialTarget is null || !player.HasAmmo(FalseGun))
{
float distanceToOwner = (player.Center - Projectile.Center).Length();
float acceleration = 0.1f;
@@ -164,7 +167,7 @@ namespace CalamityMod.Projectiles.Summon
int projIndex;
// Vanilla function tricked into using a fake gun item with the appropriate base damage as the "firing item".
player.PickAmmo(FalseGun, ref projID, ref shootSpeed, ref canShoot, ref damage, ref kb, out _, dontConsumeAmmo);
player.PickAmmo(FalseGun, out projID, out shootSpeed, out damage, out kb, out _);
// One in every 20 shots is a rocket which deals 1.5x total damage and extreme knockback.
if (shootRocket)
+33 -2
View File
@@ -1,14 +1,45 @@
using CalamityMod.Dusts;
using CalamityMod.Items.Placeables;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria.ModLoader;
using Terraria.GameContent;
namespace CalamityMod.Tiles.Abyss
{
public class AcidWoodTree : ModPalmTree
{
public override Texture2D GetTopTextures() => ModContent.Request<Texture2D>("CalamityMod/Tiles/Abyss/AcidWoodTreeTops").Value;
public override Texture2D GetTexture() => ModContent.Request<Texture2D>("CalamityMod/Tiles/Abyss/AcidWoodTree").Value;
public override void SetStaticDefaults()
{
// Grows on sulphurous sand
GrowsOnTileId = new int[2] { ModContent.TileType<SulphurousSand>() , ModContent.TileType<SulphurousSandNoWater>()};
}
//Copypasted from vanilla, just as ExampleMod did, due to the lack of proper explanation
public override TreePaintingSettings TreeShaderSettings => new TreePaintingSettings
{
UseSpecialGroups = true,
SpecialGroupMinimalHueValue = 11f / 72f,
SpecialGroupMaximumHueValue = 0.25f,
SpecialGroupMinimumSaturationValue = 0.88f,
SpecialGroupMaximumSaturationValue = 1f
};
public override Asset<Texture2D> GetTopTextures() => ModContent.Request<Texture2D>("CalamityMod/Tiles/Abyss/AcidWoodTreeTops");
public override Asset<Texture2D> GetTexture() => ModContent.Request<Texture2D>("CalamityMod/Tiles/Abyss/AcidWoodTree");
//I don't know what this means. Why do palm trees have branches?? Since when. Also acidwood trees arent meant to have oasis alts
public override Asset<Texture2D> GetOasisTopTextures() => ModContent.Request<Texture2D>("CalamityMod/Tiles/Abyss/AcidWoodTreeTops");
public override Asset<Texture2D> GetBranchTextures() => null;
public override Asset<Texture2D> GetOasisBranchTextures() => ModContent.Request<Texture2D>("CalamityMod/Tiles/Abyss/AcidWoodTree");
public override int DropWood() => ModContent.ItemType<Acidwood>();
public override int CreateDust() => (int)CalamityDusts.SulfurousSeaAcid;
public override int SaplingGrowthType(ref int style)
{
style = 0;
return ModContent.TileType<AcidWoodTreeSapling>();
}
}
}
+11 -1
View File
@@ -1,10 +1,20 @@
using Microsoft.Xna.Framework.Graphics;
using Terraria.ModLoader;
using ReLogic.Content;
namespace CalamityMod.Tiles.Abyss
{
public class SulphurousCactus : ModCactus
{
public override Texture2D GetTexture() => ModContent.Request<Texture2D>("CalamityMod/Tiles/Abyss/SulphurousCactus").Value;
public override void SetStaticDefaults()
{
// Grows on sulphurous sand
GrowsOnTileId = new int[2] { ModContent.TileType<SulphurousSand>(), ModContent.TileType<SulphurousSandNoWater>() };
}
public override Asset<Texture2D> GetTexture() => ModContent.Request<Texture2D>("CalamityMod/Tiles/Abyss/SulphurousCactus");
//What is a FruitTexture
public override Asset<Texture2D> GetFruitTexture() => null;
}
}
-7
View File
@@ -24,8 +24,6 @@ namespace CalamityMod.Tiles.Abyss
AddMapEntry(new Color(150, 100, 50));
MineResist = 1f;
SoundType = SoundID.Dig;
SetModPalmTree(new AcidWoodTree());
SetModCactus(new SulphurousCactus());
}
public override void NumDust(int i, int j, bool fail, ref int num)
@@ -255,10 +253,5 @@ namespace CalamityMod.Tiles.Abyss
TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType<SulphurousSandstone>(), false, false, false, false, resetFrame);
return false;
}
public override int SaplingGrowthType(ref int style)
{
style = 0;
return ModContent.TileType<AcidWoodTreeSapling>();
}
}
}
-6
View File
@@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.Abyss
AddMapEntry(new Color(150, 100, 50));
MineResist = 1f;
SoundType = SoundID.Dig;
SetModPalmTree(new AcidWoodTree());
}
public override void NumDust(int i, int j, bool fail, ref int num)
@@ -33,10 +32,5 @@ namespace CalamityMod.Tiles.Abyss
TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType<SulphurousSandstone>(), false, false, false, false, resetFrame);
return false;
}
public override int SaplingGrowthType(ref int style)
{
style = 0;
return ModContent.TileType<AcidWoodTreeSapling>();
}
}
}
-8
View File
@@ -31,8 +31,6 @@ namespace CalamityMod.Tiles.Astral
//Grass framing (<3 terraria devs)
TileID.Sets.NeedsGrassFraming[Type] = true;
TileID.Sets.NeedsGrassFramingDirt[Type] = ModContent.TileType<AstralDirt>();
SetModTree(new AstralTree());
}
public override void NumDust(int i, int j, bool fail, ref int Type)
@@ -47,11 +45,5 @@ namespace CalamityMod.Tiles.Astral
Main.tile[i, j].TileType = (ushort)ModContent.TileType<AstralDirt>();
}
}
public override int SaplingGrowthType(ref int style)
{
style = 0;
return ModContent.TileType<AstralTreeSapling>();
}
}
}
+33 -5
View File
@@ -1,20 +1,48 @@
using CalamityMod.Dusts;
using Microsoft.Xna.Framework.Graphics;
using Terraria.ModLoader;
using ReLogic.Content;
using Terraria;
using Terraria.GameContent;
namespace CalamityMod.Tiles.Astral
{
public class AstralTree : ModTree
{
public override Texture2D GetTopTextures(int i, int j, ref int frame, ref int frameWidth, ref int frameHeight, ref int xOffsetLeft, ref int yOffset)
public override void SetStaticDefaults()
{
frame = (i + j * j) % 3;
return ModContent.Request<Texture2D>("CalamityMod/Tiles/Astral/AstralTree_Tops").Value;
// Grows on astral grass
GrowsOnTileId = new int[1] { ModContent.TileType<AstralGrass>() };
}
public override Texture2D GetBranchTextures(int i, int j, int trunkOffset, ref int frame) => ModContent.Request<Texture2D>("CalamityMod/Tiles/Astral/AstralTree_Branches").Value;
public override Texture2D GetTexture() => ModContent.Request<Texture2D>("CalamityMod/Tiles/Astral/AstralTree").Value;
//Copypasted from vanilla, just as ExampleMod did, due to the lack of proper explanation
public override TreePaintingSettings TreeShaderSettings => new TreePaintingSettings
{
UseSpecialGroups = true,
SpecialGroupMinimalHueValue = 11f / 72f,
SpecialGroupMaximumHueValue = 0.25f,
SpecialGroupMinimumSaturationValue = 0.88f,
SpecialGroupMaximumSaturationValue = 1f
};
public override Asset<Texture2D> GetTopTextures() => ModContent.Request<Texture2D>("CalamityMod/Tiles/Astral/AstralTree_Tops");
public override void SetTreeFoliageSettings(Tile tile, int xoffset, ref int treeFrame, ref int floorY, ref int topTextureFrameWidth, ref int topTextureFrameHeight)
{
//What does this code do?
//treeFrame = (i + j * j) % 3;
}
public override Asset<Texture2D> GetBranchTextures() => ModContent.Request<Texture2D>("CalamityMod/Tiles/Astral/AstralTree_Branches");
public override Asset<Texture2D> GetTexture() => ModContent.Request<Texture2D>("CalamityMod/Tiles/Astral/AstralTree");
public override int DropWood() => ModContent.ItemType<Items.Placeables.AstralMonolith>();
public override int CreateDust() => ModContent.DustType<AstralBasic>();
public override int GrowthFXGore() => -1;
public override int SaplingGrowthType(ref int style)
{
style = 0;
return ModContent.TileType<AstralTreeSapling>();
}
}
}
+28
View File
@@ -0,0 +1,28 @@
using CalamityMod.Projectiles.Typeless;
using CalamityMod.Tiles.Astral;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using ReLogic.Content;
namespace CalamityMod.Tiles.AstralDesert
{
public class AstralCactus : ModCactus
{
public override void SetStaticDefaults()
{
// Grows on astral sand
GrowsOnTileId = new int[1] { ModContent.TileType<AstralSand>() };
}
//Idk what to make with the glowmask
public override Asset<Texture2D> GetTexture() => ModContent.Request<Texture2D>("CalamityMod/Tiles/AstralDesert/AstralCactus");
//What is a FruitTexture
public override Asset<Texture2D> GetFruitTexture() => null;
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 517 B

After

Width:  |  Height:  |  Size: 517 B

+6 -2
View File
@@ -20,6 +20,8 @@ namespace CalamityMod.Tiles.AstralDesert
Main.tileFrameImportant[Type] = true;
Main.tileNoAttach[Type] = true;
Main.tileLavaDeath[Type] = true;
TileID.Sets.CommonSapling[Type] = true;
TileID.Sets.TreeSapling[Type] = true;
TileObjectData.newTile.Width = 1;
TileObjectData.newTile.Height = 2;
TileObjectData.newTile.Origin = new Point16(0, 1);
@@ -49,10 +51,12 @@ namespace CalamityMod.Tiles.AstralDesert
public override void RandomUpdate(int i, int j)
{
if (WorldGen.genRand.Next(20) == 0)
if (WorldGen.genRand.Next(20) == 0 || true)
{
bool isPlayerNear = WorldGen.PlayerLOS(i, j);
bool success = WorldGen.GrowTree(i, j);
bool success = WorldGen.GrowPalmTree(i, j);
if (success && isPlayerNear)
{
WorldGen.TreeGrowFXCheck(i, j);
+32 -15
View File
@@ -1,33 +1,50 @@
using CalamityMod.Dusts;
using Microsoft.Xna.Framework.Graphics;
using Terraria.ModLoader;
using ReLogic.Content;
using Terraria.GameContent;
namespace CalamityMod.Tiles.AstralDesert
{
public class AstralPalmTree : ModPalmTree
{
public override Texture2D GetTexture()
public override void SetStaticDefaults()
{
return ModContent.Request<Texture2D>("CalamityMod/Tiles/AstralDesert/AstralPalmTree").Value;
// Grows on astral sand
GrowsOnTileId = new int[1] { ModContent.TileType<AstralSand>() };
}
public override Texture2D GetTopTextures()
//Copypasted from vanilla, just as ExampleMod did, due to the lack of proper explanation
public override TreePaintingSettings TreeShaderSettings => new TreePaintingSettings
{
return ModContent.Request<Texture2D>("CalamityMod/Tiles/AstralDesert/AstralPalmTree_Tops").Value;
}
UseSpecialGroups = true,
SpecialGroupMinimalHueValue = 11f / 72f,
SpecialGroupMaximumHueValue = 0.25f,
SpecialGroupMinimumSaturationValue = 0.88f,
SpecialGroupMaximumSaturationValue = 1f
};
public override int DropWood()
{
return ModContent.ItemType<Items.Placeables.AstralMonolith>();
}
public override Asset<Texture2D> GetTexture() => ModContent.Request<Texture2D>("CalamityMod/Tiles/AstralDesert/AstralPalmTree");
public override int CreateDust()
{
return ModContent.DustType<AstralBasic>();
}
public override Asset<Texture2D> GetTopTextures() => ModContent.Request<Texture2D>("CalamityMod/Tiles/AstralDesert/AstralPalmTree_Tops");
public override int GrowthFXGore()
//I don't know what this means. Why do palm trees have branches?? Since when. Will ask spriters for an oasis alt later
public override Asset<Texture2D> GetOasisTopTextures() => ModContent.Request<Texture2D>("CalamityMod/Tiles/AstralDesert/AstralPalmTree_Tops");
public override Asset<Texture2D> GetBranchTextures() => null;
public override Asset<Texture2D> GetOasisBranchTextures() => ModContent.Request<Texture2D>("CalamityMod/Tiles/AstralDesert/AstralPalmTree");
public override int DropWood() => ModContent.ItemType<Items.Placeables.AstralMonolith>();
public override int CreateDust() => ModContent.DustType<AstralBasic>();
public override int GrowthFXGore() => -1;
public override int SaplingGrowthType(ref int style)
{
return -1;
style = 0;
return ModContent.TileType<AstralPalmSapling>();
}
}
}
-18
View File
@@ -32,10 +32,6 @@ namespace CalamityMod.Tiles.AstralDesert
TileID.Sets.Conversion.Sand[Type] = true;
TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true;
TileID.Sets.Falling[Type] = true;
SetModCactus(new AstralCactus());
SetModPalmTree(new AstralPalmTree());
}
public override void NumDust(int i, int j, bool fail, ref int num)
@@ -70,19 +66,5 @@ namespace CalamityMod.Tiles.AstralDesert
{
DustType = 108;
}
public override int SaplingGrowthType(ref int style)
{
style = 0;
return ModContent.TileType<AstralPalmSapling>();
}
}
public class AstralCactus : ModCactus
{
public override Texture2D GetTexture()
{
return CalamityMod.AstralCactusTexture;
}
}
}
-8
View File
@@ -30,8 +30,6 @@ namespace CalamityMod.Tiles.AstralSnow
TileID.Sets.Snow[Type] = true;
TileID.Sets.ChecksForMerge[Type] = true;
TileID.Sets.CanBeClearedDuringOreRunner[Type] = true;
SetModTree(new AstralSnowTree());
}
public override void NumDust(int i, int j, bool fail, ref int num)
@@ -45,11 +43,5 @@ namespace CalamityMod.Tiles.AstralSnow
TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType<AstralDirt>());
return false;
}
public override int SaplingGrowthType(ref int style)
{
style = 0;
return ModContent.TileType<AstralSnowTreeSapling>();
}
}
}
+31 -10
View File
@@ -1,25 +1,40 @@
using Terraria.ModLoader;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.GameContent;
namespace CalamityMod.Tiles
namespace CalamityMod.Tiles.AstralSnow
{
public class AstralSnowTree : ModTree
{
public override Texture2D GetTopTextures(int i, int j, ref int frame, ref int frameWidth, ref int frameHeight, ref int xOffsetLeft, ref int yOffset)
public override void SetStaticDefaults()
{
frame = (i + j * j) % 6;
return ModContent.Request<Texture2D>("CalamityMod/Tiles/AstralSnow/AstralSnowTree_Tops").Value;
// Grows on astral snow
GrowsOnTileId = new int[1] { ModContent.TileType<AstralSnow>() };
}
public override Texture2D GetBranchTextures(int i, int j, int trunkOffset, ref int frame)
//Copypasted from vanilla, just as ExampleMod did, due to the lack of proper explanation
public override TreePaintingSettings TreeShaderSettings => new TreePaintingSettings
{
return ModContent.Request<Texture2D>("CalamityMod/Tiles/AstralSnow/AstralSnowTree_Branches").Value;
UseSpecialGroups = true,
SpecialGroupMinimalHueValue = 11f / 72f,
SpecialGroupMaximumHueValue = 0.25f,
SpecialGroupMinimumSaturationValue = 0.88f,
SpecialGroupMaximumSaturationValue = 1f
};
public override Asset<Texture2D> GetTopTextures() => ModContent.Request<Texture2D>("CalamityMod/Tiles/AstralSnow/AstralSnowTree_Tops");
public override void SetTreeFoliageSettings(Tile tile, int xoffset, ref int treeFrame, ref int floorY, ref int topTextureFrameWidth, ref int topTextureFrameHeight)
{
//What does this code do?
//treeFrame = (i + j * j) % 6;
}
public override Texture2D GetTexture()
{
return ModContent.Request<Texture2D>("CalamityMod/Tiles/AstralSnow/AstralSnowTree").Value;
}
public override Asset<Texture2D> GetBranchTextures() => ModContent.Request<Texture2D>("CalamityMod/Tiles/AstralSnow/AstralSnowTree_Branches");
public override Asset<Texture2D> GetTexture() => ModContent.Request<Texture2D>("CalamityMod/Tiles/AstralSnow/AstralSnowTree");
public override int DropWood()
{
@@ -35,5 +50,11 @@ namespace CalamityMod.Tiles
{
return -1;
}
public override int SaplingGrowthType(ref int style)
{
style = 0;
return ModContent.TileType<AstralSnowTreeSapling>();
}
}
}
+1 -1
View File
@@ -129,7 +129,7 @@ namespace CalamityMod.Tiles
// If it is actually astral cactus, then draw its glowmask.
if (astralCactus)
{
spriteBatch.Draw(CalamityMod.AstralCactusGlowTexture, new Vector2((float)(i * 16 - (int)Main.screenPosition.X), (float)(j * 16 - (int)Main.screenPosition.Y)) + zero, new Rectangle((int)frameX, (int)frameY, 16, 18), Color.White * 0.75f, 0f, default, 1f, SpriteEffects.None, 0f);
spriteBatch.Draw(ModContent.Request<Texture2D>("CalamityMod/Tiles/AstralDesert/AstralCactusGlow").Value, new Vector2((float)(i * 16 - (int)Main.screenPosition.X), (float)(j * 16 - (int)Main.screenPosition.Y)) + zero, new Rectangle((int)frameX, (int)frameY, 16, 18), Color.White * 0.75f, 0f, default, 1f, SpriteEffects.None, 0f);
}
}