protected override bool DrawSelf() { Vector2 pos = new Vector2(0, Main.screenHeight - 20); AbilityPlayer ap = Main.player[Main.myPlayer].GetModPlayer <AbilityPlayer>(); foreach (FieldInfo fi in typeof(AbilityPlayer).GetFields(BindingFlags.Instance | BindingFlags.Public)) { Main.spriteBatch.DrawString(Main.fontItemStack, $"{fi.Name}: {fi.GetValue(ap)}", pos, Color.White); pos.Y -= 15; } return(true); }
public override void Action(CommandCaller caller, string input, string[] args) { if (args.Length == 0) { caller.Reply("Player Abilities mod commands help:\n" + "\"/pl_abils reset\" - reset all abilities to 1x\n" + "\"/pl_abils random\" - set abilities to random (based on player name)\n" + "\"/pl_abils absrandom\" - set abilities to random\n" + "\"/pl_abils values\" - print out current stats"); } else { if (args[0] == "reset") { AbilityPlayer ap = caller.Player.GetModPlayer <AbilityPlayer>(); ap.MeleeDamage = 1f; ap.MagicDamage = 1f; ap.RangedDamage = 1f; ap.SummonDamage = 1f; ap.ThrowDamage = 1f; ap.OtherDamage = 1f; } else if (args[0] == "random") { caller.Player.GetModPlayer <AbilityPlayer>().SetupRandomValues(); } else if (args[0] == "absrandom") { caller.Player.GetModPlayer <AbilityPlayer>().SetupRandomValues(true); } else if (args[0] == "values") { string v = ""; AbilityPlayer ap = caller.Player.GetModPlayer <AbilityPlayer>(); foreach (FieldInfo fi in typeof(AbilityPlayer).GetFields(BindingFlags.Instance | BindingFlags.Public)) { v += $"{fi.Name}: {fi.GetValue(ap)}\n"; } caller.Reply(v); } } }
public override void ModifyTooltips(Item item, List <TooltipLine> tooltips) { TooltipLine tl = tooltips.FirstOrDefault((t) => t.Name == "Damage" && t.mod == "Terraria"); if (tl is null) { return; } AbilityPlayer ap = Main.player[Main.myPlayer].GetModPlayer <AbilityPlayer>(); float value = 1f; if (item.melee) { value = ap.MeleeDamage; } else if (item.ranged) { value = ap.RangedDamage; } else if (item.magic) { value = ap.MagicDamage; } else if (item.summon) { value = ap.SummonDamage; } else if (item.thrown) { value = ap.ThrowDamage; } else { value = ap.OtherDamage; } tl.text += $" ({value:N2}x)"; }