{
"player": [
[
{
"name": "sword",
"attack_bonus": 2,
"defence_bonus": 0,
"cost": 10
},
{
"name": "tornado",
"attack_bonus": 5,
"defence_bonus": 0,
"cost": 25
}
]
}
public class Equipment
{
public string name;
public int attack_bonus;
public int defence_bonus;
public int cost;
public Equipment(string name, int attack_bonus, int defence_bonus, int cost)
{
this.name = name;
this.attack_bonus = attack_bonus;
this.defence_bonus = defence_bonus;
this.cost = cost;
}
public int get_attack_bonus()
{
return this.attack_bonus;
}
public int get_defence_bonus()
{
return this.defence_bonus;
}
public int get_cost()
{
return this.cost;
}
public string get_name()
{
return this.name;
}
public string get_descr()
{
string descr = get_name() + " :";
if (get_attack_bonus() != 0)
{
descr += " attack +" + get_attack_bonus();
}
if (get_defence_bonus() != 0)
{
descr += " defence +" + get_defence_bonus();
}
descr += " cost $" + get_cost();
return descr;
}
}