コード例 #1
0
 /// <summary>
 /// Add an attack quality to all unit type's attacks
 /// </summary>
 /// <param name="quality">Attack quality to add</param>
 public void AddAttackQuality(AttackData.Quality quality)
 {
     for (int i = 0; i < _attacks.Count; i++)
     {
         _attacks[i].AddQuality(quality);
     }
 }
コード例 #2
0
    /// <summary>
    /// Get unit type's attacks for a particular phase
    /// </summary>
    /// <param name="phase">Combat turn's phase</param>
    /// <returns>List of unit type's attacks for the phase</returns>
    public List <Attack> GetAttacksForPhase(Combat.TurnPhase phase)
    {
        List <Attack> result = new List <Attack>();

        AttackData.Quality quality = AttackData.Quality.NONE;
        switch (phase)
        {
        case Combat.TurnPhase.DIVINE:
            quality = AttackData.Quality.DIVINE;
            break;

        case Combat.TurnPhase.MAGIC:
            quality = AttackData.Quality.MAGIC;
            break;

        case Combat.TurnPhase.RANGED:
            quality = AttackData.Quality.RANGED;
            break;

        case Combat.TurnPhase.SKIRMISH:
            quality = AttackData.Quality.SKIRMISH;
            break;

        case Combat.TurnPhase.CHARGE:
            quality = AttackData.Quality.CHARGE;
            break;

        case Combat.TurnPhase.MELEE:
            quality = AttackData.Quality.MELEE;
            break;
        }

        if (quality != AttackData.Quality.NONE)
        {
            for (int i = 0; i < _attacks.Count; i++)
            {
                if (_attacks[i].HasQuality(quality))
                {
                    result.Add(_attacks[i]);
                }
            }
        }
        return(result);
    }
コード例 #3
0
 /// <summary>
 /// Add a new quality to the attack
 /// </summary>
 /// <param name="quality">The attack quality to add</param>
 public void AddQuality(AttackData.Quality quality)
 {
     _qualities.Add(quality);
 }
コード例 #4
0
 /// <summary>
 /// Does the attack has the quality in question?
 /// </summary>
 /// <param name="quality">Quality to check</param>
 /// <returns>Whether the attack has the quality in question</returns>
 public bool HasQuality(AttackData.Quality quality)
 {
     return(_qualities.Contains(quality));
 }