Skip to content

Commit 8cb068e

Browse files
author
Tiffany Jager
committed
Add edible dandelion item
1 parent 5c360b3 commit 8cb068e

File tree

6 files changed

+29
-2
lines changed

6 files changed

+29
-2
lines changed

content/Icons/dandelion.png

377 Bytes
Loading

items/dandelion.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"sprite": {
3+
"rect": {
4+
"x": 0,
5+
"y": 0,
6+
"w": 16,
7+
"h": 16
8+
},
9+
"name": "dandelion.png"
10+
},
11+
"healthGained": 0,
12+
"fullnessGained": 10,
13+
"manaGained": 0,
14+
"woundsCured": 0,
15+
"hungerCured": 10,
16+
"manaCured": 0,
17+
"isItem": true,
18+
"maxStack": 30,
19+
"useTime": 32,
20+
"consumable": true
21+
}

src/action/Action.hh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,15 @@ enum class ActionType {
4444

4545
/* Other things. */
4646
MAPLE_LEAF,
47-
HEALTH_POTION,
47+
HEALTH_POTION,
48+
DANDELION,
4849

4950
FIRST_BLOCK = DIRT,
5051
LAST_BLOCK = PICKAXE,
5152
LAST_PURE_BLOCK = GLACIER,
5253

5354
FIRST_ITEM = DIRT,
54-
LAST_ITEM = HEALTH_POTION
55+
LAST_ITEM = DANDELION
5556
};
5657

5758
// Forward declare

src/action/Item.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ std::string Item::getJsonFilename(ActionType type) {
202202
case ActionType::PICKAXE:
203203
filename = "pickaxe";
204204
break;
205+
case ActionType::DANDELION:
206+
filename = "dandelion";
207+
break;
205208
default:
206209
assert(false);
207210
break;

src/action/ItemMaker.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Item *ItemMaker::makeItem(ActionType type, string path) {
7171
// A list of all the item types that should be potions
7272
std::vector<ActionType> potions;
7373
potions.push_back(ActionType::HEALTH_POTION);
74+
potions.push_back(ActionType::DANDELION);
7475

7576
// If it's a potion, make a potion
7677
if (isIn(potions, type)) {

src/entity/Player.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ Player::Player(string path) : Entity(path + "entities/bunny.json", path),
8282
pickup(ItemMaker::makeItem(ActionType::HEALTH_POTION, path));
8383
pickup(ItemMaker::makeItem(ActionType::GLOWSTONE, path));
8484
pickup(ItemMaker::makeItem(ActionType::GLASS, path));
85+
pickup(ItemMaker::makeItem(ActionType::DANDELION, path));
8586
}
8687
pickup(ItemMaker::makeItem(ActionType::DIRT, path));
8788
pickup(ItemMaker::makeItem(ActionType::TOPSOIL, path));

0 commit comments

Comments
 (0)