Peoplemon  0.1.0
Peoplemon 3 game source documentation
Static Public Member Functions | List of all members
core::item::Item Struct Reference

Collection of static methods centered around items. More...

#include <Item.hpp>

Static Public Member Functions

static Id cast (unsigned int id)
 Helper function to cast a raw id to an item Id. More...
 
static void setDataSource (file::ItemDB &source)
 Set the data source for the item methods. More...
 
static Category getCategory (Id item)
 Returns the category of the given item. More...
 
static Type getType (Id item)
 Returns the type of the given item. More...
 
static const std::string & getName (item::Id item)
 Returns the name of the given item. More...
 
static const std::string & getDescription (item::Id item)
 Returns the description of the given item. More...
 
static int getValue (item::Id item)
 Returns the value of the given item. More...
 
static const std::vector< Id > & validIds ()
 Returns the list of valid item ids. More...
 
static bool canUseInBattle (Id item)
 Returns whether or not the item can be used in battle. More...
 
static bool hasEffectOnPeoplemon (Id item, const pplmn::OwnedPeoplemon &ppl)
 Returns whether or not the given item will affect the peoplemon. More...
 
static bool hasEffectOnPeoplemon (Id item, const pplmn::BattlePeoplemon &ppl, const battle::Battler &battler)
 Returns whether or not the given item will affect the peoplemon in battle. More...
 
static void useOnPeoplemon (Id item, pplmn::OwnedPeoplemon &ppl, std::vector< pplmn::OwnedPeoplemon > *team=nullptr, std::vector< pplmn::BattlePeoplemon > *battleTeam=nullptr)
 Applies the given item to the peoplemon. More...
 
static void useOnPeoplemon (Id item, pplmn::BattlePeoplemon &ppl, battle::Battler &battler)
 Applies the given item to the peoplemon. More...
 
static std::string getUseLine (Id item, const pplmn::OwnedPeoplemon &ppl)
 Returns the text to display when the item is used on the given peoplemon. More...
 
static bool hasEffectOnPlayer (Id item, const player::State &state)
 Returns whether or not the given item will affect the player. More...
 
static void useOnPlayer (Id item, player::State &state)
 Uses the given item on the player. More...
 
static std::string getUseLine (Id item)
 Generates the text to print when the item is used on the player. More...
 
static pplmn::MoveId getTmMove (Id tm)
 Returns the move taught by the TM. More...
 
static float getPeopleballRate (Id ball, pplmn::Id ppl, int turnNumber, float levelRatio)
 Returns the catch rate for the given peopleball. More...
 

Detailed Description

Collection of static methods centered around items.

Definition at line 25 of file Item.hpp.

Member Function Documentation

◆ canUseInBattle()

bool core::item::Item::canUseInBattle ( Id  item)
static

Returns whether or not the item can be used in battle.

Parameters
itemThe item to test
Returns
True if can be used, false if not

Definition at line 133 of file Item.cpp.

◆ cast()

Id core::item::Item::cast ( unsigned int  id)
static

Helper function to cast a raw id to an item Id.

Parameters
idThe raw item id
Returns
Id The resulting id, or Unknown if unrecognized

Definition at line 31 of file Item.cpp.

◆ getCategory()

Category core::item::Item::getCategory ( Id  item)
static

Returns the category of the given item.

Parameters
itemThe item to get the category of
Returns
Category The category of the given item

Definition at line 49 of file Item.cpp.

◆ getDescription()

const std::string & core::item::Item::getDescription ( item::Id  item)
static

Returns the description of the given item.

Parameters
itemThe item to get the description for
Returns
const std::string& The description of the item

Definition at line 105 of file Item.cpp.

◆ getName()

const std::string & core::item::Item::getName ( item::Id  item)
static

Returns the name of the given item.

Parameters
itemThe item to get the name for
Returns
const std::string& The name of the item

Definition at line 91 of file Item.cpp.

◆ getPeopleballRate()

float core::item::Item::getPeopleballRate ( Id  ball,
pplmn::Id  ppl,
int  turnNumber,
float  levelRatio 
)
static

Returns the catch rate for the given peopleball.

Parameters
ballThe peopleball to get the rate for
pplThe peoplemon the ball is being used on
turnNumberThe current turn of the battle
levelRatioResult of throwerLevel / wildLevel
Returns
float The catch rate, or 1 if not a peopleball

Definition at line 426 of file Item.cpp.

◆ getTmMove()

pplmn::MoveId core::item::Item::getTmMove ( Id  tm)
static

Returns the move taught by the TM.

Parameters
tmThe TM to get the move for
Returns
pplmn::MoveId The move to teach, or Unknown

Definition at line 418 of file Item.cpp.

◆ getType()

Type core::item::Item::getType ( Id  item)
static

Returns the type of the given item.

Parameters
itemThe item to get the type of
Returns
Type The type of the given item

Definition at line 76 of file Item.cpp.

◆ getUseLine() [1/2]

std::string core::item::Item::getUseLine ( Id  item)
static

Generates the text to print when the item is used on the player.

Parameters
itemThe item being used
Returns
std::string The text to display

Definition at line 407 of file Item.cpp.

◆ getUseLine() [2/2]

std::string core::item::Item::getUseLine ( Id  item,
const pplmn::OwnedPeoplemon ppl 
)
static

Returns the text to display when the item is used on the given peoplemon.

Parameters
itemThe item that was used
pplThe peoplemon that it was used on
Returns
std::string The text to display

Definition at line 327 of file Item.cpp.

◆ getValue()

int core::item::Item::getValue ( item::Id  item)
static

Returns the value of the given item.

Parameters
itemThe item to get the value for
Returns
int The value of the item

Definition at line 119 of file Item.cpp.

◆ hasEffectOnPeoplemon() [1/2]

bool core::item::Item::hasEffectOnPeoplemon ( Id  item,
const pplmn::BattlePeoplemon ppl,
const battle::Battler battler 
)
static

Returns whether or not the given item will affect the peoplemon in battle.

Parameters
itemThe item to use
pplThe peoplemon to check
battlerThe battler using the item
Returns
True if the item can be used, false if not

Definition at line 210 of file Item.cpp.

◆ hasEffectOnPeoplemon() [2/2]

bool core::item::Item::hasEffectOnPeoplemon ( Id  item,
const pplmn::OwnedPeoplemon ppl 
)
static

Returns whether or not the given item will affect the peoplemon.

Parameters
itemThe item to use
pplThe peoplemon to check
Returns
True if the item can be used, false if not

Definition at line 144 of file Item.cpp.

◆ hasEffectOnPlayer()

bool core::item::Item::hasEffectOnPlayer ( Id  item,
const player::State state 
)
static

Returns whether or not the given item will affect the player.

Parameters
itemThe item to use
stateThe player's state
Returns
True if the item may be used, false if not

Definition at line 380 of file Item.cpp.

◆ setDataSource()

void core::item::Item::setDataSource ( file::ItemDB source)
static

Set the data source for the item methods.

Parameters
sourceThe data source. Must remain in scope

Definition at line 41 of file Item.cpp.

◆ useOnPeoplemon() [1/2]

void core::item::Item::useOnPeoplemon ( Id  item,
pplmn::BattlePeoplemon ppl,
battle::Battler battler 
)
static

Applies the given item to the peoplemon.

Parameters
itemThe itemto use
pplThe peoplemon to use it on
battlerThe battler using the item

Definition at line 313 of file Item.cpp.

◆ useOnPeoplemon() [2/2]

void core::item::Item::useOnPeoplemon ( Id  item,
pplmn::OwnedPeoplemon ppl,
std::vector< pplmn::OwnedPeoplemon > *  team = nullptr,
std::vector< pplmn::BattlePeoplemon > *  battleTeam = nullptr 
)
static

Applies the given item to the peoplemon.

Parameters
itemThe itemto use
pplThe peoplemon to use it on
teamThe peoplemon's team. Optional
battleTeamThe peoplemon's team when in battle. Optional

Definition at line 222 of file Item.cpp.

◆ useOnPlayer()

void core::item::Item::useOnPlayer ( Id  item,
player::State state 
)
static

Uses the given item on the player.

Parameters
itemThe item to use
stateThe player's state

Definition at line 391 of file Item.cpp.

◆ validIds()

const std::vector< Id > & core::item::Item::validIds ( )
static

Returns the list of valid item ids.

Definition at line 125 of file Item.cpp.


The documentation for this struct was generated from the following files: