Rolling hit point counter mechanics and basics implemented

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent e267d7ab98
commit 154cd4e067
  1. BIN
      C++ProjectTemplate
  2. BIN
      assets/rollingcounter.png
  3. 10
      ideas
  4. 65
      main.cpp

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 710 B

After

Width:  |  Height:  |  Size: 4.7 KiB

10
ideas

@ -139,3 +139,13 @@ healing move and is dying, it will attempt to use that.
There is also a dumb flag. The dumb flag will make the enemy try to use PP draining moves There is also a dumb flag. The dumb flag will make the enemy try to use PP draining moves
even if they don't have enough PP for that move. This will mean they will waste turns after even if they don't have enough PP for that move. This will mean they will waste turns after
they run out of PP. they run out of PP.
====================
Rolling Hit point counter
If you take damage, you will lose health at a tick rate of 2 per frame. (It takes 13 frames per number, so you are losing 9.23HP/sec). 60/13 = 4.62 HPsec
If your health falls below zero, you start bleeding health at a rate of +1 for every 20 health missing from your current health.
If your health falls below your negative max health, you start bleeding health at a rate of +1 for every 10 health missing from your current health.

@ -20,7 +20,7 @@
#define TILEMAP_EDITOR_TILESIZE (32*TILEMAP_EDITOR_DRAW_MULT) #define TILEMAP_EDITOR_TILESIZE (32*TILEMAP_EDITOR_DRAW_MULT)
#define PARTY_TRAIL_LENGTH 48 #define PARTY_TRAIL_LENGTH 48
#define CAMERA_WAIT_TIME 60 #define CAMERA_WAIT_TIME 60
#define HEALTH_ROLLING_SPEED 1 #define HEALTH_ROLLING_SPEED 2
#define ㅎ #define ㅎ
#define ㅍ #define ㅍ
@ -280,9 +280,8 @@ class Entity{
Object* obj; Object* obj;
std::vector<Battle::Move*> moveSet; std::vector<Battle::Move*> moveSet;
//Used for initializing players. //Used for initializing players.
Entity(int HP,int maxHP,int PP,int maxPP,int baseAtk,std::array<int,4>resistances,int speed,std::vector<Battle::Move*>moveSet,int damageReduction=0,bool smart=false,bool dumb=false) { Entity(int HP,int maxHP,int PP,int maxPP,int baseAtk,std::array<int,4>resistances,int speed,std::vector<Battle::Move*>moveSet,int damageReduction=0,bool smart=false,bool dumb=false)
Entity(nullptr,HP,maxHP,PP,maxPP,baseAtk,resistances,speed,moveSet,damageReduction,smart,dumb); :Entity(nullptr,HP,maxHP,PP,maxPP,baseAtk,resistances,speed,moveSet,damageReduction,smart,dumb){}
}
//Use this for initializing enemies as it lets you specify an object. //Use this for initializing enemies as it lets you specify an object.
Entity(Object*obj,int HP,int maxHP,int PP,int maxPP,int baseAtk,std::array<int,4>resistances,int speed,std::vector<Battle::Move*>moveSet,int damageReduction=0,bool smart=false,bool dumb=false) Entity(Object*obj,int HP,int maxHP,int PP,int maxPP,int baseAtk,std::array<int,4>resistances,int speed,std::vector<Battle::Move*>moveSet,int damageReduction=0,bool smart=false,bool dumb=false)
:obj(obj),HP(HP),maxHP(maxHP),PP(PP),maxPP(maxPP),baseAtk(baseAtk),speed(speed),moveSet(moveSet),damageReduction(damageReduction),smart(smart),dumb(dumb){ :obj(obj),HP(HP),maxHP(maxHP),PP(PP),maxPP(maxPP),baseAtk(baseAtk),speed(speed),moveSet(moveSet),damageReduction(damageReduction),smart(smart),dumb(dumb){
@ -393,6 +392,7 @@ public:
int player_rollpp_counter[4][3] = {{0,0,0},{0,0,0},{0,0,0},{0,0,0}}; int player_rollpp_counter[4][3] = {{0,0,0},{0,0,0},{0,0,0},{0,0,0}};
int player_rollhp_display[4][3] = {{0,0,0},{0,0,0},{0,0,0},{0,0,0}}; int player_rollhp_display[4][3] = {{0,0,0},{0,0,0},{0,0,0},{0,0,0}};
int player_rollpp_display[4][3] = {{0,0,0},{0,0,0},{0,0,0},{0,0,0}}; int player_rollpp_display[4][3] = {{0,0,0},{0,0,0},{0,0,0},{0,0,0}};
int SELECTED_TEST_TARGET=0;
bool MOUSE_PRESSED_DOWN=false,MOUSE_DOWN=false,MOUSE_RELEASED=false; //TODO Implement Mouse things. bool MOUSE_PRESSED_DOWN=false,MOUSE_DOWN=false,MOUSE_RELEASED=false; //TODO Implement Mouse things.
@ -599,34 +599,51 @@ goes on a very long time, I hope you can understand this is only for testing pur
} }
} else } else
if (member->HP<member->targetHP) { if (member->HP<member->targetHP) {
if (player_rollhp_counter[i][0]>=13) { if (player_rollhp_counter[i][0]>=0) {
player_rollhp_display[i][0]++; player_rollhp_display[i][0]++;
player_rollhp_counter[i][0]=0; player_rollhp_counter[i][0]=-13;
member->HP++; member->HP++;
if (player_rollhp_display[i][0]>9) { if (player_rollhp_display[i][0]>9) {
player_rollhp_display[i][0]=0; player_rollhp_display[i][0]=0;
player_rollhp_counter[i][0]=0; player_rollhp_counter[i][0]=-13;
player_rollhp_display[i][1]++; player_rollhp_display[i][1]++;
player_rollhp_counter[i][1]=0; player_rollhp_counter[i][1]=-13;
if (player_rollhp_display[i][1]>9) { if (player_rollhp_display[i][1]>9) {
player_rollhp_display[i][1]=0; player_rollhp_display[i][1]=0;
player_rollhp_counter[i][1]=0; player_rollhp_counter[i][1]=-13;
player_rollhp_display[i][2]++; player_rollhp_display[i][2]++;
player_rollhp_counter[i][2]=0; player_rollhp_counter[i][2]=-13;
} }
} }
} }
if (player_rollhp_counter[i][0]<13) { if (player_rollhp_counter[i][0]<0) {
player_rollhp_counter[i][0]+=HEALTH_ROLLING_SPEED; player_rollhp_counter[i][0]+=HEALTH_ROLLING_SPEED;
} }
if (player_rollhp_counter[i][1]<13) { if (player_rollhp_counter[i][1]<0) {
player_rollhp_counter[i][1]++; player_rollhp_counter[i][1]++;
} }
if (player_rollhp_counter[i][2]<13) { if (player_rollhp_counter[i][2]<0) {
player_rollhp_counter[i][2]++; player_rollhp_counter[i][2]++;
} }
} else { } else {
player_rollhp_counter[i][0]=player_rollhp_counter[i][1]=player_rollhp_counter[i][2]=0; if (player_rollhp_counter[i][0]<0) {
player_rollhp_counter[i][0]++;
}
if (player_rollhp_counter[i][1]<0) {
player_rollhp_counter[i][1]++;
}
if (player_rollhp_counter[i][2]<0) {
player_rollhp_counter[i][2]++;
}
if (player_rollhp_counter[i][0]>0) {
player_rollhp_counter[i][0]--;
}
if (player_rollhp_counter[i][1]>0) {
player_rollhp_counter[i][1]--;
}
if (player_rollhp_counter[i][2]>0) {
player_rollhp_counter[i][2]--;
}
} }
} }
}break; }break;
@ -984,6 +1001,19 @@ goes on a very long time, I hope you can understand this is only for testing pur
ConsoleShow(F1,false); ConsoleShow(F1,false);
} }
if (BATTLE_ENCOUNTER!=nullptr) {
if (GetMouseWheel()>0) {
SELECTED_TEST_TARGET=(SELECTED_TEST_TARGET+1)%4;
printf("Selected Test Target:%d\n",SELECTED_TEST_TARGET);
}
if (GetKey(PGUP).bPressed) {
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[SELECTED_TEST_TARGET]]->targetHP=std::clamp(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[SELECTED_TEST_TARGET]]->targetHP+10,0,PARTY_MEMBER_STATS[PARTY_MEMBER_ID[SELECTED_TEST_TARGET]]->maxHP);
}
if (GetKey(PGDN).bPressed) {
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[SELECTED_TEST_TARGET]]->targetHP=std::clamp(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[SELECTED_TEST_TARGET]]->targetHP-10,0,PARTY_MEMBER_STATS[PARTY_MEMBER_ID[SELECTED_TEST_TARGET]]->maxHP);
}
}
switch (GAME_STATE) { switch (GAME_STATE) {
case GameState::TILE_SELECT:{ case GameState::TILE_SELECT:{
if (UpPressed()) { if (UpPressed()) {
@ -1569,6 +1599,7 @@ goes on a very long time, I hope you can understand this is only for testing pur
void SetupPartyMemberStats() { void SetupPartyMemberStats() {
for (int i=0;i<7;i++) { for (int i=0;i<7;i++) {
PARTY_MEMBER_STATS[i]=new Entity(120,120,30,30,8,{0,0,0,0},4,{MOVELIST[BattleMoveName::TESTMOVE1]}); PARTY_MEMBER_STATS[i]=new Entity(120,120,30,30,8,{0,0,0,0},4,{MOVELIST[BattleMoveName::TESTMOVE1]});
printf("HP:%d Max HP:%d",PARTY_MEMBER_STATS[i]->HP,PARTY_MEMBER_STATS[i]->maxHP);
} }
} }
@ -2107,9 +2138,9 @@ goes on a very long time, I hope you can understand this is only for testing pur
FillRectDecal({(float)(pos.x+21),(float)(pos.y-2)},{28,11},olc::GREY); FillRectDecal({(float)(pos.x+21),(float)(pos.y-2)},{28,11},olc::GREY);
DrawLineDecal({(float)(pos.x+30),(float)(pos.y-3)},{(float)(pos.x+30),(float)(pos.y+10)},olc::DARK_GREY); DrawLineDecal({(float)(pos.x+30),(float)(pos.y-3)},{(float)(pos.x+30),(float)(pos.y+10)},olc::DARK_GREY);
DrawLineDecal({(float)(pos.x+40),(float)(pos.y-3)},{(float)(pos.x+40),(float)(pos.y+10)},olc::DARK_GREY); DrawLineDecal({(float)(pos.x+40),(float)(pos.y-3)},{(float)(pos.x+40),(float)(pos.y+10)},olc::DARK_GREY);
DrawPartialDecal({(float)(pos.x+22),(float)(pos.y-1)},{7,9},SPRITES["rollingcounter.png"],{0,(float)(rollcounter[2]*13+rolloffset[2])},{7,9}); DrawPartialDecal({(float)(pos.x+22),(float)(pos.y-1)},{7,9},SPRITES["rollingcounter.png"],{0,(float)(rollcounter[2]*13+rolloffset[2]+13)},{7,9});
DrawPartialDecal({(float)(pos.x+31),(float)(pos.y-1)},{7,9},SPRITES["rollingcounter.png"],{0,(float)(rollcounter[1]*13+rolloffset[1])},{7,9}); DrawPartialDecal({(float)(pos.x+31),(float)(pos.y-1)},{7,9},SPRITES["rollingcounter.png"],{0,(float)(rollcounter[1]*13+rolloffset[1]+13)},{7,9});
DrawPartialDecal({(float)(pos.x+41),(float)(pos.y-1)},{7,9},SPRITES["rollingcounter.png"],{0,(float)(rollcounter[0]*13+rolloffset[0])},{7,9}); DrawPartialDecal({(float)(pos.x+41),(float)(pos.y-1)},{7,9},SPRITES["rollingcounter.png"],{0,(float)(rollcounter[0]*13+rolloffset[0]+13)},{7,9});
} }
void ResetBattleState() { void ResetBattleState() {

Loading…
Cancel
Save