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; } }
public override void UpdateEffects(Player player) { if (Math.Abs(player.velocity.X) > 4f) { Rectangle rect = player.getRect(); int dust = ModDust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, mod, "Smoke"); } }
public override void Update(Terraria.Player player, SkillData data) { if (data.Time == 0 && !player.inventory.Take(10).Any(x => x.useAmmo == Terraria.ID.AmmoID.Bullet)) { CombatText.NewText(player.getRect(), Color.Red, "You don't have a gun type weapon."); data.EndUse(true); return; } const int ShotType = Terraria.ID.ProjectileID.BulletHighVelocity; const int FireDelay = 6; const float ShotSpeed = 17f; if (data.Time >= FireDelay) { int MouseSwayMaxDistance = 12 - data.Level / 2; Vector2 ShotDestination = new Vector2(Main.mouseX + Main.screenPosition.X, Main.mouseY + Main.screenPosition.Y); Vector2 ShotSpawnCenter = player.Center; if (MouseSwayMaxDistance > 0) { ShotDestination.X += Main.rand.Next(-MouseSwayMaxDistance, MouseSwayMaxDistance + 1); ShotDestination.Y += Main.rand.Next(-MouseSwayMaxDistance, MouseSwayMaxDistance + 1); } Vector2 ShotDirection = GetDirection(ShotSpawnCenter, ShotDestination) * ShotSpeed; int Damage = data.GetRangedDamage(0, 0.7f + 0.12f * data.Level, player); int proj = Projectile.NewProjectile(ShotSpawnCenter, ShotDirection, ShotType, Damage, 0.4f, player.whoAmI); Projectile proj2 = Main.projectile[proj]; proj2.maxPenetrate = 3 + data.Level / 5; for (int i = 0; i < 10; i++) { if (player.inventory[i].useAmmo == Terraria.ID.AmmoID.Bullet) { FakeWeaponUsage(player, i, GetMousePositionInTheWorld, FireDelay); break; } } data.ChangeStep(); } if (data.Step >= 16) { data.EndUse(); } }
public override void UpdateEffects(Player player) { if (Math.Abs(player.velocity.X) > player.mount.DashSpeed - player.mount.RunSpeed / 2f) { player.noKnockback = true; Rectangle rect = player.getRect(); //Tweak hitbox to be the Basilisks head rect.Width = 2; rect.Height = 2; if (player.direction == 1) { rect.Offset(player.width - 1, 0); } rect.Offset(0, player.height - 19); rect.Inflate(28, 16); for (int n = 0; n < Main.maxNPCs; n++) { NPC npc = Main.npc[n]; if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] == 0) { Rectangle rect2 = npc.getRect(); if (rect.Intersects(rect2) && (npc.noTileCollide || Collision.CanHit(player.position, player.width, player.height, npc.position, npc.width, npc.height))) { float damage = BasiliskMount.damage * player.minionDamage; float knockback = BasiliskMount.knockback * player.minionKB; int direction = player.direction; if (player.velocity.X < 0f) { direction = -1; } if (player.velocity.X > 0f) { direction = 1; } if (player.whoAmI == Main.myPlayer) { player.ApplyDamageToNPC(npc, (int)damage, knockback, direction, false); } npc.immune[player.whoAmI] = 30; player.immune = true; player.immuneTime = 6; return; } } } } }