So, I'm a little stuck on what the best way to implement weapons is. The problem I'm running into is, what exactly is a weapon.
I have a Player Class that has an attack method.
public class Character
{
public int MaxDamage;
public bool IsAlive = true;
public Character Attack(Character target)
{
Random attackRange = new Random();
int damageValue = attackRange.Next(0, MaxDamage);
target.TakeDamage(damageValue);
Random critCheck = new Random();
int critCheckValue = critCheck.Next(0, 100);
//hitChance = dex - target.dex;
if (critCheckValue <= CritChance)
{
//dmg min = dmg min + (dmg min*crit damage);
MaxDamage = MaxDamage + (MaxDamage * CritDamage);
}
}
}
So this works. But once I implement a weapon, it gets a little confusing.
- Does the player still have the attack method and the weapon just modifies the values?
- Does the weapon really have the attack method and the player just calls it?
- How would you handle something like a power swing that may hit 3 characters?
- Does the weapon contain the range or the player?