Created
December 3, 2017 21:21
-
-
Save Kryzarel/67fe2e79455066c120f055980ed189ce to your computer and use it in GitHub Desktop.
Updated with RemoveAllModifiersFromSource()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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