-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEquipment.cs
71 lines (67 loc) · 2.38 KB
/
Equipment.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
public abstract class Equipment
{
//The name of our equipment
public abstract string Name { get; }
//What does this equipment do?
public abstract string Description { get; }
//what the weapon attack is
public abstract IAttack WeaponAttack { get; }
/// <summary>
/// Equip a weapon to a character, checking to see if it's in the party's inventory or not.
/// </summary>
/// <param name="battle"></param>
/// <param name="character"></param>
public void EquipWeapon(BattleSystem battle, Character character)
{
//check the active party's equipment
var activePartyEquipment = battle.ActiveParty.PartyEquipment;
//if the character doesn't have a weapon, equip this weapon to them and remove it from the party equipment list
if (character.Weapon == null)
{
character.Weapon = this;
activePartyEquipment.Remove(this);
Console.WriteLine($"{character} equipped {this}");
}
//if the character has a weapon, add that weapon to the party equipment list and equip the new weapon.
if (character.Weapon != null)
{
activePartyEquipment.Add(character.Weapon);
character.Weapon = this;
activePartyEquipment.Remove(this);
Console.WriteLine($"{character} equipped {this}");
}
}
}
public class Dagger : Equipment
{
public override string Name => "Dagger";
public override string Description => "Stabby!";
public override IAttack WeaponAttack => new Stab();
}
public class Stab : IAttack
{
public string Name => "STAB";
public AttackData Generate() => new AttackData(1);
}
public class Axe : Equipment
{
public override string Name => "Axe";
public override string Description => "Slashy!";
public override IAttack WeaponAttack => new Swing();
}
public class Swing : IAttack
{
public string Name => "AXE SLASH";
public AttackData Generate() => new AttackData(3);
}
public class Bow : Equipment
{
public override string Name => "Bow";
public override string Description => "Property of Vin Fletcher";
public override IAttack WeaponAttack => new Shoot();
}
public class Shoot : IAttack
{
public string Name => "BASIC SHOT";
public AttackData Generate() => new AttackData(1, successProbability: 0.5f);
}