2019-06-02 02:30:54 +10:00
|
|
|
#include <cassert>
|
2019-05-30 15:35:05 +10:00
|
|
|
#include "ActionLut.h"
|
|
|
|
|
|
|
|
using namespace Sapphire::World::Action;
|
|
|
|
|
2019-06-02 00:34:07 +10:00
|
|
|
bool ActionLut::validEntryExists( uint16_t actionId )
|
2019-05-30 15:35:05 +10:00
|
|
|
{
|
2019-06-02 00:34:07 +10:00
|
|
|
auto it = m_actionLut.find( actionId );
|
2019-05-30 15:35:05 +10:00
|
|
|
|
2019-06-02 00:34:07 +10:00
|
|
|
if( it == m_actionLut.end() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
const auto& entry = it->second;
|
|
|
|
|
2020-01-10 21:24:35 +09:00
|
|
|
// if all of these fields are 0, it's not 'valid' due to parse error or no useful data
|
|
|
|
return entry.damagePotency != 0 || entry.healPotency != 0 || entry.selfHealPotency != 0 || entry.selfStatus != 0 ||
|
|
|
|
entry.targetStatus != 0 || entry.gainMPPercentage != 0;
|
2019-06-02 02:30:54 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
const ActionEntry& ActionLut::getEntry( uint16_t actionId )
|
|
|
|
{
|
|
|
|
auto it = m_actionLut.find( actionId );
|
|
|
|
|
|
|
|
assert( it != m_actionLut.end() );
|
|
|
|
|
2020-01-10 21:24:35 +09:00
|
|
|
return it->second;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ActionLut::validStatusEffectExists( uint16_t statusId )
|
|
|
|
{
|
|
|
|
auto it = m_statusEffectTable.find( statusId );
|
|
|
|
|
|
|
|
if( it == m_statusEffectTable.end() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
const auto& entry = it->second;
|
|
|
|
|
|
|
|
return entry.effectType != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
const StatusEffectEntry& ActionLut::getStatusEffectEntry( uint16_t statusId )
|
|
|
|
{
|
|
|
|
auto it = m_statusEffectTable.find( statusId );
|
|
|
|
|
|
|
|
assert( it != m_statusEffectTable.end() );
|
|
|
|
|
2019-06-02 02:30:54 +10:00
|
|
|
return it->second;
|
2019-06-02 00:34:07 +10:00
|
|
|
}
|