Potions Update

This commit is contained in:
ElijahZAwesome 2018-01-22 02:32:12 -06:00
parent ac02eeb2a7
commit f34ebde15b
8 changed files with 62 additions and 16 deletions

View file

@ -1,6 +1,12 @@
@echo off
echo Building 3DSX/ELF/SMDH...
make
echo Creating banner...
bannertool.exe makebanner -i icons-banners/banner.png -a icons-banners/audio.wav -o icons-banners/banner.bnr
echo Creating icon...
bannertool.exe makesmdh -s "Minicraft3DS" -l "3DS Homebrew port of Notch's ludum dare game 'Minicraft', updated." -p "Davideesk/Andre111/ElijahZAwesome" -i icons-banners/icon.png -o icons-banners/icon.icn
echo Creating CIA...
makerom -f cia -o result/Minicraft3DS.cia -DAPP_ENCRYPTED=false -rsf icons-banners/Minicraft3DS.rsf -target t -exefslogo -elf result/Minicraft3DS.elf -icon icons-banners/icon.icn -banner icons-banners/banner.bnr
echo Creating 3DS/CCI...
makerom -f cci -o result/Minicraft3DS.3ds -DAPP_ENCRYPTED=true -rsf icons-banners/Minicraft3DS.rsf -target t -exefslogo -elf result/Minicraft3DS.elf -icon icons-banners/icon.icn -banner icons-banners/banner.bnr
pause

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View file

@ -104,7 +104,7 @@ void initRecipes(){
workbenchRecipes.recipes[20] = defineRecipe(ITEM_WALL_WOOD,1,1,ITEM_WOOD,4);
workbenchRecipes.recipes[21] = defineRecipe(ITEM_WALL_STONE,1,1,ITEM_STONE,4);
anvilRecipes.size = 17;
anvilRecipes.size = 18;
anvilRecipes.recipes = (Recipe*)malloc(sizeof(Recipe) * (anvilRecipes.size));
anvilRecipes.recipes[0] = defineRecipe(TOOL_SWORD,2,2,ITEM_WOOD,5,ITEM_IRONINGOT,5);
anvilRecipes.recipes[1] = defineRecipe(TOOL_AXE,2,2,ITEM_WOOD,5,ITEM_IRONINGOT,5);
@ -123,6 +123,7 @@ void initRecipes(){
anvilRecipes.recipes[14] = defineRecipe(ITEM_WALL_IRON,1,1,ITEM_IRONINGOT,2);
anvilRecipes.recipes[15] = defineRecipe(ITEM_WALL_GOLD,1,1,ITEM_GOLDINGOT,2);
anvilRecipes.recipes[16] = defineRecipe(ITEM_COIN,3,1,ITEM_IRONINGOT,1);
anvilRecipes.recipes[17] = defineRecipe(ITEM_POTION_MAKER,1,3,ITEM_IRONINGOT,5,ITEM_GOLDINGOT,25,ITEM_GEM,5);
furnaceRecipes.size = 3;
furnaceRecipes.recipes = (Recipe*)malloc(sizeof(Recipe) * (furnaceRecipes.size));
@ -151,6 +152,10 @@ void initRecipes(){
enchanterRecipes.recipes[6] = defineRecipe(ITEM_WALL_GEM,1,1,ITEM_GEM,10);
enchanterRecipes.recipes[7] = defineRecipe(ITEM_GOLD_APPLE,1,2,ITEM_APPLE,1,ITEM_GOLDINGOT,15);
potionMakerRecipes.size = 1;
potionMakerRecipes.recipes = (Recipe*)malloc(sizeof(Recipe) * (potionMakerRecipes.size));
potionMakerRecipes.recipes[0] = defineRecipe(ITEM_STRENGTH_POTION,1,3,ITEM_GOLD_APPLE,1,ITEM_GLASS,10,ITEM_IRONINGOT,10);
}
/* Free up allocated memory */
@ -161,4 +166,5 @@ void freeRecipes(){
free(anvilRecipes.recipes);
free(loomRecipes.recipes);
free(enchanterRecipes.recipes);
free(potionMakerRecipes.recipes);
}

View file

@ -28,6 +28,7 @@ RecipeManager ovenRecipes;
RecipeManager anvilRecipes;
RecipeManager loomRecipes;
RecipeManager enchanterRecipes;
RecipeManager potionMakerRecipes;
Recipe defineRecipe(int item, int amountOrLevel, int numArgs, ...);

View file

@ -1,7 +1,7 @@
#include "Globals.h"
#include "Menu.h"
char versionText[34] = "Version 1.3.0";
char versionText[34] = "Version 1.3.2";
char fpsstr[34];
u8 currentMenu = 0;
bool UnderStrengthEffect = false;
@ -220,6 +220,12 @@ void tickTouchQuickSelect() {
void hurtEntity(Entity* e, int damage, int dir, u32 hurtColor){
if (shouldRenderDebug && e->type==ENTITY_PLAYER) return;
if(UnderStrengthEffect && player.p.strengthTimer <2000) {
damage = damage + 5;
} else if (player.p.strengthTimer >= 2000) {
UnderStrengthEffect = false;
player.p.strengthTimer = 0;
}
if (e->hurtTime > 0) return;
int xd = player.x - e->x;
int yd = player.y - e->y;
@ -708,7 +714,7 @@ s8 itemTileInteract(int tile, Item* item, int x, int y, int px, int py, int dir)
}
return 0;
case ITEM_STRENGTH_POTION:
if(player.p.health < 20 && playerUseEnergy(2)){
if(player.p.health < 20 && playerUseEnergy(2) && player.p.strengthTimer == 0){
strengthPotionEffect();
--item->countLevel;
}
@ -1670,14 +1676,19 @@ void initPlayer(){
addItemToInventory(newItem(ITEM_WORKBENCH,0), player.p.inv);
addItemToInventory(newItem(ITEM_POWGLOVE,0), player.p.inv);
addItemToInventory(newItem(ITEM_STRENGTH_POTION,1), player.p.inv);
if (shouldRenderDebug == true) {
addItemToInventory(newItem(ITEM_GLASS,10), player.p.inv);
addItemToInventory(newItem(ITEM_GOLD_APPLE,1), player.p.inv);
addItemToInventory(newItem(ITEM_POTION_MAKER,0), player.p.inv);
addItemToInventory(newItem(ITEM_STRENGTH_POTION,1), player.p.inv);
addItemToInventory(newItem(TOOL_SHOVEL,4), player.p.inv);
addItemToInventory(newItem(TOOL_HOE,4), player.p.inv);
addItemToInventory(newItem(TOOL_SWORD,4), player.p.inv);
addItemToInventory(newItem(TOOL_PICKAXE,4), player.p.inv);
addItemToInventory(newItem(TOOL_AXE,4), player.p.inv);
addItemToInventory(newItem(ITEM_GEM, 60), player.p.inv);
addItemToInventory(newItem(ITEM_IRONINGOT, 60), player.p.inv);
addItemToInventory(newItem(ITEM_GOLDINGOT, 60), player.p.inv);
addItemToInventory(newItem(ITEM_APPLE, 1), player.p.inv);
@ -1692,9 +1703,9 @@ void initPlayer(){
void playerHurtTile(int tile, int xt, int yt, int damage, int dir){
if(shouldRenderDebug) damage = 99;
if(UnderStrengthEffect && player.p.strengthTimer <1000) {
damage = damage + 7;
} else if (player.p.strengthTimer >= 1000) {
if(UnderStrengthEffect && player.p.strengthTimer <2000) {
damage = damage + 8;
} else if (player.p.strengthTimer >= 2000) {
UnderStrengthEffect = false;
player.p.strengthTimer = 0;
}
@ -2073,21 +2084,21 @@ bool useEntity(Entity* e) {
return true;
case ITEM_FURNACE:
currentRecipes = &furnaceRecipes;
currentCraftTitle = "Crafting";
currentCraftTitle = "Smelting";
currentMenu = MENU_CRAFTING;
checkCanCraftRecipes(currentRecipes, player.p.inv);
sortRecipes(currentRecipes);
return true;
case ITEM_OVEN:
currentRecipes = &ovenRecipes;
currentCraftTitle = "Crafting";
currentCraftTitle = "Cooking";
currentMenu = MENU_CRAFTING;
checkCanCraftRecipes(currentRecipes, player.p.inv);
sortRecipes(currentRecipes);
return true;
case ITEM_ANVIL:
currentRecipes = &anvilRecipes;
currentCraftTitle = "Crafting";
currentCraftTitle = "Forging";
currentMenu = MENU_CRAFTING;
checkCanCraftRecipes(currentRecipes, player.p.inv);
sortRecipes(currentRecipes);
@ -2101,14 +2112,21 @@ bool useEntity(Entity* e) {
return true;
case ITEM_LOOM:
currentRecipes = &loomRecipes;
currentCraftTitle = "Crafting";
currentCraftTitle = "Sewing";
currentMenu = MENU_CRAFTING;
checkCanCraftRecipes(currentRecipes, player.p.inv);
sortRecipes(currentRecipes);
return true;
case ITEM_ENCHANTER:
currentRecipes = &enchanterRecipes;
currentCraftTitle = "Crafting";
currentCraftTitle = "Enchanting";
currentMenu = MENU_CRAFTING;
checkCanCraftRecipes(currentRecipes, player.p.inv);
sortRecipes(currentRecipes);
return true;
case ITEM_POTION_MAKER:
currentRecipes = &potionMakerRecipes;
currentCraftTitle = "Brewing";
currentMenu = MENU_CRAFTING;
checkCanCraftRecipes(currentRecipes, player.p.inv);
sortRecipes(currentRecipes);
@ -2216,7 +2234,13 @@ void tickPlayer(){
if(isSwimming()) ++player.p.swimTimer;
if(UnderStrengthEffect) ++player.p.strengthTimer;
if(player.p.attackTimer > 0) --player.p.attackTimer;
if(player.p.strengthTimer >= 2000) {
player.p.strengthTimer = 0;
UnderStrengthEffect = false;
}
if(player.p.attackTimer > 0) {
--player.p.attackTimer;
}
//TODO - maybe move to own function
//Update Minimap

View file

@ -135,6 +135,7 @@ char* getItemName(int itemID, int countLevel){
case ITEM_OVEN: return "Oven";
case ITEM_FURNACE: return "Furnace";
case ITEM_WORKBENCH: return "Workbench";
case ITEM_POTION_MAKER: return "Potion Maker";
case ITEM_LANTERN: return "Lantern";
case ITEM_POWGLOVE: return "Power Glove";
case ITEM_FLOWER: sprintf(currentName,"%d Flower", countLevel); return currentName;
@ -247,6 +248,7 @@ char* getBasicItemName(int itemID, int countLevel){
case ITEM_OVEN: return "Oven";
case ITEM_FURNACE: return "Furnace";
case ITEM_WORKBENCH: return "Workbench";
case ITEM_POTION_MAKER: return "Potion Maker";
case ITEM_LANTERN: return "Lantern";
case ITEM_POWGLOVE: return "Power Glove";
case ITEM_FLOWER: return "Flower";

View file

@ -45,6 +45,7 @@
#define ITEM_LOOM 34
#define ITEM_ENCHANTER 35
#define ITEM_POTION_MAKER 36
#define ITEM_WALL_WOOD 51
#define ITEM_WALL_STONE 52
@ -71,12 +72,12 @@
#define ITEM_BOOKSHELVES 73
#define ITEM_MAGIC_DUST 74
#define ITEM_COIN 75
#define ITEM_GOLD_APPLE 76
#define ITEM_STRENGTH_POTION 77
#define TOOL_BUCKET 101
#define TOOL_BOW 102
#define TOOL_MAGIC_COMPASS 103
#define ITEM_GOLD_APPLE 104
#define ITEM_STRENGTH_POTION 105
typedef struct Inventory Inventory;

View file

@ -1092,6 +1092,9 @@ void renderFurniture(int itemID, int x, int y) {
case ITEM_ENCHANTER:
render16(x, y, 240, 128, 0);
break;
case ITEM_POTION_MAKER:
render16(x, y, 240, 96, 0);
break;
}
}
@ -1491,7 +1494,7 @@ void renderItemIcon(int itemID, int countLevel, int x, int y) {
render(x, y, 177, 160, 0);
break;
case ITEM_STRENGTH_POTION:
render(x, y, 177, 160, 0);
render(x, y, 184, 160, 0);
break;
case ITEM_SLIME:
renderb(x, y, 88, 152, 0, 0xFF4DC04D);
@ -1523,6 +1526,9 @@ void renderItemIcon(int itemID, int countLevel, int x, int y) {
case ITEM_ENCHANTER:
render(x, y, 144, 160, 0);
break;
case ITEM_POTION_MAKER:
render(x, y, 216, 152, 0);
break;
case ITEM_WALL_WOOD:
renderb(x, y, 224, 144, 0, woodColor);
break;