When cloning GameItems, also clone their Action objects
ScottLilly opened this issue · 0 comments
ScottLilly commented
When cloning GameItems, we need to also clone their Action objects, to prevent problems with event subscriptions.
Change it to something like the below (adding in whatever is needed to handle different types of GameItems and Actions):
Weapon clonedWeapon = new Weapon(ItemID, Name, Price, MinimumDamage, MaximumDamage, DamageType, WeaponSpeed, MissRate);
clonedWeapon.Action = new AttackWithWeapon(clonedWeapon);