Added Sundial (WIP)
This commit is contained in:
parent
8c2c2e5aa0
commit
2bb7ef3935
@ -346,7 +346,8 @@ namespace Decimation.Content
|
||||
if (AmuletSlotItem.type == ModContent.ItemType<CrystalAmulet>() && Main.rand.NextBool(25))
|
||||
CrystalAmuletEffect();
|
||||
|
||||
if (this.HasEquippedAccessory(ModContent.ItemType<WaspNecklace>()) || this.HasEquippedAccessory(ModContent.ItemType<VeilOfVengeance>()))
|
||||
if (this.HasEquippedAccessory(ModContent.ItemType<WaspNecklace>()) ||
|
||||
this.HasEquippedAccessory(ModContent.ItemType<VeilOfVengeance>()))
|
||||
{
|
||||
player.AddBuff(BuffID.Panic, 300);
|
||||
SpawnWaspNecklaceWasps();
|
||||
@ -394,7 +395,8 @@ namespace Decimation.Content
|
||||
if (AmuletSlotItem.type == ModContent.ItemType<CrystalAmulet>() && Main.rand.NextBool(25))
|
||||
CrystalAmuletEffect();
|
||||
|
||||
if (this.HasEquippedAccessory(ModContent.ItemType<WaspNecklace>()) || this.HasEquippedAccessory(ModContent.ItemType<VeilOfVengeance>()))
|
||||
if (this.HasEquippedAccessory(ModContent.ItemType<WaspNecklace>()) ||
|
||||
this.HasEquippedAccessory(ModContent.ItemType<VeilOfVengeance>()))
|
||||
{
|
||||
player.AddBuff(BuffID.Panic, 300);
|
||||
SpawnWaspNecklaceWasps();
|
||||
|
||||
28
Content/Items/Weapons/DuneWyrm/Sundial.cs
Normal file
28
Content/Items/Weapons/DuneWyrm/Sundial.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using Decimation.Lib.Items;
|
||||
using Decimation.Lib.Util;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace Decimation.Content.Items.Weapons.DuneWyrm
|
||||
{
|
||||
public class Sundial : DecimationWeapon
|
||||
{
|
||||
protected override string ItemName => "Sundial";
|
||||
protected override int Damages => 15;
|
||||
protected override DamageType DamagesType => DamageType.Magic;
|
||||
protected override int ProjectileId => ModContent.ProjectileType<Projectiles.DuneWyrm.Sundial>();
|
||||
|
||||
protected override void InitWeapon()
|
||||
{
|
||||
item.width = 36;
|
||||
item.height = 42;
|
||||
item.shootSpeed = 1f;
|
||||
item.mana = 10; // TODO
|
||||
item.autoReuse = true;
|
||||
item.useStyle = 5;
|
||||
item.useTime = 24;
|
||||
item.useAnimation = 24;
|
||||
item.crit = 15;
|
||||
item.rare = Rarity.LightRed.GetRarityValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Content/Items/Weapons/DuneWyrm/Sundial.png
Normal file
BIN
Content/Items/Weapons/DuneWyrm/Sundial.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 759 B |
@ -11,7 +11,8 @@ namespace Decimation.Content.Items.Weapons
|
||||
public class Slimer : DecimationWeapon
|
||||
{
|
||||
protected override string ItemName => "The Slimer";
|
||||
protected override string ItemTooltip => "Doesn't hurt, but this stuff is sticky!";
|
||||
protected override string ItemTooltip => "Shoots a stream of sticky green slime\n" +
|
||||
"Doesn't hurt, but this stuff is sticky!";
|
||||
protected override int Damages => 0;
|
||||
protected override DamageType DamagesType => DamageType.Ranged;
|
||||
protected override int ProjectileId => ModContent.ProjectileType<GreenSlime>();
|
||||
|
||||
127
Content/Projectiles/DuneWyrm/Sundial.cs
Normal file
127
Content/Projectiles/DuneWyrm/Sundial.cs
Normal file
@ -0,0 +1,127 @@
|
||||
using System.Collections.Generic;
|
||||
using Decimation.Lib.Items;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace Decimation.Content.Projectiles.DuneWyrm
|
||||
{
|
||||
public class Sundial : DecimationProjectile
|
||||
{
|
||||
private static readonly IDictionary<int, int> ProjectilesIndex = new Dictionary<int, int>();
|
||||
private static readonly IDictionary<int, int> ProjectilesCount = new Dictionary<int, int>();
|
||||
private static readonly int IndexResetCounterMax = 60;
|
||||
|
||||
protected override int AnimationFrames => 12;
|
||||
protected override int AnimationFps => 1;
|
||||
protected override DecimationWeapon.DamageType DamageType => DecimationWeapon.DamageType.Magic;
|
||||
protected override int Damages => 15;
|
||||
|
||||
private int ProjectileIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!ProjectilesIndex.ContainsKey(Owner)) ProjectilesIndex[Owner] = -1;
|
||||
return ProjectilesIndex[Owner];
|
||||
}
|
||||
set
|
||||
{
|
||||
int index = value;
|
||||
if (index > AnimationFrames) index = AnimationFrames;
|
||||
ProjectilesIndex[Owner] = index;
|
||||
}
|
||||
}
|
||||
|
||||
private int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!ProjectilesCount.ContainsKey(Owner)) Count = -1;
|
||||
return ProjectilesCount[Owner];
|
||||
}
|
||||
set => ProjectilesCount[Owner] = value;
|
||||
}
|
||||
|
||||
private int Index
|
||||
{
|
||||
get => (int) projectile.localAI[0];
|
||||
set => projectile.localAI[0] = value;
|
||||
}
|
||||
|
||||
private int Owner
|
||||
{
|
||||
get => (int) projectile.localAI[1];
|
||||
set => projectile.localAI[1] = value;
|
||||
}
|
||||
|
||||
private bool EndOfLife => projectile.timeLeft < IndexResetCounterMax || projectile.penetrate <= 1;
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
projectile.width = 20;
|
||||
projectile.height = 22;
|
||||
projectile.timeLeft = 180 + IndexResetCounterMax;
|
||||
projectile.aiStyle = -1;
|
||||
projectile.tileCollide = false;
|
||||
projectile.knockBack = 7;
|
||||
|
||||
Owner = projectile.owner;
|
||||
if (Count++ == 0) ProjectileIndex = 0;
|
||||
Index = ++ProjectileIndex;
|
||||
|
||||
projectile.penetrate = Index + 1;
|
||||
}
|
||||
|
||||
public override bool PreKill(int timeLeft)
|
||||
{
|
||||
Count -= 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool PreAI()
|
||||
{
|
||||
projectile.frame = Index - 1;
|
||||
if (projectile.frame >= AnimationFrames) projectile.frame = AnimationFrames - 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (EndOfLife)
|
||||
{
|
||||
projectile.velocity = Vector2.Zero;
|
||||
projectile.penetrate = -1;
|
||||
projectile.damage = 0;
|
||||
projectile.alpha = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Lighting.AddLight(projectile.Center, 0, 0.8f, 1);
|
||||
projectile.velocity.Normalize();
|
||||
projectile.velocity *= Index;
|
||||
|
||||
if (Index >= 6) projectile.damage = 25;
|
||||
if (Index >= 12) projectile.damage = 35;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
if (Index == 1) target.AddBuff(BuffID.Slow, 300);
|
||||
}
|
||||
|
||||
public override void OnHitPvp(Player target, int damage, bool crit)
|
||||
{
|
||||
if (Index == 1) target.AddBuff(BuffID.Slow, 300);
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
return !EndOfLife; // projectile.alpha = 0 does not always work?
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Content/Projectiles/DuneWyrm/Sundial.png
Normal file
BIN
Content/Projectiles/DuneWyrm/Sundial.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
Loading…
Reference in New Issue
Block a user