コード例 #1
0
        public override void ModifyTooltips(List <TooltipLine> tooltips)
        {
            OrbitalPlayer orbitalPlayer = Main.player[item.owner].GetModPlayer <OrbitalPlayer>();

            bool hasDamage = false;

            foreach (TooltipLine line in tooltips)
            {
                if (line.mod == "Terraria" && line.Name == "Damage") //Cuts the text to say "orbital damage"
                {
                    line.text = line.text.Split(' ')[0] + " orbital damage";
                    hasDamage = true;
                }
            }

            string durationText = ((int)(orbitalPlayer.ModifiedOrbitalTime(this) / 60)).ToString() + " seconds duration";

            foreach (TooltipLine line in tooltips)                                  //Adds the duration, with the place depending on whether the item has damage or not
            {
                if (!hasDamage && line.mod == "Terraria" && line.Name == "UseMana") //Puts it above mana use
                {
                    line.text = durationText + "\n" + line.text;
                }
                else if (hasDamage && line.mod == "Terraria" && line.Name == "Speed")  //Intentionally replaces use speed
                {
                    line.text = durationText;
                }
            }

            tooltips.RemoveAll(line => line.mod == "Terraria" && line.Name.StartsWith("CritChance")); //Removes the critical chance line
        }
コード例 #2
0
        public override void GetWeaponDamage(Player player, ref int damage)
        {
            //Gets boosted by the player's strongest damage between magic and melee, and ignores buffs from other orbitals
            OrbitalPlayer orbitalPlayer = player.GetModPlayer <OrbitalPlayer>();

            damage = (int)(item.damage * orbitalPlayer.damageMultiplier * (Math.Max(player.meleeDamage, player.magicDamage) - orbitalPlayer.damageBuffFromOrbitals));


            if (specialFunctionType == SpecialRightClick) //A trick to stop the bugged 1-tick delay between consecutive right-click uses of a weapon
            {
                HandleAltUseAnimation(player, item);
            }
        }
コード例 #3
0
        public sealed override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            OrbitalPlayer orbitalPlayer = player.GetModPlayer <OrbitalPlayer>();

            if (orbitalPlayer.active[this.type])                  //The orbital is already active
            {
                if (specialFunctionType != SpecialNone)           //Alternate use mechanics
                {
                    if (specialFunctionType == SpecialRightClick) //Right-click mode
                    {
                        if (player.altFunctionUse != 2)           //Left click: Resets duration
                        {
                            orbitalPlayer.time = orbitalPlayer.ModifiedOrbitalTime(this);
                        }
                        else //Right click: Special function
                        {
                            orbitalPlayer.specialFunctionActive = true;
                        }
                        return(false);
                    }
                    else if (specialFunctionType == SpecialReuse)                     //Reuse mode
                    {
                        orbitalPlayer.specialFunctionActive = true;                   //Special function
                        orbitalPlayer.time = orbitalPlayer.ModifiedOrbitalTime(this); //Resets duration
                        return(false);
                    }
                }
            }
            else //The orbital is not active
            {
                orbitalPlayer.ResetOrbitals();
                orbitalPlayer.active[this.type] = true;
                orbitalPlayer.time = orbitalPlayer.ModifiedOrbitalTime(this);

                for (int i = 0; i < amount; i++)
                {
                    Vector2 rotation;                                            //We will pass this as the velocity of the projectile, which will be stored then set to 0
                    rotation = Vector2.UnitX.RotatedBy(FullCircle * i / amount); //Divides the circle into a set amount of points and picks the current one in the loop
                    Projectile.NewProjectile(position, rotation, type, damage, knockBack, player.whoAmI);
                }
            }

            return(false); //Doesn't shoot normally
        }
コード例 #4
0
        public override bool CanUseItem(Player player)
        {
            OrbitalPlayer orbitalPlayer = player.GetModPlayer <OrbitalPlayer>();

            //Can't use the right click special function with the orbital not active
            if (specialFunctionType == SpecialRightClick && player.altFunctionUse == 2 && !orbitalPlayer.active[this.type])
            {
                return(false);
            }

            //Can't use an orbital if any other orbital is in the process of dying
            for (int id = 0; id < OrbitalID.Orbital.Length; id++)
            {
                if (orbitalPlayer.active[id] && orbitalPlayer.time <= OrbitalID.Orbital[id].DyingTime)
                {
                    return(false);
                }
            }

            return(base.CanUseItem(player));
        }