-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
194 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Microsoft.Xna.Framework; | ||
using System; | ||
using Terraria; | ||
using Terraria.ID; | ||
using Terraria.ModLoader; | ||
|
||
namespace DubNation.Buffs | ||
{ | ||
public class ScourgeBuff : ModBuff | ||
{ | ||
public override void SetDefaults() | ||
{ | ||
DisplayName.SetDefault("Scourge Minion"); | ||
Description.SetDefault("The scourge minion will fight for you"); | ||
Main.buffNoSave[Type] = true; | ||
Main.buffNoTimeDisplay[Type] = true; | ||
} | ||
|
||
public override void Update(Player player, ref int buffIndex) | ||
{ | ||
if (player.ownedProjectileCounts[ModContent.ProjectileType<Projectiles.ScourgeMinion>()] > 0) | ||
{ | ||
player.buffTime[buffIndex] = 18000; | ||
} | ||
else | ||
{ | ||
player.DelBuff(buffIndex); | ||
buffIndex--; | ||
} | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using Microsoft.Xna.Framework; | ||
using System; | ||
using Terraria; | ||
using Terraria.ID; | ||
using Terraria.ModLoader; | ||
|
||
|
||
namespace DubNation.Items | ||
{ | ||
public class ScourgeStaff : ModItem | ||
{ | ||
public override void SetStaticDefaults() | ||
{ | ||
DisplayName.SetDefault("Scourge Staff"); | ||
Tooltip.SetDefault("Summons a scourge minion to fight for you"); | ||
ItemID.Sets.GamepadWholeScreenUseRange[item.type] = true; | ||
ItemID.Sets.LockOnIgnoresCollision[item.type] = true; | ||
} | ||
|
||
public override void SetDefaults() | ||
{ | ||
item.damage = 8; | ||
item.width = 40; | ||
item.height = 40; | ||
item.useTime = 36; | ||
item.useAnimation = 36; | ||
item.useStyle = ItemUseStyleID.SwingThrow; | ||
item.value = 10; | ||
item.rare = ItemRarityID.White; | ||
item.UseSound = SoundID.Item1; | ||
item.mana = 1; | ||
item.noMelee = true; | ||
item.summon = true; | ||
item.buffType = ModContent.BuffType<Buffs.ScourgeBuff>(); | ||
item.shoot = ModContent.ProjectileType<Projectiles.ScourgeMinion>(); | ||
} | ||
|
||
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) | ||
{ | ||
player.AddBuff(item.buffType, 2); | ||
position = Main.MouseWorld; | ||
return true; | ||
} | ||
|
||
public override void AddRecipes() | ||
{ | ||
Mod calamity = ModLoader.GetMod("CalamityMod"); | ||
if (calamity != null) | ||
{ | ||
ModRecipe recipe = new ModRecipe(mod); | ||
recipe.AddIngredient(calamity.ItemType("VictoryShard"), 4); | ||
recipe.AddIngredient(ItemID.SandBlock, 10); | ||
recipe.AddTile(TileID.WorkBenches); | ||
recipe.SetResult(this); | ||
recipe.AddRecipe(); | ||
} | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
using Microsoft.Xna.Framework; | ||
using System; | ||
using Terraria; | ||
using Terraria.ID; | ||
using Terraria.ModLoader; | ||
|
||
namespace DubNation.Projectiles | ||
{ | ||
public class ScourgeMinion : ModProjectile | ||
{ | ||
public override void SetStaticDefaults() | ||
{ | ||
DisplayName.SetDefault("Scourge Minion"); | ||
// Sets the amount of frames this minion has on its spritesheet | ||
Main.projFrames[projectile.type] = 1; | ||
// This is necessary for right-click targeting | ||
ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; | ||
|
||
// These below are needed for a minion | ||
// Denotes that this projectile is a pet or minion | ||
Main.projPet[projectile.type] = true; | ||
// This is needed so your minion can properly spawn when summoned and replaced when other minions are summoned | ||
ProjectileID.Sets.MinionSacrificable[projectile.type] = true; | ||
// Don't mistake this with "if this is true, then it will automatically home". It is just for damage reduction for certain NPCs | ||
ProjectileID.Sets.Homing[projectile.type] = true; | ||
} | ||
|
||
public sealed override void SetDefaults() | ||
{ | ||
projectile.width = 40; | ||
projectile.height = 100; | ||
// Makes the minion go through tiles freely | ||
projectile.tileCollide = true; | ||
|
||
// These below are needed for a minion weapon | ||
// Only controls if it deals damage to enemies on contact (more on that later) | ||
projectile.friendly = true; | ||
// Only determines the damage type | ||
projectile.minion = true; | ||
// Amount of slots this minion occupies from the total minion slots available to the player (more on that later) | ||
projectile.minionSlots = 1f; | ||
// Needed so the minion doesn't despawn on collision with enemies or tiles | ||
projectile.penetrate = -1; | ||
} | ||
|
||
// Here you can decide if your minion breaks things like grass or pots | ||
public override bool? CanCutTiles() | ||
{ | ||
return false; | ||
} | ||
|
||
// This is mandatory if your minion deals contact damage (further related stuff in AI() in the Movement region) | ||
public override bool MinionContactDamage() | ||
{ | ||
return true; | ||
} | ||
|
||
public override void AI() | ||
{ | ||
Player player = Main.player[projectile.owner]; | ||
|
||
#region Active check | ||
// This is the "active check", makes sure the minion is alive while the player is alive, and despawns if not | ||
if (player.dead || !player.active) | ||
{ | ||
player.ClearBuff(ModContent.BuffType<Buffs.ScourgeBuff>()); | ||
} | ||
if (player.HasBuff(ModContent.BuffType<Buffs.ScourgeBuff>())) | ||
{ | ||
projectile.timeLeft = 2; | ||
} | ||
#endregion | ||
|
||
#region Movement | ||
Vector2 down = new Vector2(0, 1); | ||
projectile.velocity = (projectile.velocity + down); | ||
#endregion | ||
|
||
#region Animation and visuals | ||
// So it will lean slightly towards the direction it's moving | ||
projectile.rotation = projectile.velocity.X * 0.05f; | ||
|
||
// This is a simple "loop through all frames from top to bottom" animation | ||
int frameSpeed = 5; | ||
projectile.frameCounter++; | ||
if (projectile.frameCounter >= frameSpeed) | ||
{ | ||
projectile.frameCounter = 0; | ||
projectile.frame++; | ||
if (projectile.frame >= Main.projFrames[projectile.type]) | ||
{ | ||
projectile.frame = 0; | ||
} | ||
} | ||
|
||
// Some visuals here | ||
Lighting.AddLight(projectile.Center, Color.White.ToVector3() * 0.78f); | ||
#endregion | ||
|
||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.