osb/source/game/items/StarArmors.hpp

135 lines
3.5 KiB
C++
Raw Normal View History

2023-06-20 04:33:09 +00:00
#ifndef STAR_ARMORS_HPP
#define STAR_ARMORS_HPP
#include "StarGameTypes.hpp"
#include "StarItem.hpp"
#include "StarStatusEffectItem.hpp"
#include "StarEffectSourceItem.hpp"
#include "StarPreviewableItem.hpp"
#include "StarSwingableItem.hpp"
2023-06-20 04:33:09 +00:00
namespace Star {
STAR_CLASS(ArmorItem);
STAR_CLASS(HeadArmor);
STAR_CLASS(ChestArmor);
STAR_CLASS(LegsArmor);
STAR_CLASS(BackArmor);
class ArmorItem : public Item, public EffectSourceItem, public SwingableItem {
2023-06-20 04:33:09 +00:00
public:
ArmorItem(Json const& config, String const& directory, Json const& data);
virtual ~ArmorItem() {}
virtual List<PersistentStatusEffect> statusEffects() const override;
virtual StringSet effectSources() const override;
virtual List<Drawable> drawables() const override;
virtual float getAngle(float aimAngle) override;
virtual void fire(FireMode mode, bool shifting, bool edgeTriggered) override;
virtual void fireTriggered() override;
2023-06-20 04:33:09 +00:00
List<String> const& colorOptions();
2023-06-24 12:49:47 +00:00
Directives const& directives() const;
2023-06-20 04:33:09 +00:00
bool hideBody() const;
Maybe<String> const& techModule() const;
private:
void refreshIconDrawables();
void refreshStatusEffects();
List<String> m_colorOptions;
List<PersistentStatusEffect> m_statusEffects;
StringSet m_effectSources;
2023-06-24 12:49:47 +00:00
Directives m_directives;
2023-06-20 04:33:09 +00:00
bool m_hideBody;
Maybe<String> m_techModule;
};
class HeadArmor : public ArmorItem, public PreviewableItem {
public:
HeadArmor(Json const& config, String const& directory, Json const& data);
virtual ~HeadArmor() {}
virtual ItemPtr clone() const;
String const& frameset(Gender gender) const;
2023-06-24 12:49:47 +00:00
Directives const& maskDirectives() const;
2023-06-20 04:33:09 +00:00
virtual List<Drawable> preview(PlayerPtr const& viewer = {}) const;
private:
String m_maleImage;
String m_femaleImage;
2023-06-24 12:49:47 +00:00
Directives m_maskDirectives;
2023-06-20 04:33:09 +00:00
};
class ChestArmor : public ArmorItem, public PreviewableItem {
public:
ChestArmor(Json const& config, String const& directory, Json const& data);
virtual ~ChestArmor() {}
virtual ItemPtr clone() const;
// Will have :run, :normal, :duck, and :portrait
String const& bodyFrameset(Gender gender) const;
// Will have :idle[1-5], :duck, :rotation, :walk[1-5], :run[1-5], :jump[1-4],
// :fall[1-4]
String const& frontSleeveFrameset(Gender gender) const;
// Same as FSleeve
String const& backSleeveFrameset(Gender gender) const;
virtual List<Drawable> preview(PlayerPtr const& viewer = {}) const;
private:
String m_maleBodyImage;
String m_maleFrontSleeveImage;
String m_maleBackSleeveImage;
String m_femaleBodyImage;
String m_femaleFrontSleeveImage;
String m_femaleBackSleeveImage;
};
class LegsArmor : public ArmorItem, public PreviewableItem {
public:
LegsArmor(Json const& config, String const& directory, Json const& data);
virtual ~LegsArmor() {}
virtual ItemPtr clone() const;
// Will have :idle, :duck, :walk[1-8], :run[1-8], :jump[1-4], :fall[1-4]
String const& frameset(Gender gender) const;
virtual List<Drawable> preview(PlayerPtr const& viewer = {}) const;
private:
String m_maleImage;
String m_femaleImage;
};
class BackArmor : public ArmorItem, public PreviewableItem {
public:
BackArmor(Json const& config, String const& directory, Json const& data);
virtual ~BackArmor() {}
virtual ItemPtr clone() const;
// Will have :idle, :duck, :walk[1-8], :run[1-8], :jump[1-4], :fall[1-4]
String const& frameset(Gender gender) const;
virtual List<Drawable> preview(PlayerPtr const& viewer = {}) const;
private:
String m_maleImage;
String m_femaleImage;
};
}
#endif