Пример #1
0
        public override bool PreAI(Projectile projectile)
        {
            try {
                UpgradeProjectileInfo info = projectile.GetGlobalProjectile <UpgradeProjectileInfo>(mod);
                if (!projectile.hostile && projectile.friendly)
                {
                    Player player = Main.player[projectile.owner];
                    Item   item   = player.inventory[player.selectedItem];
                    if (!item.IsAir)
                    {
                        UpgradeInfo itemInfo = item.GetGlobalItem <UpgradeInfo>(mod);

                        if (itemInfo.elemented)
                        {
                            info.elemented           = true;
                            info.elementalProjectile = projectile;
                            info.elementType         = itemInfo.elementType;
                            info.elementDamage       = itemInfo.elementDamage;
                            info.sourceItem          = item;
                            info.broken = itemInfo.broken;
                        }
                    }
                }
            }
            catch (Exception e) {
                ErrorLogger.Log(e.ToString());
            }
            return(base.PreAI(projectile));
        }
Пример #2
0
 public override void OnHitPvp(Projectile projectile, Player target, int damage, bool crit)
 {
     try {
         UpgradeProjectileInfo info = projectile.GetGlobalProjectile <UpgradeProjectileInfo>(mod);
         if (info.elemented)
         {
             ApplyElementBonusPVP(projectile, target, info.elementType, damage);
         }
         if (info.broken)
         {
             damage = 0;
         }
     }
     catch (Exception e) {
         ErrorLogger.Log(e.ToString());
     }
     base.OnHitPvp(projectile, target, damage, crit);
 }
Пример #3
0
        public override void ModifyHitPvp(Projectile projectile, Player target, ref int damage, ref bool crit)
        {
            int damages = damage;

            try {
                UpgradeProjectileInfo info = projectile.GetGlobalProjectile <UpgradeProjectileInfo>(mod);
                if (info.elemented)
                {
                    damages += info.elementDamage;
                }
                if (info.broken)
                {
                    damages = 0;
                }
            }
            catch (Exception e) {
                ErrorLogger.Log(e.ToString());
            }
            base.ModifyHitPvp(projectile, target, ref damages, ref crit);
        }
Пример #4
0
        public override void ModifyHitNPC(Projectile projectile, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
        {
            int damages = damage;

            try {
                UpgradeProjectileInfo info = projectile.GetGlobalProjectile <UpgradeProjectileInfo>(mod);
                if (info.elemented)
                {
                    damages += info.elementDamage;
                    if (info.elementType == "Air")
                    {
                        knockback = (int)(knockback * 2);
                    }
                }
                if (info.broken)
                {
                    damages = 0;
                }
            }
            catch (Exception e) {
                ErrorLogger.Log(e.ToString());
            }
            base.ModifyHitNPC(projectile, target, ref damages, ref knockback, ref crit, ref hitDirection);
        }