From 15acc7759d30e2280ca6bbd7daaf646b460d64bb Mon Sep 17 00:00:00 2001 From: MaelVB Date: Wed, 25 Nov 2020 22:57:02 +0100 Subject: [PATCH] [fix] Few refactors #1 --- Items/Gloves/FasterSnowballGlove.cs | 4 +++- Items/Gloves/SnowballGlove.cs | 6 ++++-- Items/Snowballs/SnowballWithGrenade.cs | 3 +-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Items/Gloves/FasterSnowballGlove.cs b/Items/Gloves/FasterSnowballGlove.cs index 35a39c9..b718069 100644 --- a/Items/Gloves/FasterSnowballGlove.cs +++ b/Items/Gloves/FasterSnowballGlove.cs @@ -49,7 +49,8 @@ public override void AddRecipes() recipe.AddRecipe(); } - public override void OnConsumeAmmo(Player player) { + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { const int NUM_DUSTS = 10; float posX = player.position.X; float posY = player.position.Y; @@ -59,6 +60,7 @@ public override void OnConsumeAmmo(Player player) { posX--; posY--; } + return true; } } } \ No newline at end of file diff --git a/Items/Gloves/SnowballGlove.cs b/Items/Gloves/SnowballGlove.cs index f573c89..9bbbaf9 100644 --- a/Items/Gloves/SnowballGlove.cs +++ b/Items/Gloves/SnowballGlove.cs @@ -52,9 +52,10 @@ public override void AddRecipes() /** * My item has the noUseGraphic property because I don't want it to be displayed. * But because of this property I can't call the method MeleeEffects. - * So, in order to have an effect when I use my item, I call the OnConsummeAmmo method. + * So, in order to have an effect when I use my item, I call the Shoot method. */ - public override void OnConsumeAmmo(Player player) { + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { const int NUM_DUSTS = 5; float posX = player.position.X; float posY = player.position.Y; @@ -64,6 +65,7 @@ public override void OnConsumeAmmo(Player player) { posX--; posY--; } + return true; } } } \ No newline at end of file diff --git a/Items/Snowballs/SnowballWithGrenade.cs b/Items/Snowballs/SnowballWithGrenade.cs index b24bbe9..838e5bd 100644 --- a/Items/Snowballs/SnowballWithGrenade.cs +++ b/Items/Snowballs/SnowballWithGrenade.cs @@ -39,9 +39,8 @@ public override void SetDefaults() item.noMelee = true; item.noUseGraphic = true; - item.ammo = AmmoID.Snowball; + item.ammo = item.type; //No integration with gloves for the moment } - public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod);