Crit Or Dmg Ranged Terraria
Permalink
Terraria Ranged Build
Join GitHub today
By default, each successful hit on an enemy has a 4% chance of being a 'critical hit', dealing approximately double the usual damage of the weapon in use with 40% more knockback. A small number of weapons have a base critical strike chance that is higher than the 4% default. Mythril Set -Hat- (3 pieces) Defense (Total) 27: Bonus (Total) 12% increased ranged damage 7% increased ranged critical strike chance 5% increased damage 3% increased critical strike chance 20% chance to not consume ammo: Equip Slots: Helmet/Shirt/Pants.
Portal download mac. You can find a list of which systems are supported on the page.
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upTerraria Hardmode Ranged Weapons
Find file Copy path
Cannot retrieve contributors at this time
usingMicrosoft.Xna.Framework; |
usingTerraria; |
usingTerraria.ID; |
usingstaticTerraria.ModLoader.ModContent; |
namespaceExampleMod.Items.ExampleDamageClass |
{ |
publicclassMundane : ExampleDamageItem |
{ |
publicoverridestringTexture=>'Terraria/Item_'+ItemID.HellwingBow; |
// Called when the mod loads, so our changes are added to the game |
publicstaticvoidAddHacks() |
{ |
// Set ourselves to be ranged temporarily to benefit from ranged bonuses |
// This is needed because terraria changes the variables before calling tML's method |
// based on if the item was set to be ranged. Ours isn't, but we still want our custom bow |
// to benefit from ranged bonuses, despite being an Example damage weapon. |
// This is how to do it. |
On.Terraria.Player.GetWeaponDamage+=PlayerOnGetWeaponDamage; |
On.Terraria.Player.GetWeaponKnockback+=PlayerOnGetWeaponKnockback; |
} |
privatestaticfloatPlayerOnGetWeaponKnockback(On.Terraria.Player.orig_GetWeaponKnockbackorig, Playerself, Itemsitem, floatknockback) |
{ |
boolisMundane=sitem.typeItemType<Mundane>(); |
if (isMundane)sitem.ranged=true; |
floatkb=orig(self, sitem, knockback); |
if (isMundane) sitem.ranged=false; |
returnkb; |
} |
privatestaticintPlayerOnGetWeaponDamage(On.Terraria.Player.orig_GetWeaponDamageorig, Playerself, Itemsitem) |
{ |
boolisMundane=sitem.typeItemType<Mundane>(); |
if (isMundane) sitem.ranged=true; |
intdmg=orig(self, sitem); |
if (isMundane) sitem.ranged=false; |
returndmg; |
} |
// Our ExampleDamageItem abstract class handles all code related to our custom damage class |
publicoverridevoidSafeSetDefaults() |
{ |
item.CloneDefaults(ItemID.WoodenBow); |
item.Size=newVector2(18, 46); |
item.damage=20; |
item.crit=20; |
item.knockBack=2; |
item.rare=10; |
} |
publicoverridevoidGetWeaponCrit(Playerplayer, refintcrit) |
{ |
// It is hard to hook into every place checking item's crit and fake item.ranged = true |
// Instead, we can mimick regular ranged crit assignment |
crit=Main.LocalPlayer.rangedCrit-Main.LocalPlayer.inventory[Main.LocalPlayer.selectedItem].crit+Main.HoverItem.crit; |
base.GetWeaponCrit(player, refcrit); |
} |
} |
} |
Copy lines Copy permalink