Inheritance: Entity
Exemplo n.º 1
2
        public override void UpdateAccessory(Player player)
        {
            player.buffImmune[BuffID.Darkness] = true;
            player.buffImmune[BuffID.Blackout] = true;

            Lighting.AddLight(player.position, 0.5F, 0, 0.5F); // Add a small, red light to the player.
        }
 public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
 {
     if(Main.rand.Next(2) == 0)
     {
         target.AddBuff(BuffID.OnFire, 500);
     }
 }
Exemplo n.º 3
1
 public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
 {
     Vector2 direction = new Vector2(speedX, speedY);
     direction.Normalize();
     position += direction * item.width;
     return true;
 }
Exemplo n.º 4
1
 public override void OnHitNPC(Terraria.Player player, NPC npc, int damage, float knockBack, bool crit)
 {
     if (Main.rand.Next(2) == 0)   //50% chance to occur
     {
         npc.AddBuff(BuffID.OnFire, 360, false);
     }
 }
Exemplo n.º 5
0
        public override void Update(Terraria.Player player, SkillData rawdata)
        {
            InvokeBatsSkillData data = (InvokeBatsSkillData)rawdata;
            const float         ShotDirectionVariation = 0.2f;

            if (data.Time == 0)
            {
                data.SetFloat(ShotDirectionVar, -ShotDirectionVariation * 2);
            }
            if (data.Time >= 21 && player.itemAnimation > 0 && player.HeldItem.damage > 0)
            {
                data.ChangeStep();
                float   ShotDirectionY = data.GetFloat(ShotDirectionVar);
                int     Damage         = data.GetSummonDamage(0, 0.6f + 0.02f * data.Level, player);
                Vector2 ShotDirection  = new Vector2(player.direction * -2f, ShotDirectionY);
                int     ProjPos        = Projectile.NewProjectile(player.Center, ShotDirection, 316, Damage, 0f, player.whoAmI);
                if (!data.BatPositions.Contains(ProjPos))
                {
                    data.BatPositions.Add(ProjPos);
                }
                ShotDirectionY += ShotDirectionVariation;
                if (ShotDirectionY >= ShotDirectionVariation * 2)
                {
                    ShotDirectionY *= -1;
                }
                data.SetFloat(ShotDirectionVar, ShotDirectionY);
            }
        }
Exemplo n.º 6
0
        public override void AI()
        {
            Terraria.Player player = Terraria.Main.player[projectile.owner];
            if (player.dead || !player.active)
            {
                player.ClearBuff(BuffType <ScaryLookingPumpkinBuff>());
            }
            if (player.HasBuff(BuffType <ScaryLookingPumpkinBuff>()))
            {
                projectile.timeLeft = 2;
            }

            //General behavior
            Vector2 idlePosition = player.Center;

            float minionPositionOffsetX = (10 + projectile.minionPos * 40) * -player.direction;

            idlePosition.X += minionPositionOffsetX; // Go behind the player

            // Teleport to player if distance is too big
            Vector2 vectorToIdlePosition   = idlePosition - projectile.Center;
            float   distanceToIdlePosition = vectorToIdlePosition.Length();

            if (Main.myPlayer == player.whoAmI && distanceToIdlePosition > 800f)
            {
                projectile.position  = idlePosition;
                projectile.velocity *= 0.1f;
                projectile.netUpdate = true; //multiplayer related
            }
        }
Exemplo n.º 7
0
 internal KillEventArgs(Terraria.Player player, PlayerDeathReason damageSource, int damage, bool isPvP)
 {
     Player       = player;
     DamageSource = damageSource;
     Damage       = damage;
     IsPvP        = isPvP;
 }
Exemplo n.º 8
0
 public override bool Shoot(Terraria.Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
 {
     type = mod.ProjectileType("ogreProjectile");
     if (shootNum == 0)
     {
         Projectile.NewProjectile(position.X, position.Y, speedX * 1.2f, speedY * 1.2f, mod.ProjectileType("ogreProj"), damage, knockBack, player.whoAmI, speedX, speedY);
         shootNum = shootNum + 1;
     }
     else if (shootNum == 1)
     {
         Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.None, damage, knockBack, player.whoAmI, speedX, speedY);
         shootNum = shootNum + 1;
     }
     else if (shootNum == 2)
     {
         Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.None, damage, knockBack, player.whoAmI, speedX, speedY);
         shootNum = shootNum + 1;
     }
     else if (shootNum == 3)
     {
         Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.None, damage, knockBack, player.whoAmI, speedX, speedY);
         shootNum = shootNum + 1;
     }
     else if (shootNum == 4)
     {
         Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.None, damage, knockBack, player.whoAmI, speedX, speedY);
         shootNum = shootNum + 1;
     }
     else if (shootNum == 5)
     {
         Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("occProj"), damage, knockBack, player.whoAmI, speedX, speedY);
         shootNum = shootNum + 1;
     }
     else if (shootNum == 6)
     {
         Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("occProj"), damage, knockBack, player.whoAmI, speedX, speedY);
         shootNum = shootNum + 1;
     }
     else if (shootNum == 7)
     {
         Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("occProj"), damage, knockBack, player.whoAmI, speedX, speedY);
         shootNum = shootNum + 1;
     }
     else if (shootNum == 8)
     {
         Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("occProj"), damage, knockBack, player.whoAmI, speedX, speedY);
         shootNum = shootNum + 1;
     }
     else if (shootNum == 9)
     {
         Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("occProj"), damage, knockBack, player.whoAmI, speedX, speedY);
         shootNum = shootNum + 1;
     }
     else if (shootNum == 10)
     {
         Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("occProj"), damage, knockBack, player.whoAmI, speedX, speedY);
         shootNum = 0;
     }
     return(true);
 }
Exemplo n.º 9
0
		public override void OpenVanillaBag(string context, Player player, int arg)
		{
			if (context == "bossBag" && arg == ItemID.FishronBossBag)
			{
				player.QuickSpawnItem(mod.ItemType("Bubble"), Main.rand.Next(8, 13));
			}
		}
Exemplo n.º 10
0
        public static void PostLoad(Player p)
        {
            magicFindBonus = 0f; //Reset bonus

            oldHealth = p.statLifeMax;
            oldMana = p.statManaMax;
        }
Exemplo n.º 11
0
        public override bool CanUseItem(Player player)
        {
            if (totalEnergyInput > core.energyOutput)
                return false; // Energy input is is larger than than output, so we cannot launch the Terrabot.

            return true; // All checks passed, we are allowed to launch the Terrabot.
        }
Exemplo n.º 12
0
        /// <summary>
        /// WARNING: This assumes no state changes to the given player(s) since the real damage was calculated
        /// </summary>
        /// <param name="player"></param>
        /// <param name="realDamage"></param>
        /// <returns></returns>
        public static double GetInternalDamageFromRealDamage(Terraria.Player player, double realDamage)
        {
            float  defenseMultiplier = Main.expertMode ? 0.75f : 0.5f;
            double outDamage         = realDamage / (1 - player.endurance);

            if (player.setSolar && player.solarShields > 0)
            {
                outDamage *= 1.0 / 0.7;
            }
            else if (player.beetleDefense && player.beetleOrbs > 0)
            {
                outDamage *= 1.0 / (1.0 - (0.15 * player.beetleOrbs));
            }

            if (player.defendedByPaladin)
            {
                var buffedFrom = Main.player.Where(p => p != null && p.team == player.team && p.team != 0 && p.Distance(player.Center) < 800.0 && p.hasPaladinShield && !p.dead && !p.immune).FirstOrDefault();
                if (buffedFrom != null)
                {
                    outDamage *= 1.0 / 0.75;
                    // TODO: Implement damaging other player
                }
            }

            return(outDamage + (player.statDefense * defenseMultiplier));
        }
        /// <summary>
        /// When a <see cref="Player" /> in PvP is damaged by the <see cref="Projectile" />.
        /// </summary>
        /// <param name="p">The <see cref="Player" /> that got damaged.</param>
        /// <param name="dir">In which direction the <see cref="Player"/> got hit.</param>
        /// <param name="dmg">The damage dealt to the <see cref="Player" />.</param>
        /// <param name="crit">Wether it was a critical hit or not.</param>
        /// <param name="cMult">The damage multiplier of a critical hit.</param>
        public override void DamagePVP(Player p, int dir, ref int dmg, ref bool crit, ref float cMult)
        {
            base.DamagePVP(p, dir, ref dmg, ref crit, ref cMult);

            if (Main.rand.Next(3) == 0)
                p.AddBuff(20, 300);
        }
Exemplo n.º 14
0
		public virtual void UpdateVanitySet(Player player)
		{
			if (item != null)
			{
				item.UpdateVanitySet(player);
			}
		}
Exemplo n.º 15
0
		public override void UseStyle(Player player)
		{
			if (player.whoAmI == Main.myPlayer && player.itemTime == 0)
			{
				player.AddBuff(item.buffType, 3600, true);
			}
		}
Exemplo n.º 16
0
        public override void Update(Terraria.Player player, SkillData data)
        {
            const byte SpawnXVar = 0, SpawnYVar = 1;

            if (data.Time == 0)
            {
                data.SetFloat(SpawnXVar, Main.screenPosition.X + Main.mouseX);
                data.SetFloat(SpawnYVar, Main.screenPosition.Y + Main.mouseY);
            }
            if (data.Time % 10 == 0)
            {
                const float ShotSpeed = 20;
                float       SpawnX = data.GetFloat(SpawnXVar), SpawnY = data.GetFloat(SpawnYVar);
                float       CenterX = SpawnX, CenterY = SpawnY;
                SpawnY -= 1000;
                SpawnX += Main.rand.Next(-300, 301);
                Vector2 ShotDir = new Vector2(CenterX - SpawnX, CenterY - SpawnY);
                ShotDir.Normalize();
                Projectile.NewProjectile(new Vector2(SpawnX, SpawnY), ShotDir * ShotSpeed, Terraria.ID.ProjectileID.Meteor1 + Main.rand.Next(3), data.GetMagicDamage(0, 1.4f + 0.12f * data.Level, player), 4f, player.whoAmI);
            }
            if (data.Time / 10 >= data.Level)
            {
                data.EndUse();
            }
        }
Exemplo n.º 17
0
        public override string ReviveMessage(TerraGuardian Guardian, bool IsPlayer, Terraria.Player RevivePlayer, TerraGuardian ReviveGuardian)
        {
            List <string> Mes = new List <string>();

            Mes.Add("");
            return(Mes[Main.rand.Next(Mes.Count)]);
        }
 public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
 {
     target.AddBuff(BuffID.OnFire, 10);
     target.AddBuff(BuffID.Electrified, 3);
     target.AddBuff(BuffID.Venom, 5);
     target.AddBuff(BuffID.CursedInferno, 4);
 }
Exemplo n.º 19
0
 public TileEvent(Tile tile, Player player, int changeType)
     : base(player)
 {
     base.setState(false);
     this.tile = tile;
     this.changeType = changeType;
 }
        /// <summary>
        /// Updates the spawn rate for every player. Called every tick.
        /// </summary>
        /// <param name="player">The Player where the NPC(s) could spawn.</param>
        public override void UpdateSpawnRate(Player player)
        {
            base.UpdateSpawnRate(player);

            if (AvalonMod.Wraiths.IsActive)
            {
                NPC.spawnRate = 15;
                NPC.maxSpawns = 20;

                for (int i = 0; i < Main.npc.Length; i++)
                {
                    if (Main.npc[i] == null || Main.npc[i].type <= 0 || Main.npc[i].life <= 0 || !Main.npc[i].active || String.IsNullOrEmpty(Main.npc[i].name))
                        continue;

                    if (Main.npc[i].townNPC || Main.npc[i].boss)
                        continue;

                    bool keepAlive = false;

                    object[] attr = Main.npc[i].subClass.GetType().GetCustomAttributes(typeof(WraithInvasionNPCAttribute), true);
                    for (int j = 0; j < attr.Length; j++)
                        if (attr[j] is WraithInvasionNPCAttribute)
                            keepAlive = true;

                    Main.npc[i].active &= keepAlive;
                }
            }
        }
Exemplo n.º 21
0
 public override void UpdateAccessory(Player player, bool hideVisual)
 {
     GyrolitePlayer gp = (GyrolitePlayer)player.GetModPlayer(mod, "GyrolitePlayer");
     gp.ringType = 1;
     gp.ringEffects[0] = item.shoot;
     gp.ringEffects[1] = BuffID.CursedInferno;
 }
Exemplo n.º 22
0
        public override void UpdateAccessory(Player player)
        {
            player.runAcceleration += 0.2F; // 20% faster acceleration.
            player.maxFallSpeed += 0.33F; // 33% faster fall speed.

            Lighting.AddLight(player.position, 0, 0.5F, 0.1F); // Add a small, green light to the player.
        }
Exemplo n.º 23
0
		private Vector2 GetLightPosition(Player player)
		{
			Vector2 position = Main.screenPosition;
			position.X += Main.mouseX;
			position.Y += player.gravDir == 1 ? Main.mouseY : Main.screenHeight - Main.mouseY;
			return position;
		}
Exemplo n.º 24
0
 public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit)
 {
     if(!target.boss)
     {
     target.velocity.Y -= 5;
     }
 }
Exemplo n.º 25
0
        public override void Update(Terraria.Player player, SkillData data)
        {
            float   Range                   = GetEffectRange(data);
            Vector2 PlayerCenter            = player.Center;
            int     DamageOvertimeInflicted = 0;
            bool    InflictDamage           = data.Time % 6 == 0;

            if (InflictDamage)
            {
                DamageOvertimeInflicted = (data.Level / 2) * 2;
            }
            for (int i = 0; i < 200; i++)
            {
                if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && IsUndead(Main.npc[i].type) && Main.npc[i].Distance(PlayerCenter) < Range)
                {
                    Main.npc[i].AddBuff(31, 5 * 60);
                    if (InflictDamage)
                    {
                        CombatText.NewText(Main.npc[i].getRect(), CombatText.DamagedHostile, DamageOvertimeInflicted, false, true);
                        Main.npc[i].life -= DamageOvertimeInflicted;
                        if (Main.npc[i].life <= 0)
                        {
                            Main.npc[i].checkDead();
                        }
                    }
                }
            }
            if (data.Time >= 20 * 60)
            {
                data.EndUse();
            }
        }
Exemplo n.º 26
0
        public override void OnHitPlayer(Player target, int damage, bool crit)
        {
            npc.life = 0;
            npc.checkDead();

            target.AddBuff(BuffID.Frostburn, 180); // Applies Frostburn debuff for 3 seconds.
        }
Exemplo n.º 27
0
        public override void UpdateAccessory(Terraria.Player player, bool hideVisual)
        {
            player.waterWalk = true;
            player.fireWalk  = true;
            player.lavaMax  += 480;
            player.lavaRose  = true;

            player.accRunSpeed      = 8f;
            player.rocketBoots      = 600;
            player.moveSpeed       += 0.2f;
            player.iceSkate         = true;
            player.arcticDivingGear = true;
            player.accFlipper       = true;
            player.accDivingHelm    = true;

            player.AddBuff(BuffID.Shine, 180, false);

            player.noFallDmg = true;

            player.blackBelt   = true;
            player.dash        = 2;
            player.spikedBoots = 2;

            player.autoJump  = true;
            player.jumpBoost = true;

            player.scope         = true;
            player.rangedCrit   += 10;
            player.rangedDamage += 0.1f;

            player.kbGlove      = true;
            player.meleeSpeed  += 0.15f;
            player.meleeDamage += 0.15f;
        }
Exemplo n.º 28
0
        /// <summary>
        /// Occurs when the server has received a message from the client.
        /// </summary>
        protected void NetHooks_GetData(GetDataEventArgs args)
        {
            byte[]          bufferSegment = null;
            Terraria.Player player        = null;

            if ((player = Terraria.Main.player.ElementAtOrDefault(args.Msg.whoAmI)) == null)
            {
                return;
            }

            bufferSegment = new byte[args.Length];
            System.Array.Copy(args.Msg.readBuffer, args.Index, bufferSegment, 0, args.Length);

            if (args.MsgID == PacketTypes.NpcStrike)
            {
                Terraria.NPC      npc       = null;
                Packets.DamageNPC dmgPacket = Packets.PacketMarshal.MarshalFromBuffer <Packets.DamageNPC>(bufferSegment);

                if (dmgPacket.NPCID < 0 || dmgPacket.NPCID > Terraria.Main.npc.Length ||
                    args.Msg.whoAmI < 0 || dmgPacket.NPCID > Terraria.Main.player.Length)
                {
                    return;
                }

                if ((npc = Terraria.Main.npc.ElementAtOrDefault(dmgPacket.NPCID)) == null)
                {
                    return;
                }

                AddNPCDamage(npc, player, dmgPacket.Damage, Convert.ToBoolean(dmgPacket.CrititcalHit));
            }
        }
Exemplo n.º 29
0
        public static void CreatePlayer(Player p)
        {
            magicFindBonus = 0f; //Reset bonus

            //Start with 100 mana
            p.statManaMax = 100;
        }
        ////////////////

        internal void Update()             // Called from an Update function
        {
            foreach (var kv in this.PlayerTexts.ToArray())
            {
                int who = kv.Key;
                IList <PlayerLabelText> list   = kv.Value;
                Terraria.Player         player = Main.player[who];

                if (player == null || !player.active)
                {
                    this.PlayerTexts.Remove(who);
                    continue;
                }

                for (int i = 0; i < list.Count; i++)
                {
                    PlayerLabelText txt = list[i];

                    if (txt.Duration <= 0)
                    {
                        list.Remove(txt);
                    }
                    else
                    {
                        txt.Duration--;
                    }
                }
            }
        }
Exemplo n.º 31
0
 internal static void ReadCustomData(Player player, BinaryReader reader)
 {
     int count = reader.ReadUInt16();
     for (int k = 0; k < count; k++)
     {
         string modName = reader.ReadString();
         string name = reader.ReadString();
         byte[] data = reader.ReadBytes(reader.ReadUInt16());
         Mod mod = ModLoader.GetMod(modName);
         ModPlayer modPlayer = mod == null ? null : player.GetModPlayer(mod, name);
         if (modPlayer != null)
         {
             using (MemoryStream stream = new MemoryStream(data))
             {
                 using (BinaryReader customReader = new BinaryReader(stream))
                 {
                     modPlayer.LoadCustomData(customReader);
                 }
             }
             if (modName == "ModLoader" && name == "MysteryPlayer")
             {
                 ((MysteryPlayer)modPlayer).RestoreData(player);
             }
         }
         else
         {
             ModPlayer mystery = player.GetModPlayer(ModLoader.GetMod("ModLoader"), "MysteryPlayer");
             ((MysteryPlayer)mystery).AddData(modName, name, data);
         }
     }
 }
Exemplo n.º 32
0
        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            for (int i = 0; i < 3; ++i)
            {
                position = new Vector2(player.position.X + (player.width * 0.5f) + (float)Main.rand.Next(201) * -player.direction + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f);
                position.X = (position.X * 10f + player.Center.X) / 11f + (float)Main.rand.Next(-100, 101);
                position.Y -= (float)(150 * i);
                speedX = (float)Main.mouseX + Main.screenPosition.X - position.X;
                speedY = (float)Main.mouseY + Main.screenPosition.Y - position.Y;
                if (speedY < 0f)
                {
                    speedY *= -1f;
                }
                if (speedY < 20f)
                {
                    speedY = 20f;
                }
                float num80 = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY));
                num80 = item.shootSpeed / num80;
                speedX *= num80;
                speedY *= num80;
                speedX = speedX + Main.rand.Next(-40, 41) * 0.03f;
                speedY = speedY + (float)Main.rand.Next(-40, 41) * 0.03f;
                speedX *= (float)Main.rand.Next(75, 150) * 0.01f;
                position.X += (float)Main.rand.Next(-50, 51);
                Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, player.Center.Y, 0f);
            }

            return false;
        }
Exemplo n.º 33
0
        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            player.accRunSpeed = 6.75f;
            player.rocketBoots = 3;
            player.moveSpeed += 0.08f;
            player.iceSkate = true;

            if ((player.mount == null || player.mount.Type == 0 || !player.mount.Active) && !player.wet)
            {
                int minX = (int)(player.position.X / 16) - 1;
                int maxX = (int)(player.position.X / 16) + 3;
                int y = (int)(player.position.Y / 16) + 3;
                for (int x = minX; x < maxX; ++x)
                {
                    Tile tile = Main.tile[x, y];
                    if (tile.liquidType() == Tile.Liquid_Water && tile.liquid > 25 && !tile.active())
                    {
                        tile.active(true);
                        tile.type = TileID.BreakableIce;
                        tile.inActive(false);

                        Main.PlaySound(19, (int)player.position.X, (int)player.position.Y, 1);
                        Main.tile[x, y].liquid = 0;

                        WorldGen.SquareTileFrame(x, y, true);
                    }
                }
            }
        }
 public override void MeleeEffects(Player player, Rectangle hitbox)
 {
     if (Main.rand.Next(3) == 0)
     {
     int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, mod.DustType("CCSparkle"));
     }
 }
Exemplo n.º 35
0
 public override void OnHitPlayer(Player player, int damage, bool crit)
 {
     if(Main.expertMode || Main.rand.Next(2) == 0)
     {
     player.AddBuff(BuffID.OnFire, 600, true);
     }
 }
Exemplo n.º 36
0
 public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
 {
     position.X = (float)Main.mouseX + Main.screenPosition.X;
     position.Y = (float)Main.mouseY + Main.screenPosition.Y;
     Projectile.NewProjectile(position.X, position.Y, 0, 0, type, 10, 0.5F, player.whoAmI, Main.rand.Next(1, 4), 0f);
     return false;
 }
Exemplo n.º 37
0
		public virtual void UpdateVanity(Player player, EquipType type)
		{
			if (item != null)
			{
				item.UpdateVanity(player, type);
			}
		}
Exemplo n.º 38
0
        public override void OnEnterWorld(Terraria.Player player)
        {
            base.OnEnterWorld(player);
            var mod = ModContent.GetInstance <SkillTreeMod>();

            this.skillDefinitionLoader = mod.skillDefinitionLoader;
        }
Exemplo n.º 39
0
 protected TSPlayer(String playerName)
 {
     TilesDestroyed = new Dictionary<Vector2, Tile>();
     Index = -1;
     FakePlayer = new Player { name = playerName, whoAmi = -1 };
     Group = new Group("null");
 }
Exemplo n.º 40
0
        public override string BirthdayMessage(Terraria.Player player, TerraGuardian guardian)
        {
            List <string> Mes = new List <string>();

            Mes.Add("");
            return(Mes[Main.rand.Next(Mes.Count)]);
        }
Exemplo n.º 41
0
		public virtual void ArmorSetShadows(Player player, ref bool longTrail, ref bool smallPulse, ref bool largePulse, ref bool shortTrail)
		{
			if (item != null)
			{
				item.ArmorSetShadows(player, ref longTrail, ref smallPulse, ref largePulse, ref shortTrail);
			}
		}
Exemplo n.º 42
0
        public override bool UpdateFrame(Player player, int state, Vector2 velocity)
        {
            cool++;
            Vector2 position = Main.screenPosition;
            position.X += Main.mouseX;
            position.Y += Main.mouseY;
            Vector2 vector = Vector2.Subtract(position,player.position);
            if (velocity.Length() > 2f)
            {
                player.gravity = 0;
            }
            else
            {
                player.gravity = Player.defaultGravity;
            }
            if(cool > 60)
            {
                Main.NewText("X: "+vector.X +"  y: "+vector.Y);

            }

            player.position.Y += vector.Y > 5f ? 2.5f : vector.Y / 2;
            player.position.X += vector.X > 5f * player.direction ? 2.5f * player.direction : vector.X / 2;
            //vector = Vector2.Normalize(vector);
            //if (cool > 60)
            //{
            //    Main.NewText("X: " + vector.X + "  y: " + vector.Y);
            //    cool = 0;
            //}
            //player.position.Y += vector.Y * 2f;
            //player.position.X += vector.X;

            return true;
        }
Exemplo n.º 43
0
 //add near end of Terraria.Player.LoadPlayer before accessory check
 internal static void ReadModFile(Player player, string path, bool isCloudSave)
 {
     path = Path.ChangeExtension(path, ".tplr");
     RijndaelManaged rijndaelManaged = new RijndaelManaged();
     rijndaelManaged.Padding = PaddingMode.None;
     if (!FileUtilities.Exists(path, isCloudSave))
     {
         return;
     }
     byte[] buffer = FileUtilities.ReadAllBytes(path, isCloudSave);
     using (MemoryStream stream = new MemoryStream(buffer))
     {
         using (CryptoStream cryptoStream = new CryptoStream(stream, rijndaelManaged.CreateDecryptor(Player.ENCRYPTION_KEY, Player.ENCRYPTION_KEY), CryptoStreamMode.Read))
         {
             using (BinaryReader reader = new BinaryReader(cryptoStream))
             {
                 byte limit = reader.ReadByte();
                 if (limit == 0)
                 {
                     return;
                 }
                 byte[] flags = reader.ReadBytes(limit);
                 if (flags.Length < numFlagBytes)
                 {
                     Array.Resize(ref flags, numFlagBytes);
                 }
                 ReadModPlayer(player, flags, reader);
             }
         }
     }
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="p"></param>
        public override void ArmorSetBonus(Player p)
        {
            Main.dust[Dust.NewDust(p.position, p.width, p.height, 27, 0, 0, 200, Color.Purple, 1.0f)].noGravity = true;

            p.setBonus = "The Dark Matter has spread";
            p.invis = true;
        }
Exemplo n.º 45
0
 public override void Update(Terraria.Player player, ref int buffIndex)
 {
     if (player.HeldItem.type == mod.ItemType("anarchy"))
     {
         player.rangedDamage *= 1.3f;
     }
 }
Exemplo n.º 46
0
        public override void OnHitByNPC(Terraria.NPC npc, int damage, bool crit)
        {
            Terraria.Player player = Terraria.Main.player[npc.target];
            if (PoweredBattery)
            {
                if (Terraria.Main.rand.NextBool(10))
                {
                    Terraria.Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType <EnergyAura>(), 3, 2, player.whoAmI);
                }
            }
            if (PhanticMeleeBonus)
            {
                if (damage > 10)
                {
                    Vector2 offset = new Vector2(0, -100);
                    Terraria.Projectile.NewProjectile(player.Center + offset, new Vector2(0 + ((float)Terraria.Main.rand.Next(20) / 10) - 1, -3 + ((float)Terraria.Main.rand.Next(20) / 10) - 1), ModContent.ProjectileType <PhanticSoul>(), 6, 1f, Terraria.Main.myPlayer);
                }
            }
            if (BurnshockArmorBonus)
            {
                if (damage > 25)
                {
                    Vector2 offset = new Vector2(0, -100);

                    Terraria.Projectile.NewProjectile(player.Center + offset, new Vector2(0 + ((float)Terraria.Main.rand.Next(20) / 10) - 1, -3 + ((float)Terraria.Main.rand.Next(20) / 10) - 1), ModContent.ProjectileType <BurnshockCrystal>(), 40, 1f, Terraria.Main.myPlayer);
                    Terraria.Projectile.NewProjectile(player.Center + offset, new Vector2(0 + ((float)Terraria.Main.rand.Next(20) / 10) - 1, -3 + ((float)Terraria.Main.rand.Next(20) / 10) - 1), ModContent.ProjectileType <BurnshockCrystal>(), 40, 1f, Terraria.Main.myPlayer);
                    Terraria.Projectile.NewProjectile(player.Center + offset, new Vector2(0 + ((float)Terraria.Main.rand.Next(20) / 10) - 1, -3 + ((float)Terraria.Main.rand.Next(20) / 10) - 1), ModContent.ProjectileType <BurnshockCrystal>(), 40, 1f, Terraria.Main.myPlayer);
                }
            }
        }
Exemplo n.º 47
0
        private int DropAllYourCoins(On.Terraria.Player.orig_DropCoins orig, Terraria.Player self)
        {
            Player player = Main.LocalPlayer;
            int    num6   = 0;

            for (int i = 0; i < 59; i++)
            {
                if (player.inventory[i].type >= ItemID.CopperCoin && player.inventory[i].type <= ItemID.PlatinumCoin)
                {
                    int num5 = Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, player.inventory[i].type);
                    int num4 = player.inventory[i].stack / 2;
                    if (Main.expertMode)
                    {
                        num4 = (int)((double)player.inventory[i].stack * 0.25);
                    }
                    if (SpectraWorld.professionalMode)
                    {
                        num4 = (int)((double)player.inventory[i].stack * 0);
                    }
                    num4 = player.inventory[i].stack - num4;
                    player.inventory[i].stack -= num4;
                    if (player.inventory[i].type == ItemID.CopperCoin)
                    {
                        num6 += num4;
                    }
                    if (player.inventory[i].type == ItemID.SilverCoin)
                    {
                        num6 += num4 * 100;
                    }
                    if (player.inventory[i].type == ItemID.GoldCoin)
                    {
                        num6 += num4 * 10000;
                    }
                    if (player.inventory[i].type == ItemID.PlatinumCoin)
                    {
                        num6 += num4 * 1000000;
                    }
                    if (player.inventory[i].stack <= 0)
                    {
                        player.inventory[i] = new Item();
                    }
                    Main.item[num5].stack       = num4;
                    Main.item[num5].velocity.Y  = (float)Main.rand.Next(-20, 1) * 0.2f;
                    Main.item[num5].velocity.X  = (float)Main.rand.Next(-20, 21) * 0.2f;
                    Main.item[num5].noGrabDelay = 100;
                    if (Main.netMode == 1)
                    {
                        NetMessage.SendData(21, -1, -1, null, num5);
                    }
                    if (i == 58)
                    {
                        Main.mouseItem = player.inventory[i].Clone();
                    }
                }
            }
            player.lostCoins      = num6;
            player.lostCoinString = Main.ValueToCoins(player.lostCoins);
            return(num6);
        }
Exemplo n.º 48
0
        public override void Update(Terraria.Player player, SkillData data)
        {
            if (data.Time == 0 && !player.inventory.Take(10).Any(x => x.useAmmo == Terraria.ID.AmmoID.Arrow))
            {
                CombatText.NewText(player.getRect(), Color.Red, "You don't have a bow type weapon.");
                data.EndUse(true);
                return;
            }
            const byte RainPosXVar = 0;

            switch (data.Step)
            {
            case 0:
            {
                if (data.LastTime == 0)
                {
                    for (int i = 0; i < 10; i++)
                    {
                        if (player.inventory[i].useAmmo == Terraria.ID.AmmoID.Arrow)
                        {
                            FakeWeaponUsage(player, i, player.Center - new Vector2(0, -100));
                            break;
                        }
                    }
                    Vector2 ShotPos = player.Center;
                    for (int x = 1; x <= 6; x++)
                    {
                        float SpeedX = x * player.direction * 2, SpeedY = -18 - x * 2;
                        int   proj = Projectile.NewProjectile(player.Center, new Vector2(SpeedX, SpeedY), Terraria.ID.ProjectileID.WoodenArrowFriendly, GetDamage(player, data, true), 1.2f, player.whoAmI);
                        Main.projectile[proj].noDropItem = true;
                    }
                    data.SetFloat(RainPosXVar, ShotPos.X);
                }
                if (data.Time >= 60 * 3)
                {
                    data.ChangeStep();
                }
            }
            break;

            case 1:
            {
                if (data.Time % 3 == 0)
                {
                    Vector2 ProjPosition = player.Center;
                    ProjPosition.X  = data.GetFloat(RainPosXVar);
                    ProjPosition.Y -= Main.screenHeight;
                    ProjPosition.X -= Main.rand.Next(-Main.screenHeight, Main.screenHeight);
                    int proj = Projectile.NewProjectile(ProjPosition, new Vector2(0, 10 + Main.rand.Next(7, 13)), Terraria.ID.ProjectileID.WoodenArrowFriendly, GetDamage(player, data, false), 0.7f, player.whoAmI);
                    Main.projectile[proj].noDropItem = true;
                }
                if (data.Time >= 7 * 60)
                {
                    data.EndUse();
                }
            }
            break;
            }
        }
Exemplo n.º 49
0
        public override string CompletedRequestMessage(Terraria.Player player, TerraGuardian guardian)
        {
            List <string> Mes = new List <string>();

            Mes.Add("Yay! Thanks! Hehe.");
            Mes.Add("You did it?! You're my hero! Thanks!");
            return(Mes[Main.rand.Next(Mes.Count)]);
        }
Exemplo n.º 50
0
        public override string HasRequestMessage(Terraria.Player player, TerraGuardian guardian)
        {
            List <string> Mes = new List <string>();

            Mes.Add("Hey, Hey! I need your help to [objective]. Can you give me a hand?");
            Mes.Add("Saaaaaay... Can you help me [objective]?");
            return(Mes[Main.rand.Next(Mes.Count)]);
        }
Exemplo n.º 51
0
 public override bool UseItem(Terraria.Player player)
 {
     Main.dayTime     = false;
     Main.bloodMoon   = true;
     Main.pumpkinMoon = false;
     Main.snowMoon    = false;
     return(true);
 }
Exemplo n.º 52
0
 public override void UpdateAccessory(Terraria.Player player, bool hideVisual)
 {
     player.statManaMax2 += 20;
     player.statLifeMax2 += 20;
     player.lifeRegen    += 6;
     player.manaRegen    += 6;
     player.lavaMax       = 420;
 }
Exemplo n.º 53
0
        public override string NoRequestMessage(Terraria.Player player, TerraGuardian guardian)
        {
            List <string> Mes = new List <string>();

            Mes.Add("Um... No, I'm fine.");
            Mes.Add("Maybe another time. Right now I have everything I need.");
            return(Mes[Main.rand.Next(Mes.Count)]);
        }
Exemplo n.º 54
0
 public override bool UseItem(Terraria.Player player)
 {
     if (!ProjectPhoenix.Instance.playboy.etherHeart)
     {
         ProjectPhoenix.Instance.playboy.etherHeart = true;
         return(true);
     }
     return(false);
 }
Exemplo n.º 55
0
        public override string GreetMessage(Terraria.Player player, TerraGuardian guardian)
        {
            List <string> Mes = new List <string>();

            Mes.Add("Hello! Are you a begginer too?");
            Mes.Add("Oh, Hi! I didn't knew there were someone else in this world.");
            Mes.Add("Are you an adventurer? Cool! Me too. We could be friends!");
            return(Mes[Main.rand.Next(Mes.Count)]);
        }
Exemplo n.º 56
0
 public override bool BeforeShooting(Terraria.Player player, SkillData data, Terraria.Item weapon, ref int type, ref int damage, ref float knockback, ref Microsoft.Xna.Framework.Vector2 Position, ref float SpeedX, ref float SpeedY)
 {
     damage = (int)(damage * (0.6f + 0.02f * data.Level));
     if (weapon.ranged && MainMod.IsArrow(type))
     {
         Projectile.NewProjectile(Position.X, Position.Y, SpeedX, SpeedY - 0.4f, type, damage, knockback, player.whoAmI);
     }
     return(true);
 }
Exemplo n.º 57
0
        public override void OnHitNPC(Terraria.Player player, Terraria.NPC target, int damage, float knockBack, bool crit)
        {
            int chance = 60 / UseSpeedArray[0];

            if (Terraria.Main.rand.NextBool(chance * 3))
            {
                target.AddBuff(Terraria.ID.BuffID.OnFire, 60 * (chance));
            }
        }
Exemplo n.º 58
0
 public override void UpdateStatus(Terraria.Player player, SkillData data)
 {
     player.meleeDamage  += (player.meleeDamage - 1) * 0.5f;
     player.rangedDamage += (player.rangedDamage - 1) * 0.5f;
     player.magicDamage  += (player.magicDamage - 1) * 0.5f;
     player.minionDamage += (player.minionDamage - 1) * 0.5f;
     player.statDefense   = 0;
     player.meleeSpeed   += 1f;
 }
Exemplo n.º 59
0
 internal HurtingEventArgs(Terraria.Player player, PlayerDeathReason damageSource, int damage, bool isPvP,
                           bool isCritical)
 {
     Player       = player;
     DamageSource = damageSource;
     Damage       = damage;
     IsPvP        = isPvP;
     IsCritical   = isCritical;
 }
Exemplo n.º 60
0
        public override bool Shoot(Terraria.Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            Main.PlaySound(mod.GetSoundSlot(SoundType.Item, "Sounds/Item/cut61"), (int)player.Center.X, (int)player.Center.Y);
            Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedByRandom(MathHelper.ToRadians(0.8f));

            speedX = perturbedSpeed.X;
            speedY = perturbedSpeed.Y;
            type   = mod.ProjectileType("kaosonProj");
            return(true);
        }