generated from sigonasr2/CPlusPlusProjectTemplate
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
3.1 KiB
96 lines
3.1 KiB
#ifndef ITEM_H
|
|
#define ITEM_H
|
|
#include "pixelGameEngine.h"
|
|
using namespace olc;
|
|
#include "battle.h"
|
|
#include "defines.h"
|
|
|
|
enum class ItemName{
|
|
COOKIE,
|
|
EGG,
|
|
PIZZA,
|
|
MIRACLE_FOOD_LUNCH,
|
|
CRACKED_BAT,
|
|
TEE_BALL_BAT,
|
|
LIGHT_JACKET,
|
|
HEAVY_JACKET,
|
|
COPPER_BRACELET,
|
|
KEY_TO_THE_PALACE,
|
|
BOMB,
|
|
FREEZE_PACKET,
|
|
SOME_STUPIDLY_LONG_FEATHER,
|
|
};
|
|
|
|
namespace EquipSlot{
|
|
enum Equip{
|
|
WEAPON,
|
|
ARMOR,
|
|
ACCESSORY,
|
|
NONE
|
|
};
|
|
}
|
|
|
|
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,
|
|
PPINCREASE,
|
|
SPDINCREASE,
|
|
LEARNMOVE,
|
|
};
|
|
|
|
struct ItemStatsStruct{
|
|
int hpRecovery=0;
|
|
int ppRecovery=0;
|
|
int atkIncrease=0;
|
|
int spdIncrease=0;
|
|
int hpIncrease=0;
|
|
int ppIncrease=0;
|
|
Battle::Move*learnAbility=nullptr;
|
|
int damage=0;
|
|
int rollDmg=0;
|
|
int attack=0;
|
|
int defense=0;
|
|
EquipSlot::Equip equip=EquipSlot::NONE; //Whether or not this is equipment.
|
|
bool important=false; //If an item's important it can't be discarded.
|
|
int consumable=Consumable::NOT_A_CONSUMABLE; //Whether or not this item is consumed when used.
|
|
int sellPrice=0;
|
|
};
|
|
|
|
struct CustomItemMessage{
|
|
std::string s="";
|
|
ItemAction a=ItemAction::HPRECOVERY;
|
|
};
|
|
|
|
class Item{
|
|
public:
|
|
ItemName id;
|
|
std::string name;
|
|
std::string description;
|
|
Battle::Move*battlemove=nullptr;
|
|
ItemStatsStruct stats;
|
|
int dropChance=8; //1 out of dropChance change of item dropping.
|
|
std::vector<CustomItemMessage> messages;
|
|
Item(ItemName id,std::string name,std::string desc,int dropChance=8,ItemStatsStruct stats={hpRecovery:0,ppRecovery:0,atkIncrease:0,spdIncrease:0,hpIncrease:0,ppIncrease: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)
|
|
:id(id),name(name),description(desc),stats(stats),dropChance(dropChance),battlemove(battlemove){
|
|
if (stats.hpRecovery) {messages.push_back({"$TARGET recovers "+std::to_string(stats.hpRecovery)+" HP.",ItemAction::HPRECOVERY});}
|
|
if (stats.ppRecovery) {messages.push_back({"$TARGET recovers "+std::to_string(stats.ppRecovery)+" PP.",ItemAction::PPRECOVERY});}
|
|
if (stats.atkIncrease) {messages.push_back({"$TARGET gains "+std::to_string(stats.atkIncrease)+" ATK point"+(stats.atkIncrease==1?"":"s")+".",ItemAction::ATKINCREASE});}
|
|
if (stats.hpIncrease) {messages.push_back({"$TARGET gains "+std::to_string(stats.hpIncrease)+" HP point"+(stats.hpIncrease==1?"":"s")+".",ItemAction::HPINCREASE});}
|
|
if (stats.ppIncrease) {messages.push_back({"$TARGET gains "+std::to_string(stats.ppIncrease)+" PP point"+(stats.ppIncrease==1?"":"s")+".",ItemAction::PPINCREASE});}
|
|
if (stats.spdIncrease) {messages.push_back({"$TARGET gains "+std::to_string(stats.spdIncrease)+" SPD point"+(stats.spdIncrease==1?"":"s")+".",ItemAction::SPDINCREASE});}
|
|
if (stats.learnAbility!=nullptr) {messages.push_back({"$TARGET gains the ability to use "+stats.learnAbility->name+" "+((stats.learnAbility->grade!=0)?std::string(1,stats.learnAbility->grade):"")+"!",ItemAction::LEARNMOVE});}
|
|
}
|
|
};
|
|
#endif |