public override void Update(int type, Terraria.Player player, ref int buffIndex) { if (player.FindBuffIndex(117) != -1) { player.GetModPlayer <MPlayer>(mod).alchemistDamage += 0.1f; } if (player.FindBuffIndex(115) != -1) { player.GetModPlayer <MPlayer>(mod).alchemistCrit += 10; } }
public override void EditSpawnRate(Terraria.Player player, ref int spawnRate, ref int maxSpawns) { if (player.GetModPlayer <HordePlayer>().Horde) { if (player.GetModPlayer <HordePlayer>().HordeStacks < 2) { spawnRate = (int)(spawnRate * 0.1); } else { spawnRate = (int)(spawnRate * 0.01); } maxSpawns *= 5; } }
private void PlayerOnUpdateArmorSets(Player.orig_UpdateArmorSets orig, Terraria.Player self, int i) { int head = self.head; int body = self.body; int legs = self.legs; Item armor0 = self.armor[0].Clone(); Item armor1 = self.armor[1].Clone(); Item armor2 = self.armor[2].Clone(); int solarCounter = self.solarCounter; bool vortexStealthActive = self.vortexStealthActive; float beetleCounter = self.beetleCounter; orig(self, i); String setBonus = self.setBonus; int solarCounter2 = self.solarCounter; bool vortexStealthActive2 = self.vortexStealthActive; float beetleCounter2 = self.beetleCounter; bool stadustBuff = self.FindBuffIndex(187) != -1; self.head = self.armor[10].headSlot; self.body = self.armor[11].bodySlot; self.legs = self.armor[12].legSlot; self.armor[0] = self.armor[10]; self.armor[1] = self.armor[11]; self.armor[2] = self.armor[12]; self.solarCounter = solarCounter; self.vortexStealthActive = vortexStealthActive; self.beetleCounter = beetleCounter; orig(self, i); self.GetModPlayer <ArmorSocialPlayer>().secondSetBonus = self.setBonus; if (self.head == 101 && self.body == 66 && self.legs == 55 && ArmorSocialConfig.BalanceSpectreHealing && ArmorSocialConfig.ArmorSocialMode == setBonusOnly) { self.magicDamage -= .4f; } self.solarCounter = Math.Max(self.solarCounter, solarCounter2); self.vortexStealthActive = self.vortexStealthActive || vortexStealthActive2; self.beetleCounter = Math.Max(self.beetleCounter, beetleCounter2); if (stadustBuff && self.FindBuffIndex(187) == -1) { self.AddBuff(187, 3600); } self.head = head; self.body = body; self.legs = legs; self.armor[0] = armor0; self.armor[1] = armor1; self.armor[2] = armor2; self.setBonus = setBonus; }
private static void DrawPlayerTargets(Main.orig_DrawPlayers orig, Terraria.Main self) { Terraria.Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise); for (int i = 0; i < playerTargets.Length; i++) { RenderTarget2D target = playerTargets[i]; Terraria.Player player = Terraria.Main.player[i]; if (target == null || player == null || !player.active || player.GetModPlayer <TFPlayer>().Transporting) { continue; } float scale = player.GetModPlayer <TFPlayer>().scale; float alpha = player.GetModPlayer <TFPlayer>().alpha; Terraria.Main.spriteBatch.Draw(target, new Vector2(Terraria.Main.screenWidth, Terraria.Main.screenHeight) * 0.5f, null, Color.White * alpha, 0f, Terraria.Utils.Size(target) * 0.5f, scale, SpriteEffects.None, 0f); } Terraria.Main.spriteBatch.End(); }
private static void FixPlayerFrameForElevator(Player.orig_PlayerFrame orig, Terraria.Player self) { if (self.GetModPlayer <TFPlayer>().UsingElevator) { float velocityY = self.velocity.Y; self.velocity.Y = 0f; orig(self); self.velocity.Y = velocityY; } else { orig(self); } }
private static void CloakHooker(On.Terraria.Player.orig_KeyDoubleTap orig, Terraria.Player self, int keyDir) { orig.Invoke(self, keyDir); // call the original method, then run my code if (self.HasBuff(Terraria.ID.BuffID.ChaosState)) { return; } if (!self.GetModPlayer <CloakModPlayer>().hasCloak) { return; } if (keyDir == 3) // checking if double tap is left { TryDash(ref self, Direction.Left); } if (keyDir == 2) // checking if double tap is right { TryDash(ref self, Direction.Right); } }
public override void GetWeaponCrit(Terraria.Player player, ref int crit) { crit += player.GetModPlayer <TalismanPlayer>().lesserCurseCrit; }
public override void GetWeaponKnockback(Terraria.Player player, ref float knockback) { knockback += player.GetModPlayer <TalismanPlayer>().lesserCurseKB; }
public override void ModifyWeaponDamage(Terraria.Player player, ref float add, ref float mult, ref float flat) { add += player.GetModPlayer <TalismanPlayer>().curseDamageAdd; mult *= player.GetModPlayer <TalismanPlayer>().curseDamageMult; }