I'm currently trying to get my head around how to create an item class which contains data for multiple purposes.
As for example I would like to have an Axe which could be used as weapon, but also as a tool to chop trees. The class should contain the following:
Durability, weight, damage vs npcs/players (when attacking), damage vs trees (when chopping), attack speed, chop speed and some enum in which equipment slot the axe fits (e.g. melee slot).
What would be the typical approach?
I stumbled about this answer, but I'm not 100% sure if I'm understanding him right. Is it something like:
public class Item {
public int durability;
public float weight;
public Weapon weapon;
public Tool tool;
public class Weapon {
public int damage; // damage vs players
public int speed; // attack speed
}
public class Tool {
public int damage; // damage vs trees
public int speed; // chop speed
}
}
?