예제 #1
0
파일: Spell.cs 프로젝트: HakuFlaku/My-Game
        //randomly select an effect to be added to this spell from a master list of all effects
        private Effect setEffect()
        {
            Effect e     = null;
            Effect eCopy = null;

            if (Constants.rand.NextDouble() < Constants.GETS_EFFECT + (rank / 10.0))
            {//random chance to have an effect added to the spell or not
                int numEffect = Constants.rand.Next(-1, Constants.allEffects.getLength());
                e     = (Effect)Constants.allEffects.getItem(numEffect);
                eCopy = e.copy();
                if (e.getName().Equals("EffectHeal"))
                {
                    damage = -damage;
                }
            }

            return(eCopy);
        }
예제 #2
0
파일: Spell.cs 프로젝트: HakuFlaku/My-Game
        //constructor for loading an already made spell
        public Spell(JObject info)
        {
            rank        = (int)info["Rank"];
            damage      = (int)info["Damage"];
            description = (String)info["Description"];
            String effectName = (String)info["EffectName"];

            if (!effectName.Equals(Constants.DNE.ToString()))
            {
                for (int i = 0; i < Constants.allEffects.getLength(); i++)
                {
                    Effect currEffect = (Effect)Constants.allEffects.getItem(i);
                    if (effectName.Equals(currEffect.getName()))
                    {
                        effect = currEffect.copy();
                    }
                }
            }
        }