Merge branch '1.4.4' of https://github.com/CalamityTeam/CalamityMod into 1.4.4
This commit is contained in:
commit
533222f0bd
35 files changed
+590
-355
No files matched your search
@@ -11,6 +11,7 @@ using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.GameContent.ItemDropRules;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -411,8 +412,18 @@ namespace CalamityMod.CalPlayer
|
||||
Player.lifeRegen += 6;
|
||||
}
|
||||
|
||||
// Grant life regen based on missing health for Radiant Ooze, Ambrosial Ampule, and purity
|
||||
if (rOoze || aAmpoule || purity)
|
||||
{
|
||||
float missingLifeRatio = (Player.statLifeMax2 - Player.statLife) / Player.statLifeMax2;
|
||||
//Ambrosial Ampule and ooze give between 2 and 6 hp/s, Purity gives between 3 and 7 hp/s
|
||||
float lifeRegenToGive = MathHelper.Lerp( purity ? 6f : 4f, purity ? 14f : 12f, missingLifeRatio);
|
||||
Player.lifeRegen += (int)lifeRegenToGive;
|
||||
}
|
||||
|
||||
if (purity)
|
||||
{
|
||||
int intendedPurityDefense = 0;
|
||||
int currentDebuffs = Player.buffType.Count(CalamityLists.debuffList.Contains);
|
||||
if (currentDebuffs > 0)
|
||||
{
|
||||
@@ -423,7 +434,9 @@ namespace CalamityMod.CalPlayer
|
||||
// Healing slows down after 5 seconds (300 frames) debuffed. For every 15 frames thereafter the cadence slows
|
||||
// There is no upper limit to how slow it can get and it can take a very long time to reset to normal
|
||||
int punishmentFrames = PurityHealSlowdownFrames - 300;
|
||||
healFrameCadence += (punishmentFrames < 0) ? 0 : punishmentFrames / 15;
|
||||
//lowest punishment is three full seconds between the one health heal
|
||||
if (healFrameCadence < 180)
|
||||
healFrameCadence += (punishmentFrames < 0) ? 0 : punishmentFrames / 15;
|
||||
|
||||
if (Player.miscCounter % healFrameCadence == healFrameCadence - 1)
|
||||
Player.Heal(1);
|
||||
@@ -431,12 +444,17 @@ namespace CalamityMod.CalPlayer
|
||||
if (Player.lifeRegenTime < 1800)
|
||||
Player.lifeRegenTime = 1800;
|
||||
|
||||
jewelBonusDefense = 40 + (currentDebuffs - 1) * 10;
|
||||
intendedPurityDefense = 20 + (currentDebuffs - 1) * 8;
|
||||
if (jewelBonusDefense < intendedPurityDefense)
|
||||
jewelBonusDefense = intendedPurityDefense;
|
||||
|
||||
// Count up total frames spent healing for slowdown.
|
||||
++PurityHealSlowdownFrames;
|
||||
}
|
||||
else if (Player.miscCounter % 20 == 0 && jewelBonusDefense > 0) //TODO reduce defense and put cooldown at 60 like infected jewel
|
||||
|
||||
// If the defense should be ticking down to some lower value, do that.
|
||||
// Purity loses 1 point of defense every second.
|
||||
if (Player.miscCounter % 60 == 0 && jewelBonusDefense > intendedPurityDefense)
|
||||
--jewelBonusDefense;
|
||||
|
||||
// If the player is clear of all debuffs then gradually reduce the slowdown frames
|
||||
@@ -447,6 +465,7 @@ namespace CalamityMod.CalPlayer
|
||||
PurityHealSlowdownFrames = 0;
|
||||
}
|
||||
|
||||
// Actually apply defense bonus
|
||||
Player.statDefense += jewelBonusDefense;
|
||||
}
|
||||
|
||||
@@ -457,6 +476,7 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
// If the player has any debuffs, give the extra life regen and defense
|
||||
// More defense is given for each additional debuff
|
||||
int intendedJewelDefense = 0;
|
||||
int currentDebuffs = Player.buffType.Count(CalamityLists.debuffList.Contains);
|
||||
if (currentDebuffs > 0)
|
||||
{
|
||||
@@ -464,13 +484,17 @@ namespace CalamityMod.CalPlayer
|
||||
if (Player.lifeRegenTime < 1800)
|
||||
Player.lifeRegenTime = 1800;
|
||||
|
||||
jewelBonusDefense = 16 + (currentDebuffs - 1) * 4;
|
||||
intendedJewelDefense = 16 + (currentDebuffs - 1) * 5;
|
||||
if (jewelBonusDefense < intendedJewelDefense)
|
||||
jewelBonusDefense = intendedJewelDefense;
|
||||
}
|
||||
|
||||
// Otherwise tick down the defense, one point per second
|
||||
else if (Player.miscCounter % 60 == 0 && jewelBonusDefense > 0)
|
||||
// If the defense should be ticking down to some lower value, do that.
|
||||
// Infected Jewel loses 1 point of defense every 20 frames.
|
||||
if (Player.miscCounter % 60 == 0 && jewelBonusDefense > intendedJewelDefense)
|
||||
--jewelBonusDefense;
|
||||
|
||||
// Actually apply defense bonus
|
||||
Player.statDefense += jewelBonusDefense;
|
||||
}
|
||||
|
||||
@@ -749,39 +773,39 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
#region Standing Still Life Regen
|
||||
// Standing still healing bonuses (all are exclusive with vanilla Shiny Stone, but all function similarly)
|
||||
if (!Player.shinyStone && Player.StandingStill() && Player.itemAnimation == 0)
|
||||
if (!Player.shinyStone && Player.StandingStill() && Player.velocity.Y == 0 && Player.itemAnimation == 0)
|
||||
{
|
||||
bool honeyDewWorking = honeyTurboRegen && Player.honey;
|
||||
bool anyStandingStillLifeRegen = shadeRegen || cFreeze || honeyDewWorking || photosynthesis;
|
||||
bool honeyDewWorking = honeyTurboRegen && Player.honeyWet;
|
||||
bool anyStandingStillLifeRegen = shadeRegen || cFreeze || honeyDewWorking || photosynthesis || aAmpoule || purity;
|
||||
bool onlyPhotosynthesisAtNight = !shadeRegen && !cFreeze && !honeyDewWorking && photosynthesis && !Main.dayTime;
|
||||
|
||||
// Divides all negative life regen by two before applying any other effects.
|
||||
if (anyStandingStillLifeRegen && Player.lifeRegen < 0)
|
||||
Player.lifeRegen /= 2;
|
||||
|
||||
// Spawn dust of some flavor while actually regenerating
|
||||
// Spawn dust of some flavor while actually regenerating, aAmpule and purity have a slightly different looking style
|
||||
if (Player.lifeRegen > 0 && Player.statLife < actualMaxLife)
|
||||
{
|
||||
int dustType = shadeRegen ? 173 : cFreeze ? 67 : honeyDewWorking ? DustID.Honey2 : photosynthesis ? 244 : -1;
|
||||
bool dustSpawnRolled = Main.rand.Next(30000) < Player.lifeRegenTime || Main.rand.NextBool(30);
|
||||
int dustType = shadeRegen ? 173 : cFreeze ? 67 : honeyDewWorking ? DustID.Honey2 : photosynthesis ? 244 : aAmpoule ? 228 : purity ? 187 : -1;
|
||||
bool dustSpawnRolled = Main.rand.Next(30000) < Player.lifeRegenTime || purity ? Main.rand.NextBool(2) : aAmpoule ? Main.rand.NextBool(4) : Main.rand.NextBool(30);
|
||||
if (dustType != -1 && dustSpawnRolled)
|
||||
{
|
||||
int regen = Dust.NewDust(Player.position, Player.width, Player.height, dustType, 0f, 0f, 200, default, 1f);
|
||||
int regen = Dust.NewDust(Player.position, Player.width, Player.height, dustType, 0f, 0f, purity || aAmpoule ? 80 : 200, default, purity || aAmpoule ? 0.5f : 1f);
|
||||
Main.dust[regen].noGravity = true;
|
||||
Main.dust[regen].fadeIn = 1.3f;
|
||||
Vector2 velocity = CalamityUtils.RandomVelocity(100f, 50f, 100f, 0.04f);
|
||||
Main.dust[regen].velocity = velocity;
|
||||
velocity.Normalize();
|
||||
velocity *= 34f;
|
||||
velocity *= purity || aAmpoule ? 55f : 34f;
|
||||
Main.dust[regen].position = Player.Center - velocity;
|
||||
}
|
||||
}
|
||||
|
||||
// Actually apply "standing still" regeneration (the stats are granted even at full health)
|
||||
float regenTimeNeededForTurboRegen = shadeRegen ? 40f : cFreeze ? 60f : honeyDewWorking ? 90f : photosynthesis ? 90f : -1f;
|
||||
float regenTimeNeededForTurboRegen = shadeRegen ? 40f : cFreeze ? 60f : honeyDewWorking ? 90f : photosynthesis ? 90f : aAmpoule ? 90f : purity ? 60f : -1f;
|
||||
|
||||
// 4 = vanilla Shiny Stone
|
||||
int turboRegenPower = shadeRegen || cFreeze ? 4 : honeyDewWorking ? 3 : photosynthesis ? 1 : -1;
|
||||
int turboRegenPower = shadeRegen || cFreeze || purity ? 4 : honeyDewWorking || aAmpoule ? 3 : photosynthesis ? 1 : -1;
|
||||
|
||||
if (turboRegenPower > 0)
|
||||
{
|
||||
|
||||
@@ -1989,6 +1989,7 @@ namespace CalamityMod
|
||||
ProjectileID.MonkStaffT3,
|
||||
ProjectileID.LastPrismLaser,
|
||||
ProjectileID.ChargedBlasterLaser,
|
||||
ProjectileID.PiercingStarlight,
|
||||
ProjectileID.FinalFractal,
|
||||
ProjectileType<FlakKrakenProj>(),
|
||||
ProjectileType<MurasamaSlash>(),
|
||||
@@ -2037,6 +2038,9 @@ namespace CalamityMod
|
||||
ProjectileType<YharimsCrystalBeam>(),
|
||||
ProjectileType<PrismaticBeam>(),
|
||||
ProjectileType<SpiritCongregation>(),
|
||||
ProjectileType<BallisticPoisonCloud>(),
|
||||
ProjectileType<DuststormCloudHitbox>(),
|
||||
ProjectileType<StarmageddonBinaryStarCenter>(),
|
||||
};
|
||||
|
||||
// Lists of enemies that resist piercing to some extent (mostly worms).
|
||||
|
||||
@@ -24,26 +24,17 @@ namespace CalamityMod.Items.Accessories
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
player.statLifeMax2 += 70;
|
||||
|
||||
// Grant life regen based on missing health
|
||||
if (!(modPlayer.rOoze || modPlayer.purity))
|
||||
{
|
||||
float missingLifeRatio = (player.statLifeMax2 - player.statLife) / player.statLifeMax2;
|
||||
float lifeRegenToGive = MathHelper.Lerp(4f, 12f, missingLifeRatio);
|
||||
player.lifeRegen += (int)lifeRegenToGive;
|
||||
}
|
||||
|
||||
// bool left in for abyss light purposes
|
||||
// bool left in for abyss light purposes and life regen effects
|
||||
modPlayer.aAmpoule = true;
|
||||
|
||||
// Inherits all effects of Honey Dew and Living Dew
|
||||
// Inherits all effects of Honey Dew and Living Dew (except standing regen is not honey exclusive anymore)
|
||||
modPlayer.alwaysHoneyRegen = true;
|
||||
modPlayer.honeyTurboRegen = true;
|
||||
modPlayer.honeyDewHalveDebuffs = true;
|
||||
modPlayer.livingDewHalveDebuffs = true;
|
||||
|
||||
// Add light if the other accessories aren't equipped and visibility is turned on
|
||||
if (!(modPlayer.rOoze || modPlayer.purity) && !hideVisual)
|
||||
Lighting.AddLight(player.Center, new Vector3(1.2f, 1.7f, 2.7f));
|
||||
Lighting.AddLight(player.Center, new Vector3(1.2f, 1.2f, 0.72f));
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
|
||||
@@ -27,26 +27,17 @@ namespace CalamityMod.Items.Accessories
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
player.statLifeMax2 += 100;
|
||||
|
||||
// Grant life regen based on missing health
|
||||
if (!(modPlayer.rOoze || modPlayer.aAmpoule))
|
||||
{
|
||||
float missingLifeRatio = (player.statLifeMax2 - player.statLife) / player.statLifeMax2;
|
||||
float lifeRegenToGive = MathHelper.Lerp(6f, 14f, missingLifeRatio);
|
||||
player.lifeRegen += (int)lifeRegenToGive;
|
||||
}
|
||||
|
||||
// Abyss light, debuff near-immunity, and massively enhances debuff halving
|
||||
// Abyss light, debuff near-immunity, life regen effects, and massively enhances debuff halving
|
||||
modPlayer.purity = true;
|
||||
|
||||
// Inherits effects from Honey Dew and Living Dew
|
||||
modPlayer.alwaysHoneyRegen = true;
|
||||
modPlayer.honeyTurboRegen = true;
|
||||
modPlayer.honeyDewHalveDebuffs = true;
|
||||
modPlayer.livingDewHalveDebuffs = true;
|
||||
|
||||
// Add light if the other accessories aren't equipped and visibility is turned on
|
||||
if (!(modPlayer.rOoze || modPlayer.aAmpoule) && !hideVisual)
|
||||
Lighting.AddLight(player.Center, new Vector3(1.376f, 1.658f, 2.103f));
|
||||
Lighting.AddLight(player.Center, new Vector3(1.32f, 1.32f, 1.82f));
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
|
||||
@@ -23,15 +23,7 @@ namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
|
||||
// Grant life regen based on missing health
|
||||
if (!(modPlayer.aAmpoule || modPlayer.purity))
|
||||
{
|
||||
float missingLifeRatio = (player.statLifeMax2 - player.statLife) / player.statLifeMax2;
|
||||
float lifeRegenToGive = MathHelper.Lerp(4f, 12f, missingLifeRatio);
|
||||
player.lifeRegen += (int)lifeRegenToGive;
|
||||
}
|
||||
|
||||
// bool left in for abyss light purposes
|
||||
// bool left in for abyss light purposes and life regen effects
|
||||
modPlayer.rOoze = true;
|
||||
|
||||
// Add light if the other accessories aren't equipped and visibility is turned on
|
||||
|
||||
@@ -17,10 +17,10 @@ namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
Item.width = 64;
|
||||
Item.height = 62;
|
||||
Item.value = CalamityGlobalItem.Rarity14BuyPrice;
|
||||
Item.value = CalamityGlobalItem.Rarity15BuyPrice;
|
||||
Item.defense = 18;
|
||||
Item.accessory = true;
|
||||
Item.rare = ModContent.RarityType<DarkBlue>();
|
||||
Item.rare = ModContent.RarityType<Violet>();
|
||||
}
|
||||
|
||||
public override void UpdateAccessory(Player player, bool hideVisual)
|
||||
@@ -57,9 +57,8 @@ namespace CalamityMod.Items.Accessories
|
||||
CreateRecipe().
|
||||
AddIngredient(ItemID.FrozenShield).
|
||||
AddIngredient<DeificAmulet>().
|
||||
AddIngredient<DivineGeode>(10).
|
||||
AddIngredient<CosmiliteBar>(10).
|
||||
AddIngredient<AscendantSpiritEssence>(4).
|
||||
AddIngredient<AuricBar>(5).
|
||||
AddIngredient<AscendantSpiritEssence>(5).
|
||||
AddTile<CosmicAnvil>().
|
||||
Register();
|
||||
}
|
||||
|
||||
@@ -442,7 +442,7 @@ namespace CalamityMod.Items
|
||||
|
||||
// Palladium
|
||||
if (item.type == ItemID.PalladiumSword || item.type == ItemID.PalladiumPike)
|
||||
EditTooltipByName("Knockback", (line) => line.Text += "\nIncreases life regen on hit");
|
||||
EditTooltipByName("Knockback", (line) => line.Text += "\nIncreases natural life regen on hit");
|
||||
|
||||
// Mythril
|
||||
if (item.type == ItemID.MythrilSword || item.type == ItemID.MythrilHalberd)
|
||||
@@ -588,7 +588,7 @@ namespace CalamityMod.Items
|
||||
// Fairy Boots buff.
|
||||
if (item.type == ItemID.FairyBoots)
|
||||
EditTooltipByNum(2, (line) => line.Text += "\nFairies can spawn at any time on the surface and spawn far more frequently\n" +
|
||||
"Nearby fairies grant increased life regen, defense and movement speed\n" +
|
||||
"Nearby fairies grant +2 HP/s life regen, 10 defense and 10% movement speed\n" +
|
||||
"Fairies are immune to damage and will no longer flee");
|
||||
|
||||
// Armor Crunch immunity pre-Golem.
|
||||
@@ -729,7 +729,7 @@ namespace CalamityMod.Items
|
||||
if (item.type == ItemID.TinHelmet)
|
||||
AddTooltip("3% increased critical strike chance");
|
||||
if (item.type == ItemID.TinChainmail)
|
||||
AddTooltip("+1 life regen");
|
||||
AddTooltip("+0.5 HP/s life regen");
|
||||
if (item.type == ItemID.TinGreaves)
|
||||
AddTooltip("5% increased movement speed");
|
||||
|
||||
@@ -745,7 +745,7 @@ namespace CalamityMod.Items
|
||||
if (item.type == ItemID.SilverHelmet)
|
||||
AddTooltip("5% increased critical strike chance");
|
||||
if (item.type == ItemID.SilverChainmail)
|
||||
AddTooltip("+2 life regen");
|
||||
AddTooltip("+1 HP/s life regen");
|
||||
if (item.type == ItemID.SilverGreaves)
|
||||
AddTooltip("8% increased movement speed");
|
||||
|
||||
@@ -753,7 +753,7 @@ namespace CalamityMod.Items
|
||||
if (item.type == ItemID.TungstenHelmet)
|
||||
AddTooltip("7% increased damage");
|
||||
if (item.type == ItemID.TungstenChainmail)
|
||||
AddTooltip("+1 life regen");
|
||||
AddTooltip("+0.5 HP/s life regen");
|
||||
if (item.type == ItemID.TungstenGreaves)
|
||||
AddTooltip("8% increased movement speed");
|
||||
|
||||
@@ -782,7 +782,7 @@ namespace CalamityMod.Items
|
||||
{
|
||||
EditTooltipByNum(0, (line) => {
|
||||
string newTooltip = line.Text.Replace("2%", "5%");
|
||||
newTooltip += "\n+1 life regen";
|
||||
newTooltip += "\n+0.5 HP/s life regen";
|
||||
line.Text = newTooltip;
|
||||
});
|
||||
}
|
||||
@@ -945,7 +945,7 @@ namespace CalamityMod.Items
|
||||
AddWingStats(3f, 1f, 0, 25);
|
||||
|
||||
if (item.type == ItemID.AngelWings)
|
||||
AddWingStats(6.25f, 1f, 1, 100, "+20 max life, +10 defense and +2 life regen");
|
||||
AddWingStats(6.25f, 1f, 1, 100, "+20 max life, +10 defense and +1 HP/s life regen");
|
||||
|
||||
if (item.type == ItemID.DemonWings)
|
||||
AddWingStats(6.25f, 1f, 1, 100, "5% increased damage and critical strike chance");
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
|
||||
public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal";
|
||||
public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/PulseRifleFire");
|
||||
|
||||
private int BaseDamage = 1280;
|
||||
private int BaseDamage = 1200;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using CalamityMod.CustomRecipes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.CustomRecipes;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.DraedonsArsenal;
|
||||
using CalamityMod.Rarities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
@@ -15,12 +15,16 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
|
||||
public class SnakeEyes : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal";
|
||||
|
||||
public static float EnemyDistanceDetection = 2000f;
|
||||
public static float TimeToShoot = 30f;
|
||||
public static float ProjectileSpeed = 40f;
|
||||
public static float TimeToRedirect = 15f;
|
||||
public static float TimeToRestart = 45f;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
CalamityGlobalItem modItem = Item.Calamity();
|
||||
|
||||
Item.shootSpeed = 10f;
|
||||
Item.damage = 65;
|
||||
Item.damage = 200;
|
||||
Item.mana = 12;
|
||||
Item.width = 38;
|
||||
Item.height = 24;
|
||||
@@ -35,9 +39,9 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
|
||||
Item.UseSound = SoundID.Item15;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<SnakeEyesSummon>();
|
||||
Item.shootSpeed = 10f;
|
||||
Item.DamageType = DamageClass.Summon;
|
||||
|
||||
CalamityGlobalItem modItem = Item.Calamity();
|
||||
modItem.UsesCharge = true;
|
||||
modItem.MaxCharge = 190f;
|
||||
modItem.ChargePerUse = 1f;
|
||||
@@ -46,10 +50,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
int watcher = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI);
|
||||
if (Main.projectile.IndexInRange(watcher))
|
||||
Main.projectile[watcher].originalDamage = Item.damage;
|
||||
|
||||
Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 20;
|
||||
Item.damage = 14;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.width = 38;
|
||||
Item.height = 68;
|
||||
|
||||
@@ -26,11 +26,10 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 130;
|
||||
Item.damage = 162;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.width = 124;
|
||||
Item.height = 78;
|
||||
|
||||
Item.useTime = 9;
|
||||
Item.useAnimation = 18;
|
||||
Item.reuseDelay = BetweenShotsPause;
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 300;
|
||||
Item.damage = 221;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.width = 138;
|
||||
Item.height = 176;
|
||||
@@ -76,4 +76,4 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
Register();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
public new string LocalizationCategory => "Items.Weapons.Ranged";
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 56;
|
||||
Item.damage = 37;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.width = 26;
|
||||
Item.height = 70;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 90;
|
||||
Item.damage = 100;
|
||||
Item.knockBack = 4f;
|
||||
Item.shootSpeed = 16f;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
@@ -55,11 +55,8 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<Starfleet>().
|
||||
AddIngredient<StarSputter>().
|
||||
AddIngredient<BarracudaGun>().
|
||||
AddIngredient<AscendantSpiritEssence>().
|
||||
AddIngredient<CosmiliteBar>(5).
|
||||
AddIngredient<Lumenyl>(10).
|
||||
AddIngredient<DarksunFragment>(10).
|
||||
AddIngredient<ExodiumCluster>(15).
|
||||
AddTile(ModContent.TileType<CosmicAnvil>()).
|
||||
|
||||
@@ -5,6 +5,7 @@ using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Particles;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Rogue
|
||||
{
|
||||
@@ -45,23 +46,23 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
}
|
||||
else
|
||||
{
|
||||
int utensil = ModContent.ProjectileType<Fork>();
|
||||
type = ModContent.ProjectileType<Fork>();
|
||||
double dmgMult = 1D;
|
||||
float kbMult = 1f;
|
||||
switch (Main.rand.Next(3))
|
||||
switch (counter)
|
||||
{
|
||||
case 0:
|
||||
utensil = ModContent.ProjectileType<Fork>();
|
||||
type = ModContent.ProjectileType<Fork>();
|
||||
dmgMult = 1.1;
|
||||
kbMult = 2f;
|
||||
break;
|
||||
case 1:
|
||||
utensil = ModContent.ProjectileType<Knife>();
|
||||
type = ModContent.ProjectileType<Knife>();
|
||||
dmgMult = 1.2;
|
||||
kbMult = 1f;
|
||||
break;
|
||||
case 2:
|
||||
utensil = ModContent.ProjectileType<CarvingFork>();
|
||||
type = ModContent.ProjectileType<CarvingFork>();
|
||||
dmgMult = 1D;
|
||||
kbMult = 1f;
|
||||
break;
|
||||
@@ -70,7 +71,8 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
}
|
||||
damage = (int)(damage * dmgMult);
|
||||
knockback = knockback * kbMult;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
@@ -80,7 +82,6 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
int idx = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI);
|
||||
if (idx.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[idx].Calamity().stealthStrike = mp.StealthStrikeAvailable();
|
||||
|
||||
counter++;
|
||||
if (counter == 3)
|
||||
counter = 0;
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Summon
|
||||
public new string LocalizationCategory => "Items.Weapons.Summon";
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 17;
|
||||
Item.damage = 15;
|
||||
Item.knockBack = 1.25f;
|
||||
Item.mana = 10;
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@ namespace CalamityMod.Items.Weapons.Summon
|
||||
public class SandSharknadoStaff : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Summon";
|
||||
#region Other stats for easy modifcation
|
||||
#region Other stats for easy modification
|
||||
|
||||
public const float ProjVel = 30f;
|
||||
public const float ProjSpeed = 30f;
|
||||
|
||||
public const float FireSpeed = 120f; // In frames. 60 frames = 2 seconds.
|
||||
public const float FireSpeed = 50f; // In frames. 60 frames = 1 second.
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ PestilentSlime: The virus hunts for any openings within one’s body to reprogra
|
||||
PlaguebringerMiniboss: Nothing can escape the Plague; everything is either assimilated or culled. Such is the case of queen bees. While strong enough to stave off plagued creatures, they are often forced to abandon their hives due to their subjects becoming infected. This leaves their larvae to be overtaken by nanites, and soon after, a plaguebringer is born.
|
||||
PlagueCharger: Spawn of the plaguebringers, these were born already taken by Draedon’s nanomachines. Nanites ensure they reach adulthood in a matter of hours by supercharging their aging process, even if this means their lifespan can be counted in days. Yet, this is exactly what makes them the perfect dispensable soldiers.
|
||||
Plagueshell: A turtle’s shell and nervous system are intertwined, making giant tortoises ideal targets for the Plague. Whatever pain is caused by the process of drilling into their shells is rapidly anesthetized, putting the tortoises under control without a single protest.
|
||||
Viruling: Unlike derplings, who use their proboscis to drain the blood of other creatures, virulings use theirs by using it to inject the plague directly into their victims. Aside from the plaguebringers themselves, no creature is nearly as efficient at contaminating the local wildlife.
|
||||
Viruling: Unlike derplings, who use their proboscis to drain the blood of other creatures, virulings use theirs to inject the plague directly into their victims. Aside from the plaguebringers themselves, no creature is nearly as efficient at contaminating the local wildlife.
|
||||
//Sulphur Sea Enemies
|
||||
AnthozoanCrab: Though disguised as simple rocks, they are capable of hurling entire boulders at creatures with ease, and will retreat swiftly if approached. Elsewhere, a creature such as this would thrive due to its might; yet in such a hostile environment as this, this much is required merely to survive.
|
||||
AquaticUrchin: Closely related to sea urchins, aquatic urchins have been forced to adapt to the acidic water and radioactive waste. Normally their venomous spikes would normally deter predators, but in the environment it lives in, a painful meal is still a meal. Nothing in this sea can afford to be a picky eater.
|
||||
|
||||
@@ -754,7 +754,7 @@ KamiBuff: {
|
||||
|
||||
Mushy: {
|
||||
DisplayName: Mushy
|
||||
Description: Increased defense by 6 and life regen by 2
|
||||
Description: Increased defense by 6 and life regen by 1HP/s
|
||||
}
|
||||
|
||||
PhantomicEmpowerment: {
|
||||
@@ -1479,12 +1479,12 @@ WulfrumDroidBuff: {
|
||||
|
||||
PinkJellyRegen: {
|
||||
DisplayName: Pink Jelly Regen
|
||||
Description: The power of goo refreshes you, life regen increased by 4
|
||||
Description: The power of goo refreshes you, life regen increased by 2HP/s
|
||||
}
|
||||
|
||||
GreenJellyRegen: {
|
||||
DisplayName: Green Jelly Regen
|
||||
Description: The regenerative goo empowers you, life regen increased by 5
|
||||
Description: The regenerative goo empowers you, life regen increased by 2.5HP/s
|
||||
}
|
||||
|
||||
AbsorberRegen: {
|
||||
@@ -1492,7 +1492,7 @@ AbsorberRegen: {
|
||||
Description:
|
||||
'''
|
||||
You are blessed by the culmimation of nature's powers
|
||||
Life regen increased by 6, damage increased by 8%, damage reduction increased by 5%
|
||||
Life regen increased by 3HP/s, damage increased by 8%, damage reduction increased by 5%
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,6 @@ CalamityConfig: {
|
||||
'''
|
||||
Gives the player a very weak dash by default that requires no equipment or items to use.
|
||||
This dash will be replaced by any other available dash, including those from other mods.
|
||||
Calamity is balanced around this setting being enabled.
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ AmbrosialAmpoule: {
|
||||
+70 max life
|
||||
Grants +2 to +6 HP/s life regen based on missing health
|
||||
Provides life regeneration equivalent to standing in Honey
|
||||
Standing still in Honey grants extremely powerful regen
|
||||
Standing still grants extremely powerful regen
|
||||
Halves how long you are afflicted with fire and sickness debuffs
|
||||
You emit yellow light if visibility is enabled
|
||||
'''
|
||||
@@ -248,10 +248,10 @@ Purity: {
|
||||
Grants +3 to +7 HP/s life regen based on missing health
|
||||
Provides life regeneration equivalent to standing in Honey
|
||||
Standing still grants extremely powerful regen
|
||||
Grants 40 defense and continuous healing while afflicted with any debuff
|
||||
Grants 20 defense and continuous healing while afflicted with any debuff
|
||||
The healing eventually slows down if debuffed for an extended period of time
|
||||
Massively boosts natural life regen while afflicted with any debuff
|
||||
Each debuff beyond the first grants 10 additional defense
|
||||
Each debuff beyond the first grants 8 additional defense
|
||||
Granted defense fades away slowly when not afflicted with any debuffs
|
||||
Makes weak damage over time debuffs harmless and halves the duration of all but the strongest debuffs
|
||||
You emit shining blue light if visibility is enabled
|
||||
@@ -366,8 +366,8 @@ InfectedJewel: {
|
||||
+1 HP/s life regen
|
||||
Grants 16 defense and +2 HP/s life regen while afflicted with any debuff
|
||||
Massively boosts natural life regen while afflicted with any debuff
|
||||
Each debuff beyond the first grants 4 additional defense
|
||||
Granted defense fades away slowly when not afflicted with any debuffs
|
||||
Granted defense fades away quickly when not afflicted with any debuffs
|
||||
Each debuff beyond the first grants 5 additional defense
|
||||
Makes the Astral Infection debuff harmless
|
||||
'A beautiful gemstone tarnished by spaceborne rot'
|
||||
'''
|
||||
@@ -799,7 +799,7 @@ FungalSymbiote: {
|
||||
Tooltip:
|
||||
'''
|
||||
You grow mushrooms on the grass beneath you
|
||||
Consuming mushrooms provides the Mushy buff, increasing defense by 6 and granting 0.5 HP/s life regen
|
||||
Consuming mushrooms provides the Mushy buff, increasing defense by 6 and granting 1 HP/s life regen
|
||||
All mushroom-based weapons deal 10% more damage and emit non-damaging mushrooms
|
||||
'''
|
||||
}
|
||||
@@ -1818,7 +1818,7 @@ TheSponge: {
|
||||
'''
|
||||
Projects a quantum foam barrier that absorbs up to 180 damage
|
||||
The barrier grants 30 defense and reduces damage taken by 30% while active
|
||||
The barrier starts recharging 6 seconds after being hit
|
||||
The barrier starts recharging 9 seconds after being hit
|
||||
Recharging from zero to full charge takes 6 seconds
|
||||
Being hit again while recharging restarts the charge timer
|
||||
The barrier's color will change to match your team selection as needed
|
||||
|
||||
@@ -180,7 +180,7 @@ BloodyMary: {
|
||||
Tooltip:
|
||||
'''
|
||||
10% increased damage and movement speed during a Blood Moon
|
||||
Reduces life regen by 4 and defense by 4%
|
||||
Reduces life regen by 2 HP/s and defense by 4%
|
||||
[c/B00BA5:'Extra spicy... and bloody!']
|
||||
'''
|
||||
}
|
||||
@@ -189,7 +189,7 @@ CaribbeanRum: {
|
||||
DisplayName: Caribbean Rum
|
||||
Tooltip:
|
||||
'''
|
||||
Increases life regen by 2, movement speed by 10% and wing flight time by 20%
|
||||
Increases life regen by 1 HP/s, movement speed by 10% and wing flight time by 20%
|
||||
Makes you floaty and reduces defense by 10%
|
||||
[c/B00BA5:'Why is the rum gone?']
|
||||
'''
|
||||
@@ -210,7 +210,7 @@ Everclear: {
|
||||
Tooltip:
|
||||
'''
|
||||
25% increased damage
|
||||
Reduces life regen by 10 and defense by 30%
|
||||
Reduces life regen by 5 HP/s and defense by 30%
|
||||
[c/B00BA5:'This is the most potent booze I have, be careful with it.']
|
||||
'''
|
||||
}
|
||||
@@ -220,7 +220,7 @@ EvergreenGin: {
|
||||
Tooltip:
|
||||
'''
|
||||
Multiplies all sickness and water-related debuff damage by 1.25x
|
||||
Reduces life regen by 1
|
||||
Reduces life regen by 0.5 HP/s
|
||||
[c/B00BA5:'It tastes like a Christmas tree, if you can imagine that.']
|
||||
'''
|
||||
}
|
||||
@@ -240,7 +240,7 @@ Fireball: {
|
||||
Tooltip:
|
||||
'''
|
||||
Multiplies all fire-based debuff damage by 1.25x
|
||||
Reduces life regen by 1
|
||||
Reduces life regen by 0.5 HP/s
|
||||
[c/B00BA5:'A great-tasting cinnamon whiskey.']
|
||||
'''
|
||||
}
|
||||
@@ -259,7 +259,7 @@ Margarita: {
|
||||
Tooltip:
|
||||
'''
|
||||
Halves the duration of most harmful debuffs
|
||||
Reduces defense by 6% and life regen by 1
|
||||
Reduces defense by 6% and life regen by 0.5 HP/s
|
||||
3 minute duration
|
||||
[c/B00BA5:'One of the best drinks ever created, enjoy it while it lasts.']
|
||||
'''
|
||||
@@ -270,7 +270,7 @@ Moonshine: {
|
||||
Tooltip:
|
||||
'''
|
||||
Increases defense by 10 and damage reduction by 3%
|
||||
Reduces life regen by 1
|
||||
Reduces life regen by 0.5 HP/s
|
||||
[c/B00BA5:'This stuff is pretty strong, but I'm sure you can handle it.']
|
||||
'''
|
||||
}
|
||||
@@ -280,7 +280,7 @@ MoscowMule: {
|
||||
Tooltip:
|
||||
'''
|
||||
Increases damage by 9%, knockback by 50% and critical strike chance by 3%
|
||||
Reduces life regen by 4
|
||||
Reduces life regen by 2 HP/s
|
||||
[c/B00BA5:'I once heard the copper mug can be toxic and I told 'em, 'listen dummy, I'm already poisoning myself!'']
|
||||
'''
|
||||
}
|
||||
@@ -299,7 +299,7 @@ RedWine: {
|
||||
DisplayName: Red Wine
|
||||
Tooltip:
|
||||
'''
|
||||
Reduces life regen by 1 for 15 seconds
|
||||
Reduces life regen by 0.5 HP/s for 15 seconds
|
||||
[c/B00BA5:'Too dry for my taste.']
|
||||
'''
|
||||
}
|
||||
@@ -308,7 +308,7 @@ Rum: {
|
||||
DisplayName: Rum
|
||||
Tooltip:
|
||||
'''
|
||||
Increases life regen by 2 and movement speed by 10%
|
||||
Increases life regen by 1 HP/s and movement speed by 10%
|
||||
Reduces defense by 5%
|
||||
[c/B00BA5:'Sweet and potent, just how I like it.']
|
||||
'''
|
||||
@@ -319,7 +319,7 @@ Screwdriver: {
|
||||
Tooltip:
|
||||
'''
|
||||
Multiplies piercing projectile damage by 1.05x
|
||||
Reduces life regen by 1
|
||||
Reduces life regen by 0.5 HP/s
|
||||
[c/B00BA5:'Do you have a screw loose?']
|
||||
'''
|
||||
}
|
||||
@@ -330,7 +330,7 @@ StarBeamRye: {
|
||||
'''
|
||||
Increases max mana by 50, magic damage by 8%,
|
||||
and reduces mana usage by 10%
|
||||
Reduces defense by 6% and life regen by 2
|
||||
Reduces defense by 6% and life regen by 1 HP/s
|
||||
[c/B00BA5:'Made from some stuff I found near the Astral Meteor crash site. Don't worry, it's safe, trust me...']
|
||||
'''
|
||||
}
|
||||
@@ -340,7 +340,7 @@ Tequila: {
|
||||
Tooltip:
|
||||
'''
|
||||
Increases knockback by 10%, crit chance by 4% and defense by 5 during daytime
|
||||
Reduces life regen by 1
|
||||
Reduces life regen by 0.5 HP/s
|
||||
[c/B00BA5:'Great for mixing up daytime drinks.']
|
||||
'''
|
||||
}
|
||||
@@ -350,7 +350,7 @@ TequilaSunrise: {
|
||||
Tooltip:
|
||||
'''
|
||||
Increases knockback by 20%, crit chance by 8% and defense by 10 during daytime
|
||||
Reduces life regen by 2
|
||||
Reduces life regen by 1 HP/s
|
||||
[c/B00BA5:'The greatest daytime drink I've ever had.']
|
||||
'''
|
||||
}
|
||||
@@ -360,7 +360,7 @@ Vodka: {
|
||||
Tooltip:
|
||||
'''
|
||||
Increases damage by 6% and critical strike chance by 2%
|
||||
Reduces life regen by 1 and defense by 5%
|
||||
Reduces life regen by 0.5 HP/s and defense by 5%
|
||||
[c/B00BA5:'The number one alcohol for creating great mixed drinks.']
|
||||
'''
|
||||
}
|
||||
@@ -380,7 +380,7 @@ WhiteWine: {
|
||||
Tooltip:
|
||||
'''
|
||||
Increases magic damage by 8%
|
||||
Reduces defense by 6% and life regen by 1
|
||||
Reduces defense by 6% and life regen by 0.5 HP/s
|
||||
[c/B00BA5:'I drank a full barrel of this stuff once in one night, I couldn't remember who I was the next day.']
|
||||
'''
|
||||
}
|
||||
@@ -164,7 +164,9 @@ SnakeEyes: {
|
||||
DisplayName: Snake Eyes
|
||||
Tooltip:
|
||||
'''
|
||||
Summons a mechanical surveillance drone that flies around enemies and mercilessly zaps them with electricity
|
||||
Summons a levitating drone which fires piercing, highly calibrated energy bolts
|
||||
If a bolt hits, the drone will teleport into its path and reflect the bolt
|
||||
Reflected bolts home in and explode on impact
|
||||
[c/1FFBFF:'Equipped with high-end sensors, little can evade them. Even less are able to escape their ever watchful eyes.]
|
||||
[c/1FFBFF:An excellent bridge between my experiments with the sight-based soul powered machines and my latest project.']
|
||||
'''
|
||||
|
||||
@@ -843,7 +843,7 @@ OrichalcumSpikedGemstone: {
|
||||
|
||||
PalladiumJavelin: {
|
||||
DisplayName: Palladium Javelin
|
||||
Tooltip: Stealth strikes split into more javelins and boost life regeneration on hits
|
||||
Tooltip: Stealth strikes split into more javelins and boost natural life regeneration on hits
|
||||
}
|
||||
|
||||
Penumbra: {
|
||||
@@ -1337,7 +1337,7 @@ UtensilPoker: {
|
||||
DisplayName: Utensil Poker
|
||||
Tooltip:
|
||||
'''
|
||||
Fires random utensils in bursts of three
|
||||
Fires utensils in bursts of three
|
||||
Stealth strikes replace any utensil with a powerful butcher knife
|
||||
'Space chickens, that is all'
|
||||
'''
|
||||
|
||||
@@ -45,6 +45,7 @@ UnstableMatter.DisplayName: Unstable Matter
|
||||
VoltageStream.DisplayName: Voltage Stream
|
||||
WavePounderBoom.DisplayName: Explosion
|
||||
WavePounderProjectile.DisplayName: Wave Pounder
|
||||
SnakeEyesProjectile.DisplayName: Inescapable Bolt
|
||||
// Environmental
|
||||
AcidDrop.DisplayName: Acid
|
||||
BrimstoneGeyser.DisplayName: Smoke
|
||||
|
||||
@@ -7,6 +7,7 @@ using CalamityMod.Events;
|
||||
using CalamityMod.Items;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Particles.Metaballs;
|
||||
using CalamityMod.Systems;
|
||||
using CalamityMod.UI;
|
||||
using CalamityMod.UI.CalamitasEnchants;
|
||||
using CalamityMod.UI.DraedonSummoning;
|
||||
@@ -521,6 +522,13 @@ namespace CalamityMod
|
||||
return CalamityWorld.armageddon = enabled;
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddCustomDifficulty(DifficultyMode newMode)
|
||||
{
|
||||
//Add the new difficulty and recalculate
|
||||
DifficultyModeSystem.Difficulties.Add(newMode);
|
||||
DifficultyModeSystem.CalculateDifficultyData();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Rogue Class
|
||||
@@ -1865,6 +1873,16 @@ namespace CalamityMod
|
||||
return new ArgumentException("ERROR: The first argument to \"SetDifficulty\" must be a string.");
|
||||
return SetDifficultyActive(args[1].ToString(), enabled);
|
||||
|
||||
|
||||
case "AddDifficultyToUI":
|
||||
if (args.Length < 2)
|
||||
return new ArgumentException("ERROR: Not enough arguements provided");
|
||||
|
||||
if (args[1] is not DifficultyMode mode)
|
||||
return new ArgumentException("ERROR: A class inheriting from 'DifficultyMode' must be provided.");
|
||||
AddCustomDifficulty(mode);
|
||||
return null;
|
||||
|
||||
case "GetLight":
|
||||
case "GetLightLevel":
|
||||
case "GetLightStrength":
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace CalamityMod.NPCs.Leviathan
|
||||
{
|
||||
SoundID.Zombie38,
|
||||
SoundID.Zombie39,
|
||||
SoundID.Zombie49
|
||||
SoundID.Zombie40
|
||||
});
|
||||
|
||||
if (soundDelay > 0)
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using CalamityMod.Items.Weapons.DraedonsArsenal;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
{
|
||||
public class SnakeEyesProjectile : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Misc";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
public NPC TargetShot => Main.npc[(int)TargetID];
|
||||
public NPC Target => Projectile.Center.MinionHoming(SnakeEyes.EnemyDistanceDetection, Owner);
|
||||
|
||||
public ref float MinionID => ref Projectile.ai[0];
|
||||
public ref float TargetID => ref Projectile.ai[1];
|
||||
public ref float TimerToRedirect => ref Projectile.ai[2];
|
||||
|
||||
public bool HasHitEnemy = false;
|
||||
public bool HasRedirected = false;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.MinionShot[Type] = true;
|
||||
|
||||
// While this projectile doesn't have afterimages, it keeps track of old positions for its primitive drawcode.
|
||||
ProjectileID.Sets.TrailingMode[Type] = 2;
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 6;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.DamageType = DamageClass.Summon;
|
||||
Projectile.localNPCHitCooldown = 10;
|
||||
Projectile.width = Projectile.height = 16;
|
||||
Projectile.timeLeft = 120;
|
||||
Projectile.penetrate = -1;
|
||||
|
||||
Projectile.friendly = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.netImportant = true;
|
||||
}
|
||||
|
||||
#region Variable Syncing
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(HasHitEnemy);
|
||||
writer.Write(HasRedirected);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
HasHitEnemy = reader.ReadBoolean();
|
||||
HasRedirected = reader.ReadBoolean();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (HasHitEnemy && TimerToRedirect < SnakeEyes.TimeToRedirect)
|
||||
TimerToRedirect++;
|
||||
|
||||
if (TimerToRedirect >= SnakeEyes.TimeToRedirect && !HasRedirected)
|
||||
{
|
||||
if (TargetShot is not null)
|
||||
TargetEnemy(TargetShot);
|
||||
else if (Target is not null)
|
||||
TargetEnemy(Target);
|
||||
}
|
||||
|
||||
if (HasRedirected)
|
||||
{
|
||||
if (TargetShot is not null)
|
||||
FollowEnemy(TargetShot);
|
||||
else if (Target is not null)
|
||||
FollowEnemy(Target);
|
||||
else
|
||||
Projectile.Kill();
|
||||
|
||||
Projectile.timeLeft = 2;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Dust trailDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, HasRedirected ? 261 : 226, Scale: HasRedirected ? 2f : .5f);
|
||||
trailDust.velocity = Vector2.Zero;
|
||||
trailDust.noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
#region AI Methods
|
||||
|
||||
private void TargetEnemy(NPC target)
|
||||
{
|
||||
Projectile.velocity = Projectile.SafeDirectionTo(target.Center) * SnakeEyes.ProjectileSpeed;
|
||||
HasRedirected = true;
|
||||
|
||||
SoundEngine.PlaySound(SoundID.Item92 with { Volume = .8f, Pitch = .5f, PitchVariance = .1f }, Projectile.Center);
|
||||
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
|
||||
private void FollowEnemy(NPC target)
|
||||
{
|
||||
Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(target.Center) * SnakeEyes.ProjectileSpeed, .2f);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
HasHitEnemy = true;
|
||||
|
||||
if (HasRedirected && TargetShot == target)
|
||||
Projectile.Kill();
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
if (!HasRedirected)
|
||||
return;
|
||||
|
||||
Projectile.ExpandHitboxBy(300);
|
||||
Projectile.Damage();
|
||||
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
Dust boomDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 261, Scale: 2f);
|
||||
boomDust.noGravity = true;
|
||||
}
|
||||
|
||||
Particle boom = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.White, Vector2.One, 0f, 0.05f, 1f + Main.rand.NextFloat(0.2f), 20);
|
||||
GeneralParticleHandler.SpawnParticle(boom);
|
||||
|
||||
SoundEngine.PlaySound(SoundID.Item14, Projectile.Center);
|
||||
}
|
||||
|
||||
#region Shader Trail Methods
|
||||
|
||||
private float PrimitiveWidthFunction(float completionRatio)
|
||||
{
|
||||
float arrowheadCutoff = 0.36f;
|
||||
float width = 39f;
|
||||
float minHeadWidth = 0.02f;
|
||||
float maxHeadWidth = width;
|
||||
if (completionRatio <= arrowheadCutoff)
|
||||
width = MathHelper.Lerp(minHeadWidth, maxHeadWidth, Utils.GetLerpValue(0f, arrowheadCutoff, completionRatio, true));
|
||||
return width;
|
||||
}
|
||||
|
||||
private Color PrimitiveColorFunction(float completionRatio)
|
||||
{
|
||||
float endFadeRatio = 0.41f;
|
||||
|
||||
float completionRatioFactor = 2.7f;
|
||||
float globalTimeFactor = 5.3f;
|
||||
float endFadeFactor = 3.2f;
|
||||
float endFadeTerm = Utils.GetLerpValue(0f, endFadeRatio * 0.5f, completionRatio, true) * endFadeFactor;
|
||||
float cosArgument = completionRatio * completionRatioFactor - Main.GlobalTimeWrappedHourly * globalTimeFactor + endFadeTerm;
|
||||
float startingInterpolant = (float)Math.Cos(cosArgument) * 0.5f + 0.5f;
|
||||
|
||||
float colorLerpFactor = 0.6f;
|
||||
Color startingColor = Color.Lerp(HasRedirected ? Color.White with { A = 50 } : new Color(0, 0, 0, 0), HasRedirected ? Color.White with { A = 100 } : Color.Cyan with { A = 25 }, startingInterpolant * colorLerpFactor);
|
||||
|
||||
return Color.Lerp(startingColor, HasRedirected ? Color.White : Color.DarkCyan with { A = 50 }, MathHelper.SmoothStep(0f, 1f, Utils.GetLerpValue(0f, endFadeRatio, completionRatio, true)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
|
||||
Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame);
|
||||
Vector2 origin = frame.Size() * 0.5f;
|
||||
Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0);
|
||||
|
||||
PrimitiveTrail trail = new PrimitiveTrail(PrimitiveWidthFunction, PrimitiveColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]);
|
||||
GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/FabstaffStreak"));
|
||||
trail.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, 92);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,260 +1,256 @@
|
||||
using CalamityMod.Buffs.Summon;
|
||||
using System;
|
||||
using CalamityMod.Buffs.Summon;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Items.Weapons.DraedonsArsenal;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
{
|
||||
public class SnakeEyesSummon : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Misc";
|
||||
public bool SufferingFromSeparationAnxiety = false;
|
||||
public Vector2 OldCenter;
|
||||
public Vector2 Destination;
|
||||
|
||||
public float Time
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
public CalamityPlayer ModdedOwner => Owner.Calamity();
|
||||
public NPC Target => Owner.Center.MinionHoming(SnakeEyes.EnemyDistanceDetection, Owner);
|
||||
|
||||
public enum AIState
|
||||
{
|
||||
get => Projectile.ai[0];
|
||||
set => Projectile.ai[0] = value;
|
||||
Idle,
|
||||
Targetting,
|
||||
Redirecting
|
||||
}
|
||||
public AIState State
|
||||
{
|
||||
get => (AIState)Projectile.ai[0];
|
||||
set => Projectile.ai[0] = (int)value;
|
||||
}
|
||||
public ref float AITimer => ref Projectile.ai[1];
|
||||
public ref float EyeAngle => ref Projectile.localAI[0];
|
||||
public ref float EyeOutwardness => ref Projectile.localAI[1];
|
||||
|
||||
public float EyeOutwardness = 1f;
|
||||
public float EyeRotation = 0f;
|
||||
public bool HasShot = false;
|
||||
public bool HasTeleported = false;
|
||||
public Vector2 RandomPosition;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.MinionSacrificable[Projectile.type] = true;
|
||||
ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true;
|
||||
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
|
||||
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4;
|
||||
ProjectileID.Sets.MinionSacrificable[Type] = true;
|
||||
ProjectileID.Sets.MinionTargettingFeature[Type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.DamageType = DamageClass.Summon;
|
||||
Projectile.minionSlots = 1f;
|
||||
Projectile.width = Projectile.height = 22;
|
||||
Projectile.netImportant = true;
|
||||
Projectile.friendly = true;
|
||||
Projectile.minionSlots = 1;
|
||||
Projectile.timeLeft = 18000;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft *= 5;
|
||||
|
||||
Projectile.friendly = true;
|
||||
Projectile.minion = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.DamageType = DamageClass.Summon;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(SufferingFromSeparationAnxiety);
|
||||
writer.Write(EyeOutwardness);
|
||||
writer.Write(EyeRotation);
|
||||
writer.WriteVector2(OldCenter);
|
||||
writer.WriteVector2(Destination);
|
||||
}
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
SufferingFromSeparationAnxiety = reader.ReadBoolean();
|
||||
EyeOutwardness = reader.ReadSingle();
|
||||
EyeRotation = reader.ReadSingle();
|
||||
OldCenter = reader.ReadVector2();
|
||||
Destination = reader.ReadVector2();
|
||||
Projectile.netImportant = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player player = Main.player[Projectile.owner];
|
||||
if (Projectile.localAI[0] == 0f)
|
||||
// Checks if the minion can still exist given the player's circumstance.
|
||||
CheckMinionExistence();
|
||||
|
||||
// The properties of the minion's pupil, it looks around the target if there's one and to the mouse if there isn't any.
|
||||
EyeAngle = Projectile.SafeDirectionTo((Target is not null) ? Target.Center : Main.MouseWorld).ToRotation();
|
||||
EyeOutwardness = Utils.Remap(Projectile.Distance((Target is not null) ? Target.Center : Main.MouseWorld), 0f, 300f, 0f, 5f);
|
||||
|
||||
// Random flavor pulse.
|
||||
if (Main.rand.NextBool(100))
|
||||
{
|
||||
Initialize(player);
|
||||
Projectile.localAI[0] = 1f;
|
||||
Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.DarkCyan, Vector2.One, 0f, 0.05f, 0.4f + Main.rand.NextFloat(0.2f), 30);
|
||||
GeneralParticleHandler.SpawnParticle(pulse);
|
||||
}
|
||||
GrantBuffs(player);
|
||||
NPC potentialTarget = Projectile.Center.MinionHoming(820f, player);
|
||||
if (potentialTarget == null || SufferingFromSeparationAnxiety)
|
||||
|
||||
switch (State)
|
||||
{
|
||||
Projectile.ai[1] = 0f;
|
||||
if (Projectile.localAI[1] == 1f)
|
||||
case AIState.Idle:
|
||||
IdleState();
|
||||
break;
|
||||
case AIState.Targetting:
|
||||
TargettingState();
|
||||
break;
|
||||
case AIState.Redirecting:
|
||||
RedirectingState();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#region AI Methods
|
||||
|
||||
private void IdleState()
|
||||
{
|
||||
AITimer += .01f;
|
||||
|
||||
// The projectile oscillates in place.
|
||||
Projectile.velocity.Y -= MathF.Cos(AITimer) / 350f;
|
||||
|
||||
// If the player's far enough from the minion, he'll teleport somewhere around the player.
|
||||
if (!Projectile.WithinRange(Owner.Center, 400f))
|
||||
{
|
||||
Projectile.Center = Owner.Center + Main.rand.NextVector2Circular(300f, 300f);
|
||||
DoVFXPulse();
|
||||
}
|
||||
|
||||
if (Target is not null)
|
||||
SwitchAIState(AIState.Targetting);
|
||||
}
|
||||
|
||||
private void TargettingState()
|
||||
{
|
||||
if (Target is not null)
|
||||
{
|
||||
// The minion decides a random position around the target.
|
||||
if (!HasTeleported)
|
||||
{
|
||||
Time = 0f;
|
||||
Projectile.localAI[1] = 0f;
|
||||
RandomPosition = Target.Center + Main.rand.NextVector2CircularEdge(400f, 400f);
|
||||
Projectile.Center = RandomPosition;
|
||||
|
||||
DoVFXPulse();
|
||||
|
||||
HasTeleported = true;
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// The projectile will stay on that position.
|
||||
Projectile.Center = RandomPosition;
|
||||
|
||||
// When the delay is over, shoot at the target.
|
||||
if (!HasShot && AITimer >= SnakeEyes.TimeToShoot)
|
||||
ShootProjectile();
|
||||
|
||||
// When the minion has shot, when the projectile redirects towards the target,
|
||||
// the minion will teleport on that moment on top of the projectile,
|
||||
// so it looks like the minion deflected his own projectile.
|
||||
if (HasShot)
|
||||
{
|
||||
for (int i = 0; i < Main.maxProjectiles; i++)
|
||||
{
|
||||
Projectile proj = Main.projectile[i];
|
||||
if (proj is not null && proj.active && proj.type == ModContent.ProjectileType<SnakeEyesProjectile>() && proj.owner == Owner.whoAmI && proj.ModProjectile<SnakeEyesProjectile>().MinionID == Projectile.whoAmI && proj.ModProjectile<SnakeEyesProjectile>().HasRedirected)
|
||||
{
|
||||
Projectile.Center = proj.Center;
|
||||
SwitchAIState(AIState.Redirecting);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If the projectile failed to hit it's enemy and therefore couldn't deflect,
|
||||
// repeat this process.
|
||||
if (AITimer >= SnakeEyes.TimeToShoot + 120f)
|
||||
SwitchAIState(AIState.Targetting);
|
||||
|
||||
AITimer++;
|
||||
}
|
||||
PlayerMovement(player);
|
||||
}
|
||||
else
|
||||
SwitchAIState(AIState.Idle);
|
||||
}
|
||||
|
||||
private void ShootProjectile()
|
||||
{
|
||||
if (Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
if (Projectile.localAI[1] == 0f)
|
||||
{
|
||||
Time = 0f;
|
||||
Projectile.localAI[1] = 1f;
|
||||
}
|
||||
NPCMovement(potentialTarget);
|
||||
}
|
||||
if (!SufferingFromSeparationAnxiety && Projectile.Distance(player.Center) > (potentialTarget is null ? 360f : 1800f))
|
||||
{
|
||||
SufferingFromSeparationAnxiety = true;
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, Target, SnakeEyes.ProjectileSpeed), ModContent.ProjectileType<SnakeEyesProjectile>(), Projectile.damage, Projectile.knockBack, Owner.whoAmI, Projectile.whoAmI, Target.whoAmI);
|
||||
|
||||
DoVFXPulse();
|
||||
|
||||
SoundEngine.PlaySound(SoundID.Item91 with { Volume = .8f, Pitch = .5f, PitchVariance = .1f }, Projectile.Center);
|
||||
|
||||
HasShot = true;
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
else if (SufferingFromSeparationAnxiety && Projectile.Distance(player.Center) < (potentialTarget is null ? 10f : 120f))
|
||||
{
|
||||
SufferingFromSeparationAnxiety = false;
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
GenerateAfterimageDust();
|
||||
}
|
||||
Time++;
|
||||
}
|
||||
|
||||
public void Initialize(Player player)
|
||||
private void RedirectingState()
|
||||
{
|
||||
Destination = Projectile.Center - Vector2.UnitY * 180f;
|
||||
for (int i = 0; i < 45; i++)
|
||||
if (Target is not null)
|
||||
{
|
||||
float angle = MathHelper.TwoPi / 45f * i;
|
||||
Vector2 velocity = angle.ToRotationVector2() * 4f;
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + velocity * 2.75f, 39, velocity);
|
||||
dust.noGravity = true;
|
||||
// The projectile will idle on the spot where he "deflected" the projectile to restart the process.
|
||||
if (AITimer < SnakeEyes.TimeToRestart)
|
||||
AITimer++;
|
||||
else
|
||||
SwitchAIState(AIState.Targetting);
|
||||
}
|
||||
else
|
||||
SwitchAIState(AIState.Idle);
|
||||
}
|
||||
|
||||
public void GrantBuffs(Player player)
|
||||
private void SwitchAIState(AIState state)
|
||||
{
|
||||
bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType<SnakeEyesSummon>();
|
||||
player.AddBuff(ModContent.BuffType<SnakeEyesBuff>(), 3600);
|
||||
if (isCorrectProjectile)
|
||||
{
|
||||
if (player.dead)
|
||||
{
|
||||
player.Calamity().snakeEyes = false;
|
||||
}
|
||||
if (player.Calamity().snakeEyes)
|
||||
{
|
||||
Projectile.timeLeft = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
State = state;
|
||||
AITimer = 0f;
|
||||
HasTeleported = false;
|
||||
HasShot = false;
|
||||
RandomPosition = Vector2.Zero;
|
||||
|
||||
public void PlayerMovement(Player player)
|
||||
{
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
if (!SufferingFromSeparationAnxiety)
|
||||
{
|
||||
Projectile.Center = player.Center - Vector2.UnitY * (80f + (float)Math.Sin(Time / 120f * MathHelper.TwoPi) * 30f);
|
||||
EyeOutwardness = MathHelper.Lerp(EyeOutwardness, 0f, 0.15f);
|
||||
|
||||
DoVFXPulse(state == AIState.Redirecting);
|
||||
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
|
||||
private void CheckMinionExistence()
|
||||
{
|
||||
Owner.AddBuff(ModContent.BuffType<SnakeEyesBuff>(), 2);
|
||||
if (Type != ModContent.ProjectileType<SnakeEyesSummon>())
|
||||
return;
|
||||
}
|
||||
if (Time % 150f == 0f)
|
||||
{
|
||||
OldCenter = Projectile.Center;
|
||||
}
|
||||
else if (Time % 150f <= 35f)
|
||||
{
|
||||
EyeRotation = Projectile.AngleTo(player.Center);
|
||||
EyeOutwardness = MathHelper.Lerp(EyeOutwardness, 1f, 0.15f);
|
||||
Projectile.Center = Vector2.SmoothStep(OldCenter, player.Center - Vector2.UnitY * 80f, Utils.GetLerpValue(0f, 35f, Time % 150f));
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.Center = player.Center - Vector2.UnitY * (80f + (float)Math.Sin((Time % 150f - 35f) / 115f * MathHelper.TwoPi) * 30f);
|
||||
}
|
||||
EyeOutwardness = MathHelper.Lerp(EyeOutwardness, 0f, 0.15f);
|
||||
|
||||
if (Owner.dead)
|
||||
ModdedOwner.snakeEyes = false;
|
||||
if (ModdedOwner.snakeEyes)
|
||||
Projectile.timeLeft = 2;
|
||||
}
|
||||
|
||||
public void NPCMovement(NPC npc)
|
||||
private void DoVFXPulse(bool empowered = false)
|
||||
{
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
Vector2 offsetMultiplier = Vector2.UnitX;
|
||||
switch ((int)Projectile.ai[1] % 4)
|
||||
int dustAmount = 40;
|
||||
for (int dustIndex = 0; dustIndex < dustAmount; dustIndex++)
|
||||
{
|
||||
case 0:
|
||||
offsetMultiplier = new Vector2(-1f, -1f);
|
||||
break;
|
||||
case 1:
|
||||
offsetMultiplier = new Vector2(-1f, 1f);
|
||||
break;
|
||||
case 2:
|
||||
offsetMultiplier = new Vector2(1f, 1f);
|
||||
break;
|
||||
case 3:
|
||||
offsetMultiplier = new Vector2(1f, -1f);
|
||||
break;
|
||||
}
|
||||
if (Time % 20f == 0f)
|
||||
{
|
||||
if (Projectile.ai[1] > 0 && Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
Vector2 shootPosition = Projectile.Center + Utils.Vector2FromElipse(EyeRotation.ToRotationVector2(), Projectile.Size * 0.5f * EyeOutwardness);
|
||||
Vector2 shootVelocity = Projectile.SafeDirectionTo(npc.Center, Main.rand.NextVector2Unit()) * 4f;
|
||||
int laser = Projectile.NewProjectile(Projectile.GetSource_FromThis(), shootPosition, shootVelocity, ProjectileID.UFOLaser, Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
if (laser.WithinBounds(Main.maxProjectiles))
|
||||
{
|
||||
Main.projectile[laser].timeLeft *= 2;
|
||||
Main.projectile[laser].originalDamage = Projectile.originalDamage;
|
||||
Main.projectile[laser].tileCollide = false;
|
||||
Main.projectile[laser].netUpdate = true;
|
||||
Main.projectile[laser].DamageType = DamageClass.Summon;
|
||||
}
|
||||
}
|
||||
Projectile.ai[1]++;
|
||||
OldCenter = Projectile.Center;
|
||||
}
|
||||
else
|
||||
{
|
||||
EyeOutwardness = MathHelper.Lerp(EyeOutwardness, 1f, 0.15f);
|
||||
EyeRotation = EyeRotation.AngleTowards(Projectile.AngleTo(npc.Center), MathHelper.TwoPi / 20f);
|
||||
Projectile.Center = Vector2.SmoothStep(OldCenter, npc.Center + (new Vector2(300f) + Projectile.Size * 0.5f) * offsetMultiplier, Time % 20f / 20f);
|
||||
float angle = MathHelper.TwoPi / dustAmount * dustIndex;
|
||||
Vector2 velocity = angle.ToRotationVector2() * 9f;
|
||||
Dust pulseDust = Dust.NewDustPerfect(Projectile.Center, empowered ? 261 : 226, velocity, Scale: empowered ? 2f : .5f);
|
||||
pulseDust.noGravity = true;
|
||||
}
|
||||
|
||||
Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, empowered ? Color.White : Color.DarkCyan * 1.2f, Vector2.One, 0f, 0.05f, 0.5f + Main.rand.NextFloat(0.2f), 20);
|
||||
GeneralParticleHandler.SpawnParticle(pulse);
|
||||
}
|
||||
|
||||
public void GenerateAfterimageDust()
|
||||
{
|
||||
for (int i = 1; i < Projectile.oldPos.Length; i++)
|
||||
{
|
||||
if (i == 1)
|
||||
{
|
||||
for (int j = 0; j < 14; j++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, 261);
|
||||
dust.position += (j / 14f * MathHelper.TwoPi).ToRotationVector2() * Projectile.Size * 0.5f * 1.3f;
|
||||
dust.velocity = Vector2.Zero;
|
||||
dust.scale = 0.6f;
|
||||
dust.noGravity = true;
|
||||
}
|
||||
}
|
||||
if (Vector2.Distance(Projectile.oldPos[i - 1], Projectile.oldPos[i]) > 3f)
|
||||
{
|
||||
for (int j = 0; j < 7; j++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.oldPos[i] + Projectile.Size * 0.5f, 261);
|
||||
dust.position += (j / 7f * MathHelper.TwoPi).ToRotationVector2() * ((Projectile.oldPos.Length - i) * 1.2f + 3f);
|
||||
dust.velocity = Vector2.Zero;
|
||||
dust.scale = 0.6f;
|
||||
dust.noGravity = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public override void OnSpawn(IEntitySource source) => DoVFXPulse();
|
||||
|
||||
public override bool? CanDamage() => false;
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
CalamityUtils.DrawAfterimagesCentered(Projectile, 0, Color.White, ProjectileID.Sets.TrailCacheLength[Projectile.type]);
|
||||
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
|
||||
Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame);
|
||||
Vector2 origin = frame.Size() * 0.5f;
|
||||
Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0);
|
||||
|
||||
Texture2D eyeTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/DraedonsArsenal/SnakeEye").Value;
|
||||
Vector2 offsetVector = Utils.Vector2FromElipse(EyeRotation.ToRotationVector2(), Projectile.Size * 0.5f * EyeOutwardness);
|
||||
Main.EntitySpriteDraw(eyeTexture,
|
||||
Projectile.Center + offsetVector - Main.screenPosition,
|
||||
null,
|
||||
Color.White,
|
||||
0f,
|
||||
eyeTexture.Size() * 0.5f,
|
||||
1f,
|
||||
SpriteEffects.None,
|
||||
0);
|
||||
Vector2 eyeDrawPosition = Projectile.Center - Main.screenPosition + EyeAngle.ToRotationVector2() * EyeOutwardness;
|
||||
Main.EntitySpriteDraw(eyeTexture, eyeDrawPosition, null, Color.White, 0f, eyeTexture.Size() * 0.5f, 1f, SpriteEffects.None, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,13 +19,11 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Projectile.height = 20;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Melee;
|
||||
Projectile.penetrate = 2;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.timeLeft = 90;
|
||||
Projectile.aiStyle = ProjAIStyleID.Beam;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
|
||||
@@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Summon
|
||||
Projectile.minion = true;
|
||||
Projectile.friendly = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.DamageType = DamageClass.Summon;
|
||||
}
|
||||
|
||||
@@ -34,6 +36,16 @@ namespace CalamityMod.Projectiles.Summon
|
||||
|
||||
public override void Kill(int timeLeft) // When the projectile hits an enemy, it'll make a dust impact effect.
|
||||
{
|
||||
Projectile.position = Projectile.Center;
|
||||
Projectile.width = Projectile.height = 64;
|
||||
Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2);
|
||||
Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2);
|
||||
Projectile.maxPenetrate = -1;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 10;
|
||||
Projectile.damage = (int)(Projectile.damage * 0.6f);
|
||||
Projectile.Damage();
|
||||
SoundEngine.PlaySound(SoundID.Item14, Projectile.position);
|
||||
for (int dustIndex = 0; dustIndex < 36; dustIndex++)
|
||||
{
|
||||
|
||||
@@ -143,11 +143,16 @@ namespace CalamityMod.Projectiles.Summon
|
||||
|
||||
public void ShootTarget(NPC target)
|
||||
{
|
||||
if (TimerForShooting == SandSharknadoStaff.FireSpeed && Main.myPlayer == Projectile.owner)
|
||||
int randomDelay = Main.rand.Next(-5, 6);
|
||||
Vector2 targetPos = target.Center;
|
||||
Vector2 ProjVel = targetPos - Projectile.Center;
|
||||
ProjVel.Normalize();
|
||||
ProjVel *= SandSharknadoStaff.ProjSpeed;
|
||||
if (TimerForShooting == SandSharknadoStaff.FireSpeed + randomDelay && Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
int sandSharkProj = Projectile.NewProjectile(Projectile.GetSource_FromThis(),
|
||||
Projectile.Center,
|
||||
CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, target, SandSharknadoStaff.ProjVel),
|
||||
ProjVel,
|
||||
ModContent.ProjectileType<MiniSandShark>(),
|
||||
Projectile.damage,
|
||||
Projectile.knockBack,
|
||||
|
||||
@@ -22,23 +22,51 @@ namespace CalamityMod.Systems
|
||||
{
|
||||
internal static bool _hasCheckedItOutYet = false; //Simple variable to add a cool effect to the mode selector
|
||||
|
||||
public static DifficultyMode[] Difficulties; //Difficulty modes ordered by ascending difficulty
|
||||
public static List<DifficultyMode> Difficulties = new List<DifficultyMode>(); //Difficulty modes ordered by ascending difficulty
|
||||
public static List<DifficultyMode[]> DifficultyTiers; //Difficulty modes grouped together by difficulty
|
||||
public static int MostAlternateDifficulties; //The most alternate difficulties at any tier that exists. Used to know the widest space to take in the ui
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
MostAlternateDifficulties = 1;
|
||||
Difficulties = new DifficultyMode[] { new NoDifficulty(), new RevengeanceDifficulty(), new DeathDifficulty()};
|
||||
//Initialize base mod difficulties
|
||||
Difficulties = new List<DifficultyMode>() { new NoDifficulty(), new RevengeanceDifficulty(), new DeathDifficulty()};
|
||||
|
||||
//All of this should happen after a hook happens which lets other mods add their own difficulties
|
||||
Difficulties = Difficulties.OrderBy(d => d.DifficultyScale).ToArray();
|
||||
CalculateDifficultyData();
|
||||
}
|
||||
|
||||
public override void Unload()
|
||||
{
|
||||
Difficulties = null;
|
||||
}
|
||||
|
||||
public static DifficultyMode GetCurrentDifficulty
|
||||
{
|
||||
get
|
||||
{
|
||||
DifficultyMode mode = Difficulties[0];
|
||||
|
||||
for (int i = 1; i < Difficulties.Count; i++)
|
||||
{
|
||||
if (Difficulties[i].Enabled)
|
||||
mode = Difficulties[i];
|
||||
}
|
||||
|
||||
return mode;
|
||||
}
|
||||
}
|
||||
|
||||
public static void CalculateDifficultyData()
|
||||
{
|
||||
MostAlternateDifficulties = 1;
|
||||
Difficulties.OrderBy(d => d.DifficultyScale);
|
||||
|
||||
//Difficulties are arranged in "tiers". This is done so that multiple mods can add their own alternate difficulties sharing a tier with the base ones
|
||||
DifficultyTiers = new List<DifficultyMode[]>();
|
||||
float currentTier = -1;
|
||||
int tierIndex = -1;
|
||||
|
||||
for (int i = 0; i < Difficulties.Length; i++)
|
||||
for (int i = 0; i < Difficulties.Count; i++)
|
||||
{
|
||||
//if we are at a new tier, create a new list of difficulties at that tier.
|
||||
if (currentTier != Difficulties[i].DifficultyScale)
|
||||
@@ -53,7 +81,6 @@ namespace CalamityMod.Systems
|
||||
{
|
||||
//ugly
|
||||
DifficultyTiers[tierIndex] = DifficultyTiers[tierIndex].Append(Difficulties[i]).ToArray();
|
||||
|
||||
MostAlternateDifficulties = Math.Max(DifficultyTiers[tierIndex].Length, MostAlternateDifficulties);
|
||||
}
|
||||
|
||||
@@ -61,27 +88,6 @@ namespace CalamityMod.Systems
|
||||
}
|
||||
}
|
||||
|
||||
public override void Unload()
|
||||
{
|
||||
Difficulties = null;
|
||||
}
|
||||
|
||||
public static DifficultyMode GetCurrentDifficulty
|
||||
{
|
||||
get
|
||||
{
|
||||
DifficultyMode mode = Difficulties[0];
|
||||
|
||||
for (int i = 1; i < Difficulties.Length; i++)
|
||||
{
|
||||
if (Difficulties[i].Enabled)
|
||||
mode = Difficulties[i];
|
||||
}
|
||||
|
||||
return mode;
|
||||
}
|
||||
}
|
||||
|
||||
public override void SaveWorldData(TagCompound tag)
|
||||
{
|
||||
//Apparently this is ran after worldgen so it cant always be set to true
|
||||
|
||||
@@ -210,7 +210,7 @@ namespace CalamityMod.UI.ModeIndicator
|
||||
string modeToDisplay = Difficulties[1].Name.ToString();
|
||||
bool anyActiveMode = false;
|
||||
|
||||
for (int i = 1; i < Difficulties.Length; i++)
|
||||
for (int i = 1; i < Difficulties.Count; i++)
|
||||
{
|
||||
if (GetCurrentDifficulty == Difficulties[i])
|
||||
{
|
||||
@@ -406,7 +406,7 @@ namespace CalamityMod.UI.ModeIndicator
|
||||
// But would be super useful so other mods can let their own difficulties go there.
|
||||
|
||||
// Disable difficulties.
|
||||
for (int i = 0; i < Difficulties.Length; i++)
|
||||
for (int i = 0; i < Difficulties.Count; i++)
|
||||
{
|
||||
// Disable all difficulties at the same tier / at a tier above itself.
|
||||
if (Difficulties[i]._difficultyTier >= mode._difficultyTier && Difficulties[i] != mode)
|
||||
|
||||
@@ -827,6 +827,7 @@ namespace CalamityMod
|
||||
{ Vanilla(ItemID.BundleofBalloons), AddIngredient(ModContent.ItemType<AerialiteBar>(), 3) },
|
||||
{ r => r.HasResult(ItemID.HorseshoeBundle) && !r.HasIngredient(ItemID.BundleofBalloons), AddIngredient(ModContent.ItemType<AerialiteBar>(), 3) },
|
||||
{ Vanilla(ItemID.NightsEdge), AddIngredient(ModContent.ItemType<PurifiedGel>(), 5) },
|
||||
{ Vanilla(ItemID.FairyBoots), AddIngredient(ItemID.SoulofLight, 5) },
|
||||
{ Vanilla(ItemID.SpiritFlame), AddGroup(AnyAdamantiteBar, 2) },
|
||||
{ Vanilla(ItemID.TerraBlade), AddIngredient(ModContent.ItemType<LivingShard>(), 12) },
|
||||
{ Vanilla(ItemID.FireGauntlet), AddIngredient(ModContent.ItemType<ScoriaBar>(), 5) },
|
||||
|
||||
Reference in new issue
Block a user