public override GlobalItem Clone(Item item, Item itemClone) { UThrowingWeapon myClone = (UThrowingWeapon)base.Clone(item, itemClone); myClone.thrown = thrown; return(myClone); }
public override void ModifyWeaponDamage(Item item, Player player, ref float add, ref float mult, ref float flat) { UThrowingWeapon weapon = item.Throwing(); UThrowingPlayer thrownPlayer = player.Throwing(); if (weapon.thrown) { mult = thrownPlayer.thrownDamage; } }
public override void HoldItem(Item item, Player player) { UThrowingWeapon weapon = item.Throwing(); UThrowingPlayer thrownPlayer = player.Throwing(); if (weapon.thrown) { thrownPlayer.thrownCrit += item.crit; } }
public override bool Shoot(Item item, Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { UThrowingWeapon weapon = item.Throwing(); UThrowingPlayer thrownPlayer = player.Throwing(); if (weapon.thrown) { speedX *= thrownPlayer.thrownVelocity; speedY *= thrownPlayer.thrownVelocity; } return(true); }
public override void ModifyTooltips(Item item, List <TooltipLine> tooltips) { UThrowingPlayer thrownPlayer = Main.LocalPlayer.Throwing(); UThrowingWeapon weapon = item.Throwing(); if (weapon.thrown) { // Get the vanilla damage tooltip TooltipLine tt = tooltips.FirstOrDefault(x => x.Name == "Damage" && x.mod == "Terraria"); if (tt != null) { // We want to grab the last word of the tooltip, which is the translated word for 'damage' (depending on what langauge the player is using) // So we split the string by whitespace, and grab the last word from the returned arrays to get the damage word, and the first to get the damage shown in the tooltip string[] splitText = tt.text.Split(' '); string damageValue = splitText.First(); string damageWord = splitText.Last(); // Change the tooltip text tt.text = damageValue + " (U)Thrown " + damageWord; } // Get the vanilla crit tooltip tt = tooltips.FirstOrDefault(x => x.Name == "CritChance" && x.mod == "Terraria"); if (tt != null) { string[] thetext = tt.text.Split(' '); string newline = ""; List <string> valuez = new List <string>(); int counter = 0; foreach (string text2 in thetext) { counter += 1; if (counter > 1) { valuez.Add(text2 + " "); } } int thecrit = ThrowingUtils.DisplayedCritChance(item); string thecrittype = "(U)Thrown "; valuez.Insert(0, thecrit + "% " + thecrittype); foreach (string text3 in valuez) { newline += text3; } tt.text = newline; } } }
public override bool ConsumeItem(Item item, Player player) { UThrowingWeapon weapon = item.Throwing(); UThrowingPlayer thrownPlayer = player.Throwing(); if (weapon.thrown) { if (Main.rand.Next(0, 100) < 33 && thrownPlayer.thrownCost33) { return(false); } if (Main.rand.Next(0, 100) < 50 && thrownPlayer.thrownCost50) { return(false); } } return(true); }