using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace ExampleMod { // This file shows the very basics of using ModPlayer classes since ExamplePlayer can be a bit overwhelming. // ModPlayer classes provide a way to attach data to Players and act on that data. // This example will hopefully provide you with an understanding of the basic building blocks of how ModPlayer works. // This example will teach the most commonly sought after effect: "How to do X if the player has Y?" // X in this example will be "Apply a debuff to enemies." // Y in this example will be "Wearing an accessory." // After studying this example, you can change X to other effects by changing the "hook" you use or the code within the hook you use. For example, you could use OnHitByNPC and call Projectile.NewProjectile within that hook to change X to "When the player is hit by NPC, spawn Projectiles". // We can change Y to other conditions as well. For example, you could give the player the effect by having a "potion" ModItem give a ModBuff that sets the ModPlayer variable in ModBuff.Update // Another example would be an armor set effect. Simply use the ModItem.UpdateArmorSet hook // Below you will see the ModPlayer class, and below that will be another class called SimpleAccessory for the accessory both in the same file for your reading convenience. This accessory will give our effect to our ModPlayer. // This is the ModPlayer class. Make note of the classname, which is SimpleModPlayer, since we will be using this in the accessory item below. class SimpleModPlayer : ModPlayer { } }