|
-
September 10th, 2008, 11:54 PM
#1
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.
-
September 11th, 2008, 02:54 AM
#2
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.
- Make it run.
- Make it right.
- Make it fast.
Don't hesitate to rate my post. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|