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; }
public override bool UseItem(Player player) { GyrolitePlayer gp = player.GetModPlayer <GyrolitePlayer>(mod); player.statLifeMax += 50; gp.lunarHeartStack++; return(true); }
public override bool CanUseItem(Player player) { GyrolitePlayer gp = player.GetModPlayer <GyrolitePlayer>(mod); if (gp.lunarHeartStack < 2) { return(true); } return(false); }
public override void UpdateArmorSet(Player player) { GyrolitePlayer p = player.GetModPlayer <GyrolitePlayer>(mod); p.frostbiteMax += 900; player.magicDamage += 0.08F; player.meleeDamage += 0.08F; player.rangedDamage += 0.08F; player.minionDamage += 0.08F; player.thrownDamage += 0.08F; }
public override void Update(Player player, ref int buffIndex) { GyrolitePlayer gp = (GyrolitePlayer)player.GetModPlayer(mod, "GyrolitePlayer"); if (player.ownedProjectileCounts[mod.ProjectileType("VileGeyserMinion")] > 0) { gp.vileGeyserMinion = true; } if (!gp.vileGeyserMinion) { player.DelBuff(buffIndex); buffIndex--; } else { player.buffTime[buffIndex] = 18000; } }
public override bool PreAI() { GyrolitePlayer gp = (GyrolitePlayer)Main.player[projectile.owner].GetModPlayer(mod, "GyrolitePlayer"); if (gp.player.dead) { gp.vileGeyserMinion = false; } if (gp.vileGeyserMinion) { projectile.timeLeft = 2; } projectile.ai[0]++; if (projectile.ai[0] >= 60) { projectile.frame++; projectile.ai[0] = 0; if (projectile.frame == Main.projFrames[projectile.type]) { int randAmount = Main.rand.Next(9, 17); for (int i = 0; i < randAmount; ++i) { int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0, 0, mod.ProjectileType("BloodyGeyserProjectile"), projectile.damage, 0, projectile.owner, Main.rand.Next(0, 3)); Main.projectile[proj].position.X += Main.rand.Next(-10, 11); Main.projectile[proj].position.Y += Main.rand.Next(-10, 11); if (Main.projectile[proj].position != projectile.Center) { Main.projectile[proj].velocity = projectile.DirectionTo(Main.projectile[proj].position) * Main.rand.Next(4, 9); } Main.projectile[proj].localAI[0] = Main.rand.Next(-10, 11) / 80; } projectile.frame = 0; } } return(false); }
public override bool PreAI() { Player player = Main.player[projectile.owner]; if (!player.active) { projectile.active = false; return(false);; } GyrolitePlayer modPlayer = (GyrolitePlayer)player.GetModPlayer(mod, "GyrolitePlayer"); if (player.dead) { modPlayer.dwarfFeederPet = false; modPlayer.petKillStack = 0; } if (modPlayer.dwarfFeederPet) { if (modPlayer.petKillStack >= 12) { int amount = Main.rand.Next(1, 3); Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ItemID.CursedFlame, amount); modPlayer.petKillStack = 0; } projectile.timeLeft = 2; } if (Main.netMode != 1) { if (projectile.ai[0] == 0) { int lastProj = projectile.whoAmI; for (int i = 0; i < 6; ++i) { int newProj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0, 0, mod.ProjectileType("DwarfFeederBody"), projectile.damage, projectile.knockBack, projectile.owner, lastProj); lastProj = newProj; } int newTailProj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0, 0, mod.ProjectileType("DwarfFeederTail"), projectile.damage, projectile.knockBack, projectile.owner, lastProj); projectile.ai[0] = 1; } } int minTileX = (int)(projectile.position.X / 16) - 1; int maxTileX = (int)((projectile.position.X + projectile.width) / 16.0) + 2; int minTileY = (int)(projectile.position.Y / 16.0) - 1; int maxTileY = (int)((projectile.position.Y + projectile.height) / 16.0) + 2; if (minTileX < 0) { minTileX = 0; } if (maxTileX > Main.maxTilesX) { maxTileX = Main.maxTilesX; } if (minTileY < 0) { minTileY = 0; } if (maxTileY > Main.maxTilesY) { maxTileY = Main.maxTilesY; } bool collision = false; for (int x = minTileX; x < maxTileX; x++) { for (int y = minTileY; y < maxTileY; y++) { if (Main.tile[x, y] != null && (Main.tile[x, y].nactive() && (Main.tileSolid[Main.tile[x, y].type] || Main.tileSolidTop[Main.tile[x, y].type] && Main.tile[x, y].frameY == 0) || Main.tile[x, y].liquid > 64)) { Vector2 pos; pos.X = x * 16; pos.Y = y * 16; if (projectile.position.X + projectile.width > pos.X && projectile.position.X < pos.X + 16 && projectile.position.Y + projectile.height > pos.Y && projectile.position.Y < pos.Y + 16) { collision = true; } } } } if (!collision) { Rectangle hitbox = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); int hitboxCheck = 160; bool notInRange = true; if (player.active && !player.dead) { Rectangle playerHitbox = new Rectangle((int)player.position.X - hitboxCheck, (int)player.position.Y - hitboxCheck, hitboxCheck * 2, hitboxCheck * 2); if (hitbox.Intersects(playerHitbox)) { notInRange = false; } } if (notInRange) { collision = true; } } float maxVelocity = 8f; float acceleration = 0.07f; Vector2 center = new Vector2(projectile.position.X + (projectile.width * 0.5F), projectile.position.Y + (projectile.height * 0.5F)); Vector2 ownerCenter = new Vector2(player.position.X + (player.width * 0.5F), player.position.Y + (player.height * 0.5F)); float targetX = (int)(ownerCenter.X / 16) * 16; float targetY = (int)(ownerCenter.Y / 16) * 16; center.X = (int)(center.X / 16) * 16; center.Y = (int)(center.Y / 16) * 16; float dirX = targetX - center.X; float dirY = targetY - center.Y; float length = (float)Math.Sqrt(dirX * dirX + dirY * dirY); if (!collision) { projectile.velocity.Y = projectile.velocity.Y + 0.11f; if (projectile.velocity.Y > maxVelocity) { projectile.velocity.Y = maxVelocity; } if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < maxVelocity * 0.4) { if (projectile.velocity.X < 0.0) { projectile.velocity.X = projectile.velocity.X - acceleration * 1.1f; } else { projectile.velocity.X = projectile.velocity.X + acceleration * 1.1f; } } else if (projectile.velocity.Y == maxVelocity) { if (projectile.velocity.X < maxVelocity) { projectile.velocity.X = projectile.velocity.X + acceleration; } else if (projectile.velocity.X > maxVelocity) { projectile.velocity.X = projectile.velocity.X - acceleration; } } else if (projectile.velocity.Y > 4.0) { if (projectile.velocity.X < 0.0) { projectile.velocity.X = projectile.velocity.X + acceleration * 0.9f; } else { projectile.velocity.X = projectile.velocity.X - acceleration * 0.9f; } } } else { float num2 = (float)Math.Sqrt(dirX * dirX + dirY * dirY); float num3 = Math.Abs(dirX); float num12 = Math.Abs(dirY); float num13 = maxVelocity / num2; float num14 = dirX * num13; float num15 = dirY * num13; if (projectile.velocity.X > 0.0 && num14 > 0.0 || projectile.velocity.X < 0.0 && num14 < 0.0 || (projectile.velocity.Y > 0.0 && num15 > 0.0 || projectile.velocity.Y < 0.0 && num15 < 0.0)) { if (projectile.velocity.X < num14) { projectile.velocity.X = projectile.velocity.X + acceleration; } else if (projectile.velocity.X > num14) { projectile.velocity.X = projectile.velocity.X - acceleration; } if (projectile.velocity.Y < num15) { projectile.velocity.Y = projectile.velocity.Y + acceleration; } else if (projectile.velocity.Y > num15) { projectile.velocity.Y = projectile.velocity.Y - acceleration; } if (Math.Abs(num15) < maxVelocity * 0.2 && (projectile.velocity.X > 0.0 && num14 < 0.0 || projectile.velocity.X < 0.0 && num14 > 0.0)) { if (projectile.velocity.Y > 0.0) { projectile.velocity.Y = projectile.velocity.Y + acceleration * 2f; } else { projectile.velocity.Y = projectile.velocity.Y - acceleration * 2f; } } if (Math.Abs(num14) < maxVelocity * 0.2 && (projectile.velocity.Y > 0.0 && num15 < 0.0 || projectile.velocity.Y < 0.0 && num15 > 0.0)) { if (projectile.velocity.X > 0.0) { projectile.velocity.X = projectile.velocity.X + acceleration * 2f; } else { projectile.velocity.X = projectile.velocity.X - acceleration * 2f; } } } else if (num3 > num12) { if (projectile.velocity.X < num14) { projectile.velocity.X = projectile.velocity.X + acceleration * 1.1f; } else if (projectile.velocity.X > num14) { projectile.velocity.X = projectile.velocity.X - acceleration * 1.1f; } if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < maxVelocity * 0.5) { if (projectile.velocity.Y > 0.0) { projectile.velocity.Y = projectile.velocity.Y + acceleration; } else { projectile.velocity.Y = projectile.velocity.Y - acceleration; } } } else { if (projectile.velocity.Y < num15) { projectile.velocity.Y = projectile.velocity.Y + acceleration * 1.1f; } else if (projectile.velocity.Y > num15) { projectile.velocity.Y = projectile.velocity.Y - acceleration * 1.1f; } if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < maxVelocity * 0.5) { if (projectile.velocity.X > 0.0) { projectile.velocity.X = projectile.velocity.X + acceleration; } else { projectile.velocity.X = projectile.velocity.X - acceleration; } } } } projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; return(false); }
public override void UpdateEffects(Player player) { GyrolitePlayer modPlayer = (GyrolitePlayer)player.GetModPlayer(mod, "GyrolitePlayer"); modPlayer.wyvernMount = true; }
public override bool PreAI() { Player player = Main.player[projectile.owner]; if (!player.active) { projectile.active = false; return(false);; } GyrolitePlayer modPlayer = (GyrolitePlayer)player.GetModPlayer(mod, "GyrolitePlayer"); if (player.dead) { modPlayer.skyJellyPet = false; modPlayer.petKillStack = 0; } if (modPlayer.skyJellyPet) { if (modPlayer.petKillStack >= 12) { int amount = Main.rand.Next(1, 3); Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ItemID.StickyGlowstick, amount); modPlayer.petKillStack = 0; } projectile.timeLeft = 2; } ++projectile.frameCounter; if (projectile.frameCounter < 6.0) { projectile.frame = 0; } else if (projectile.frameCounter < 12.0) { projectile.frame = 1; } else if (projectile.frameCounter < 18.0) { projectile.frame = 2; } else { projectile.frame = 3; if (projectile.frameCounter >= 23.0) { projectile.frameCounter = 0; } } Lighting.AddLight((int)(projectile.position.X + (projectile.height / 2)) / 16, (int)(projectile.position.Y + (projectile.height / 2)) / 16, 0.1f, 0.3f, 0.8f); projectile.tileCollide = false; projectile.ignoreWater = true; float num2 = 0.5f; if (Vector2.Distance(player.Center, projectile.Center) >= 120) { projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; projectile.velocity = projectile.velocity * 0.98f; if (projectile.velocity.X <= -num2 || projectile.velocity.X >= num2 || (projectile.velocity.Y <= -num2 || projectile.velocity.Y >= num2)) { return(false); } float num3 = 7f; Vector2 center = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); float dirX = player.position.X + (player.width / 2) - center.X; float dirY = player.position.Y + (player.height / 2) - center.Y; float num6 = (float)Math.Sqrt(dirX * dirX + dirY * dirY); float num7 = num3 / num6; float num8 = dirX * num7; float num9 = dirY * num7; projectile.velocity.X = num8; projectile.velocity.Y = num9; } else { projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; projectile.velocity = projectile.velocity * 0.95f; if (projectile.velocity.X <= -num2 || projectile.velocity.X >= num2 || (projectile.velocity.Y <= -num2 || projectile.velocity.Y >= num2)) { return(false); } projectile.ai[1]++; if (projectile.ai[1] >= 60) { float num3 = 3f; Vector2 center = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); float dirX = (player.position.X + (player.width / 2) + Main.rand.Next(-player.width, player.width + 1)) - center.X; float dirY = (player.position.Y + (player.height / 2) + Main.rand.Next(-player.height, player.height + 1)) - center.Y; float num6 = (float)Math.Sqrt(dirX * dirX + dirY * dirY); float num7 = num3 / num6; float num8 = dirX * num7; float num9 = dirY * num7; projectile.velocity.X = num8; projectile.velocity.Y = num9; projectile.ai[1] = 0; } } return(false); }
public override bool PreAI() { Player player = Main.player[projectile.owner]; if (!player.active) { projectile.active = false; return(false);; } GyrolitePlayer modPlayer = (GyrolitePlayer)player.GetModPlayer(mod, "GyrolitePlayer"); if (player.dead) { modPlayer.crystalSpiritPet = false; modPlayer.petKillStack = 0; } if (modPlayer.crystalSpiritPet) { if (modPlayer.petKillStack >= 50) { int amount = Main.rand.Next(1, 4); Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ItemID.CrystalShard, amount); modPlayer.petKillStack = 0; } projectile.timeLeft = 2; } float num16 = 0.2f; projectile.tileCollide = false; int num17 = 100; Vector2 center = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); float dirX = player.position.X + (float)(player.width / 2) - center.X; float dirY = player.position.Y + (float)(player.height / 2) - center.Y; dirY += (float)Main.rand.Next(-10, 21); dirX += (float)Main.rand.Next(-10, 21); dirY -= 60f; float num20 = (float)Math.Sqrt((double)(dirX * dirX + dirY * dirY)); float num21 = 6f; if (num20 < (float)num17 && player.velocity.Y == 0f && projectile.position.Y + (float)projectile.height <= player.position.Y + (float)player.height && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { if (projectile.velocity.Y < -6f) { projectile.velocity.Y = -6f; } } if (num20 < 50f) { if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) { projectile.velocity *= 0.99f; } num16 = 0.01f; } else { if (num20 < 100f) { num16 = 0.02f; } if (num20 > 300f) { num16 = 0.2f; } num20 = num21 / num20; dirX *= num20; dirY *= num20; } if (projectile.velocity.X < dirX) { projectile.velocity.X = projectile.velocity.X + num16; if (num16 > 0.05f && projectile.velocity.X < 0f) { projectile.velocity.X = projectile.velocity.X + num16; } } if (projectile.velocity.X > dirX) { projectile.velocity.X = projectile.velocity.X - num16; if (num16 > 0.05f && projectile.velocity.X > 0f) { projectile.velocity.X = projectile.velocity.X - num16; } } if (projectile.velocity.Y < dirY) { projectile.velocity.Y = projectile.velocity.Y + num16; if (num16 > 0.05f && projectile.velocity.Y < 0f) { projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; } } if (projectile.velocity.Y > dirY) { projectile.velocity.Y = projectile.velocity.Y - num16; if (num16 > 0.05f && projectile.velocity.Y > 0f) { projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; } } projectile.rotation += 0.03F; return(false); }