public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) { if (Main.hardMode) { int blockedDamage = (int)Math.Floor(target.defense * 0.75f); if (damage <= AttackDamagePlayer.ModPlayer(player).lethality) { damage = (int)(damage + blockedDamage); } else { int nonLethalityDamage = damage - AttackDamagePlayer.ModPlayer(player).lethality; if (nonLethalityDamage <= blockedDamage) { nonLethalityDamage = 1; } else { nonLethalityDamage -= blockedDamage; } damage = (int)(nonLethalityDamage + AttackDamagePlayer.ModPlayer(player).lethality + blockedDamage); } } else { int blockedDamage = (int)Math.Floor(target.defense * 0.5f); if (damage <= AttackDamagePlayer.ModPlayer(player).lethality) { damage = (int)(damage + blockedDamage); } else { int nonLethalityDamage = damage - AttackDamagePlayer.ModPlayer(player).lethality; if (nonLethalityDamage <= blockedDamage) { nonLethalityDamage = 1; } else { nonLethalityDamage -= blockedDamage; } damage = (int)(nonLethalityDamage + AttackDamagePlayer.ModPlayer(player).lethality + blockedDamage); } } }
public override void HoldItem(Player player) { AttackDamagePlayer modPlayer = AttackDamagePlayer.ModPlayer(player); modPlayer.lethality += 18; }
public override void GetWeaponKnockback(Player player, ref float knockback) { // Adds knockback bonuses knockback = knockback + AttackDamagePlayer.ModPlayer(player).attackKnockback; }
public override float MeleeSpeedMultiplier(Player player) { return(AttackDamagePlayer.ModPlayer(player).attackSpeed + player.meleeSpeed); }
// As a modder, you could also opt to make the Get overrides also sealed, Up to the modder public override void GetWeaponDamage(Player player, ref int damage) { // Multiplies the damage by our custom damage multiplier damage = (int)((damage + AttackDamagePlayer.ModPlayer(player).attackBonus) * (AttackDamagePlayer.ModPlayer(player).attackDamage + player.meleeDamage)); }
public override void GetWeaponCrit(Player player, ref int crit) { // Adds crit bonuses crit = crit + AttackDamagePlayer.ModPlayer(player).attackCrit + player.meleeCrit; }