コード例 #1
0
ファイル: Abilities.cs プロジェクト: tjjjwxzq/50.003-Project
 /// <summary>
 /// Method to set a player's ability to a certain level.
 /// </summary>
 /// <param name="ability">Ability to be changed</param>
 /// <param name="level">New level</param>
 public void SetAbility(AbilityName ability, int level)
 {
     switch (ability)
     {
         case AbilityName.Immunity:
             Immunity = new Immunity(level);
             break;
         case AbilityName.TreatsGalore:
             TreatsGalore = new TreatsGalore(level);
             break;
         case AbilityName.Fearless:
             Fearless = new Fearless(level);
             break;
         case AbilityName.FatMouse:
             FatMouse = new FatMouse(level);
             break;
         case AbilityName.ScaryCat:
             ScaryCat = new ScaryCat(level);
             break;
         case AbilityName.BeastlyBuffet:
             BeastlyBuffet = new BeastlyBuffet(level);
             break;
         case AbilityName.Thief:
             Thief = new Thief(level);
             break;
         default:
             throw new ArgumentOutOfRangeException("ability", ability, "No such ability.");
     }
 }
コード例 #2
0
ファイル: Abilities.cs プロジェクト: tjjjwxzq/50.003-Project
 public Abilities(int immunityLevel, int treatsGaloreLevel, int fearlessLevel, int fatMouseLevel, int scaryCatLevel, int beastlyBuffetLevel, int thiefLevel)
 {
     Immunity = new Immunity(immunityLevel);
     TreatsGalore = new TreatsGalore(treatsGaloreLevel);
     Fearless = new Fearless(fearlessLevel);
     FatMouse = new FatMouse(fatMouseLevel);
     ScaryCat = new ScaryCat(scaryCatLevel);
     BeastlyBuffet = new BeastlyBuffet(beastlyBuffetLevel);
     Thief = new Thief(thiefLevel);
 }
コード例 #3
0
        //======================================================
        #region Event Methods
        private void SpecialForm_Load(object sender, EventArgs e)
        {
            //Until I find a better way, this list is typed manually.

            //Rules attached to this ability should be added first, for editing.
            //TODO Need to determine between Common Abilities and Non-Common, as common abilities can be Active or Passive Abilities).
            if (character.SpecialAbilities != null)
            {
                foreach (Ability a in character.SpecialAbilities)
                {
                    if (a.IsCommon)
                    {
                        clbAbilities.Items.Add(a, true);
                    }
                }
            }

            //Add the rest of the abilities, but don't add ones already added from the character.
            Ability ability = new ActiveCamouflage();

            if (!character.SpecialAbilities.Contains(ability))
            {
                clbAbilities.Items.Add(ability);
            }
            ability = new Camouflage();
            if (!character.SpecialAbilities.Contains(ability))
            {
                clbAbilities.Items.Add(ability);
            }
            ability = new Cloaking();
            if (!character.SpecialAbilities.Contains(ability))
            {
                clbAbilities.Items.Add(ability);
            }
            ability = new Fearless();
            if (!character.SpecialAbilities.Contains(ability))
            {
                clbAbilities.Items.Add(ability);
            }
            ability = new Fleet();
            if (!character.SpecialAbilities.Contains(ability))
            {
                clbAbilities.Items.Add(ability);
            }
            ability = new Fly();
            if (!character.SpecialAbilities.Contains(ability))
            {
                clbAbilities.Items.Add(ability);
            }
            ability = new GreaterDodge();
            if (!character.SpecialAbilities.Contains(ability))
            {
                clbAbilities.Items.Add(ability);
            }
        }