-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathICharacterActions.cs
50 lines (47 loc) · 1.8 KB
/
ICharacterActions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//Interface for character actions, runs actions. Takes in a battle system for various checks and a character who will be taking the action
public interface ICharacterActions { public void DoAction(BattleSystem battle, Character character); }
//The character did nothing this round for some reason
public class NothingAction : ICharacterActions
{
public void DoAction(BattleSystem battle, Character character)
{
Console.WriteLine($"{character.Name} did NOTHING.");
}
}
//The character attacked
public class AttackAction : ICharacterActions
{
public void DoAction(BattleSystem battle, Character character)
{
Character target = Selections.SelectTarget(battle, character);
AttackController attack = new AttackController(character, target);
}
}
//The character tried to use an item.
public class ItemAction : ICharacterActions
{
public void DoAction(BattleSystem battle, Character character)
{
var hasItems = battle.ActiveParty.PartyItems.Any();
if (!hasItems) Console.WriteLine($"{character.Name} tried to use an item, but there were no items to use!");
else
{
var item = Selections.SelectItem(battle, character);
item.UseItem(battle, character);
}
}
}
//The character tried to equip something.
public class EquipAction : ICharacterActions
{
public void DoAction(BattleSystem battle, Character character)
{
var hasEquipment = battle.ActiveParty.PartyEquipment.Any();
if (!hasEquipment) Console.WriteLine($"{character.Name} tried to equip something, but there was no equipment!");
else
{
var equip = Selections.SelectEquipment(battle, character);
equip.EquipWeapon(battle, character);
}
}
}