mirror of
https://github.com/YouHaveTrouble/YHTMod.git
synced 2026-05-11 21:56:54 +00:00
arcane missle initial logic
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
using Terraria;
|
||||||
|
using Terraria.GameContent.Creative;
|
||||||
|
using Terraria.ModLoader;
|
||||||
|
|
||||||
|
namespace YHTMod.Items.ArcaneMissle;
|
||||||
|
|
||||||
|
public class ArcaneMissle : ModItem {
|
||||||
|
|
||||||
|
public override void SetStaticDefaults() {
|
||||||
|
DisplayName.SetDefault("Arcane Missle");
|
||||||
|
Tooltip.SetDefault("Magic damage crits have a chance to shoot a homing arcane missle");
|
||||||
|
CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SetDefaults() {
|
||||||
|
Item.width = 64;
|
||||||
|
Item.height = 64;
|
||||||
|
Item.accessory = true;
|
||||||
|
Item.damage = 10;
|
||||||
|
Item.DamageType = DamageClass.Magic;
|
||||||
|
Item.noMelee = true;
|
||||||
|
Item.noUseGraphic = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void UpdateAccessory(Player player, bool hideVisual) {
|
||||||
|
|
||||||
|
player.GetModPlayer<YhtPlayer>().arcaneMissle = true;
|
||||||
|
|
||||||
|
base.UpdateAccessory(player, hideVisual);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using Terraria;
|
||||||
|
using Terraria.ModLoader;
|
||||||
|
|
||||||
|
namespace YHTMod.Items.ArcaneMissle;
|
||||||
|
|
||||||
|
public class ArcaneMissleBehavior : GlobalNPC {
|
||||||
|
|
||||||
|
public override void OnHitByProjectile(NPC npc, Projectile projectile, int damage, float knockback, bool crit) {
|
||||||
|
if (!crit) {
|
||||||
|
base.OnHitByProjectile(npc, projectile, damage, knockback, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Player player = Main.LocalPlayer;
|
||||||
|
|
||||||
|
if (player.GetModPlayer<YhtPlayer>().arcaneMissle && projectile.DamageType == DamageClass.Magic) {
|
||||||
|
// player just crit with magic weapon while having arcane missle accessory equipped
|
||||||
|
}
|
||||||
|
|
||||||
|
base.OnHitByProjectile(npc, projectile, damage, knockback, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using Terraria.ModLoader;
|
||||||
|
|
||||||
|
namespace YHTMod;
|
||||||
|
|
||||||
|
public class YhtPlayer : ModPlayer {
|
||||||
|
|
||||||
|
public bool arcaneMissle = false;
|
||||||
|
|
||||||
|
public override void ResetEffects() {
|
||||||
|
|
||||||
|
this.arcaneMissle = false;
|
||||||
|
|
||||||
|
base.ResetEffects();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user