// add buff/debuff dusts if we've got a squire affecting buff or debuff
        public override void PostAI(Projectile projectile)
        {
            if (!SquireMinionTypes.Contains(projectile.type))
            {
                return;
            }
            Player player = Main.player[projectile.owner];

            foreach (int buffType in player.buffType)
            {
                bool debuff = false;

                if (squireDebuffTypes.Contains(buffType))
                {
                    debuff = true;
                }
                else if (!squireBuffTypes.Contains(buffType))
                {
                    continue;
                }
                int timeLeft = player.buffTime[player.FindBuffIndex(buffType)];
                if (timeLeft % 60 == 0)
                {
                    doBuffDust(projectile, debuff ? DustType <MinusDust>() : DustType <PlusDust>());
                }
                break;
            }
        }
Example #2
0
 public override void ModifyWeaponDamage(Item item, ref float add, ref float mult, ref float flat)
 {
     base.ModifyWeaponDamage(item, ref add, ref mult, ref flat);
     if (!SquireMinionTypes.Contains(item.shoot))
     {
         return;
     }
     mult += squireDamageMultiplierBonus;
 }
 public override void ModifyWeaponDamage(Item item, ref float add, ref float mult, ref float flat)
 {
     if (!item.summon && usedMinionSlots > 0)
     {
         add -= ServerConfig.Instance.OtherDamageMinionNerf / 100f;
     }
     if (!SquireMinionTypes.Contains(item.shoot))
     {
         return;
     }
     mult += squireDamageMultiplierBonus;
 }
 public Projectile GetSquire()
 {
     for (int i = 0; i < Main.maxProjectiles; i++)
     {
         Projectile p = Main.projectile[i];
         if (p.active && p.owner == player.whoAmI && SquireMinionTypes.Contains(p.type))
         {
             return(p);
         }
     }
     return(null);
 }
        public override void ModifyHitNPC(Projectile projectile, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
        {
            if (!SquireMinionTypes.Contains(projectile.type) && !isSquireShot.Contains(projectile.type))
            {
                return;
            }
            float multiplier = Main.player[projectile.owner].GetModPlayer <SquireModPlayer>().squireDamageOnHitMultiplier;

            if (multiplier == 1)
            {
                return;
            }
            // may need to manually apply defense formula
            damage = (int)(damage * multiplier);
        }
        public override void OnHitNPC(Projectile projectile, NPC target, int damage, float knockback, bool crit)
        {
            if (!SquireMinionTypes.Contains(projectile.type) && !isSquireShot.Contains(projectile.type))
            {
                return;
            }
            SquireModPlayer player     = Main.player[projectile.owner].GetModPlayer <SquireModPlayer>();
            int             debuffType = player.squireDebuffOnHit;
            int             duration   = player.squireDebuffTime;

            if (debuffType == -1 || Main.rand.NextFloat() > 0.25f)
            {
                return;
            }
            target.AddBuff(debuffType, duration);
        }
        public override void SetStaticDefaults()
        {
            base.SetStaticDefaults();
            SquireMinionTypes.Add(projectile.type);
            ProjectileID.Sets.MinionTargettingFeature[projectile.type] = false;

            ProjectileID.Sets.Homing[projectile.type]     = true;
            ProjectileID.Sets.MinionShot[projectile.type] = true;

            // These below are needed for a minion
            // Denotes that this projectile is a pet or minion
            Main.projPet[projectile.type] = false;
            // This is needed so your minion can properly spawn when summoned and replaced when other minions are summoned
            ProjectileID.Sets.MinionSacrificable[projectile.type] = false;
            IdleLocationSets.trailingInAir.Add(projectile.type);
        }
Example #8
0
        public override void SetStaticDefaults()
        {
            base.SetStaticDefaults();
            SquireMinionTypes.Add(projectile.type);
            ProjectileID.Sets.MinionTargettingFeature[projectile.type] = false;

            ProjectileID.Sets.Homing[projectile.type]     = true;
            ProjectileID.Sets.MinionShot[projectile.type] = true;

            // These below are needed for a minion
            // Denotes that this projectile is a pet or minion
            Main.projPet[projectile.type] = false;
            // This is needed so your minion can properly spawn when summoned and replaced when other minions are summoned
            ProjectileID.Sets.MinionSacrificable[projectile.type] = false;
            // Don't mistake this with "if this is true, then it will automatically home". It is just for damage reduction for certain NPCs
        }
 public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
 {
     if (player.ownedProjectileCounts[item.shoot] > 0 || player.altFunctionUse == 2)
     {
         return(false);
     }
     for (int i = 0; i < Main.maxProjectiles; i++)
     {
         Projectile p = Main.projectile[i];
         if (p.active && p.owner == player.whoAmI && SquireMinionTypes.Contains(p.type))
         {
             p.Kill();
         }
     }
     player.AddBuff(item.buffType, 2);
     Projectile.NewProjectile(player.Center, Vector2.Zero, item.shoot, damage, item.knockBack, player.whoAmI);
     return(false);
 }
        // little bit weird to put this in the squire itself rather than the modplayer, but so it goes
        public void StartSpecial(bool fromSync = false)
        {
            int cooldownBuffType = ModContent.BuffType <SquireCooldownBuff>();

            player.AddBuff(cooldownBuffType, SpecialCooldown + SpecialDuration);
            // this is a bit hacky, but this code only runs on the first squire, so
            // manually propegate the special to all squires the player owns
            for (int i = 0; i < Main.maxProjectiles; i++)
            {
                Projectile p = Main.projectile[i];
                if (p.owner == player.whoAmI && SquireMinionTypes.Contains(p.type))
                {
                    ((SquireMinion)p.modProjectile).SetSpecialStartFrame();
                }
            }
            if (!fromSync)
            {
                new SquireSpecialStartPacket(player).Send();
            }
        }