public static void DrawLayer(PlayerDrawInfo drawInfo) { if (Main.netMode == NetmodeID.Server) { return; } DBTPlayer modPlayer = drawInfo.drawPlayer.GetModPlayer <DBTPlayer>(); TransformationDefinition transformation = modPlayer.ActiveTransformations.FirstOrDefault(); int frame = modPlayer.TailFrameTimer / 8; Color tailColor = Color.White; float XOffset; SpriteEffects spriteEffects; if (drawInfo.drawPlayer.direction == 1) { spriteEffects = SpriteEffects.None; XOffset = 3f; } else { spriteEffects = SpriteEffects.FlipHorizontally; XOffset = 1.8f; } if (transformation != null) { if (modPlayer.IsTransformed(TransformationDefinitionManager.Instance.SSJ4) || modPlayer.IsTransformed(TransformationDefinitionManager.Instance.SSJ4FP)) { tailColor = new Color(224, 51, 66); } else { tailColor = transformation.Appearance.Hair.Color.Value; } } else { tailColor = drawInfo.drawPlayer.hairColor; } Color color = Lighting.GetColor((int)drawInfo.drawPlayer.position.X / 16, (int)drawInfo.drawPlayer.position.Y / 16, tailColor); //Color trueTailColor = new Color(tailColor.R, tailColor.G, tailColor.B, alpha.A); Texture2D texture = DBTMod.Instance.GetTexture("Effects/PrimalTail"); int frameSize = texture.Height / 14; float drawX = (drawInfo.position.X + drawInfo.drawPlayer.width / XOffset - Main.screenPosition.X); float drawY = (drawInfo.position.Y + drawInfo.drawPlayer.height / 0.11f - Main.screenPosition.Y); Main.spriteBatch.Draw(texture, new Vector2(drawX, drawY), new Rectangle(0, frameSize * frame, texture.Width, frameSize), color, drawInfo.drawPlayer.bodyRotation, new Vector2(texture.Width / 2f, texture.Height / 2f), 1f, spriteEffects, 0); }
public override void Update(Player player, ref int buffIndex) { DBTPlayer dbtPlayer = player.GetModPlayer <DBTPlayer>(); if (dbtPlayer == null) { return; } if (!dbtPlayer.IsTransformed(this) && dbtPlayer.player.HasBuff(Type)) { player.ClearBuff(Type); return; } TransformationTimer++; bool isFormMastered = dbtPlayer.HasMastered(Definition); float kiDrain = -(isFormMastered ? Definition.GetMasteredKiDrain(dbtPlayer) : Definition.GetUnmasteredKiDrain(dbtPlayer)); float healthDrain = -(isFormMastered ? Definition.GetMasteredHealthDrain(dbtPlayer) : Definition.GetUnmasteredHealthDrain(dbtPlayer)); float overloadIncrease = (isFormMastered ? Definition.GetMasteredOverloadGrowthRate(dbtPlayer) : Definition.GetUnmasteredOverloadGrowthRate(dbtPlayer)); if (kiDrain != 0f) { if (!isFormMastered) { kiDrain *= KiDrainMultiplier; } kiDrain *= dbtPlayer.KiDrainMultiplier; dbtPlayer.ModifyKi(kiDrain); if (TransformationTimer % Definition.Drain.transformationStepDelay == 0 && KiDrainMultiplier < Definition.Drain.maxTransformationKiDrainMultiplier) { KiDrainMultiplier += Definition.Drain.kiMultiplierPerStep; } } if (healthDrain != 0f) { if (!isFormMastered) { healthDrain *= HealthDrainMultiplier; } healthDrain *= dbtPlayer.HealthDrainMultiplier; dbtPlayer.player.statLife -= (int)healthDrain; dbtPlayer.player.lifeRegenTime = 0; if (TransformationTimer % Definition.Drain.transformationStepDelay == 0 && HealthDrainMultiplier < Definition.Drain.maxTransformationHealthDrainMultiplier) { HealthDrainMultiplier += Definition.Drain.healthMultiplierPerStep; } } if (overloadIncrease != 0f) { overloadIncrease *= dbtPlayer.OverloadIncreaseMultiplier; dbtPlayer.Overload += overloadIncrease; } float damageMultiplier = Definition.GetDamageMultiplier(dbtPlayer), halvedDamageMultiplier = damageMultiplier / 2; player.allDamage *= damageMultiplier; dbtPlayer.KiDamageMultiplier = damageMultiplier; player.statDefense += Definition.GetDefenseAdditive(dbtPlayer); float speedMultiplier = Definition.GetSpeedMultiplier(dbtPlayer); player.moveSpeed *= speedMultiplier; player.maxRunSpeed *= speedMultiplier; player.runAcceleration *= speedMultiplier; if (player.jumpSpeedBoost < 1f) { player.jumpSpeedBoost = 1f; } player.jumpSpeedBoost *= speedMultiplier; }
public override void AI() { Player player = Main.player[projectile.owner]; DBTPlayer modPlayer = player.GetModPlayer <DBTPlayer>(); projectile.position.X = player.Center.X; projectile.position.Y = player.Center.Y; projectile.Center = player.Center + new Vector2(-50, -15 - projectile.scale * 45); if (modPlayer.IsOverloading && modPlayer.IsTransformed()) { if (_sizeTimer < 500) { projectile.scale = _sizeTimer / 300f * 4; _sizeTimer++; projectile.ai[0]++; if (projectile.ai[0] >= 10) { int rotation = Main.rand.Next(60, 120); Projectile.NewProjectile(player.position.X, player.position.Y, 0, 0, GetRingStyle(), 0, 0, projectile.owner, rotation); projectile.ai[0] = 0; } player.position.Y = player.oldPosition.Y - 0.45f; player.velocity.X = 0; player.immuneNoBlink = true; } if (_sizeTimer == 500) { projectile.scale = 0f; _sizeTimer += 1; } if (player.dead) { projectile.Kill(); } else { if (modPlayer.IsCharging && _sizeTimer > 500) { if (projectile.scale > 2.5f) { player.position.Y = player.oldPosition.Y; player.velocity.X = 0; projectile.ai[1]++; if (projectile.ai[1] > 60) { _blastTimer++; if (_blastTimer > 2) { int blastDamage = (int)modPlayer.KiDamageMultiplier * modPlayer.MaxKi / 60; Vector2 velocity = Vector2.UnitY.RotateRandom(MathHelper.TwoPi) * 30; Projectile.NewProjectile(player.Center.X, player.Center.Y, velocity.X, velocity.Y, mod.ProjectileType <OverloadBlast>(), blastDamage, 2f, projectile.owner); _blastTimer = 0; } } } else { projectile.scale += 0.02f; player.position.Y = player.oldPosition.Y - 2f; player.velocity.X = 0; } } if (DBTMod.Instance.energyChargeKey.JustReleased && projectile.scale != 0) { projectile.scale = 0f; } } } else { projectile.Kill(); } }