public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) { if (ModSabres.SabreIsChargedStriking(player, item)) { knockBack *= 2f; } }
public override void AI() { Player player = Main.player[projectile.owner]; if (ModSabres.AINormalSlash(projectile, SlashLogic)) { Lighting.AddLight(projectile.Center, SabreColour() / 2f); } else { // Charged attack projectile.width = 164; ModSabres.AISetChargeSlashVariables(player, chargeSlashDirection); ModSabres.NormalSlash(projectile, player); // Play charged sound if (sndOnce) { Main.PlaySound(SoundID.Item60, projectile.Center); sndOnce = false; } Lighting.AddLight(projectile.Center, SabreColour()); } projectile.damage = 0; FrameCheck += 0.75f; // Framerate }
public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) { if (ModSabres.SabreIsChargedStriking(player, item)) { target.AddBuff(mod.BuffType <Buffs.Reversal>(), 60); } }
public override void AI() { Player player = Main.player[projectile.owner]; if (ModSabres.AINormalSlash(projectile, SlashLogic)) { } else { // Charged attack ModSabres.AISetChargeSlashVariables(player, chargeSlashDirection); ModSabres.NormalSlash(projectile, player); // Play charged sound if (sndOnce) { Main.PlaySound(SoundID.Item5.WithVolume(0.5f), projectile.Center); sndOnce = false; preDashVelocity = player.velocity; // Save velocity before dash } } if (SlashLogic == 0) { float dashFrameDuration = 3; float dashSpeed = player.maxRunSpeed * 4f; int freezeFrame = 2; ModSabres.AIDashSlash(player, projectile, dashFrameDuration, dashSpeed, freezeFrame, ref preDashVelocity); } projectile.damage = 0; projectile.ai[0] += 1f; // Framerate }
public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) { int height = 98; int length = 100; ModSabres.UseItemHitboxCalculate(player, item, ref hitbox, ref noHitbox, 0.9f, height, length); }
public override void HoldItem(Player player) { if (ModSabres.HoldItemManager(player, item, mod.ProjectileType <BorealWoodSabreSlash>(), default(Color), 0.9f, player.itemTime == 0 ? 0f : 1f)) { Buffs.SabreDance.ApplySabreDance(mod, player, 1); } }
public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) { if (ModSabres.SabreIsChargedStriking(player, item)) { damage *= chargeDamageMult; if ((player.Center - target.Center).Length() > 70) { crit = true; } } }
public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) { int height = 64; int length = 84; if (item.noGrabDelay > 0) { length = 164; player.meleeDamage += 2f; } ModSabres.UseItemHitboxCalculate(player, item, ref hitbox, ref noHitbox, 0.9f, height, length); }
public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) { int height = 100; int length = 100; if (item.noGrabDelay > 0) { length = 228; height = 140; } ModSabres.UseItemHitboxCalculate(player, item, ref hitbox, ref noHitbox, 0.9f, height, length); }
//x6 damage + crit to make up for terrible (but cool) usage public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) { if (ModSabres.SabreIsChargedStriking(player, item)) { damage *= chargeDamageMult; knockBack *= 2; if ((player.Center - target.Center).Length() > 70) { crit = true; } } }
public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) { int height = 94; int length = 104; ModSabres.UseItemHitboxCalculate(player, item, ref hitbox, ref noHitbox, 0.9f, height, length); if (ModSabres.SabreIsChargedStriking(player, item)) { player.meleeDamage += 2f; noHitbox = player.itemAnimation < player.itemAnimationMax - 10; } }
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Player player = Main.player[projectile.owner]; int weaponItemID = mod.ItemType <Hayauchi>(); Color lighting = Lighting.GetColor((int)(player.MountedCenter.X / 16), (int)(player.MountedCenter.Y / 16)); return(ModSabres.PreDrawSlashAndWeapon(spriteBatch, projectile, weaponItemID, lighting, SlashLogic == 0f ? specialSlash : null, SlashLogic == 0f ? new Color(1f, 1f, 1f, 0.1f) : lighting, specialProjFrames, SlashLogic == 0f ? chargeSlashDirection : SlashLogic)); }
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Player player = Main.player[projectile.owner]; Texture2D specialSlash = mod.GetTexture("Items/Weapons/Sabres/BeamSabres/" + GetType().Name + "_Special"); int weaponItemID = player.HeldItem.type; //Color lighting = Lighting.GetColor((int)(player.MountedCenter.X / 16), (int)(player.MountedCenter.Y / 16)); return(ModSabres.PreDrawSlashAndWeapon(spriteBatch, projectile, weaponItemID, Color.White, SlashLogic == 0f ? specialSlash : null, new Color(1f, 1f, 1f, 0.1f), specialProjFrames, SlashLogic == 0f ? chargeSlashDirection : SlashLogic)); }
public override void AI() { Player player = Main.player[projectile.owner]; if (ModSabres.AINormalSlash(projectile, SlashLogic)) { } else { // Charged attack ModSabres.AISetChargeSlashVariables(player, chargeSlashDirection); ModSabres.NormalSlash(projectile, player); } projectile.damage = 0; projectile.ai[0] += 1f; // Framerate }
public override void HoldItem(Player player) { bool specialCharge = hasHayauchiSpecialCharge(player); ModSabres.HoldItemManager(player, item, mod.ProjectileType <HayauchiSlash>(), Color.Red, 0.9f, specialCharge ? 0f : 1f, customCharge, 12); // Blade sheen once fully charged if (specialCharge) { Vector2 dustPos = getBladeDustPos(player, Main.rand.NextFloat()); Dust d = Dust.NewDustDirect(dustPos, 0, 0, 90); d.velocity = Vector2.Zero; d.noGravity = true; d.scale = 0.2f; d.fadeIn = 0.8f; } }
public override void HoldItem(Player player) { ModSabres.HoldItemManager(player, item, mod.ProjectileType <RaidenSlash>(), default(Color), 1f, player.itemTime == 0 ? 0f : 1f, customCharge, 8); if (player.itemTime == 0) { float radius = RaidenUtils.GetFocusRadius(player); RaidenUtils.DrawDustRadius(player, radius, RaidenUtils.DustAmount(player)); if (Main.myPlayer == player.whoAmI) { Vector2 mouse = new Vector2(Main.screenPosition.X + Main.mouseX, Main.screenPosition.Y + Main.mouseY); List <NPC> targets = RaidenUtils.GetTargettableNPCs(player.Center, mouse, radius, RaidenUtils.focusTargets); RaidenUtils.DrawOrderedTargets(player, targets); } } }
public override void AI() { Player player = Main.player[projectile.owner]; if (ModSabres.AINormalSlash(projectile, SlashLogic)) { } else { // Charged attack ModSabres.AISetChargeSlashVariables(player, chargeSlashDirection); ModSabres.NormalSlash(projectile, player); // Play charged sound if (sndOnce) { Main.PlaySound(SoundID.Item5.WithVolume(0.5f), projectile.Center); sndOnce = false; } } projectile.damage = 0; projectile.ai[0] += 1f; // Framerate }
public override void AI() { Player player = Main.player[projectile.owner]; if (ModSabres.AINormalSlash(projectile, SlashLogic)) { FrameCheck += 1f; } else { // Charged attack projectile.height = 228; projectile.width = 140; ModSabres.AISetChargeSlashVariables(player, chargeSlashDirection); ModSabres.NormalSlash(projectile, player); // Play charged sound if (sndOnce) { Main.PlaySound(SoundID.Item71, projectile.Center); sndOnce = false; } float pow = (specialProjFrames - SlashLogic) / 16f; Lighting.AddLight(new Vector2(projectile.Center.X + 70, projectile.Center.Y), new Vector3(pow, pow * 0.2f, pow * 0.8f)); Lighting.AddLight(new Vector2(projectile.Center.X - 70, projectile.Center.Y), new Vector3(pow, pow * 0.2f, pow * 0.8f)); Lighting.AddLight(new Vector2(projectile.Center.X, projectile.Center.Y + 70), new Vector3(pow, pow * 0.2f, pow * 0.8f)); Lighting.AddLight(new Vector2(projectile.Center.X, projectile.Center.Y - 70), new Vector3(pow, pow * 0.2f, pow * 0.8f)); FrameCheck += 0.5f; } projectile.damage = 0; }
public override void AI() { Player player = Main.player[projectile.owner]; if (ModSabres.AINormalSlash(projectile, SlashLogic)) { } else { // Charged attack ModSabres.AISetChargeSlashVariables(player, chargeSlashDirection); ModSabres.NormalSlash(projectile, player); // Play charged sound if (sndOnce) { Main.PlaySound(2, player.Center, 28); sndOnce = false; preDashVelocity = null; // Save velocity before dash } } if (SlashLogic == 0) { float dashFrameDuration = 6; float dashSpeed = 32f; int freezeFrame = 2; bool dashing = ModSabres.AIDashSlash(player, projectile, dashFrameDuration, dashSpeed, freezeFrame, ref preDashVelocity); if (dashing) { Dust.NewDust(player.Center - new Vector2(6, 6), 4, 4, 20); // Coloured line trail Vector2 dashStep = player.position - player.oldPosition; for (int i = 0; i < 8; i++) { Dust d = Main.dust[Dust.NewDust(player.Center - (dashStep / 8) * i, 0, 0, 181, dashStep.X / 32, dashStep.Y / 32, 0, default(Color), 1.3f)]; d.noGravity = true; d.velocity *= 0.1f; } } // Calculate ending position dust if (firstFrame) { firstFrame = false; Vector2 endPosition = player.position; Vector2 dashVector = projectile.velocity * dashSpeed; for (int i = 0; i < dashFrameDuration * 2; i++) { Vector2 move = Collision.TileCollision( endPosition, dashVector / 2, player.width, player.height, false, false, (int)player.gravDir); if (move == Vector2.Zero) { break; } endPosition += move; } // dash dust from the total distance over the duration Vector2 totalDistanceStep = (endPosition + new Vector2(player.width / 2, player.height / 2) - player.Center) / dashFrameDuration; for (int i = 0; i < dashFrameDuration; i++) { Vector2 pos = player.Center + (totalDistanceStep * i) - new Vector2(4, 4); for (int j = 0; j < 5; j++) { pos += totalDistanceStep * (j / 5f); Dust d = Main.dust[Dust.NewDust(pos, 0, 0, 175, projectile.velocity.X, projectile.velocity.Y, 0, Color.White, 1f)]; d.noGravity = true; d.velocity *= 0.05f; } } } } projectile.damage = 0; FrameCheck += 1f; // Framerate }
public override void HoldItem(Player player) { ModSabres.HoldItemManager(player, item, mod.ProjectileType <WoodenSabreSlash>(), default(Color), 0.9f, player.itemTime == 0 ? 0f : 1f); }
public override void AI() { Player player = Main.player[projectile.owner]; if (ModSabres.AINormalSlash(projectile, SlashLogic)) { FrameCheck += 1f; targets = null; } else { // Charged attack ModSabres.AISetChargeSlashVariables(player, chargeSlashDirection); ModSabres.NormalSlash(projectile, player); // Play charged sound & set targets if (sndOnce) { Vector2 mouse; if (Main.myPlayer == player.whoAmI) { mouse = new Vector2(Main.screenPosition.X + Main.mouseX, Main.screenPosition.Y + Main.mouseY); } else { mouse = player.Center + new Vector2(player.direction * 256); } // an estimation targets = RaidenUtils.GetTargettableNPCs(player.Center, mouse, RaidenUtils.GetFocusRadius(player), RaidenUtils.focusTargets); if (targets.Count > 0) { Main.PlaySound(SoundID.Item71, projectile.Center); sndOnce = false; // Set up initial ending position as where we started if (player.whoAmI == Main.myPlayer) { endingPositionCenter = player.Center; } // Set ending slash direction if (targets.Last().Center.X > player.Center.X) { player.direction = 1; } else { player.direction = -1; } } } if (targets != null && targets.Count > 0) { ChargeSlashAI(player); } else { SlashLogic = 1; ModSabres.AINormalSlash(projectile, SlashLogic); FrameCheck += 1f; targets = null; } } projectile.damage = 0; }
public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) { Color colour = new Color(1f, 0f, 0f); ModSabres.OnHitFX(player, target, crit, colour, true); }
public void ChargeSlashAI(Player player) { if (targets.Count == 1) { totalTargetTime = 15; } setAnimationAndImmunities(player); float countf = targets.Count; int framesPerTarget = (int)Math.Max(1, (float)totalTargetTime / countf); float oneFrame = specialProjFrames / (framesPerTarget * countf); // calculates ro roughly 9 / 30 = 0.3 // Get current frame, and current target in attack int i = (int)(FrameCheck / oneFrame); if (i >= framesPerTarget * countf) { // End frame player.Center = (Vector2)endingPositionCenter; player.velocity = new Vector2(projectile.direction * -7.5f, player.gravDir * -2); projectile.timeLeft = 0; return; } else { // Set camera lerp if (player.whoAmI == Main.myPlayer) { Main.SetCameraLerp(0.1f, 10); } // Get the target position, or wait if the target is invalid int iTarget = (int)MathHelper.Clamp((float)i / framesPerTarget, 0, countf - 1); NPC target = targets[iTarget]; Vector2 targetBottom; if (target == null || !target.active || target.dontTakeDamage) { targetBottom = player.Bottom; target = null; } else { // Set target targetBottom = target.Bottom; // and rotate slash Vector2 toTarget = targetBottom - player.Bottom; projectile.rotation = (float)Math.Atan2(toTarget.Y, toTarget.X); } Vector2 oldBottom = new Vector2(player.Bottom.X, player.Bottom.Y); Vector2 vecHeight = new Vector2(0, Player.defaultHeight / -2); // Tweening if there is time if (framesPerTarget > 1) { Vector2 dist = (targetBottom - player.Bottom) * (1f / Math.Max(1, framesPerTarget / 2f)); player.Bottom = player.Bottom + dist; player.velocity.Y = -player.gravDir * 1.5f; int distFactor = (int)(dist.Length() / 4f); RaidenUtils.DrawDustToBetweenVectors(oldBottom + vecHeight, player.Bottom + vecHeight, 106, distFactor, 2f); } int framesToNextKeyframe = Math.Max(0, ((iTarget + 1) * framesPerTarget - 1) - i); //// Snap to target on key frames, assuming they can be reached if (framesToNextKeyframe == 0) { player.Bottom = targetBottom; RaidenUtils.DrawDustToBetweenVectors(oldBottom + vecHeight, player.Bottom + vecHeight, 106, 2, 2f); } // Set slash ModSabres.RecentreSlash(projectile, player); // Clientside unstick code, don't bother for others in MP if (player.whoAmI == Main.myPlayer) { UpdateValidEndingPosition(player); } else { endingPositionCenter = player.Center; } FrameCheck += oneFrame; } }
public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) { ModSabres.OnHitFX(player, target, crit, SabreColour(), true); }
public override void HoldItem(Player player) { ModSabres.HoldItemManager(player, item, mod.ProjectileType <EnchantedSabreSlash>(), Color.Yellow, 0.9f, player.itemTime == 0 ? 0f : 1f); }
public override void HoldItem(Player player) { ModSabres.HoldItemManager(player, item, mod.ProjectileType <OnsokuSlash>(), Color.HotPink, 0.9f, player.itemTime == 0 ? 0f : 1f); }
public override bool UseItemFrame(Player player) { ModSabres.UseItemFrame(player, 0.9f, item.isBeingGrabbed); return(true); }
public override void HoldItem(Player player) { ModSabres.HoldItemManager(player, item, SabreSlashType(), SabreColour(), 0.75f, player.itemTime == 0 ? 0f : 1f); }
public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) { Color colour = new Color(255, 180, 210, 119); ModSabres.OnHitFX(player, target, crit, colour); }
// Doesn't get called unless item.shoot is defined. public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { return(ModSabres.IsChargedShot(player)); }