Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 86 additions & 37 deletions Items/Ranged/Bows/GaiasBow.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using EBF.Abstract_Classes;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;

Expand All @@ -19,17 +21,17 @@ public override void SetDefaults()
Item.width = 24;//Width of the hitbox of the item (usually the item's sprite width)
Item.height = 58;//Height of the hitbox of the item (usually the item's sprite height)

Item.damage = 32;//Item's base damage value
Item.damage = 16;//Item's base damage value
Item.knockBack = 3;//Float, the item's knockback value. How far the enemy is launched when hit
Item.useTime = 30;//How fast the item is used
Item.useAnimation = 30;//How long the animation lasts. For swords it should stay the same as UseTime
Item.useTime = 35;//How fast the item is used
Item.useAnimation = 35;//How long the animation lasts. For swords it should stay the same as UseTime

Item.value = Item.buyPrice(copper: 0, silver: 0, gold: 10, platinum: 0);//Item's value when sold
Item.rare = ItemRarityID.Orange;//Item's name colour, this is hardcoded by the modder and should be based on progression
Item.shootSpeed = 7f;
base.SetDefaults();
}
//Sold by Witch Doctor
//Sold by Anna
}

public class GaiasBow_HoldoutProjectile : EBFHoldoutBow
Expand All @@ -47,38 +49,8 @@ public override void SetDefaults()
}
}

public class GaiasBow_Arrow : ModProjectile
{
private bool fullyCharged;
public override string Texture => "EBF/Items/Ranged/Bows/GaiasGift_Arrow";
public override void SetDefaults()
{
Projectile.width = 10;
Projectile.height = 10;

Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.aiStyle = ProjAIStyleID.Arrow;
Projectile.ignoreWater = true;
Projectile.localNPCHitCooldown = -1;
Projectile.usesLocalNPCImmunity = true;
}

public override void OnSpawn(IEntitySource source)
{
fullyCharged = (int)Projectile.ai[0] == 1;
}

public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
if (fullyCharged)
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<GaiaSeed>(), 1, 0, Projectile.owner);
}
}

public class GaiaSeed : ModProjectile
{
private const int LifeTime = 2; //In seconds
public override void SetDefaults()
{
Projectile.width = 36;
Expand All @@ -91,6 +63,40 @@ public override void SetDefaults()
Projectile.ignoreWater = true;
Projectile.localNPCHitCooldown = -1;
Projectile.usesLocalNPCImmunity = true;
Projectile.alpha = 255;
}
public override void AI()
{
Projectile.ai[0] += 1f;

int newWidth = (int)(18 * Projectile.scale);
int newHeight = (int)(18 * Projectile.scale);
Projectile.Resize(newWidth, newHeight);

FadeInAndOut();
{
Projectile.velocity.X = Projectile.velocity.X * 0.97f;
Projectile.velocity.Y = Projectile.velocity.Y * 0.97f;
}
}
public void FadeInAndOut()
{
// If last less than 50 ticks — fade in, than more — fade out
if (Projectile.ai[0] <= 50f)
{
// Fade in
Projectile.alpha -= 30;

Projectile.scale += 0.01f;

return;
}

// Fade out
Projectile.alpha += 30;

Projectile.scale -= 0.01f;

}

public override void OnSpawn(IEntitySource source)
Expand All @@ -105,16 +111,59 @@ public override void OnSpawn(IEntitySource source)
var dust = Dust.NewDustPerfect(Projectile.Center, DustID.Plantera_Green, velocity, Scale: 2f);
dust.noGravity = true;
}

}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(BuffID.Poisoned, 60 * 5);

}
public override void OnKill(int timeLeft)
{
/*Temporary firework explosion until we care to make our own
var proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.position, Projectile.velocity / 2, ProjectileID.RocketFireworksBoxGreen, Projectile.damage = 0, Projectile.knockBack);
proj.timeLeft = 0;*/
}
}
public class GaiasBow_Arrow : ModProjectile
{
private const int gaiaSpawnRate = 6; //How often a projectile is spawned per second
public override string Texture => "EBF/Items/Ranged/Bows/GaiasGift_Arrow";
private bool fullyCharged;
public override void SetDefaults()
{
Projectile.width = 10;
Projectile.height = 10;
Projectile.penetrate = 3;

Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.aiStyle = ProjAIStyleID.Arrow;
Projectile.ignoreWater = true;
Projectile.localNPCHitCooldown = -1;
Projectile.usesLocalNPCImmunity = true;
}
public override void OnSpawn(IEntitySource source)
{
fullyCharged = (int)Projectile.ai[0] == 1;
}
public override void AI()
{
Projectile.alpha += 255 / (60 * LifeTime); // takes 1 * lifetime seconds
if (Projectile.alpha >= 254)
Projectile.Kill();
//Prevent sub-projectiles from being spawned by other players' arrows.
if (Main.myPlayer != Projectile.owner)
return;

//Run this code x times per second
if (Main.GameUpdateCount % (60 / (gaiaSpawnRate)) == 0 && (fullyCharged))
{
var proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.position, Projectile.velocity / 2 + Main.rand.NextVector2Unit(), ModContent.ProjectileType<GaiaSeed>(), Projectile.damage, Projectile.knockBack);
proj.timeLeft = 100;
}
else if (Main.GameUpdateCount % (60 / gaiaSpawnRate*2) == 0 && (!fullyCharged))
{
var proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.position, Projectile.velocity / 2 + Main.rand.NextVector2Unit(), ModContent.ProjectileType<GaiaSeed>(), Projectile.damage, Projectile.knockBack);
proj.timeLeft = 100;
}
}
}
}
41 changes: 24 additions & 17 deletions Items/Ranged/Bows/GaiasGift.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using EBF.Abstract_Classes;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
Expand All @@ -17,10 +19,10 @@ public override void SetDefaults()
Item.width = 26;//Width of the hitbox of the item (usually the item's sprite width)
Item.height = 66;//Height of the hitbox of the item (usually the item's sprite height)

Item.damage = 61;//Item's base damage value
Item.damage = 62;//Item's base damage value
Item.knockBack = 3;//Float, the item's knockback value. How far the enemy is launched when hit
Item.useTime = 30;//How fast the item is used
Item.useAnimation = 30;//How long the animation lasts. For swords it should stay the same as UseTime
Item.useTime = 35;//How fast the item is used
Item.useAnimation = 35;//How long the animation lasts. For swords it should stay the same as UseTime

Item.value = Item.sellPrice(copper: 0, silver: 50, gold: 12, platinum: 0);//Item's value when sold
Item.rare = ItemRarityID.Pink;//Item's name colour, this is hardcoded by the modder and should be based on progression
Expand Down Expand Up @@ -52,14 +54,16 @@ public override void SetDefaults()
base.SetDefaults();
}
}

public class GaiasGift_Arrow : ModProjectile
{
private const int gaiaSpawnRate = 12; //How often a projectile is spawned per second
private bool fullyCharged;
public override void SetDefaults()
{
Projectile.width = 10;
Projectile.height = 10;
Projectile.penetrate = 5;

Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Expand All @@ -68,26 +72,29 @@ public override void SetDefaults()
Projectile.localNPCHitCooldown = -1;
Projectile.usesLocalNPCImmunity = true;
}

public override void OnSpawn(IEntitySource source)
{
fullyCharged = (int)Projectile.ai[0] == 1;
}

public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
public override void AI()
{
if (!fullyCharged)
//Prevent sub-projectiles from being spawned by other players' arrows.
if (Main.myPlayer != Projectile.owner)
return;

var player = Main.player[Projectile.owner];
player.Heal(hit.Damage / 15);

//Spawn Gaia seed
var proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<GaiaSeed>(), 1, 0, Projectile.owner);
proj.scale = 2f;

//Temporary firework explosion until we care to make our own
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ProjectileID.RocketFireworksBoxGreen, Projectile.damage, 0, Projectile.owner);
//Run this code x times per second
if (Main.GameUpdateCount % (60 / (gaiaSpawnRate)) == 0 && (fullyCharged))
{
var proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.position, Projectile.velocity / 2 + Main.rand.NextVector2Unit(), ModContent.ProjectileType<GaiaSeed>(), (Projectile.damage / 3) * 2, Projectile.knockBack);
proj.timeLeft = 100;
}
else if (Main.GameUpdateCount % (60 / gaiaSpawnRate * 2) == 0 && (!fullyCharged))
{
var proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.position, Projectile.velocity / 2 + Main.rand.NextVector2Unit(), ModContent.ProjectileType<GaiaSeed>(), (Projectile.damage /3) * 2, Projectile.knockBack);
proj.timeLeft = 100;
}
}
}
}


5 changes: 4 additions & 1 deletion Items/Ranged/Bows/TheStinger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,13 @@ protected override void OnShoot(IEntitySource source, Vector2 position, Vector2
if (FullyCharged)
{
Projectile.Kill();
for (var i = 0; i < 3; i++)
for (var i = 0; i < 4; i++)
{
var proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedByRandom(0.2d), ProjectileID.HornetStinger, Projectile.damage, Projectile.knockBack, Projectile.owner);
proj.DamageType = DamageClass.Ranged;
proj.penetrate = 2;
proj.localNPCHitCooldown = -1;
proj.usesLocalNPCImmunity = true;
}
}
else
Expand Down
8 changes: 4 additions & 4 deletions Items/Ranged/Bows/ThornBow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public override void SetDefaults()

Item.damage = 16;//Item's base damage value
Item.knockBack = 3;//Float, the item's knockback value. How far the enemy is launched when hit
Item.useTime = 26;//How fast the item is used
Item.useAnimation = 26;//How long the animation lasts. For swords it should stay the same as UseTime
Item.useTime = 21;//How fast the item is used
Item.useAnimation = 21;//How long the animation lasts. For swords it should stay the same as UseTime

Item.value = Item.sellPrice(copper: 0, silver: 55, gold: 0, platinum: 0);//Item's value when sold
Item.rare = ItemRarityID.Orange;//Item's name colour, this is hardcoded by the modder and should be based on progression
Expand Down Expand Up @@ -63,8 +63,8 @@ protected override void OnShoot(IEntitySource source, Vector2 position, Vector2
proj.DamageType = DamageClass.Ranged;
}
}

base.OnShoot(source, position, velocity, type, damage, knockback, owner, ai0, ai1, ai2);
else
base.OnShoot(source, position, velocity, type, damage, knockback, owner, ai0, ai1, ai2);
}
}
}
4 changes: 2 additions & 2 deletions Localization/en-US_Mods.EBF.Items.Weapons.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ Ranged: {
DisplayName: Gaias Gift
Tooltip:
'''
Fully charged wooden arrows drain health and spawn a Gaia Bloom on hit that poisons foes.
Wooden arrows spawn gaia seeds as it travels, fully charged arrows makes more gaia seeds.
'A gift from Gaia to her Ores, dotted with peridot and emerald.'
'''
}
Expand Down Expand Up @@ -478,7 +478,7 @@ Ranged: {
DisplayName: Gaias Bow
Tooltip:
'''
Fully charged wooden arrows spawn a poisonous gaia seed on hit foes.
Wooden arrows spawn gaia seeds as it travels, fully charged arrows makes more gaia seeds.
'Forged from mud and blessed by nature.'
'''
}
Expand Down