/*public override void SetDefaults(NPC npc) * { * Mod thoriummod = ModLoader.GetMod("ThoriumMod"); * Mod calamitymod = ModLoader.GetMod("CalamityMod"); * * if (MyPlayer.RealismMode) * { * if (npc.type == NPCID.EyeofCthulhu) * { * npc.lifeMax = npc.lifeMax * 2; * } * else if (npc.type == NPCID.EaterofWorldsHead) * { * npc.lifeMax = npc.lifeMax * 3; * } * else if (npc.type == NPCID.EaterofWorldsBody) * { * npc.lifeMax = npc.lifeMax * 3; * } * else if (npc.type == NPCID.EaterofWorldsTail) * { * npc.lifeMax = npc.lifeMax * 3; * } * else if (npc.type == NPCID.BrainofCthulhu) * { * npc.lifeMax = npc.lifeMax * 3; * } * else if (npc.type == NPCID.QueenBee) * { * npc.lifeMax = npc.lifeMax * 4; * } * else if (npc.type == NPCID.SkeletronHead) * { * npc.lifeMax = npc.lifeMax * 5; * } * else if (npc.type == NPCID.SkeletronHand) * { * npc.lifeMax = npc.lifeMax * 5; * } * else if (npc.type == NPCID.WallofFlesh) * { * npc.lifeMax = npc.lifeMax * 7; * } * else if (npc.type == NPCID.WallofFleshEye) * { * npc.lifeMax = npc.lifeMax * 7; * } * else if (npc.type == NPCID.Spazmatism) * { * npc.lifeMax = npc.lifeMax * 8; * } * else if (npc.type == NPCID.Retinazer) * { * npc.lifeMax = npc.lifeMax * 8; * } * else if (npc.type == NPCID.SkeletronPrime) * { * npc.lifeMax = npc.lifeMax * 8; * } * else if (npc.type == NPCID.TheDestroyer) * { * npc.lifeMax = npc.lifeMax * 8; * } * else if (npc.type == NPCID.Plantera) * { * npc.lifeMax = npc.lifeMax * 9; * } * else if (npc.type == NPCID.Golem) * { * npc.lifeMax = npc.lifeMax * 9; * } * else if (npc.type == NPCID.GolemHead) * { * npc.lifeMax = npc.lifeMax * 9; * } * else if (npc.type == NPCID.GolemFistLeft) * { * npc.lifeMax = npc.lifeMax * 9; * } * else if (npc.type == NPCID.GolemFistRight) * { * npc.lifeMax = npc.lifeMax * 9; * } * else if (npc.type == NPCID.DukeFishron) * { * npc.lifeMax = npc.lifeMax * 10; * } * else if (npc.type == NPCID.CultistBoss) * { * npc.lifeMax = npc.lifeMax * 11; * } * else if (npc.type == NPCID.MoonLordCore) * { * npc.lifeMax = npc.lifeMax * 12; * } * else if (npc.type == NPCID.MoonLordHand) * { * npc.lifeMax = npc.lifeMax * 12; * } * else if (npc.type == NPCID.MoonLordHead) * { * npc.lifeMax = npc.lifeMax * 12; * } * else if (npc.type == thoriummod.NPCType("TheGrandThunderBirdv2")) * { * npc.lifeMax = npc.lifeMax * 2; * } * else if (npc.type == thoriummod.NPCType("QueenJelly")) * { * npc.lifeMax = npc.lifeMax * 3; * } * else if (npc.type == thoriummod.NPCType("Viscount")) * { * npc.lifeMax = npc.lifeMax * 4; * } * else if (npc.type == thoriummod.NPCType("TheBuriedWarrior")) * { * npc.lifeMax = npc.lifeMax * 5; * } * else if (npc.type == thoriummod.NPCType("GraniteEnergyStorm")) * { * npc.lifeMax = npc.lifeMax * 5; * } * else if (npc.type == thoriummod.NPCType("ThePrimeScouter")) * { * npc.lifeMax = npc.lifeMax * 6; * } * else if (npc.type == thoriummod.NPCType("BoreanStrider")) * { * npc.lifeMax = npc.lifeMax * 7; * } * else if (npc.type == thoriummod.NPCType("BoreanStriderPopped")) * { * npc.lifeMax = npc.lifeMax * 7; * } * else if (npc.type == thoriummod.NPCType("FallenDeathBeholder")) * { * npc.lifeMax = npc.lifeMax * 7; * } * else if (npc.type == thoriummod.NPCType("FallenDeathBeholder2")) * { * npc.lifeMax = npc.lifeMax * 7; * } * else if (npc.type == thoriummod.NPCType("Lich")) * { * npc.lifeMax = npc.lifeMax * 8; * } * else if (npc.type == thoriummod.NPCType("LichHeadless")) * { * npc.lifeMax = npc.lifeMax * 8; * } * else if (npc.type == thoriummod.NPCType("Abyssion")) * { * npc.lifeMax = npc.lifeMax * 9; * } * else if (npc.type == thoriummod.NPCType("AbyssionCracked")) * { * npc.lifeMax = npc.lifeMax * 9; * } * else if (npc.type == thoriummod.NPCType("AbyssionReleased")) * { * npc.lifeMax = npc.lifeMax * 9; * } * else if (npc.type == thoriummod.NPCType("Aquaius")) * { * npc.lifeMax = npc.lifeMax * 13; * } * else if (npc.type == thoriummod.NPCType("Aquaius2")) * { * npc.lifeMax = npc.lifeMax * 13; * } * else if (npc.type == thoriummod.NPCType("Omnicide")) * { * npc.lifeMax = npc.lifeMax * 13; * } * else if (npc.type == thoriummod.NPCType("SlagFury")) * { * npc.lifeMax = npc.lifeMax * 13; * } * else if (npc.type == thoriummod.NPCType("RealityBreaker")) * { * npc.lifeMax = npc.lifeMax * 13; * } * } * base.SetDefaults(npc); * }*/ public override void OnChatButtonClicked(NPC npc, bool firstButton) { if (npc.type == NPCID.Nurse) { if (firstButton) { MyPlayer modPlayer = Main.LocalPlayer.GetModPlayer <MyPlayer>(); modPlayer.kaiokenLevel = 0; modPlayer.EndTransformations(); float kihealvalue = modPlayer.OverallKiMax() - modPlayer.GetKi(); modPlayer.AddKi(modPlayer.OverallKiMax(), false, false); CombatText.NewText(new Rectangle((int)modPlayer.player.position.X, (int)modPlayer.player.position.Y, modPlayer.player.width, modPlayer.player.height), new Color(51, 204, 255), (int)Math.Round(kihealvalue, 0), false, false); SoundHelper.PlayVanillaSound(SoundID.MaxMana, modPlayer.player); } } }
public static void Update(Player player) { // this might seem weird but the server isn't allowed to control the flight system. if (Main.netMode == NetmodeID.Server) { return; } MyPlayer modPlayer = player.GetModPlayer <MyPlayer>(); //check for ki or death lol if ((modPlayer.IsKiDepleted() || player.dead || player.mount.Type != -1 || player.ropeCount != 0) && modPlayer.isFlying) { modPlayer.isFlying = false; AddKatchinFeetBuff(player); } if (modPlayer.isFlying) { // cancel platform collision player.DryCollision(true, true); //prepare vals player.fullRotationOrigin = new Vector2(11, 22); Vector2 mRotationDir = Vector2.Zero; int flightDustType = 261; //Input checks float boostSpeed = (BURST_SPEED)*(modPlayer.isCharging ? 1 : 0); // handle ki drain float totalFlightUsage = Math.Max(1f, FLIGHT_KI_DRAIN * modPlayer.flightKiConsumptionMultiplier); float flightCostMult = modPlayer.flightUpgraded ? 0.25f : (modPlayer.flightDampeningUnlocked ? 0.5f : 1f); totalFlightUsage *= flightCostMult; modPlayer.AddKi((totalFlightUsage * (1f + boostSpeed)) * -1, false, false); float flightSpeedMult = (1f + boostSpeed); flightSpeedMult *= modPlayer.flightUpgraded ? 1.25f : (modPlayer.flightDampeningUnlocked ? 1f : 0.75f); float flightSpeed = FLIGHT_SPEED * flightSpeedMult; float totalHorizontalFlightSpeed = flightSpeed + (player.moveSpeed / 3) + modPlayer.flightSpeedAdd; float totalVerticalFlightSpeed = flightSpeed + (Player.jumpSpeed / 2) + modPlayer.flightSpeedAdd; if (modPlayer.isUpHeld) { // for some reason flying up is way, way faster than flying down. player.velocity.Y -= (totalVerticalFlightSpeed / 3.8f); mRotationDir = Vector2.UnitY; } else if (modPlayer.isDownHeld) { player.maxFallSpeed = 20f; player.velocity.Y += totalVerticalFlightSpeed / 3.6f; mRotationDir = -Vector2.UnitY; } if (modPlayer.isRightHeld) { player.velocity.X += totalHorizontalFlightSpeed; mRotationDir += Vector2.UnitX; } else if (modPlayer.isLeftHeld) { player.velocity.X -= totalHorizontalFlightSpeed; mRotationDir -= Vector2.UnitX; } // TODO Add in TransformationAppearance class. if (modPlayer.IsTransformedInto(DBZMOD.Instance.TransformationDefinitionManager.SSJ1Definition) && !modPlayer.IsTransformedInto(DBZMOD.Instance.TransformationDefinitionManager.SSJGDefinition)) { flightDustType = 170; } else if (modPlayer.IsTransformedInto(DBZMOD.Instance.TransformationDefinitionManager.LSSJDefinition)) { flightDustType = 107; } else if (modPlayer.IsTransformedInto(DBZMOD.Instance.TransformationDefinitionManager.SSJGDefinition)) { flightDustType = 174; } else if (DBZMOD.Instance.TransformationDefinitionManager.IsKaioken(modPlayer.ActiveTransformations)) { flightDustType = 182; } else { flightDustType = 267; } if (player.velocity.Length() > 0.5f) { SpawnFlightDust(player, boostSpeed, flightDustType, 0f); } //calculate velocity player.velocity.X = MathHelper.Lerp(player.velocity.X, 0, 0.1f); player.velocity.Y = MathHelper.Lerp(player.velocity.Y, 0, 0.1f); // keep the player suspended at worst. player.velocity = player.velocity - (player.gravity * Vector2.UnitY); // handles keeping legs from moving when the player is in flight/moving fast/channeling. if (player.velocity.X > 0) { player.legFrameCounter = -player.velocity.X; } else { player.legFrameCounter = player.velocity.X; } //calculate rotation float radRot = GetPlayerFlightRotation(mRotationDir, player); player.fullRotation = MathHelper.Lerp(player.fullRotation, radRot, 0.1f); } // altered to only fire once, the moment you exit flight, to avoid overburden of sync packets when moving normally. if (!modPlayer.isFlying) { player.fullRotation = MathHelper.Lerp(player.fullRotation, 0, 0.1f); } }
public override void Update(Player player, ref int buffIndex) { MyPlayer modPlayer = MyPlayer.ModPlayer(player); KiDrainAdd(player); if (Transformations.IsAnyKaioken(player) || Transformations.IsSSJG(player)) { Lighting.AddLight(player.Center + player.velocity * 8f, 0.2f, 0f, 0f); } else if (Transformations.IsLSSJ1(player) || Transformations.IsLSSJ2(player)) { Lighting.AddLight(player.Center + player.velocity * 8f, 0f, 0.2f, 0f); } else if (Transformations.IsSSJ1(player) || Transformations.IsSSJ2(player) || Transformations.IsSSJ2(player) || Transformations.IsASSJ(player) || Transformations.IsUSSJ(player)) { Lighting.AddLight(player.Center + player.velocity * 8f, 0.2f, 0.2f, 0f); } else if (Transformations.IsSpectrum(player)) { var rainbow = Main.DiscoColor; Lighting.AddLight(player.Center + player.velocity * 8f, rainbow.R / 512f, rainbow.G / 512f, rainbow.B / 512f); } //give bonus base defense player.statDefense += BaseDefenceBonus; // if the player is in any ki-draining state, handles ki drain and power down when ki is depleted if (Transformations.IsAnythingOtherThanKaioken(player)) { // player ran out of ki, so make sure they fall out of any forms they might be in. if (modPlayer.IsKiDepleted()) { if (Transformations.IsSuperKaioken(player)) { modPlayer.KaiokenLevel = 0; } Transformations.EndTransformations(player, true, false); } else { modPlayer.AddKi((KiDrainRate + modPlayer.KiDrainAddition) * -1, false, true); KiDrainAddTimer++; if (KiDrainAddTimer > 600) { modPlayer.KiDrainAddition += 1; KiDrainAddTimer = 0; } Lighting.AddLight(player.Center, 1f, 1f, 0f); } } else { // the player isn't in a ki draining state anymore, reset KiDrainAddition modPlayer.KiDrainAddition = 0; } player.moveSpeed *= GetModifiedSpeedMultiplier(modPlayer); player.maxRunSpeed *= GetModifiedSpeedMultiplier(modPlayer); player.runAcceleration *= GetModifiedSpeedMultiplier(modPlayer); if (player.jumpSpeedBoost < 1f) { player.jumpSpeedBoost = 1f; } player.jumpSpeedBoost *= GetModifiedSpeedMultiplier(modPlayer); // set player damage mults player.meleeDamage *= GetHalvedDamageBonus(); player.rangedDamage *= GetHalvedDamageBonus(); player.magicDamage *= GetHalvedDamageBonus(); player.minionDamage *= GetHalvedDamageBonus(); player.thrownDamage *= GetHalvedDamageBonus(); modPlayer.KiDamage *= DamageMulti; // cross mod support stuff if (DBZMOD.instance.thoriumLoaded) { ThoriumEffects(player); } if (DBZMOD.instance.tremorLoaded) { TremorEffects(player); } if (DBZMOD.instance.enigmaLoaded) { EnigmaEffects(player); } if (DBZMOD.instance.battlerodsLoaded) { BattleRodEffects(player); } if (DBZMOD.instance.expandedSentriesLoaded) { ExpandedSentriesEffects(player); } }
public static void Update(Player player) { // this might seem weird but the server isn't allowed to control the flight system. if (Main.netMode == NetmodeID.Server) { return; } MyPlayer modPlayer = MyPlayer.ModPlayer(player); //check for ki or death lol if ((modPlayer.IsKiDepleted() || player.dead || player.mount.Type != -1 || player.ropeCount != 0) && modPlayer.IsFlying) { modPlayer.IsFlying = false; AddKatchinFeetBuff(player); } if (modPlayer.IsFlying) { // cancel platform collision player.DryCollision(true, true); //prepare vals player.fullRotationOrigin = new Vector2(11, 22); Vector2 m_rotationDir = Vector2.Zero; int FlightDustType = 261; //Input checks float boostSpeed = (BURST_SPEED)*(modPlayer.IsCharging ? 1 : 0); int totalFlightUsage = Math.Max(1, FLIGHT_KI_DRAIN - modPlayer.FlightUsageAdd); float totalHorizontalFlightSpeed = FLIGHT_SPEED + boostSpeed + (player.moveSpeed / 3) + modPlayer.FlightSpeedAdd; float totalVerticalFlightSpeed = FLIGHT_SPEED + boostSpeed + (Player.jumpSpeed / 2) + modPlayer.FlightSpeedAdd; if (modPlayer.IsUpHeld) { // for some reason flying up is way, way faster than flying down. player.velocity.Y -= (totalVerticalFlightSpeed / 3.8f); m_rotationDir = Vector2.UnitY; } else if (modPlayer.IsDownHeld) { player.maxFallSpeed = 20f; player.velocity.Y += totalVerticalFlightSpeed / 3.6f; m_rotationDir = -Vector2.UnitY; } if (modPlayer.IsRightHeld) { player.velocity.X += totalHorizontalFlightSpeed; m_rotationDir += Vector2.UnitX; } else if (modPlayer.IsLeftHeld) { player.velocity.X -= totalHorizontalFlightSpeed; m_rotationDir -= Vector2.UnitX; } if (player.velocity.Length() > 0.5f) { SpawnFlightDust(player, boostSpeed, FlightDustType, 0f); } if (Transformations.IsSSJ(player) && !Transformations.IsSSJG(player)) { FlightDustType = 170; } else if (Transformations.IsLSSJ(player)) { FlightDustType = 107; } else if (Transformations.IsSSJG(player)) { FlightDustType = 174; } else if (Transformations.IsAnyKaioken(player)) { FlightDustType = 182; } else { FlightDustType = 267; } //calculate velocity player.velocity.X = MathHelper.Lerp(player.velocity.X, 0, 0.1f); player.velocity.Y = MathHelper.Lerp(player.velocity.Y, 0, 0.1f); // keep the player suspended at worst. player.velocity = player.velocity - (player.gravity * Vector2.UnitY); // handles keeping legs from moving when the player is in flight/moving fast/channeling. if (player.velocity.X > 0) { player.legFrameCounter = -player.velocity.X; } else { player.legFrameCounter = player.velocity.X; } //calculate rotation float radRot = GetPlayerFlightRotation(m_rotationDir, player); player.fullRotation = MathHelper.Lerp(player.fullRotation, radRot, 0.1f); //drain ki if (!modPlayer.flightUpgraded) { if (DBZMOD.IsTickRateElapsed(2)) { modPlayer.AddKi((totalFlightUsage + (totalFlightUsage * (int)boostSpeed)) * -1, false, false); } } else { if (DBZMOD.IsTickRateElapsed(4)) { modPlayer.AddKi(-1, false, false); } } } // altered to only fire once, the moment you exit flight, to avoid overburden of sync packets when moving normally. if (!modPlayer.IsFlying) { player.fullRotation = MathHelper.Lerp(player.fullRotation, 0, 0.1f); } }