Skip to content

Instantly share code, notes, and snippets.

@Kryzarel
Created December 3, 2017 21:21
Show Gist options
  • Save Kryzarel/67fe2e79455066c120f055980ed189ce to your computer and use it in GitHub Desktop.
Save Kryzarel/67fe2e79455066c120f055980ed189ce to your computer and use it in GitHub Desktop.
Updated with RemoveAllModifiersFromSource()
public class Item
{
public void Equip(Character c)
{
// Create the modifiers and set the Source to "this"
// Note that we don't need to store the modifiers in variables anymore
c.Strength.AddModifier(new StatModifier(10, StatModType.Flat, this));
c.Strength.AddModifier(new StatModifier(0.1, StatModType.Percent, this));
}
public void Unequip(Character c)
{
// Remove all modifiers applied by "this" Item
c.Strength.RemoveAllModifiersFromSource(this);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment