Example #1
0
        public void DamageOverride(int sourceDamage, Player target, int killer, bool sendThorns)
        {
            if (!target.immune)
            {
                PlayerLastHurt = killer;

                int damage = sourceDamage;

                if (PercentThorns > 0f && sendThorns)
                {
                    target.GetModPlayer <MobaPlayer>().DamageOverride((int)(damage * PercentThorns), Main.player[killer], target.whoAmI, false);
                    SyncPvpHitPacket.Write(killer, (int)(damage * PercentThorns), target.whoAmI, false);
                }

                damage -= (int)(target.statDefense * 0.5);
                if (damage <= 0)
                {
                    damage = 1;
                }

                target.statLife -= damage;

                CombatText.NewText(target.Hitbox, Color.OrangeRed, damage);

                if (target.statLife <= 0)
                {
                    target.KillMe(PlayerDeathReason.ByPlayer(PlayerLastHurt), damage, 1, true);
                }

                if (sendThorns)
                {
                    Main.PlaySound(1, target.position);
                    target.immune     = true;
                    target.immuneTime = 8;
                }
            }
        }
Example #2
0
 public override void ModifyHitPvp(Item item, Player target, ref int damage, ref bool crit)
 {
     EditDamage(ref damage);
     target.GetModPlayer <MobaPlayer>().DamageOverride(damage, target, player.whoAmI, true);
     SyncPvpHitPacket.Write(target.whoAmI, damage, player.whoAmI, true);
 }