0.2.0 commit
This commit is contained in:
23
Content/Items/Materials/FrozenTablet.cs
Normal file
23
Content/Items/Materials/FrozenTablet.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria;
|
||||
|
||||
namespace tMx.Content.Items.Materials
|
||||
{
|
||||
public class FrozenTablet : ModItem
|
||||
{
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.ResearchUnlockCount = 666;
|
||||
Item.value = Item.buyPrice(gold: 1);
|
||||
Item.rare = ItemRarityID.Blue;
|
||||
Item.material = true;
|
||||
Item.maxStack = 666;
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Content/Items/Materials/FrozenTablet.png
Normal file
BIN
Content/Items/Materials/FrozenTablet.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
BIN
Content/Items/Materials/FrozenTablet.psd
Normal file
BIN
Content/Items/Materials/FrozenTablet.psd
Normal file
Binary file not shown.
23
Content/Items/Materials/MoltenTablet.cs
Normal file
23
Content/Items/Materials/MoltenTablet.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria;
|
||||
|
||||
namespace tMx.Content.Items.Materials
|
||||
{
|
||||
public class MoltenTablet : ModItem
|
||||
{
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.ResearchUnlockCount = 666;
|
||||
Item.value = Item.buyPrice(gold: 1);
|
||||
Item.rare = ItemRarityID.Red;
|
||||
Item.material = true;
|
||||
Item.maxStack = 666;
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Content/Items/Materials/MoltenTablet.png
Normal file
BIN
Content/Items/Materials/MoltenTablet.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
BIN
Content/Items/Materials/MoltenTablet.psd
Normal file
BIN
Content/Items/Materials/MoltenTablet.psd
Normal file
Binary file not shown.
47
Content/Items/Weapons/Boomrangs/MeteorHammer.cs
Normal file
47
Content/Items/Weapons/Boomrangs/MeteorHammer.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
namespace tMx.Content.Items.Weapons.Boomrangs
|
||||
{
|
||||
public class MeteorHammer : ModItem
|
||||
{
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 80;
|
||||
Item.DamageType = DamageClass.Melee;
|
||||
Item.width = 30;
|
||||
Item.height = 30;
|
||||
Item.useTime = 5;
|
||||
Item.useAnimation = 10;
|
||||
Item.noUseGraphic = true;
|
||||
Item.useStyle = 1;
|
||||
Item.knockBack = 3;
|
||||
Item.value = 8;
|
||||
Item.rare = ItemRarityID.Orange;
|
||||
Item.shootSpeed = 12f;
|
||||
Item.shoot = ModContent.ProjectileType<Content.Projectiles.MeteorHammerProjectile>();
|
||||
Item.UseSound = SoundID.Item1;
|
||||
Item.autoReuse = true;
|
||||
}
|
||||
public override void AddRecipes()
|
||||
{
|
||||
Recipe recipe = CreateRecipe();
|
||||
recipe.AddIngredient(ItemID.DirtBlock, 10);
|
||||
recipe.AddTile(TileID.WorkBenches);
|
||||
recipe.Register();
|
||||
}
|
||||
public override bool CanUseItem(Player player) //this make that you can shoot only 1 boomerang at once
|
||||
{
|
||||
for (int i = 0; i < 1000; ++i)
|
||||
{
|
||||
if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == Item.shoot)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Content/Items/Weapons/Boomrangs/MeteorHammer.png
Normal file
BIN
Content/Items/Weapons/Boomrangs/MeteorHammer.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 501 B |
37
Content/Items/tMxSword.cs
Normal file
37
Content/Items/tMxSword.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace tMx.Content.Items
|
||||
{
|
||||
// This is a basic item template.
|
||||
// Please see tModLoader's ExampleMod for every other example:
|
||||
// https://github.com/tModLoader/tModLoader/tree/stable/ExampleMod
|
||||
public class tMxSword : ModItem
|
||||
{
|
||||
// The Display Name and Tooltip of this item can be edited in the 'Localization/en-US_Mods.tMx.hjson' file.
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 50;
|
||||
Item.DamageType = DamageClass.Melee;
|
||||
Item.width = 40;
|
||||
Item.height = 40;
|
||||
Item.useTime = 20;
|
||||
Item.useAnimation = 20;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
Item.knockBack = 6;
|
||||
Item.value = Item.buyPrice(silver: 1);
|
||||
Item.rare = ItemRarityID.Blue;
|
||||
Item.UseSound = SoundID.Item1;
|
||||
Item.autoReuse = true;
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
Recipe recipe = CreateRecipe();
|
||||
recipe.AddIngredient(ItemID.DirtBlock, 10);
|
||||
recipe.AddTile(TileID.WorkBenches);
|
||||
recipe.Register();
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Content/Items/tMxSword.png
Normal file
BIN
Content/Items/tMxSword.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 720 B |
86
Content/Projectiles/MeteorHammerProjectile.cs
Normal file
86
Content/Projectiles/MeteorHammerProjectile.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using tMx.Content.Items;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using System;
|
||||
using Terraria.Audio;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace tMx.Content.Projectiles
|
||||
{
|
||||
// This file showcases the concept of piercing.
|
||||
// The code of the item that spawns it is located at the bottom.
|
||||
|
||||
// NPC.immune determines if an npc can be hit by a item or projectile owned by a particular player (it is an array, each slot corresponds to different players (whoAmI))
|
||||
// NPC.immune is decremented towards 0 every update
|
||||
// Melee items set NPC.immune to player.itemAnimation, which starts at item.useAnimation and decrements towards 0
|
||||
// Projectiles, however, provide mechanisms for custom immunity.
|
||||
// 1. penetrate == 1: A projectile with penetrate set to 1 in SetDefaults will hit regardless of the NPC's immunity counters (The penetrate from SetDefaults is remembered in maxPenetrate)
|
||||
// Ex: Wooden Arrow.
|
||||
// 2. No code and penetrate > 1, penetrate == -1, or (appliesImmunityTimeOnSingleHits && penetrate == 1): npc.immune[owner] will be set to 10.
|
||||
// The NPC will be hit if not immune and will become immune to all damage for 10 ticks
|
||||
// Ex: Unholy Arrow
|
||||
// 3. Override OnHitNPC: If not immune, when it hits it manually set an immune other than 10
|
||||
// Ex: Arkhalis: Sets it to 5
|
||||
// Ex: Sharknado Minion: Sets to 20
|
||||
// Video: https://media-1.discordapp.net/attachments/242228770855976960/1150275205017636995/Projectile_Immunity_Sharknado_Arkhalis_Example.mp4 Notice how Sharknado minion hits prevent Arkhalis hits for a brief moment.
|
||||
// 4. Projectile.usesIDStaticNPCImmunity and Projectile.idStaticNPCHitCooldown: Specifies that a type of projectile has a shared immunity timer for each npc.
|
||||
// Use this if you want other projectiles a chance to damage, but don't want the same projectile type to hit an npc rapidly.
|
||||
// Ex: Ghastly Glaive is the only one who uses this.
|
||||
// 5. Projectile.usesLocalNPCImmunity and Projectile.localNPCHitCooldown: Specifies the projectile manages it's own immunity timers for each npc
|
||||
// Use this if you want the multiple projectiles of the same type to have a chance to attack rapidly, but don't want a single projectile to hit rapidly. A -1 value prevents the same projectile from ever hitting the npc again.
|
||||
// Ex: Lightning Aura sentries use this. (localNPCHitCooldown = 3, but other code controls how fast the projectile itself hits)
|
||||
// Overlapping Auras all have a chance to hit after each other even though they share the same ID.
|
||||
// Try the above by uncommenting out the respective bits of code in the projectile below.
|
||||
|
||||
// This is a simple item that is based on the FlintlockPistol and shoots ExamplePiercingProjectile to showcase it.
|
||||
internal class MeteorHammerProjectile : ModProjectile
|
||||
{
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 8; // The width of projectile hitbox
|
||||
Projectile.height = 8; // The height of projectile hitbox
|
||||
Projectile.aiStyle = 1; // The ai style of the projectile, please reference the source code of Terraria
|
||||
Projectile.friendly = true; // Can the projectile deal damage to enemies?
|
||||
Projectile.hostile = false; // Can the projectile deal damage to the player?
|
||||
Projectile.DamageType = DamageClass.Melee; // Is the projectile shoot by a ranged weapon?
|
||||
Projectile.penetrate = 0; // How many monsters the projectile can penetrate. (OnTileCollide below also decrements penetrate for bounces as well)
|
||||
Projectile.timeLeft = 60; // The live time for the projectile (60 = 1 second, so 600 is 10 seconds)
|
||||
Projectile.alpha = 5; // The transparency of the projectile, 255 for completely transparent. (aiStyle 1 quickly fades the projectile in) Make sure to delete this if you aren't using an aiStyle that fades in. You'll wonder why your projectile is invisible.
|
||||
Projectile.light = 10.0f; // How much light emit around the projectile
|
||||
Projectile.ignoreWater = true; // Does the projectile's speed be influenced by water?
|
||||
Projectile.tileCollide = true; // Can the projectile collide with tiles?
|
||||
Projectile.extraUpdates = 1; // Set to above 0 if you want the projectile to update multiple time in a frame
|
||||
}
|
||||
|
||||
public override bool OnTileCollide(Vector2 oldVelocity)
|
||||
{
|
||||
// If collide with tile, reduce the penetrate.
|
||||
// So the projectile can reflect at most 5 times
|
||||
Projectile.penetrate--;
|
||||
if (Projectile.penetrate <= 0)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
else
|
||||
{
|
||||
Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height);
|
||||
SoundEngine.PlaySound(SoundID.Item10, Projectile.position);
|
||||
|
||||
// If the projectile hits the left or right side of the tile, reverse the X velocity
|
||||
if (Math.Abs(Projectile.velocity.X - oldVelocity.X) > float.Epsilon)
|
||||
{
|
||||
Projectile.velocity.X = -oldVelocity.X;
|
||||
}
|
||||
|
||||
// If the projectile hits the top or bottom side of the tile, reverse the Y velocity
|
||||
if (Math.Abs(Projectile.velocity.Y - oldVelocity.Y) > float.Epsilon)
|
||||
{
|
||||
Projectile.velocity.Y = -oldVelocity.Y;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Content/Projectiles/MeteorHammerProjectile.png
Normal file
BIN
Content/Projectiles/MeteorHammerProjectile.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 252 B |
Reference in New Issue
Block a user