generated from sigonasr2/CPlusPlusProjectTemplate
Basic consumable behaviors implemented
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
3d7d26927d
commit
03285edba4
Binary file not shown.
2
battle.h
2
battle.h
@ -13,6 +13,8 @@ enum class BattleMoveName{
|
|||||||
BASH_CHANGE,
|
BASH_CHANGE,
|
||||||
DEFEND,
|
DEFEND,
|
||||||
EQUIP_ARMOR,
|
EQUIP_ARMOR,
|
||||||
|
CONSUMABLE,
|
||||||
|
CONSUMABLE_ENEMY,
|
||||||
HAILSTORM_A,
|
HAILSTORM_A,
|
||||||
HAILSTORM_B,
|
HAILSTORM_B,
|
||||||
HAILSTORM_G,
|
HAILSTORM_G,
|
||||||
|
@ -15,6 +15,7 @@ using namespace olc;
|
|||||||
#define HEALTH_ROLLING_SPEED 2
|
#define HEALTH_ROLLING_SPEED 2
|
||||||
#define NO_TARGET -99
|
#define NO_TARGET -99
|
||||||
#define DEFAULT_CHANNELPOS {-99,-99}
|
#define DEFAULT_CHANNELPOS {-99,-99}
|
||||||
|
#define CUSTOM_MESSAGE_WAIT_TIME 90
|
||||||
|
|
||||||
#define ㅎ
|
#define ㅎ
|
||||||
#define ㅍ
|
#define ㅍ
|
||||||
@ -37,4 +38,5 @@ using namespace olc;
|
|||||||
|
|
||||||
extern PixelGameEngine*GAME;
|
extern PixelGameEngine*GAME;
|
||||||
extern vd2d cameraPos;
|
extern vd2d cameraPos;
|
||||||
|
template<typename T, typename F> inline T transform_to( F str ) noexcept{if (str.empty()) return {}; return { std::begin(str), std::end(str) };};
|
||||||
#endif
|
#endif
|
@ -106,6 +106,14 @@ class Entity{
|
|||||||
PP=pp;
|
PP=pp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RemoveItem(int index) {
|
||||||
|
if (isPlayer) {
|
||||||
|
PARTY_INVENTORY.erase(PARTY_INVENTORY.begin()+index);
|
||||||
|
} else {
|
||||||
|
inventory.erase(inventory.begin()+index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//If index is -1, the item is inserted at the end of the list. Otherwise it's going to overwrite a certain slot. Be certain you swap the item before doing this!
|
//If index is -1, the item is inserted at the end of the list. Otherwise it's going to overwrite a certain slot. Be certain you swap the item before doing this!
|
||||||
void RemoveEquip(int slot,int index=-1) {
|
void RemoveEquip(int slot,int index=-1) {
|
||||||
Item*CurrentEquip=equipment[slot];
|
Item*CurrentEquip=equipment[slot];
|
||||||
|
44
item.h
44
item.h
@ -3,16 +3,20 @@
|
|||||||
#include "pixelGameEngine.h"
|
#include "pixelGameEngine.h"
|
||||||
using namespace olc;
|
using namespace olc;
|
||||||
#include "battle.h"
|
#include "battle.h"
|
||||||
|
#include "defines.h"
|
||||||
|
|
||||||
enum class ItemName{
|
enum class ItemName{
|
||||||
COOKIE,
|
COOKIE,
|
||||||
EGG,
|
EGG,
|
||||||
PIZZA,
|
PIZZA,
|
||||||
|
MIRACLE_FOOD_LUNCH,
|
||||||
CRACKED_BAT,
|
CRACKED_BAT,
|
||||||
TEE_BALL_BAT,
|
TEE_BALL_BAT,
|
||||||
LIGHT_JACKET,
|
LIGHT_JACKET,
|
||||||
HEAVY_JACKET,
|
HEAVY_JACKET,
|
||||||
COPPER_BRACELET,
|
COPPER_BRACELET,
|
||||||
KEY_TO_THE_PALACE,
|
KEY_TO_THE_PALACE,
|
||||||
|
BOMB,
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace EquipSlot{
|
namespace EquipSlot{
|
||||||
@ -24,6 +28,25 @@ namespace EquipSlot{
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Consumable{
|
||||||
|
enum{
|
||||||
|
FRIENDLY,
|
||||||
|
ENEMY,
|
||||||
|
FRIENDLY_PERMANENT, //This item does not get used up when used.
|
||||||
|
ENEMY_PERMANENT, //This item does not get used up when used.
|
||||||
|
NOT_A_CONSUMABLE
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class ItemAction{
|
||||||
|
HPRECOVERY,
|
||||||
|
PPRECOVERY,
|
||||||
|
ATKINCREASE,
|
||||||
|
HPINCREASE,
|
||||||
|
SPDINCREASE,
|
||||||
|
LEARNMOVE,
|
||||||
|
};
|
||||||
|
|
||||||
struct ItemStatsStruct{
|
struct ItemStatsStruct{
|
||||||
int hpRecovery=0;
|
int hpRecovery=0;
|
||||||
int ppRecovery=0;
|
int ppRecovery=0;
|
||||||
@ -31,11 +54,18 @@ struct ItemStatsStruct{
|
|||||||
int spdIncrease=0;
|
int spdIncrease=0;
|
||||||
int hpIncrease=0;
|
int hpIncrease=0;
|
||||||
Battle::Move*learnAbility=nullptr;
|
Battle::Move*learnAbility=nullptr;
|
||||||
|
int damage=0;
|
||||||
|
int rollDmg=0;
|
||||||
int attack=0;
|
int attack=0;
|
||||||
int defense=0;
|
int defense=0;
|
||||||
EquipSlot::Equip equip=EquipSlot::NONE; //Whether or not this is equipment.
|
EquipSlot::Equip equip=EquipSlot::NONE; //Whether or not this is equipment.
|
||||||
bool important=false; //If an item's important it can't be discarded.
|
bool important=false; //If an item's important it can't be discarded.
|
||||||
bool consumable=false; //Whether or not this item is consumed when used.
|
int consumable=Consumable::NOT_A_CONSUMABLE; //Whether or not this item is consumed when used.
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CustomItemMessage{
|
||||||
|
std::wstring s;
|
||||||
|
ItemAction a;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Item{
|
class Item{
|
||||||
@ -44,7 +74,15 @@ class Item{
|
|||||||
std::string description;
|
std::string description;
|
||||||
Battle::Move*battlemove=nullptr;
|
Battle::Move*battlemove=nullptr;
|
||||||
ItemStatsStruct stats;
|
ItemStatsStruct stats;
|
||||||
Item(std::string name,std::string desc,ItemStatsStruct stats={hpRecovery:0,ppRecovery:0,atkIncrease:0,spdIncrease:0,hpIncrease:0,learnAbility:nullptr,attack:0,defense:0,equip:EquipSlot::NONE,important:false,consumable:false},Battle::Move*battlemove=nullptr)
|
std::vector<CustomItemMessage> messages;
|
||||||
:name(name),description(desc),stats(stats),battlemove(battlemove){}
|
Item(std::string name,std::string desc,ItemStatsStruct stats={hpRecovery:0,ppRecovery:0,atkIncrease:0,spdIncrease:0,hpIncrease:0,learnAbility:nullptr,damage:0,rollDmg:0,attack:0,defense:0,equip:EquipSlot::NONE,important:false,consumable:Consumable::NOT_A_CONSUMABLE},Battle::Move*battlemove=nullptr)
|
||||||
|
:name(name),description(desc),stats(stats),battlemove(battlemove){
|
||||||
|
if (stats.hpRecovery) {messages.push_back({L"$USER recovers "+std::to_wstring(stats.hpRecovery)+L" HP.",ItemAction::HPRECOVERY});}
|
||||||
|
if (stats.ppRecovery) {messages.push_back({L"$USER recovers "+std::to_wstring(stats.ppRecovery)+L" PP.",ItemAction::PPRECOVERY});}
|
||||||
|
if (stats.atkIncrease) {messages.push_back({L"$USER gains "+std::to_wstring(stats.atkIncrease)+L" point"+(stats.atkIncrease==1?L"":L"s")+L".",ItemAction::ATKINCREASE});}
|
||||||
|
if (stats.hpIncrease) {messages.push_back({L"$USER gains "+std::to_wstring(stats.hpIncrease)+L" point"+(stats.hpIncrease==1?L"":L"s")+L".",ItemAction::HPINCREASE});}
|
||||||
|
if (stats.spdIncrease) {messages.push_back({L"$USER gains "+std::to_wstring(stats.spdIncrease)+L" point"+(stats.spdIncrease==1?L"":L"s")+L".",ItemAction::SPDINCREASE});}
|
||||||
|
if (stats.learnAbility!=nullptr) {messages.push_back({L"$USER gains the ability to use "+transform_to<std::wstring>(stats.learnAbility->name)+L" "+((stats.learnAbility->grade!=0)?std::wstring(1,stats.learnAbility->grade):L"")+L"!",ItemAction::LEARNMOVE});}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
125
main.cpp
125
main.cpp
@ -33,8 +33,6 @@ enum{
|
|||||||
SIGMA=Σ,
|
SIGMA=Σ,
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T, typename F> inline T transform_to( F str ) noexcept{if (str.empty()) return {}; return { std::begin(str), std::end(str) };};
|
|
||||||
|
|
||||||
class Map{
|
class Map{
|
||||||
public:
|
public:
|
||||||
std::string filename;
|
std::string filename;
|
||||||
@ -142,6 +140,9 @@ public:
|
|||||||
int BATTLE_HIT_SCREENSHAKE = 0; //Amount of time the screen will rapidly shake as getting hit.
|
int BATTLE_HIT_SCREENSHAKE = 0; //Amount of time the screen will rapidly shake as getting hit.
|
||||||
bool ITEM_REQUIRES_EQUIPPING=false;
|
bool ITEM_REQUIRES_EQUIPPING=false;
|
||||||
std::wstring EQUIP_$ITEM_DISPLAY=L" "; //Use this to change the $ITEM tag modifier for abilities.
|
std::wstring EQUIP_$ITEM_DISPLAY=L" "; //Use this to change the $ITEM tag modifier for abilities.
|
||||||
|
std::vector<CustomItemMessage> BATTLE_CUSTOM_MSGS; //Used for displaying additional information during battles.
|
||||||
|
CustomItemMessage BATTLE_CURRENT_CUSTOM_MSG;
|
||||||
|
int BATTLE_CUSTOM_MESSAGE_WAIT_TIME=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.
|
||||||
|
|
||||||
@ -940,12 +941,21 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
|
|||||||
HandleInventoryNavigation();
|
HandleInventoryNavigation();
|
||||||
}
|
}
|
||||||
if (ACTIONKEYPRESSED) {
|
if (ACTIONKEYPRESSED) {
|
||||||
ITEM_REQUIRES_EQUIPPING=true;
|
|
||||||
EQUIP_$ITEM_DISPLAY=transform_to<std::wstring>(PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->name);
|
EQUIP_$ITEM_DISPLAY=transform_to<std::wstring>(PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->name);
|
||||||
if (PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->stats.equip==EquipSlot::WEAPON) {
|
if (PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->stats.equip==EquipSlot::WEAPON) {
|
||||||
|
ITEM_REQUIRES_EQUIPPING=true;
|
||||||
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove=MOVELIST[BattleMoveName::BASH_CHANGE];
|
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove=MOVELIST[BattleMoveName::BASH_CHANGE];
|
||||||
SetupTargetSelect();
|
SetupTargetSelect();
|
||||||
|
} else
|
||||||
|
if (PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->stats.consumable!=Consumable::NOT_A_CONSUMABLE) {
|
||||||
|
if (PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->stats.consumable==Consumable::FRIENDLY) {
|
||||||
|
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove=MOVELIST[BattleMoveName::CONSUMABLE];
|
||||||
|
} else {
|
||||||
|
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove=MOVELIST[BattleMoveName::CONSUMABLE_ENEMY];
|
||||||
|
}
|
||||||
|
SetupTargetSelect();
|
||||||
} else {
|
} else {
|
||||||
|
ITEM_REQUIRES_EQUIPPING=true;
|
||||||
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove=MOVELIST[BattleMoveName::EQUIP_ARMOR];
|
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove=MOVELIST[BattleMoveName::EQUIP_ARMOR];
|
||||||
ConfirmPlayerTargetSelection();
|
ConfirmPlayerTargetSelection();
|
||||||
BATTLE_STATE=BattleState::WAIT;
|
BATTLE_STATE=BattleState::WAIT;
|
||||||
@ -1321,34 +1331,25 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
|
|||||||
}
|
}
|
||||||
if (BATTLE_STATE==BattleState::WAIT_ANIMATION) {
|
if (BATTLE_STATE==BattleState::WAIT_ANIMATION) {
|
||||||
SetDrawTarget(layer::INTERFACE);
|
SetDrawTarget(layer::INTERFACE);
|
||||||
std::wstring label=L"";
|
|
||||||
if (CURRENT_TURN<0) {
|
|
||||||
std::wstring baseStr = PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->attackMsg;
|
|
||||||
label=baseStr;
|
|
||||||
if (label.find(L"$USER")!=std::string::npos) {
|
|
||||||
label=label.replace(label.find(L"$USER"),5,transform_to<std::wstring>(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->obj->name));
|
|
||||||
}
|
|
||||||
if (label.find(L"$POWER")!=std::string::npos) {
|
|
||||||
label=label.replace(label.find(L"$POWER"),6,transform_to<std::wstring>(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->name)+L" "+((PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->grade!=0)?std::wstring(1,PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->grade):L""));
|
|
||||||
}
|
|
||||||
if (label.find(L"$ITEM")!=std::string::npos) {
|
|
||||||
label=label.replace(label.find(L"$ITEM"),5,EQUIP_$ITEM_DISPLAY);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
std::wstring baseStr = BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->attackMsg;
|
|
||||||
label=baseStr;
|
|
||||||
if (label.find(L"$USER")!=std::string::npos) {
|
|
||||||
label=label.replace(label.find(L"$USER"),5,transform_to<std::wstring>(BATTLE_ENCOUNTER->objs[CURRENT_TURN]->obj->name));
|
|
||||||
}
|
|
||||||
if (label.find(L"$POWER")!=std::string::npos) {
|
|
||||||
label=label.replace(label.find(L"$POWER"),6,transform_to<std::wstring>(BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->name)+L" "+((BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->grade!=0)?std::wstring(1,BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->grade):L""));
|
|
||||||
}
|
|
||||||
if (label.find(L"$ITEM")!=std::string::npos) {
|
|
||||||
label=label.replace(label.find(L"$ITEM"),5,EQUIP_$ITEM_DISPLAY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
vd2d text={2,2};
|
vd2d text={2,2};
|
||||||
vd2d shadowOffset={1,1};
|
vd2d shadowOffset={1,1};
|
||||||
|
std::wstring label;
|
||||||
|
if (BATTLE_CURRENT_CUSTOM_MSG.s.length()>0) {
|
||||||
|
std::wstring baseStr = transform_to<std::wstring>(BATTLE_CURRENT_CUSTOM_MSG.s);
|
||||||
|
if (CURRENT_TURN<0) {
|
||||||
|
label=ParseBattleMessage(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]],baseStr);
|
||||||
|
} else {
|
||||||
|
label=ParseBattleMessage(BATTLE_ENCOUNTER->objs[CURRENT_TURN],baseStr);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (CURRENT_TURN<0) {
|
||||||
|
std::wstring baseStr = PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->attackMsg;
|
||||||
|
label=ParseBattleMessage(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]],baseStr);
|
||||||
|
} else {
|
||||||
|
std::wstring baseStr = BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->attackMsg;
|
||||||
|
label=ParseBattleMessage(BATTLE_ENCOUNTER->objs[CURRENT_TURN],baseStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
DrawFancyStringDecal(text+shadowOffset,Wrap(label,ScreenWidth()-2,false,{1,2}),BLACK,{1,2});
|
DrawFancyStringDecal(text+shadowOffset,Wrap(label,ScreenWidth()-2,false,{1,2}),BLACK,{1,2});
|
||||||
DrawFancyStringDecal(text,Wrap(label,ScreenWidth()-2,false,{1,2}),WHITE,{1,2});
|
DrawFancyStringDecal(text,Wrap(label,ScreenWidth()-2,false,{1,2}),WHITE,{1,2});
|
||||||
}
|
}
|
||||||
@ -1890,6 +1891,8 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
|
|||||||
MOVELIST[BattleMoveName::BASH_CHANGE]=new Battle::Move(MOVELIST[BattleMoveName::BASH]->name,"Regular attack.",MOVELIST[BattleMoveName::BASH]->baseDmg,MOVELIST[BattleMoveName::BASH]->randomDmg,ㅍ MOVELIST[BattleMoveName::BASH]->PPCost,MOVELIST[BattleMoveName::BASH]->range,MOVELIST[BattleMoveName::BASH]->composition,L"$USER equipped the $ITEM instead and attacks.",MOVELIST[BattleMoveName::BASH]->eff,MOVELIST[BattleMoveName::BASH]->pctDamage,MOVELIST[BattleMoveName::BASH]->properties);
|
MOVELIST[BattleMoveName::BASH_CHANGE]=new Battle::Move(MOVELIST[BattleMoveName::BASH]->name,"Regular attack.",MOVELIST[BattleMoveName::BASH]->baseDmg,MOVELIST[BattleMoveName::BASH]->randomDmg,ㅍ MOVELIST[BattleMoveName::BASH]->PPCost,MOVELIST[BattleMoveName::BASH]->range,MOVELIST[BattleMoveName::BASH]->composition,L"$USER equipped the $ITEM instead and attacks.",MOVELIST[BattleMoveName::BASH]->eff,MOVELIST[BattleMoveName::BASH]->pctDamage,MOVELIST[BattleMoveName::BASH]->properties);
|
||||||
MOVELIST[BattleMoveName::DEFEND]=new Battle::Move("Defend","Defend.",0,0,ㅍ 0,1,5*60,true,{0,0,0,0});
|
MOVELIST[BattleMoveName::DEFEND]=new Battle::Move("Defend","Defend.",0,0,ㅍ 0,1,5*60,true,{0,0,0,0});
|
||||||
MOVELIST[BattleMoveName::EQUIP_ARMOR]=new Battle::Move("Equip Armor","Equip Armor.",0,0,ㅍ 0,1,0,true,{0,0,0,0},L"$USER equips the $ITEM");
|
MOVELIST[BattleMoveName::EQUIP_ARMOR]=new Battle::Move("Equip Armor","Equip Armor.",0,0,ㅍ 0,1,0,true,{0,0,0,0},L"$USER equips the $ITEM");
|
||||||
|
MOVELIST[BattleMoveName::CONSUMABLE]=new Battle::Move("Consumable","Consumes an item.",0,0,ㅍ 0,1,0,true,{0,0,0,0},L"$USER uses $ITEM on $TARGET");
|
||||||
|
MOVELIST[BattleMoveName::CONSUMABLE_ENEMY]=new Battle::Move("Consumable","Consumes an item.",0,0,ㅍ 0,1,0,false,{0,0,0,0},L"$USER uses $ITEM on $TARGET");
|
||||||
MOVELIST[BattleMoveName::HAILSTORM_A]=new Battle::Move("Hailstorm","Causes heavy ice rocks to crash",ALPHA,40,20,ㅍ 4,4,0,false,{0,0,20,0});
|
MOVELIST[BattleMoveName::HAILSTORM_A]=new Battle::Move("Hailstorm","Causes heavy ice rocks to crash",ALPHA,40,20,ㅍ 4,4,0,false,{0,0,20,0});
|
||||||
MOVELIST[BattleMoveName::HAILSTORM_B]=new Battle::Move("Hailstorm","Causes heavy ice rocks to crash",BETA,80,20,ㅍ 12,4,0,false,{0,0,20,0});
|
MOVELIST[BattleMoveName::HAILSTORM_B]=new Battle::Move("Hailstorm","Causes heavy ice rocks to crash",BETA,80,20,ㅍ 12,4,0,false,{0,0,20,0});
|
||||||
MOVELIST[BattleMoveName::HAILSTORM_G]=new Battle::Move("Hailstorm","Causes heavy ice rocks to crash",GAMMA,120,20,ㅍ 28,4,0,false,{0,0,20,0});
|
MOVELIST[BattleMoveName::HAILSTORM_G]=new Battle::Move("Hailstorm","Causes heavy ice rocks to crash",GAMMA,120,20,ㅍ 28,4,0,false,{0,0,20,0});
|
||||||
@ -1925,9 +1928,11 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SetupItemList() { //hpRecovery,ppRecovery,attack,dmgReduction,equip,important,consumable
|
void SetupItemList() { //hpRecovery,ppRecovery,attack,dmgReduction,equip,important,consumable
|
||||||
ITEMLIST[ItemName::COOKIE]=new Item("Cookie","A delightful little treat. Restores 40 HP.",{hpRecovery:40,consumable:true});
|
ITEMLIST[ItemName::COOKIE]=new Item("Cookie","A delightful little treat. Restores 40 HP.",{hpRecovery:40,consumable:Consumable::FRIENDLY});
|
||||||
ITEMLIST[ItemName::EGG]=new Item("Egg","Did it come before or after the chicken? Restores 60 HP.",{hpRecovery:60,consumable:true});
|
ITEMLIST[ItemName::EGG]=new Item("Egg","Did it come before or after the chicken? Restores 60 HP.",{hpRecovery:60,consumable:Consumable::FRIENDLY});
|
||||||
ITEMLIST[ItemName::PIZZA]=new Item("Pizza","A scrumptious meal filled with lots of cheese. Restores 200 HP.",{hpRecovery:200,consumable:true});
|
ITEMLIST[ItemName::PIZZA]=new Item("Pizza","A scrumptious meal filled with lots of cheese. Restores 200 HP.",{hpRecovery:200,consumable:Consumable::FRIENDLY});
|
||||||
|
ITEMLIST[ItemName::MIRACLE_FOOD_LUNCH]=new Item("Miracle Food Lunch","It doesn't taste very good, but it's said to have miracoulous powers when consumed.",{hpRecovery:30,ppRecovery:10,atkIncrease:30,spdIncrease:6,hpIncrease:150,learnAbility:MOVELIST[BattleMoveName::PKFIRE_O],consumable:Consumable::FRIENDLY_PERMANENT});
|
||||||
|
ITEMLIST[ItemName::BOMB]=new Item("Bomb","A small explosive device. Deals around 120 damage.",{damage:110,rollDmg:30,consumable:Consumable::FRIENDLY});
|
||||||
ITEMLIST[ItemName::CRACKED_BAT]=new Item("Cracked Bat","Has some dents in it, but you can probably still dent things with it yourself.",{attack:10,equip:EquipSlot::WEAPON});
|
ITEMLIST[ItemName::CRACKED_BAT]=new Item("Cracked Bat","Has some dents in it, but you can probably still dent things with it yourself.",{attack:10,equip:EquipSlot::WEAPON});
|
||||||
ITEMLIST[ItemName::TEE_BALL_BAT]=new Item("Tee Ball Bat","Great for playing some ball! Also great for beating your foes!",{attack:40,equip:EquipSlot::WEAPON});
|
ITEMLIST[ItemName::TEE_BALL_BAT]=new Item("Tee Ball Bat","Great for playing some ball! Also great for beating your foes!",{attack:40,equip:EquipSlot::WEAPON});
|
||||||
ITEMLIST[ItemName::LIGHT_JACKET]=new Item("Light Jacket","Fits just fine.",{defense:10,equip:EquipSlot::ARMOR});
|
ITEMLIST[ItemName::LIGHT_JACKET]=new Item("Light Jacket","Fits just fine.",{defense:10,equip:EquipSlot::ARMOR});
|
||||||
@ -2729,6 +2734,9 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
|
|||||||
StartEffect(eff);
|
StartEffect(eff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (CURRENT_TURN>=120&&(CURRENT_TURN-120)%90==0) {
|
||||||
|
BATTLE_CURRENT_CUSTOM_MSG=BATTLE_CUSTOM_MSGS[(CURRENT_TURN-120)/90];
|
||||||
|
}
|
||||||
if (CURRENT_EFFECT==nullptr&&BATTLE_ANIMATION_TIMER==90||CURRENT_EFFECT!=nullptr&&BATTLE_ANIMATION_TIMER>CURRENT_EFFECT->maxLifeTime) {
|
if (CURRENT_EFFECT==nullptr&&BATTLE_ANIMATION_TIMER==90||CURRENT_EFFECT!=nullptr&&BATTLE_ANIMATION_TIMER>CURRENT_EFFECT->maxLifeTime) {
|
||||||
if (CURRENT_TURN<0) {
|
if (CURRENT_TURN<0) {
|
||||||
if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedTarget!=NO_TARGET) {
|
if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedTarget!=NO_TARGET) {
|
||||||
@ -2810,7 +2818,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (CURRENT_EFFECT==nullptr&&BATTLE_ANIMATION_TIMER>120||CURRENT_EFFECT!=nullptr&&BATTLE_ANIMATION_TIMER>CURRENT_EFFECT->maxLifeTime+30) {
|
if (CURRENT_EFFECT==nullptr&&BATTLE_ANIMATION_TIMER>120+BATTLE_CUSTOM_MESSAGE_WAIT_TIME||CURRENT_EFFECT!=nullptr&&BATTLE_ANIMATION_TIMER>CURRENT_EFFECT->maxLifeTime+30+BATTLE_CUSTOM_MESSAGE_WAIT_TIME) {
|
||||||
//Turn's done!
|
//Turn's done!
|
||||||
if (CURRENT_TURN<0) {
|
if (CURRENT_TURN<0) {
|
||||||
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove=nullptr;
|
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove=nullptr;
|
||||||
@ -2857,6 +2865,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
|
|||||||
}
|
}
|
||||||
|
|
||||||
CURRENT_TURN=-99;
|
CURRENT_TURN=-99;
|
||||||
|
BATTLE_CUSTOM_MESSAGE_WAIT_TIME=0;
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
case BattleState::SELECT_ACTION:
|
case BattleState::SELECT_ACTION:
|
||||||
@ -3221,20 +3230,34 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
|
|||||||
}
|
}
|
||||||
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->channelTimeRemaining=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->channelTime;
|
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->channelTimeRemaining=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->channelTime;
|
||||||
|
|
||||||
|
int prevPartyInvenSize=PARTY_INVENTORY.size();
|
||||||
if (ITEM_REQUIRES_EQUIPPING) {
|
if (ITEM_REQUIRES_EQUIPPING) {
|
||||||
Item*SelectedItem=PARTY_INVENTORY[ITEM_SELECTION_CURSOR];
|
Item*SelectedItem=PARTY_INVENTORY[ITEM_SELECTION_CURSOR];
|
||||||
if (SelectedItem->stats.equip==EquipSlot::WEAPON&&PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->equipment[SelectedItem->stats.equip]!=nullptr) { //Only swap back to the previous equip when there was nothing equipped to begin with.
|
if (SelectedItem->stats.equip==EquipSlot::WEAPON&&PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->equipment[SelectedItem->stats.equip]!=nullptr) { //Only swap back to the previous equip when there was nothing equipped to begin with.
|
||||||
previousEquip[-CURRENT_TURN-1]=ITEM_SELECTION_CURSOR;
|
previousEquip[-CURRENT_TURN-1]=ITEM_SELECTION_CURSOR;
|
||||||
}
|
}
|
||||||
int prevPartyInvenSize=PARTY_INVENTORY.size();
|
|
||||||
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->EquipItem(ITEM_SELECTION_CURSOR);
|
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->EquipItem(ITEM_SELECTION_CURSOR);
|
||||||
printf("Equipped item: %s\n",PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->equipment[SelectedItem->stats.equip]->name.c_str());
|
printf("Equipped item: %s\n",PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->equipment[SelectedItem->stats.equip]->name.c_str());
|
||||||
ITEM_REQUIRES_EQUIPPING=false;
|
ITEM_REQUIRES_EQUIPPING=false;
|
||||||
if (ITEM_SELECTION_CURSOR>=PARTY_INVENTORY.size()&&prevPartyInvenSize&1&&PARTY_INVENTORY.size()==prevPartyInvenSize-1) {
|
|
||||||
ITEM_SELECTION_OFFSET-=2;
|
|
||||||
}
|
|
||||||
ITEM_SELECTION_CURSOR=std::clamp(ITEM_SELECTION_CURSOR,0,(int)PARTY_INVENTORY.size()-1);
|
|
||||||
}
|
}
|
||||||
|
if ((PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove==MOVELIST[BattleMoveName::CONSUMABLE]||
|
||||||
|
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove==MOVELIST[BattleMoveName::CONSUMABLE_ENEMY])&&
|
||||||
|
(PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->stats.consumable==Consumable::FRIENDLY||PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->stats.consumable==Consumable::ENEMY)) {
|
||||||
|
if (PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->stats.consumable==Consumable::FRIENDLY) {
|
||||||
|
MOVELIST[BattleMoveName::CONSUMABLE]->baseDmg=PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->stats.hpRecovery;
|
||||||
|
MOVELIST[BattleMoveName::CONSUMABLE]->randomDmg=0;
|
||||||
|
BATTLE_CUSTOM_MESSAGE_WAIT_TIME=PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->messages.size();
|
||||||
|
BATTLE_CUSTOM_MSGS=PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->messages;
|
||||||
|
} else {
|
||||||
|
MOVELIST[BattleMoveName::CONSUMABLE_ENEMY]->baseDmg=PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->stats.damage;
|
||||||
|
MOVELIST[BattleMoveName::CONSUMABLE_ENEMY]->randomDmg=PARTY_INVENTORY[ITEM_SELECTION_CURSOR]->stats.rollDmg;
|
||||||
|
}
|
||||||
|
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->RemoveItem(ITEM_SELECTION_CURSOR);
|
||||||
|
}
|
||||||
|
if (ITEM_SELECTION_CURSOR>=PARTY_INVENTORY.size()&&prevPartyInvenSize&1&&PARTY_INVENTORY.size()==prevPartyInvenSize-1) {
|
||||||
|
ITEM_SELECTION_OFFSET-=2;
|
||||||
|
}
|
||||||
|
ITEM_SELECTION_CURSOR=std::clamp(ITEM_SELECTION_CURSOR,0,(int)PARTY_INVENTORY.size()-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CalculateDamage(Entity*attacker,Entity*defender) {
|
int CalculateDamage(Entity*attacker,Entity*defender) {
|
||||||
@ -3416,6 +3439,32 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string GetTargetName(int target) {
|
||||||
|
if (target<0) {
|
||||||
|
return PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-target-1]]->obj->name;
|
||||||
|
} else {
|
||||||
|
return BATTLE_ENCOUNTER->objs[target]->obj->name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring ParseBattleMessage(Entity*ent,std::wstring baseStr) {
|
||||||
|
std::wstring label=L"";
|
||||||
|
label=baseStr;
|
||||||
|
if (label.find(L"$USER")!=std::string::npos) {
|
||||||
|
label=label.replace(label.find(L"$USER"),5,transform_to<std::wstring>(ent->obj->name));
|
||||||
|
}
|
||||||
|
if (label.find(L"$POWER")!=std::string::npos) {
|
||||||
|
label=label.replace(label.find(L"$POWER"),6,transform_to<std::wstring>(ent->selectedMove->name)+L" "+((ent->selectedMove->grade!=0)?std::wstring(1,ent->selectedMove->grade):L""));
|
||||||
|
}
|
||||||
|
if (label.find(L"$ITEM")!=std::string::npos) {
|
||||||
|
label=label.replace(label.find(L"$ITEM"),5,EQUIP_$ITEM_DISPLAY);
|
||||||
|
}
|
||||||
|
if (label.find(L"$TARGET")!=std::string::npos) {
|
||||||
|
label=label.replace(label.find(L"$TARGET"),7,transform_to<std::wstring>(GetTargetName(ent->selectedTarget)));
|
||||||
|
}
|
||||||
|
return label;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user