Ejemplo n.º 1
0
 public override void ModifyTooltips(List <TooltipLine> tooltips)
 {
     if (ModSupport.GetMod("CalamityMod") != null)
     {
         TooltipLine tooltipLine = tooltips.FirstOrDefault((TooltipLine x) => x.Name == "Damage" && x.mod == "Terraria");
         if (tooltipLine != null)
         {
             string[] source = tooltipLine.text.Split(new char[]
             {
                 ' '
             });
             string str  = source.First();
             string str2 = source.Last();
             tooltipLine.text = str + " rogue " + str2;
         }
     }
     else
     {
         TooltipLine error = new TooltipLine(mod, "Error", "WARNING: ITEM WILL NOT FUNCTION WITHOUT CALAMITY ENABLED!")
         {
             overrideColor = new Color(255, 50, 50)
         };
         tooltips.Add(error);
     }
 }
Ejemplo n.º 2
0
 public override void GetWeaponCrit(Player player, ref int crit)
 {
     if (ModSupport.GetMod("CalamityMod") != null)
     {
         int throwingCrit = (int)ModSupport.GetModPlayerConditions("CalamityMod", player, "CalamityPlayer", "throwingCrit", false, false);
         crit = item.crit + throwingCrit;
     }
 }
Ejemplo n.º 3
0
 public override void SetDefaults(Projectile projectile)
 {
     if (ModSupport.GetMod("CalamityMod") != null)
     {
         rogue = (bool)ModSupport.GetModGlobalProjConditions("CalamityMod", projectile, "CalamityGlobalProjectile", "rogue", false, false);
         ModSupport.SetModGlobalProjConditions("CalamityMod", projectile, "CalamityGlobalProjectile", "rogue", true, false, false);
     }
 }
Ejemplo n.º 4
0
 public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat)
 {
     if (ModSupport.GetMod("CalamityMod") != null)
     {
         float throwingDamage = (float)ModSupport.GetModPlayerConditions("CalamityMod", player, "CalamityPlayer", "throwingDamage", false, false);
         add += throwingDamage - 1f;
     }
 }
Ejemplo n.º 5
0
 public override void SetDefaults(Item item)
 {
     if (ModSupport.GetMod("CalamityMod") != null)
     {
         rogue = (bool)ModSupport.GetModGlobalItemConditions("CalamityMod", item, "CalamityGlobalItem", "rogue", false, false);
         ModSupport.SetModGlobalItemConditions("CalamityMod", item, "CalamityGlobalItem", "rogue", true, false, false);
     }
 }
Ejemplo n.º 6
0
 public override void UpdateLifeRegen(NPC npc, ref int damage)
 {
     if (ModSupport.GetMod("CalamityMod") != null)
     {
         if (npc.realLife > 0 && Main.npc[npc.realLife].GetGlobalNPC <CalamityGlobalNPC>().CalamityDR < 1f)
         {
             CalamityDR = Main.npc[npc.realLife].GetGlobalNPC <CalamityGlobalNPC>().CalamityDR;
         }
     }
 }
Ejemplo n.º 7
0
 public override bool ConsumeItem(Player player)
 {
     if (ModSupport.GetMod("CalamityMod") != null)
     {
         bool throwingAmmoCost50 = (bool)ModSupport.GetModPlayerConditions("CalamityMod", player, "CalamityPlayer", "throwingAmmoCost50", false, false);
         bool throwingAmmoCost66 = (bool)ModSupport.GetModPlayerConditions("CalamityMod", player, "CalamityPlayer", "throwingAmmoCost66", false, false);
         return((!throwingAmmoCost50 || Main.rand.Next(1, 101) <= 50) && (!throwingAmmoCost66 || Main.rand.Next(1, 101) <= 66));
     }
     return(base.ConsumeItem(player));
 }
Ejemplo n.º 8
0
 public override void ModifyTooltips(List <TooltipLine> list)
 {
     if (ModSupport.GetMod(crossoverModName) != null)
     {
         TooltipLine error = new TooltipLine(mod, "Error", "WARNING: ITEM WILL NOT FUNCTION WITHOUT " + crossoverModName.ToUpper() + " ENABLED!")
         {
             overrideColor = new Color(255, 50, 50)
         };
         list.Add(error);
     }
 }
Ejemplo n.º 9
0
 public override void ModifyHitPlayer(Projectile projectile, Player target, ref int damage, ref bool crit)
 {
     if (ModSupport.GetMod("CalamityMod") != null)
     {
         if (projectile.hostile && !projectile.friendly && projectile.type > 714 && projectile.modProjectile.mod == AAMod.instance)
         {
             bool revenge = (bool)ModSupport.GetModWorldConditions("CalamityMod", "CalamityWorld", "revenge", false, true);
             bool Death   = (bool)ModSupport.GetModWorldConditions("CalamityMod", "CalamityWorld", "death", false, true);
             if (!NPC.downedMoonlord)
             {
                 damage = (int)(damage * (1.1f + (revenge? 0.2f:0f) + (Death? 0.3f:0f)));
             }
             else
             {
                 damage = (int)(damage * (1.2f + (revenge? 0.4f:0f) + (Death? 0.6f:0f)));
             }
         }
     }
 }
Ejemplo n.º 10
0
 public override void ModifyHitPlayer(NPC npc, Player target, ref int damage, ref bool crit)
 {
     if (ModSupport.GetMod("CalamityMod") != null)
     {
         if (npc.type > 580 && npc.modNPC.mod == AAMod.instance && npc.boss)
         {
             bool revenge = (bool)ModSupport.GetModWorldConditions("CalamityMod", "CalamityWorld", "revenge", false, true);
             bool Death   = (bool)ModSupport.GetModWorldConditions("CalamityMod", "CalamityWorld", "death", false, true);
             if (!NPC.downedMoonlord)
             {
                 damage = (int)(damage * (1.1f + (revenge? 0.2f:0f) + (Death? 0.3f:0f)));
             }
             else
             {
                 damage = (int)(damage * (1.2f + (revenge? 0.4f:0f) + (Death? 0.6f:0f)));
             }
         }
     }
 }
Ejemplo n.º 11
0
        public override float UseTimeMultiplier(Player player)
        {
            float num = 1f;

            if (ModSupport.GetMod("CalamityMod") != null)
            {
                bool gloveOfPrecision    = (bool)ModSupport.GetModPlayerConditions("CalamityMod", player, "CalamityPlayer", "gloveOfPrecision", false, false);
                bool gloveOfRecklessness = (bool)ModSupport.GetModPlayerConditions("CalamityMod", player, "CalamityPlayer", "gloveOfRecklessness", false, false);
                if (gloveOfPrecision)
                {
                    num -= 0.2f;
                }
                if (gloveOfRecklessness)
                {
                    num += 0.2f;
                }
            }
            return(num);
        }
Ejemplo n.º 12
0
 public override void ModifyHitByProjectile(NPC npc, Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
 {
     if (ModSupport.GetMod("CalamityMod") != null)
     {
         if (npc.type > 580 && npc.boss && npc.modNPC.mod == AAMod.instance)
         {
             if (projectile.type > 714 && projectile.modProjectile.mod == ModLoader.GetMod("CalamityMod"))
             {
                 damage = (int)(damage * CalamityDR * (NPC.downedPlantBoss? 0.8f : 1f) * (NPC.downedMoonlord? 0.7f : 1f));
             }
         }
         if (npc.type > 580 && npc.boss && npc.modNPC.mod == ModLoader.GetMod("CalamityMod"))
         {
             if (projectile.type > 714 && projectile.modProjectile.mod == AAMod.instance)
             {
                 damage = (int)(damage * (NPC.downedPlantBoss? 1.25f : 1f) * (NPC.downedMoonlord? 1.42f : 1f));
             }
         }
     }
 }
Ejemplo n.º 13
0
 public override void ModifyHitByItem(NPC npc, Player player, Item item, ref int damage, ref float knockback, ref bool crit)
 {
     if (ModSupport.GetMod("CalamityMod") != null)
     {
         if (npc.type > 580 && npc.boss && npc.modNPC.mod == AAMod.instance)
         {
             if (item.type > 3930 && item.modItem.mod == ModLoader.GetMod("CalamityMod"))
             {
                 damage = (int)(damage * CalamityDR * (NPC.downedPlantBoss? 0.8f : 1f) * (NPC.downedMoonlord? 0.7f : 1f));
             }
         }
         if (npc.type > 580 && npc.boss && npc.modNPC.mod == ModLoader.GetMod("CalamityMod"))
         {
             if (item.type > 3930 && item.modItem.mod == AAMod.instance)
             {
                 damage = (int)(damage * (NPC.downedPlantBoss? 1.25f : 1f) * (NPC.downedMoonlord? 1.42f : 1f));
             }
         }
     }
 }
Ejemplo n.º 14
0
        public override void SetDefaults(NPC npc)
        {
            if (ModSupport.GetMod("CalamityMod") != null)
            {
                if (npc.type == mod.NPCType("Athena"))
                {
                    CalamityDR = 0.8f;
                }
                if (npc.type == mod.NPCType("OlympianDragon"))
                {
                    CalamityDR = 0.8f;
                }

                if (npc.type == mod.NPCType("Greed"))
                {
                    CalamityDR = 0.8f;
                }

                if (npc.type == mod.NPCType("ForsakenAnubis"))
                {
                    CalamityDR = 0.65f;
                }
                if (npc.type == mod.NPCType("CurseCircle"))
                {
                    CalamityDR = 0.65f;
                }
                if (npc.type == mod.NPCType("CursedScarab"))
                {
                    CalamityDR = 0.65f;
                }
                if (npc.type == mod.NPCType("CursedLocust"))
                {
                    CalamityDR = 0.65f;
                }
                if (npc.type == mod.NPCType("Naddaha"))
                {
                    CalamityDR = 0.65f;
                }
                if (npc.type == mod.NPCType("HorusSentry"))
                {
                    CalamityDR = 0.65f;
                }

                if (npc.type == mod.NPCType("Ashe"))
                {
                    CalamityDR = 0.6f;
                }
                if (npc.type == mod.NPCType("AsheDragon"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("AsheOrbiter"))
                {
                    CalamityDR = 0.7f;
                }

                if (npc.type == mod.NPCType("Haruka"))
                {
                    CalamityDR = 0.6f;
                }

                if (npc.type == mod.NPCType("AkumaA"))
                {
                    CalamityDR = 0.4f;
                }
                if (npc.type == mod.NPCType("Akuma"))
                {
                    CalamityDR = 0.4f;
                }
                if (npc.type == mod.NPCType("AwakenedLung"))
                {
                    CalamityDR = 0.4f;
                }
                if (npc.type == mod.NPCType("AncientLung"))
                {
                    CalamityDR = 0.4f;
                }

                if (npc.type == mod.NPCType("AthenaA"))
                {
                    CalamityDR = 0.7f;
                }
                if (npc.type == mod.NPCType("Seraph"))
                {
                    CalamityDR = 0.7f;
                }
                if (npc.type == mod.NPCType("SeraphA"))
                {
                    CalamityDR = 0.7f;
                }

                if (npc.type == mod.NPCType("DaybringerHead"))
                {
                    CalamityDR = 0.4f;
                }
                if (npc.type == mod.NPCType("NightcrawlerHead"))
                {
                    CalamityDR = 0.4f;
                }
                if (npc.type == mod.NPCType("NCCloud"))
                {
                    CalamityDR = 0.6f;
                }

                if (npc.type == mod.NPCType("GreedA"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("GreedMinion"))
                {
                    CalamityDR = 0.7f;
                }

                if (npc.type == mod.NPCType("SupremeRajah"))
                {
                    CalamityDR = 0.6f;
                }

                if (npc.type == mod.NPCType("AbyssGrip"))
                {
                    CalamityDR = 0.2f;
                }
                if (npc.type == mod.NPCType("BlazeGrip"))
                {
                    CalamityDR = 0.2f;
                }
                if (npc.type == mod.NPCType("FuryAshe"))
                {
                    CalamityDR = 0.2f;
                }
                if (npc.type == mod.NPCType("WrathHaruka"))
                {
                    CalamityDR = 0.2f;
                }
                if (npc.type == mod.NPCType("Shen"))
                {
                    CalamityDR = 0.15f;
                }
                if (npc.type == mod.NPCType("ShenA"))
                {
                    CalamityDR = 0.1f;
                }
                if (npc.type == mod.NPCType("FuryAsheOrbiter"))
                {
                    CalamityDR = 0.2f;
                }
                if (npc.type == mod.NPCType("Shenling"))
                {
                    CalamityDR = 0.15f;
                }

                if (npc.type == mod.NPCType("YamataA"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("YamataAHead"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("YamataAHeadF"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("YamataAHeadF1"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("YamataAHeadF2"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("Yamata"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("YamataHead"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("YamataHeadF"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("YamataHeadF1"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("YamataHeadF2"))
                {
                    CalamityDR = 0.5f;
                }

                if (npc.type == mod.NPCType("ZeroEcho"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("ZeroMini"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("ZeroProtocol"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("GenocideCannon"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("Neutralizer"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("NovaFocus"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("OmegaVolley"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("RealityCannon"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("RiftShredder"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("SearcherZero"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("Taser"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("TeslaHand"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("VoidStar"))
                {
                    CalamityDR = 0.5f;
                }
                if (npc.type == mod.NPCType("Zero"))
                {
                    CalamityDR = 0.5f;
                }
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Charge item time faster when not moving, or grounded (or both!)
        /// Also handles the item.useStyle to allow for custom animation
        /// </summary>
        /// <param name="slashDelay">Delay before slash appears, as a ratio (default 0.9f) of the total attack time (1f - no delay to 0f - start at the end)</param>
        /// <param name="ai1">Set ai1, usually the direction of the slash, or power attack. </param>
        /// <param name="customCharge">Custom function call replacing normal charge effect, using player.itemTime; </param>
        /// <returns>True on the frame of a charged attack</returns>
        public static bool HoldItemManager(Player player, Item item, int slashProjectileID, Color chargeColour = default, float slashDelay = 0.9f, float ai1 = 1f, Action <Player, bool> customCharge = null, int delaySpeed = 4)
        {
            bool charged = false;

            // Attacking
            if (player.itemAnimation > 0)
            {
                // JUST attacked
                bool onAttackFrame = player.itemAnimation == player.itemAnimationMax - 1;
                if (ModSupport.GetMod("TerrariaOverhaul") != null)
                {
                    onAttackFrame = player.itemAnimation == player.itemAnimationMax - 2;
                }

                if (onAttackFrame)
                {
                    if (ai1 == 1f || ai1 == -1f)
                    {
                        // Use isBeingGrabbed for alternating swings
                        ai1 = item.isBeingGrabbed ? 1f : -1f;
                        item.isBeingGrabbed = !item.isBeingGrabbed;
                    }
                    else if (ai1 == 0)
                    {
                        // Used to identify a charged attack
                        item.beingGrabbed = true;
                        charged           = true;
                    }

                    if (Main.myPlayer == player.whoAmI)
                    {
                        // First frame of attack
                        Vector2 mouse = new Vector2(Main.screenPosition.X + Main.mouseX, Main.screenPosition.Y + Main.mouseY);
                        SetAttackRotation(player);
                        Vector2 velocity = (mouse - player.MountedCenter).SafeNormalize(new Vector2(player.direction, 0));
                        int     p        = Projectile.NewProjectile(
                            player.MountedCenter,
                            velocity,
                            slashProjectileID,
                            (int)(item.damage * player.meleeDamage),
                            item.scale,
                            player.whoAmI,
                            (int)(player.itemAnimationMax * slashDelay - player.itemAnimationMax), ai1);
                    }

                    // Set item time anyway, if not shoot, also make next slash upwards
                    if (item.shoot <= 0 && player.itemTime == 0)
                    {
                        player.itemTime = item.useTime; item.isBeingGrabbed = false;
                    }
                }

                item.useStyle = 0;
            }
            else
            {
                item.useStyle     = 1;
                item.beingGrabbed = false;
            }

            // when counting down
            if (player.itemTime > 0)
            {
                // internalChargeTicker hangs the item time until past the delaySpeed
                // in which case it allows the itemTime to be reduced on that frame.

                // If not moving much, boost item charge speed
                //int delaySpeed = 4; // default, item charged 1 1 / 3 speed

                // If grounded, half the dleay speed
                if (player.velocity.Y == 0)
                {
                    delaySpeed /= 2;
                }

                // cap
                delaySpeed = Math.Max(delaySpeed, 1);

                // Reset if swinging
                if (player.itemAnimation > 0)
                {
                    player.itemTime = Math.Max(player.itemTime, item.useTime);
                }
                else if (Main.myPlayer == player.whoAmI)
                {
                    if (customCharge != null)
                    {
                        customCharge(player, false);
                    }
                    else
                    {
                        for (int i = 0; i < 3; i++)
                        {
                            // Charging dust
                            Vector2 vector = new Vector2(
                                Main.rand.Next(-2048, 2048) * (0.003f * player.itemTime) - 4,
                                Main.rand.Next(-2048, 2048) * (0.003f * player.itemTime) - 4);
                            Dust d = Main.dust[Dust.NewDust(
                                                   player.MountedCenter + vector, 1, 1,
                                                   45, 0, 0, 255,
                                                   chargeColour, 1.5f)];
                            d.velocity  = -vector / 16;
                            d.velocity -= player.velocity / 8;
                            d.noLight   = true;
                            d.noGravity = true;
                        }
                    }
                }

                // allow item time when past "limit"

                if (internalChargeTicker >= delaySpeed)
                {
                    internalChargeTicker = 0;
                }

                // delay item time unless at 0
                if (internalChargeTicker > 0)
                {
                    player.itemTime++;
                }
                internalChargeTicker++;

                // flash and correct
                if (player.itemTime <= 1)
                {
                    player.itemTime = 1;
                    if (customCharge != null)
                    {
                        customCharge(player, true);
                    }
                }
            }

            // HACK: allows the player to swing the sword when held on the mouse
            if (Main.mouseItem.type == item.type)
            {
                if (player.controlUseItem && player.itemAnimation == 0 && player.itemTime == 0 && player.releaseUseItem)
                {
                    player.itemAnimation = 1;
                }
            }

            return(charged);
        }