Multiplying Values in a STRUCT
I find Structs a little intimidating, and I am unsure how to approach this problem.
I have a Struct of ints called StatisticsValue
it hold stuff like
int Hitpoints
int MagicPoints
int Strength....etc
I have a Spell and spells affect 1 or more values in the StatisticsValue
this gathers them
StatisticsValue statEffect = spell.TargetEffectValue;
but I need to multiply those statEffects by a modifier and doing it directly doesn't work.
int modifiedEffect = Math.Abs(statEffect * ARCmodifier);
My question is how do I multiply all of the possible values the Spell is effecting by the modifer int. And how do I know it doesn't modify all of the values in StatisticsValue???
for instance a spell might alter Strength and Hitpoints, but ignore everything else.
Re: Multiplying Values in a STRUCT
First ensure, that you understood the semantic difference between value types (struct) and reference types (class); look e.g. here.