public override bool UseItem(Player player) { DarkPlayer dplayer = player.GetModPlayer <DarkPlayer>(); if (player.altFunctionUse == 2) { if (dplayer.CostDarkness(5, false)) { dplayer.ShadowGuardianAttack = 4; dplayer.shadowGuardianDamage = Math.Max(1, player.statDefense / 10) * (item.damage / 10); item.reuseDelay = 25 + Math.Min(40, (2000 / Math.Max(1, player.statDefense))); item.autoReuse = false; } } else { if (dplayer.CostDarkness(4, false)) { dplayer.ShadowGuardianAttack = 3; dplayer.shadowGuardianDamage = item.damage; item.reuseDelay = 15; item.autoReuse = true; } } return(base.UseItem(player)); }
public void Shoot(Vector2 shootVel, int projectileType, Vector2 PosOffset = new Vector2()) { int type; switch (projectileType) { default: case 1: type = mod.ProjectileType("DarkFist"); animTime = 45; animType = 1; rightHand = !rightHand; break; case 2: type = mod.ProjectileType("darkDash"); break; case 3: type = mod.ProjectileType("UltimateDarkDash"); break; } Player player = Main.player[projectile.owner]; DarkPlayer dp = player.GetModPlayer <DarkPlayer>(); int proj = Projectile.NewProjectile(projectile.Center.X + PosOffset.X, projectile.Center.Y + PosOffset.Y, shootVel.X, shootVel.Y, type, dp.shadowGuardianDamage, projectile.knockBack, Main.myPlayer, 0f, 0f); Main.projectile[proj].timeLeft = 300; Main.projectile[proj].netUpdate = true; projectile.netUpdate = true; }
public void DarkDash(Player player, DarkPlayer Dplayer) { if (DashTimer <= 0) { //Buff player.AddBuff(mod.BuffType("DarkDashBuff"), 60); //Mouse position Vector2 offset = projectile.Center - player.Center; Vector2 MousePos = new Vector2(Main.mouseX - (Main.screenWidth / 2 + offset.X), Main.mouseY - (Main.screenHeight / 2 + offset.Y)); MousePos.Normalize(); MousePos *= shootSpeed; if (Dplayer.UltimateAttackDash) { MousePos *= 2; Dplayer.UltimateAttackDash = false; Shoot(player.velocity, 3, player.velocity); } player.velocity = MousePos; DashTimer = initDashTimer / Math.Max(1, (int)(Dplayer.darkDash.GetLevel() * 1.25f - 0.75f)); Dplayer.DarknessUseTimer = initDashTimer / Math.Max(1, (int)(Dplayer.darkDash.GetLevel() * 1.25f - 0.75f)); Shoot(player.velocity, 2); } Dplayer.ShadowGuardianAttack = 0; }
public void TeleportToNearestEnemy(Player player, DarkPlayer DPlayer) { Vector2 turnedOffset = DPlayer.offset; NPC target = new NPC(); for (int i = 0; i < 200; i++) { NPC npc = Main.npc[i]; if (npc.CanBeChasedBy(this, false)) { if (npc.position != new Vector2() && Vector2.Distance(npc.position, player.position) < 400) { Vector2 relativePos = npc.position - player.position; if (relativePos.Length() < (target.position - player.position).Length()) { target = npc; } } } } if (target.position != new Vector2()) { player.Center = target.position + turnedOffset * -target.spriteDirection; } DPlayer.ShadowGuardianAttack = 0; projectile.ai[0] = 30; }
public override bool CheckDead(NPC npc) { DarkPlayer dp = Main.player[Main.myPlayer].GetModPlayer <DarkPlayer>(); dp.RecoverDarkness(dp.darknessRecovery); return(base.CheckDead(npc)); }
public override bool UseItem(Player player) { item.damage = Math.Max(1, player.statDefense / 10) * initialDamage; DarkPlayer Dplayer = player.GetModPlayer <DarkPlayer>(); if (Dplayer.doubleDarkDamage) { item.damage *= 2; } Dplayer.shadowGuardianDamage = item.damage; if (player.altFunctionUse == 2) { if (Dplayer.CostDarkness(4, true)) { Dplayer.shadowGuardianDamage *= Dplayer.darkDash.GetLevel(); Dplayer.ShadowGuardianAttack = 2; } } else { if (Dplayer.CostDarkness(1, false)) { Dplayer.shadowGuardianDamage = Dplayer.shadowGuardianDamage * (int)(0.75f + (Dplayer.shadowPunch.GetLevel() * 0.25f)); Dplayer.ShadowGuardianAttack = 1; } } return(base.UseItem(player)); }
public override bool CanUseItem(Player player) { DarkPlayer Dplayer = player.GetModPlayer <DarkPlayer>(); bool QueenBee = NPC.downedQueenBee; bool bossOne = NPC.downedBoss1; bool bossTwo = NPC.downedBoss2; bool bossThree = NPC.downedBoss3; bool HardMode = Main.hardMode; bool mechOne = NPC.downedMechBoss1; bool mechTwo = NPC.downedMechBoss2; bool mechThree = NPC.downedMechBoss3; bool plantera = NPC.downedPlantBoss; bool golem = NPC.downedGolemBoss; bool cultist = NPC.downedAncientCultist; bool moonLord = NPC.downedMoonlord; bool day = Main.dayTime; bool alreadySpawned = NPC.AnyNPCs(mod.NPCType("godessQueen")); return(!alreadySpawned && moonLord && Dplayer.summonShadowMinion); }
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { DarkPlayer Dplayer = Main.player[projectile.owner].GetModPlayer <DarkPlayer>(); Dplayer.shadowPunch.GainExp(1); base.OnHitNPC(target, damage, knockback, crit); }
public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) { DarkPlayer Dplayer = player.GetModPlayer <DarkPlayer>(); mult = mult + Dplayer.CleansingDamage; base.ModifyWeaponDamage(player, ref add, ref mult, ref flat); }
public override void Update(GameTime gameTime) { Player pl = Main.player[Main.myPlayer]; DarkPlayer dp = pl.GetModPlayer <DarkPlayer>(); darkMetter.SetText(dp.TotalDarkness.ToString()); base.Update(gameTime); }
public void TpPlayerToEnemy() { Player pl = Main.player[projectile.owner]; DarkPlayer player = pl.GetModPlayer <DarkPlayer>(); for (int k = 0; k < 200; k++) { NPC npc = Main.npc[k]; if (npc.CanBeChasedBy(this, false)) { pl.position = npc.position + (player.offset * -npc.spriteDirection); player.ApearedBehind = true; player.ResetApearTimer(); } } }
public override void Update(Player player, ref int buffIndex) { DarkPlayer DarkPlayer = player.GetModPlayer <DarkPlayer>(); if (player.ownedProjectileCounts[mod.ProjectileType("ShadowGuardian")] > 0) { DarkPlayer.summonShadowMinion = true; } if (!DarkPlayer.summonShadowMinion) { player.DelBuff(buffIndex); DarkPlayer.ResetEffects(); buffIndex--; } else { player.buffTime[buffIndex] = 18000; } }
public void BackAttack(Player player) { DarkPlayer dp = player.GetModPlayer <DarkPlayer>(); NPC target = new NPC(); for (int i = 0; i < 200; i++) { NPC npc = Main.npc[i]; if (npc.CanBeChasedBy(this, false)) { if (npc.position != new Vector2() && Vector2.Distance(npc.position, player.position) < 400) { Vector2 relativePos = npc.position - player.position; if (relativePos.Length() < (target.position - player.position).Length()) { target = npc; } } } } if (target.position != new Vector2()) { Vector2 offset = new Vector2(25 * target.spriteDirection, -15); projectile.Center = target.Center + offset; backAttackTimer--; if (backAttackTimer <= 0) { Shoot(target.position - projectile.position, 1); if (backAttackTimer <= -10) { projectile.ai[0] = 30; dp.ShadowGuardianAttack = 0; } } } else { dp.ShadowGuardianAttack = 0; projectile.ai[0] = 30; } }
public override void UpdateAccessory(Player player, bool hideVisual) { DarkPlayer dp = player.GetModPlayer <DarkPlayer>(); dp.darknessRecovery += 3; dp.MaxDarkness += 50; DarkWorld dw = ModContent.GetInstance <DarkWorld>(); if (NPC.downedMoonlord) { item.defense = 100; } if (dw.downedGodessQueen) { item.defense = 150; } DarkPlayer Dplayer = player.GetModPlayer <DarkPlayer>(); player.noFallDmg = true; player.meleeSpeed += 1; player.maxMinions += 6; player.magicDamage += 3; player.statManaMax2 += 200; player.doubleJumpBlizzard = true; player.doubleJumpCloud = true; player.doubleJumpFart = true; player.doubleJumpSail = true; player.doubleJumpSandstorm = true; player.doubleJumpUnicorn = true; player.buffImmune[BuffID.OnFire] = true; player.buffImmune[BuffID.Darkness] = true; player.buffImmune[BuffID.Frozen] = true; player.buffImmune[BuffID.Chilled] = true; player.waterWalk = true; player.jumpBoost = true; player.noKnockback = true; Dplayer.doubleDarkDamage = true; }
public override void UpdateAccessory(Player player, bool hideVisual) { DarkPlayer dp = player.GetModPlayer <DarkPlayer>(); dp.darknessRecovery += 1; player.doubleJumpBlizzard = true; player.doubleJumpCloud = true; if (NPC.downedBoss1) { item.defense = 20; player.doubleJumpFart = true; if (NPC.downedBoss2) { item.defense = 30; player.doubleJumpSail = true; if (NPC.downedBoss3) { item.defense = 40; player.doubleJumpSandstorm = true; if (NPC.downedPlantBoss) { item.defense = 50; player.doubleJumpUnicorn = true; } } } } player.noFallDmg = true; player.meleeSpeed += 0.25f; player.maxMinions += 2; player.magicDamage += 1.5f; player.buffImmune[BuffID.OnFire] = true; player.waterWalk = true; player.jumpBoost = true; }
public override bool UseItem(Player player) { DarkPlayer DPlayer = player.GetModPlayer <DarkPlayer>(); if (player.statMana < 6) { return(false); } if (!DPlayer.summonShadowMinion) { item.buffType = mod.BuffType("Shadow"); item.shoot = mod.ProjectileType("ShadowGuardian"); DPlayer.summonShadowMinion = true; } else { item.buffType = -1; item.shoot = -1; DPlayer.summonShadowMinion = false; DPlayer.ResetEffects(); } return(base.UseItem(player)); }
public override void CheckActive() { Player player = Main.player[projectile.owner]; DarkPlayer darkPlayer = player.GetModPlayer <DarkPlayer>(); if (player.dead) { darkPlayer.summonShadowMinion = false; } if (!player.HasBuff(mod.BuffType("Shadow")) && timespawned > 30) { darkPlayer.summonShadowMinion = false; } if (!darkPlayer.summonShadowMinion && projectile.timeLeft > 4) { projectile.timeLeft = 2; } else if (darkPlayer.summonShadowMinion) { projectile.timeLeft = 150000; } }
public void DarkPunchAttack(Player player, DarkPlayer Player) { Vector2 offset = projectile.Center - player.Center; Vector2 MousePos = new Vector2(Main.mouseX - (Main.screenWidth / 2 + offset.X), Main.mouseY - (Main.screenHeight / 2 + offset.Y)); Player.ShadowGuardianAttack = 0; if (MousePos.X > 0) { projectile.spriteDirection = (projectile.direction = 1); } else if (MousePos.X < 0) { projectile.spriteDirection = (projectile.direction = -1); } MousePos.Normalize(); MousePos *= shootSpeed; Shoot(MousePos, 1); if (Player.shadowPunch.GetLevel() > 1 || Player.UltimateAttackPunch) { Vector2 Offset = new Vector2(0, 25); Shoot(MousePos, 1, Offset); Offset = new Vector2(0, -25); Shoot(MousePos, 1, Offset); if (Player.shadowPunch.GetLevel() > 2 || Player.UltimateAttackPunch) { Offset = new Vector2(25, 0); Shoot(MousePos, 1, Offset); Offset = new Vector2(-25, 0); Shoot(MousePos, 1, Offset); if (Player.UltimateAttackPunch) { Offset = new Vector2(-50, 50); Shoot(MousePos, 1, Offset); Offset = new Vector2(50, -50); Shoot(MousePos, 1, Offset); Offset = new Vector2(50, 50); Shoot(MousePos, 1, Offset); Offset = new Vector2(-50, -50); Shoot(MousePos, 1, Offset); //asdf Offset = new Vector2(-50, 0); Shoot(MousePos, 1, Offset); Offset = new Vector2(50, 0); Shoot(MousePos, 1, Offset); Offset = new Vector2(0, 50); Shoot(MousePos, 1, Offset); Offset = new Vector2(0, -50); Shoot(MousePos, 1, Offset); Player.UltimateAttackPunch = false; } } } projectile.ai[0] = 1; }
public override bool UseItem(Player player) { DarkPlayer dp = player.GetModPlayer <DarkPlayer>(); return(dp.RecoverDarkness(20)); }
public override void Behavior() { GodsHaveNoMercy.instance.darknessInterface.SetState(GodsHaveNoMercy.instance.darkUI); timespawned++; //movement Player player = Main.player[projectile.owner]; DarkPlayer Dplayer = player.GetModPlayer <DarkPlayer>(); Vector2 pos = LerpPos(player.Center, projectile.Center, speed); if (Dplayer.TotalDarkness < Dplayer.MaxDarkness) { DarknessRecover--; if (DarknessRecover <= 0) { DarknessRecover = 300; Dplayer.TotalDarkness += Dplayer.darknessRecovery; if (Dplayer.TotalDarkness < 0) { Dplayer.TotalDarkness = 0; } if (Dplayer.TotalDarkness > Dplayer.MaxDarkness) { Dplayer.TotalDarkness = Dplayer.MaxDarkness; } } } else { DarknessRecover = 100; } if (player.velocity.X > 0) { right = true; projectile.spriteDirection = (projectile.direction = 1); } else if (player.velocity.X < 0) { right = false; projectile.spriteDirection = (projectile.direction = -1); } if (DashTimer > 0) { projectile.Center = (!right) ? player.position + positionoffset : player.position; } else { projectile.Center = (right) ? player.position + positionoffset : player.position; } Vector2 relativePos = projectile.position - player.position; //targeting Vector2 targetPos = projectile.position; float targetDist = viewDist; bool target = false; for (int k = 0; k < 200; k++) { NPC npc = Main.npc[k]; if (npc.CanBeChasedBy(this, false)) { float distance = Vector2.Distance(npc.Center, projectile.Center); if ((distance < targetDist || !target) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { targetDist = distance; targetPos = npc.Center; target = true; } } } //shooting if (projectile.ai[0] > 0) { projectile.ai[0]++; } if (projectile.ai[0] > shootSpeed) { projectile.ai[0] = 0f; projectile.netUpdate = true; } if (projectile.ai[0] == 0f) { switch (Dplayer.ShadowGuardianAttack) { case 1: DarkPunchAttack(player, Dplayer); break; case 2: DarkDash(player, Dplayer); break; case 3: TeleportToNearestEnemy(player, Dplayer); break; case 4: BackAttack(player); break; default: break; } } DashTimer--; if (player.velocity.Length() == 0 && DashTimer > 20 && Dplayer.lastUseDash) { DashTimer = 20; Dplayer.DarknessUseTimer = -1; } Animate(); /* * * if (projectile.ai[1] > 0) * { * projectile.ai[1]++; * if (Main.rand.Next(3) == 0) * projectile.ai[1]++; * } * * if (projectile.ai[1] > shootSpeed) * { * projectile.ai[1] = 0f; * projectile.netUpdate = true; * } * * if (projectile.ai[0] == 0f) * { * if (target) * { * if ((targetPos - projectile.Center).X > 0f) * { * projectile.spriteDirection = (projectile.direction = 1); * } * else if ((targetPos - projectile.Center).X < 0f) * { * projectile.spriteDirection = (projectile.direction = -1); * } * if (projectile.ai[1] == 0f) * { * projectile.ai[1] = 1f; * if (Main.myPlayer == projectile.owner) * { * Vector2 shootVel = targetPos - projectile.Center; * if (shootVel == Vector2.Zero) * { * shootVel = new Vector2(0f, 1f); * } * shootVel.Normalize(); * shootVel *= shootSpeed; * Shoot(shootVel); * } * } * } * else * { * if (relativePos.X > 10) * { * projectile.spriteDirection = (projectile.direction = -1); * } * else if(relativePos.X<-10) * { * projectile.spriteDirection = (projectile.direction = 1); * } * } * }*/ }
public override float SpawnChance(NPCSpawnInfo spawnInfo) { DarkPlayer dp = Main.player[Main.myPlayer].GetModPlayer <DarkPlayer>(); return((spawnInfo.spawnTileY < Main.rockLayer && dp.ZoneHauntedMansion) ? 1f : 0f); }