Regen potion and stuff, other little things

This commit is contained in:
ElijahZAwesome 2018-01-22 18:37:15 -06:00
parent 5e06ba05c7
commit 24567827c2
6 changed files with 24 additions and 34 deletions

View file

@ -152,11 +152,11 @@ 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 = 2;
potionMakerRecipes.size = 3;
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);
potionMakerRecipes.recipes[1] = defineRecipe(ITEM_SPEED_POTION,1,4,ITEM_GEM,2,ITEM_GLASS,10,ITEM_IRONINGOT,10, ITEM_GOLDINGOT,15);
potionMakerRecipes.recipes[2] = defineRecipe(ITEM_REGEN_POTION,1,3,ITEM_GOLD_APPLE,2,ITEM_GLASS,10,ITEM_GEM,10);
}
/* Free up allocated memory */

View file

@ -1,7 +1,7 @@
#include "Globals.h"
#include "Menu.h"
char versionText[34] = "Version 1.3.2";
char versionText[34] = "Version 1.4";
char fpsstr[34];
u8 currentMenu = 0;
bool UnderStrengthEffect = false;
@ -696,6 +696,9 @@ void strengthPotionEffect() {
void speedPotionEffect() {
UnderSpeedEffect = true;
}
void regenPotionEffect() {
regening = true;
}
s8 itemTileInteract(int tile, Item* item, int x, int y, int px, int py, int dir){
@ -729,6 +732,12 @@ s8 itemTileInteract(int tile, Item* item, int x, int y, int px, int py, int dir)
speedPotionEffect();
--item->countLevel;
}
return 0;
case ITEM_REGEN_POTION:
if(player.p.health < 20 && playerUseEnergy(2) && player.p.strengthTimer == 0){
regenPotionEffect();
--item->countLevel;
}
return 0;
case ITEM_GOLD_APPLE:
if(player.p.health < 10 && playerUseEnergy(1)){
@ -1693,6 +1702,7 @@ void initPlayer(){
addItemToInventory(newItem(ITEM_POTION_MAKER,0), player.p.inv);
addItemToInventory(newItem(ITEM_STRENGTH_POTION,1), player.p.inv);
addItemToInventory(newItem(ITEM_SPEED_POTION,1), player.p.inv);
addItemToInventory(newItem(ITEM_REGEN_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);
@ -2249,8 +2259,8 @@ void tickPlayer(){
}
}
if (regening && player.p.regenTimer % 60 == 0) {
if(!shouldRenderDebug) --healPlayer(1);
if (regening && player.p.regenTimer % 90 == 0) {
if(!shouldRenderDebug) healPlayer(1);
}
if (k_pause.clicked){

View file

@ -154,6 +154,7 @@ char* getItemName(int itemID, int countLevel){
case ITEM_GOLD_APPLE: sprintf(currentName,"%d Golden Apple", countLevel); return currentName;
case ITEM_STRENGTH_POTION: sprintf(currentName,"%d Strength Potion", countLevel); return currentName;
case ITEM_SPEED_POTION: sprintf(currentName,"%d Speed Potion", countLevel); return currentName;
case ITEM_REGEN_POTION: sprintf(currentName,"%d Regen Potion", countLevel); return currentName;
case ITEM_COAL: sprintf(currentName,"%d Coal", countLevel); return currentName;
case ITEM_IRONORE: sprintf(currentName,"%d Iron ore", countLevel); return currentName;
case ITEM_GOLDORE: sprintf(currentName,"%d Gold ore", countLevel); return currentName;
@ -304,6 +305,7 @@ char* getBasicItemName(int itemID, int countLevel){
case ITEM_COIN: return "Coin";
case ITEM_STRENGTH_POTION: return "Strength Potion";
case ITEM_SPEED_POTION: return "Speed Potion";
case ITEM_REGEN_POTION: return "Regen Potion";
case TOOL_BUCKET:
switch(countLevel){
case 1: return "Water Bucket";

View file

@ -75,6 +75,7 @@
#define ITEM_GOLD_APPLE 76
#define ITEM_STRENGTH_POTION 77
#define ITEM_SPEED_POTION 78
#define ITEM_REGEN_POTION 79
#define TOOL_BUCKET 101
#define TOOL_BOW 102

View file

@ -98,11 +98,10 @@ void renderTutorialPage(bool topScreen){
break;
case 7: // Potion Brewing
drawTextColor("Brewing",(400-6*12)/2,40,0xFF007FBF);
drawText("Use the Potion Maker to make potions",(400-29*12)/2,74);
drawText("The potions give you abilities",(400-20*12)/2,94);
drawText("Create potions.",(400-13*12)/2,74);
drawText("The potions give you abilities",(400-29*12)/2,94);
drawText("Like speed and strength",(400-22*12)/2,114);
drawText("They are hard to obtain",(400-22*12)/2,134);
drawText("So get to it!",(400-24*12)/2,154);
break;
}
} else {
@ -242,32 +241,7 @@ void renderTutorialPage(bool topScreen){
render(130,56,144,144,0); // Gold Pickaxe
break;
case 7: // Brewing
render16(23,32,464,48,0); // iron ore
render16(23,52,480,48,0); // gold ore
render16(23,72,496,48,0); // gem ore
renderb(41,38,88,152,0,ironColor); // Iron ore item
renderb(41,58,88,152,0,goldColor); // Gold ore item
render(41,78,112,152,0); // Gem item
drawText(">",104,74);
drawText(">",104,114);
drawText(">",104,154);
render16(60,32,112,128,0); // Furnace
render16(60,52,112,128,0); // Furnace
render16(60,72,240,128,0); // Enchanter
drawText(">",160,74);
drawText(">",160,114);
drawText(">",160,154);
renderb(88,36,96,152,0,ironColor); // Iron ingot item
renderb(88,56,96,152,0,goldColor); // Gold ingot item
renderb(88,76,152,144,0,goldColor); // Gem Pickaxe
drawText(">",200,74);
drawText(">",200,114);
render16(106,32,64,128,0); // Anvil
render16(106,52,64,128,0); // Anvil
drawText(">",244,74);
drawText(">",244,114);
render(130,36,136,144,0); // Iron Pickaxe
render(130,56,144,144,0); // Gold Pickaxe
render16(65, 56, 240, 96, 0);
break;
}

View file

@ -1499,6 +1499,9 @@ void renderItemIcon(int itemID, int countLevel, int x, int y) {
case ITEM_SPEED_POTION:
render(x, y, 191, 160, 0);
break;
case ITEM_REGEN_POTION:
render(x, y, 198, 160, 0);
break;
case ITEM_SLIME:
renderb(x, y, 88, 152, 0, 0xFF4DC04D);
break;