Skip to content

Commit

Permalink
Lord's Flame
Browse files Browse the repository at this point in the history
  • Loading branch information
Joost8910 committed May 14, 2020
1 parent 80b1689 commit 9445cf8
Show file tree
Hide file tree
Showing 27 changed files with 719 additions and 47 deletions.
63 changes: 63 additions & 0 deletions Items/Rewards/ImpLordFlame.cs
@@ -0,0 +1,63 @@
using Microsoft.Xna.Framework;
using System.Collections.Generic;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;

namespace JoostMod.Items.Rewards
{
public class ImpLordFlame : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Lord's Flame");
Tooltip.SetDefault("Hold attack to charge a bigger fireball");
Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(4, 8));
ItemID.Sets.ItemNoGravity[item.type] = true;
}
public override void SetDefaults()
{
item.damage = 60;
item.mana = 10;
item.magic = true;
item.noMelee = true;
item.scale = 1f;
item.noUseGraphic = true;
item.width = 26;
item.height = 26;
item.useTime = 20;
item.useAnimation = 20;
item.useStyle = 1;
item.knockBack = 3.5f;
item.value = 80000;
item.rare = 3;
item.UseSound = SoundID.Item20;
item.autoReuse = true;
item.channel = true;
item.shoot = mod.ProjectileType("ImpLordFlame");
item.shootSpeed = 12f;
item.useTurn = true;
}
public override bool CanUseItem(Player player)
{
if (player.ownedProjectileCounts[item.shoot] > 0)
{
return false;
}
return base.CanUseItem(player);
}
public override void ModifyTooltips(List<TooltipLine> list)
{
foreach (TooltipLine line2 in list)
{
if (line2.mod == "Terraria" && line2.Name == "ItemName")
{
line2.overrideColor = new Color(230, 204, 128);
}
}
}

}
}

Binary file added Items/Rewards/ImpLordFlame.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Items/Rewards/TailWhip.cs
Expand Up @@ -15,7 +15,7 @@ public override void SetStaticDefaults()
}
public override void SetDefaults()
{
item.damage = 31;
item.damage = 38;
item.melee = true;
item.noMelee = true;
item.scale = 1f;
Expand Down
3 changes: 2 additions & 1 deletion Items/Weapons/WaterWhip.cs
Expand Up @@ -59,7 +59,8 @@ public override bool Shoot(Player player, ref Vector2 position, ref float speedX
{
type = mod.ProjectileType("WaterWhip2");
}
return true;
Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0, -1);
return false;
}
public override void AddRecipes()
{
Expand Down
1 change: 1 addition & 0 deletions JoostMod.cs
Expand Up @@ -295,6 +295,7 @@ private void ImpReward(Player player)
{
Mod mod = JoostMod.instance;
player.QuickSpawnItem(mod.ItemType("TailWhip"));
player.QuickSpawnItem(mod.ItemType("ImpLordFlame"));
player.QuickSpawnItem(ItemID.GoldCoin, 7);
player.QuickSpawnItem(ItemID.FireblossomSeeds, 15);
}
Expand Down
2 changes: 1 addition & 1 deletion JoostPlayer.cs
Expand Up @@ -1682,7 +1682,7 @@ public override void PostUpdateEquips()
}
}
}
bool noHooks = player.ownedProjectileCounts[mod.ProjectileType("SwingyHook")] + player.ownedProjectileCounts[mod.ProjectileType("MobHook")] + player.ownedProjectileCounts[mod.ProjectileType("EnchantedSwingyHook")] + player.ownedProjectileCounts[mod.ProjectileType("CactusHook")] <= 0;
bool noHooks = player.ownedProjectileCounts[mod.ProjectileType("SwingyHook")] + player.ownedProjectileCounts[mod.ProjectileType("MobHook")] + player.ownedProjectileCounts[mod.ProjectileType("EnchantedSwingyHook")] + player.ownedProjectileCounts[mod.ProjectileType("EnchantedMobHook")] + player.ownedProjectileCounts[mod.ProjectileType("CactusHook")] <= 0;
if (spinTimer > 0)
{
spinTimer--;
Expand Down
2 changes: 1 addition & 1 deletion NPCs/Hunts/FireBall.cs
Expand Up @@ -55,7 +55,7 @@ public override void HitEffect(int hitDirection, double damage)
Player P = Main.player[npc.target];
for (int i = 0; i < 10; i++)
{
Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, npc.velocity.X / 10, npc.velocity.Y / 10, 100, default(Color), 0.8f + (Main.rand.Next(3) * 0.1f));
Dust.NewDustDirect(npc.position, npc.width, npc.height, DustID.Fire, -npc.velocity.X / 5, -npc.velocity.Y / 5, 100, default(Color), 2f + (Main.rand.Next(20) * 0.1f)).noGravity = true;
}
if (npc.life > 0)
{
Expand Down
176 changes: 176 additions & 0 deletions NPCs/Hunts/FireBall2.cs
@@ -0,0 +1,176 @@
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace JoostMod.NPCs.Hunts
{
public class FireBall2 : ModNPC
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Fire Blast");
Main.npcFrameCount[npc.type] = 3;
}
public override void SetDefaults()
{
npc.friendly = true;
npc.dontTakeDamageFromHostiles = true;
npc.width = 68;
npc.height = 68;
npc.defense = 9999;
npc.lifeMax = Main.expertMode ? 12 : 6;
npc.damage = 50;
npc.HitSound = SoundID.NPCHit3;
npc.DeathSound = SoundID.Item74;
npc.value = Item.buyPrice(0, 0, 0, 0);
npc.knockBackResist = 0;
npc.aiStyle = -1;
npc.noGravity = true;
npc.noTileCollide = false;
npc.buffImmune[BuffID.OnFire] = true;
npc.buffImmune[BuffID.Venom] = true;
npc.buffImmune[BuffID.Poisoned] = true;
npc.buffImmune[BuffID.Frostburn] = true;
npc.buffImmune[BuffID.CursedInferno] = true;
npc.buffImmune[BuffID.Daybreak] = true;
npc.buffImmune[mod.BuffType("BoneHurt")] = true;
npc.buffImmune[mod.BuffType("CorruptSoul")] = true;
}
public override void ModifyHitByItem(Player player, Item item, ref int damage, ref float knockback, ref bool crit)
{
crit = false;
damage = 1;
npc.target = player.whoAmI;
}
public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
crit = false;
damage = 1;
npc.target = projectile.owner;
}
public override bool PreNPCLoot()
{
return false;
}
public override void HitEffect(int hitDirection, double damage)
{
for (int i = 0; i < 10; i++)
{
Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, npc.velocity.X / 10, npc.velocity.Y / 10, 100, default(Color), 0.8f + (Main.rand.Next(3) * 0.1f));
}
if (npc.life > 0)
{
npc.velocity *= -1.15f;
}
npc.ai[3]= 1;
}
public override void AI()
{
if (npc.ai[3] < 1)
{
npc.velocity.X = npc.ai[0];
npc.velocity.Y = npc.ai[1];
npc.damage = (int)npc.ai[2];
npc.ai[3]= 1;
if (Main.netMode != 0)
{
ModPacket packet = mod.GetPacket();
packet.Write((byte)JoostModMessageType.NPCpos);
packet.Write(npc.whoAmI);
packet.WriteVector2(npc.position);
packet.WriteVector2(npc.velocity);
ModPacket netMessage = packet;
netMessage.Send();
}
npc.netUpdate = true;
}
Dust.NewDustDirect(npc.position, npc.width, npc.height, DustID.Fire, -npc.velocity.X / 5, -npc.velocity.Y / 5, 100, default(Color), 2f + (Main.rand.Next(20) * 0.1f)).noGravity = true;
npc.ai[3]++;
bool colliding = (npc.ai[3] > 2 && (npc.oldVelocity.X != 0 && npc.velocity.X == 0) || (npc.oldVelocity.Y != 0 && npc.velocity.Y == 0));
for (int i = 0; i < Main.maxNPCs && !colliding; i++)
{
NPC target = Main.npc[i];
if (!target.friendly && !target.dontTakeDamage && npc.Hitbox.Intersects(target.Hitbox))
{
colliding = true;
break;
}
}
if (npc.ai[3] > 300 || colliding)
{
npc.life = 0;
npc.HitEffect(0, 0);
npc.checkDead();
}
npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + 1.57f;
npc.lifeRegen = 0;
}
public override void FindFrame(int frameHeight)
{
frameHeight = 100;
npc.frameCounter++;
if (npc.frameCounter >= 4)
{
npc.frame.Y += frameHeight;
npc.frameCounter = 0;
}
if (npc.frame.Y > frameHeight * 2)
{
npc.frame.Y = 0;
}
}
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
{
return target.whoAmI != (int)npc.target && target.hostile && Main.player[npc.target].hostile;
}
public override bool? CanHitNPC(NPC target)
{
if (!target.friendly)
{
return true;
}
return base.CanHitNPC(target);
}
public override bool? CanBeHitByItem(Player player, Item item)
{
if ((player.whoAmI == (int)npc.target) || !(ItemLoader.CanHitPvp(item, player, Main.player[npc.target]) && PlayerHooks.CanHitPvp(player, item, Main.player[npc.target])))
{
return false;
}
return base.CanBeHitByItem(player, item);
}
public override bool? CanBeHitByProjectile(Projectile projectile)
{
Player player = Main.player[projectile.owner];
if ((projectile.owner == (int)npc.target) || (player.heldProj != projectile.whoAmI) || !(ProjectileLoader.CanHitPvp(projectile, Main.player[npc.target]) && PlayerHooks.CanHitPvpWithProj(projectile, Main.player[npc.target])))
{
return false;
}
return base.CanBeHitByProjectile(projectile);
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
if (target.type != NPCID.BurningSphere)
{
npc.life = 0;
npc.HitEffect(0, 0);
npc.checkDead();
}
}
public override void OnHitPlayer(Player target, int damage, bool crit)
{
npc.life = 0;
npc.HitEffect(0, 0);
npc.checkDead();
}
public override bool CheckDead()
{
Projectile.NewProjectile(npc.Center, Vector2.Zero, mod.ProjectileType("FireballExplosion"), npc.damage, 20, (int)npc.target);
return true;
}
}
}


Binary file added NPCs/Hunts/FireBall2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions Projectiles/BurningSphere.cs
@@ -0,0 +1,49 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace JoostMod.Projectiles
{
public class BurningSphere : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Lord's Flame");
}
public override void SetDefaults()
{
projectile.width = 16;
projectile.height = 16;
projectile.aiStyle = 1;
projectile.friendly = true;
projectile.magic = true;
projectile.penetrate = 1;
projectile.timeLeft = 450;
projectile.tileCollide = true;
projectile.alpha = 150;
aiType = ProjectileID.Bullet;
}
public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough)
{
width = 6;
height = 6;
return base.TileCollideStyle(ref width, ref height, ref fallThrough);
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(BuffID.OnFire, 300, true);
}
public override void OnHitPlayer(Player target, int damage, bool crit)
{
target.AddBuff(BuffID.OnFire, 300, true);
}
public override void AI()
{
projectile.rotation = projectile.direction * 3 * projectile.timeLeft;
Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, DustID.Fire, 0, 0, 100, default(Color), 2f + (Main.rand.Next(5) * 0.1f)).noGravity = true;
}
}
}

Binary file added Projectiles/BurningSphere.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9445cf8

Please sign in to comment.