#region File Description
//-----------------------------------------------------------------------------
// DefendCombatAction.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion
#region Using Statements
using System;
using Microsoft.Xna.Framework;
using RolePlayingGameData;
using Microsoft.Xna.Framework.Graphics;
#endregion
namespace RolePlaying
{
///
/// A melee-attack combat action, including related data and calculations.
///
class DefendCombatAction : CombatAction
{
#region State
///
/// Returns true if the action is offensive, targeting the opponents.
///
public override bool IsOffensive
{
get { return false; }
}
///
/// Returns true if this action requires a target.
///
public override bool IsTargetNeeded
{
get { return false; }
}
#endregion
#region Combat Stage
///
/// Starts a new combat stage. Called right after the stage changes.
///
/// The stage never changes into NotStarted.
protected override void StartStage()
{
switch (stage)
{
case CombatActionStage.Preparing: // called from Start()
Combatant.CombatSprite.PlayAnimation("Defend");
break;
case CombatActionStage.Executing:
Combatant.CombatEffects.AddStatistics(new StatisticsValue(
0, 0, 0, Combatant.Character.CharacterStatistics.PhysicalDefense,
0, Combatant.Character.CharacterStatistics.MagicalDefense), 1);
break;
}
}
#endregion
#region Heuristic
///
/// The heuristic used to compare actions of this type to similar ones.
///
public override int Heuristic
{
get
{
return 0;
}
}
#endregion
#region Initialization
///
/// Constructs a new DefendCombatAction object.
///
/// The character performing the action.
public DefendCombatAction(Combatant combatant)
: base(combatant) { }
#endregion
}
}