beginning work on potions
This commit is contained in:
parent
bc5540a793
commit
88996ed3b3
6 changed files with 28 additions and 2 deletions
|
@ -45,6 +45,7 @@ typedef struct {
|
|||
bool isCarrying;
|
||||
bool isSwimming;
|
||||
int swimTimer;
|
||||
int strengthTimer;
|
||||
int score;
|
||||
Inventory* inv;
|
||||
Item* activeItem;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
char versionText[34] = "Version 1.3.0";
|
||||
char fpsstr[34];
|
||||
u8 currentMenu = 0;
|
||||
bool UnderStrengthEffect = false;
|
||||
|
||||
void addItemsToWorld(Item item,int x, int y, int count){
|
||||
int i;
|
||||
|
@ -681,6 +682,10 @@ void healPlayer(int amount){
|
|||
addEntityToList(newTextParticleEntity(healText,0xFF00FF00,player.x,player.y,currentLevel), &eManager);
|
||||
}
|
||||
|
||||
void strengthPotionEffect() {
|
||||
UnderStrengthEffect = true;
|
||||
}
|
||||
|
||||
s8 itemTileInteract(int tile, Item* item, int x, int y, int px, int py, int dir){
|
||||
|
||||
// Furniture items
|
||||
|
@ -701,6 +706,12 @@ s8 itemTileInteract(int tile, Item* item, int x, int y, int px, int py, int dir)
|
|||
healPlayer(1);
|
||||
--item->countLevel;
|
||||
}
|
||||
return 0;
|
||||
case ITEM_STRENGTH_POTION:
|
||||
if(player.p.health < 20 && playerUseEnergy(2)){
|
||||
strengthPotionEffect();
|
||||
--item->countLevel;
|
||||
}
|
||||
return 0;
|
||||
case ITEM_GOLD_APPLE:
|
||||
if(player.p.health < 10 && playerUseEnergy(1)){
|
||||
|
@ -1659,6 +1670,7 @@ 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(TOOL_SHOVEL,4), player.p.inv);
|
||||
addItemToInventory(newItem(TOOL_HOE,4), player.p.inv);
|
||||
|
@ -1680,6 +1692,12 @@ 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) {
|
||||
UnderStrengthEffect = false;
|
||||
player.p.strengthTimer = 0;
|
||||
}
|
||||
|
||||
char hurtText[11];
|
||||
switch(tile){
|
||||
|
@ -2197,6 +2215,7 @@ void tickPlayer(){
|
|||
}
|
||||
|
||||
if(isSwimming()) ++player.p.swimTimer;
|
||||
if(UnderStrengthEffect) ++player.p.strengthTimer;
|
||||
if(player.p.attackTimer > 0) --player.p.attackTimer;
|
||||
|
||||
//TODO - maybe move to own function
|
||||
|
|
|
@ -151,6 +151,7 @@ char* getItemName(int itemID, int countLevel){
|
|||
case ITEM_BREAD: sprintf(currentName,"%d Bread", countLevel); return currentName;
|
||||
case ITEM_APPLE: sprintf(currentName,"%d Apple", countLevel); return currentName;
|
||||
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_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;
|
||||
|
@ -298,6 +299,7 @@ char* getBasicItemName(int itemID, int countLevel){
|
|||
case ITEM_BOOKSHELVES: return "Bookshelves";
|
||||
case ITEM_MAGIC_DUST: return "Magic Dust";
|
||||
case ITEM_COIN: return "Coin";
|
||||
case ITEM_STRENGTH_POTION: return "Strength Potion";
|
||||
case TOOL_BUCKET:
|
||||
switch(countLevel){
|
||||
case 1: return "Water Bucket";
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
#define TOOL_BOW 102
|
||||
#define TOOL_MAGIC_COMPASS 103
|
||||
#define ITEM_GOLD_APPLE 104
|
||||
#define ITEM_STRENGTH_POTION 105
|
||||
|
||||
typedef struct Inventory Inventory;
|
||||
|
||||
|
|
|
@ -1490,6 +1490,9 @@ void renderItemIcon(int itemID, int countLevel, int x, int y) {
|
|||
case ITEM_GOLD_APPLE:
|
||||
render(x, y, 177, 160, 0);
|
||||
break;
|
||||
case ITEM_STRENGTH_POTION:
|
||||
render(x, y, 177, 160, 0);
|
||||
break;
|
||||
case ITEM_SLIME:
|
||||
renderb(x, y, 88, 152, 0, 0xFF4DC04D);
|
||||
break;
|
||||
|
|
|
@ -203,7 +203,7 @@ int main() {
|
|||
cfguInit();
|
||||
CFGU_GetSystemModel(&MODEL_3DS);
|
||||
FILE * file;
|
||||
shouldRenderDebug = true;
|
||||
shouldRenderDebug = false;
|
||||
if ((file = fopen("settings.bin", "r"))) {
|
||||
fread(&shouldRenderDebug,sizeof(bool),1,file);
|
||||
fread(&shouldSpeedup,sizeof(bool),1,file);
|
||||
|
@ -322,7 +322,7 @@ int main() {
|
|||
offsetY = 0;
|
||||
|
||||
if(shouldRenderDebug){
|
||||
sprintf(fpsstr, " FPS: %.0f, X:%d, Y:%d, E:%d", sf2d_get_fps(), player.x, player.y, eManager.lastSlot[currentLevel]);
|
||||
sprintf(fpsstr, "FPS: %.0f X:%d Y:%d E:%d %d", sf2d_get_fps(), player.x, player.y, eManager.lastSlot[currentLevel], player.p.strengthTimer);
|
||||
drawText(fpsstr, 2, 225);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue