57 lines
1.1 KiB
C++
57 lines
1.1 KiB
C++
#include "precompile.h"
|
|
|
|
#include "weapon.h"
|
|
#include "creature.h"
|
|
#include "battledatacontext.h"
|
|
#include "pbutils.h"
|
|
|
|
#include "mt/Equip.h"
|
|
|
|
void Weapon::Clear()
|
|
{
|
|
weapon_uniid = 0;
|
|
weapon_id = 0;
|
|
ammo = 0;
|
|
meta = nullptr;
|
|
bullet_meta = nullptr;
|
|
skill_meta = nullptr;
|
|
grasp_buff_list.clear();
|
|
}
|
|
|
|
void Weapon::Recalc()
|
|
{
|
|
bullet_meta = mt::Equip::GetById(meta->use_bullet());
|
|
}
|
|
|
|
int Weapon::GetClipVolume(Creature* c)
|
|
{
|
|
if (c->GetBattleContext()) {
|
|
return c->GetBattleContext()->GetClipVolume(c, this);
|
|
} else {
|
|
return meta ? meta->clip_volume() :0;
|
|
}
|
|
}
|
|
|
|
int Weapon::GetFireRate(Creature* c)
|
|
{
|
|
if (c->GetBattleContext()) {
|
|
return c->GetBattleContext()->GetFireRate(c, this);
|
|
} else {
|
|
return meta ? meta->fire_rate() :0;
|
|
}
|
|
}
|
|
|
|
int Weapon::GetReloadTime(Creature* c)
|
|
{
|
|
if (c->GetBattleContext()) {
|
|
return c->GetBattleContext()->GetReloadTime(c, this);
|
|
} else {
|
|
return meta ? meta->reload_time() :0;
|
|
}
|
|
}
|
|
|
|
void Weapon::CalcGraspBuffList(Creature* c)
|
|
{
|
|
grasp_buff_list.clear();
|
|
}
|