示例#1
0
 public CharacterAction(string name)
 {
     itsName = name;
     itsEffects = new string[Globals.EFFECT_LIMIT];
     itsCharacter = new Character();
     itsCoefficients = new Coefficient[Globals.EFFECT_LIMIT, Globals.PROPERTY_LIMIT + 1];
 }
示例#2
0
        public void xmlSkillsTest()
        {
            Character expected = new Character(); // TODO: Initialize to an appropriate value
            XmlDocument creator = new XmlDocument(); // TODO: Initialize to an appropriate value
            expected.addSkill(new Skill("Skill", 20));
            XmlNode node=expected.toXml(creator);

            Character actual = new Character();
            actual.fromXml(node);

            Assert.AreEqual(expected.Skills.Count, actual.Skills.Count);
        }
示例#3
0
        public void xmlAttributesTest()
        {
            Character expected = new Character(); // TODO: Initialize to an appropriate value
            XmlDocument creator = new XmlDocument(); // TODO: Initialize to an appropriate value
            expected.addAttribute(new CharacterSystemLibrary.Classes.Attribute("Attribute"));
            XmlNode node = expected.toXml(creator);

            Character actual = new Character();
            actual.fromXml(node);

            Assert.AreEqual(expected.Attributes.Count, actual.Attributes.Count);
        }
示例#4
0
        /* For every effect, calculate the effect's value,
         * then subtract the value from the value of the
         * corresponding property from target character.
         * If some effect couldn't be carried out because
         * it was turn ending, and it's value was too low,
         * return false; */
        public bool doAction(Character target)
        {
            /*
            if (!itsCharacter.is_empty)
            {
                int value;
                Stat currentStat = new Stat();
                charProperty property = new charProperty();
                for (int i = 0; i < Globals.EFFECT_LIMIT; i++)
                {
                    value = 0;
                    for (int j = 0; j < Globals.PROPERTY_LIMIT; j++)
                    {
                        // Set property to the right character property
                        if (j < Globals.ATTRIBUTE_LIMIT)
                            property = itsGov_Attributes[j];
                        else if (j < Globals.ATTRIBUTE_LIMIT + Globals.SKILL_LIMIT)
                            property = itsGov_Skills[j - Globals.ATTRIBUTE_LIMIT];
                        else
                            property = itsGov_Stats[j - Globals.ATTRIBUTE_LIMIT - Globals.SKILL_LIMIT];

                        // Add up new value to previous total
                        if (!property.is_empty)
                            value += itsCoefficients[i, j].getValue() * property.Value;
                    }
                    value += itsCoefficients[i, Globals.PROPERTY_LIMIT].getValue();
                    /* If affected property is a stat, we're good.
                     * Else, the getStat method will return an empty
                     * stat, which is fine for our purposes, since its
                     * is_turn_ending member is false.          */
            /*
                    currentStat = target.getStat(itsEffects[i]);
                    if (currentStat.is_Turn_Ending)
                    {
                        if (currentStat.Value < value)
                            return false;
                    }*/
                    /* Since we don't know which type of property it is,
                     * we call all the decrease methods. If a property of the
                     * wanted name is not found, nothing will be done. */
            /*
                    target.decreaseStat(itsEffects[i], value);
                    target.decreaseAttribute(itsEffects[i], value);
                    target.decreaseSkill(itsEffects[i], value);

                }
                return true;
            }
            else
                return false;*/
            return false;
        }
示例#5
0
 /* Gets value of effect with given name
  * If effect is not in action, return 0. */
 public void setCharacter(Character character)
 {
     itsCharacter = character;
     itsGov_Attributes = itsCharacter.getAllAttributes();
     itsGov_Skills = itsCharacter.getAllSkills();
     itsGov_Stats = itsCharacter.getAllStats();
 }
示例#6
0
 public bool removeTarget(Character oldTarget)
 {
     if (isTarget(oldTarget.Name))
     {
         itsTargets.Remove(oldTarget);
         return true;
     }
     else
         return false;
 }
示例#7
0
        public Character copy(Character copyCharacter)
        {
            copyCharacter=(Character)base.copy(copyCharacter);
            if (isInitialized())
            {
                copyCharacter.Name = this.Name;
                copyCharacter.itsCurrentWeapon=this.ItsCurrentWeapon.copy(new Weapon());
                copyCharacter.itsAttributes = this.itsAttributes.copy();
                copyCharacter.itsSkills = this.itsSkills.copy();
                copyCharacter.itsStats = this.itsStats.copy();
                copyCharacter.itsTargets = this.itsTargets.copy();

                for (int i = 0; i < itsWeapons.Length; i++)
                    this.itsWeapons[i].copy(copyCharacter.itsWeapons[i]);
            }
            return copyCharacter;
        }
示例#8
0
 public bool addTarget(Character newTarget)
 {
     if (itsTargets.Count < Globals.CHARACTER_LIMIT)
     {
         itsTargets.add(newTarget);
         return true;
     }
     return false;
 }
示例#9
0
 public bool removeUser(Character oldUser)
 {
     if (isUser(oldUser.Name))
     {
         itsUsers.Remove(oldUser);
         return true;
     }
     else
         return false;
 }
示例#10
0
 public bool addUser(Character newUser)
 {
     if (itsUsers.Count < Globals.CHARACTER_LIMIT)
     {
         itsUsers.add(newUser);
         return true;
     }
     return false;
 }