本文整理汇总了C++中SpellItem类的典型用法代码示例。如果您正苦于以下问题:C++ SpellItem类的具体用法?C++ SpellItem怎么用?C++ SpellItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SpellItem类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: killSpawn
void SpellShell::killSpawn(const Item* deceased)
{
uint16_t id = deceased->id();
SpellItem* spell;
if (m_lastPlayerSpell && (m_lastPlayerSpell->targetId() == id))
m_lastPlayerSpell = 0;
QValueList<SpellItem*>::Iterator it = m_spellList.begin();
while(it != m_spellList.end())
{
spell = *it;
if (spell->targetId() == id)
{
it = m_spellList.remove(it);
emit delSpell(spell);
delete spell;
}
else
++it;
}
if (m_spellList.count() == 0)
m_timer->stop();
}
示例2: while
void SpellShell::timeout()
{
SpellItem* spell;
QValueList<SpellItem*>::Iterator it = m_spellList.begin();
while (it != m_spellList.end())
{
spell = *it;
int d = spell->duration() -
pSEQPrefs->getPrefInt("SpellTimer", "SpellList", 6);
if (d > -6)
{
spell->setDuration(d);
emit changeSpell(spell);
it++;
}
else
{
seqInfo("SpellItem '%s' finished.", (*it)->spellName().latin1());
if (m_lastPlayerSpell == spell)
m_lastPlayerSpell = 0;
emit delSpell(spell);
it = m_spellList.remove(it);
delete spell;
}
}
if (m_spellList.count() == 0)
m_timer->stop();
}
示例3: FindSpell
SpellItem* SpellShell::FindSpell(int spell_id, int target_id)
{
bool target = true;
const Spell* spell = m_spells->spell(spell_id);
if (spell)
target = (spell->targetType() != 6);
for(QValueList<SpellItem*>::Iterator it = m_spellList.begin();
it != m_spellList.end(); it++) {
SpellItem *i = *it;
//loop to trap a spell being added that is already cast on self.
if (i->spellId() == spell_id)
{
// if it's a targeted spell, check target, else just return the item
if (target)
{
// if the target id is non-zero, then check it, otherwise return it
if (i->targetId())
{
// if target id matches then return it
if (i->targetId() == target_id)
return i;
}
else
return i; // no target id, return item
}
else
return i; // non-targeted spell, return item
}
}
return NULL;
}
示例4: seqDebug
//slot for loading buffs when main char struct is loaded
void SpellShell::buffLoad(const spellBuff* c)
{
#ifdef DIAG_SPELLSHELL
seqDebug("Loading buff - id=%d.",c->spellid);
#endif // DIAG_SPELLSHELL
const Spell* spell = m_spells->spell(c->spellid);
int duration = c->duration * 6;
SpellItem *item = findSpell(c->spellid, m_player->id(), m_player->name());
if (item)
{ // exists
item->update(c->spellid, spell, duration,
0, "Buff", m_player->id(), m_player->name());
emit changeSpell(item);
}
else
{ // new spell
item = new SpellItem();
item->update(c->spellid, spell, duration,
0, "Buff", m_player->id(), m_player->name());
m_spellList.append(item);
if ((m_spellList.count() > 0) && (!m_timer->isActive()))
m_timer->start(1000 *
pSEQPrefs->getPrefInt("SpellTimer", "SpellList", 6));
emit addSpell(item);
}
}
示例5: findSpell
void SpellShell::action(const uint8_t* data, size_t, uint8_t)
{
const actionStruct* a = (const actionStruct*)data;
if (a->type != 0xe7) // only things to do if action is a spell
return;
const Item* s;
QString targetName;
if (a->target &&
((s = m_spawnShell->findID(tSpawn, a->target))))
targetName = s->name();
SpellItem *item = findSpell(a->spell, a->target, targetName);
if (item || (a->target == m_player->id()))
{
int duration = 0;
const Spell* spell = m_spells->spell(a->spell);
if (spell)
duration = spell->calcDuration(a->level) * 6;
QString casterName;
if (a->source &&
((s = m_spawnShell->findID(tSpawn, a->source))))
casterName = s->name();
if (item)
{
#ifdef DIAG_SPELLSHELL
seqDebug("action - found - source=%d (lvl: %d) cast id=%d on target=%d causing %d damage",
a->source, a->level, a->spell, a->target, a->damage);
#endif // DIAG_SPELLSHELL
item->update(a->spell, spell, duration,
a->source, casterName, a->target, targetName);
emit changeSpell(item);
}
else
{
// otherwise check for spells cast on us
#ifdef DIAG_SPELLSHELL
seqDebug("action - new - source=%d (lvl: %d) cast id=%d on target=%d causing %d damage",
a->source, a->level, a->spell, a->target, a->damage);
#endif // DIAG_SPELLSHELL
// only way to get here is if there wasn't an existing spell, so...
item = new SpellItem();
item->update(a->spell, spell, duration,
a->source, casterName, a->target, targetName);
m_spellList.append(item);
if ((m_spellList.count() > 0) && (!m_timer->isActive()))
m_timer->start(1000 *
pSEQPrefs->getPrefInt("SpellTimer", "SpellList", 6));
emit addSpell(item);
}
}
}
示例6: FindSpell
void SpellShell::UpdateSpell(const castStruct *c)
{
if (c) {
SpellItem *item = FindSpell(c->spellId, m_player->getPlayerID(),
c->targetId);
item->UpdateSpell(m_spawnShell, m_player->getPlayerID(), c);
emit changeSpell(item);
}
}
示例7: Initialize
void CSEHallOfFameSpellItem::Initialize( UInt32 FormID )
{
void* Throwaway = NULL;
SpellItem* Spell = SpellItem::InitializeDefaultPlayerSpell(Throwaway);
Spell->name.Set(Title);
Spell->SetFormID(FormID);
Spell->SetEditorID(Name);
Spell->SetFromActiveFile(false);
_DATAHANDLER->spellItems.AddAt(Spell, eListEnd);
}
示例8: zoneChanged
void SpellShell::zoneChanged(void)
{
m_lastPlayerSpell = 0;
SpellItem* spell;
for(QValueList<SpellItem*>::Iterator it = m_spellList.begin();
it != m_spellList.end(); it++)
{
spell = *it;
// clear all the invalidated spawn ids
spell->setTargetId(0);
spell->setCasterId(0);
}
}
示例9: clear
void SpellShell::killSpawn(const Item* deceased)
{
uint16_t id = deceased->id();
if (id == m_player->id())
{
// We're dead. No more buffs for us.
clear();
}
else
{
SpellItem* spell;
if (m_lastPlayerSpell && (m_lastPlayerSpell->targetId() == id))
{
m_lastPlayerSpell = 0;
}
QValueList<SpellItem*>::Iterator it = m_spellList.begin();
while(it != m_spellList.end())
{
spell = *it;
if (spell->targetId() == id)
{
it = m_spellList.remove(it);
emit delSpell(spell);
delete spell;
}
else
{
++it;
}
}
if (m_spellList.count() == 0)
{
m_timer->stop();
}
}
}
示例10: Q_ASSERT
void SpellItem::drawSpell()
{
Q_ASSERT(spell_ != NULL);
// Setting brush
this->setPen(this->getDefaultPen());
this->setBrush(QBrush(colorBackground()));
float innerRadius = 0.0f;
float outerRadius = 0.0f;
// Center part
if (spell_->isCenterSpell())
{
innerSpell_ = new SpellItem(spell_->getCenterSpell(), this, runeImages_, runeEngine_);
innerSpell_->drawSpell();
innerRadius = innerSpell_->getTotalRadius();
// Positioning outer circle
this->setRect(-outerRadius, -outerRadius, outerRadius * 2, outerRadius * 2);
}
else
{
innerRune_ = new RuneItem(spell_, this, runeImages_, runeEngine_);
innerRune_->drawSpell();
connect(innerRune_, SIGNAL(requestRedraw()),
this, SLOT(redraw()));
innerRadius = this->getInnerRadius();
}
// Creating and positioning components and their paths
if (!spell_->getComponents().empty())
{
// Creating
vector<Spell*> spellComponents = spell_->getComponents();
for (Spell* comp : spellComponents)
{
SpellItem* ri = new SpellItem(comp, this, runeImages_, runeEngine_);
ri->drawSpell();
this->components_.push_back(ri);
}
// Positioning components
float componentRadius = this->getBiggestComponentRadius();
componentRadius += innerRadius + _GRAPHICS_SPELLITEM_DISTANCE;
int i = 0;
for (SpellItem* ri : components_)
{
QPointF pos = getPositionOnSpell(i, this->components_.size(), componentRadius, this->pos());
ri->setPos(pos);
this->positionPath(ri, innerRadius);
++i;
}
outerRadius = this->getTotalRadius();
this->setRect(-outerRadius, -outerRadius, outerRadius * 2, outerRadius * 2);
}
else
outerRadius = innerRadius;
// Creating and positioning children and their paths
if (!spell_->getChildren().empty())
{
// Creating
vector<Spell*> spellChildren = spell_->getChildren();
for (Spell* child : spellChildren)
{
// Components
SpellItem* ri = new SpellItem(child, this, runeImages_, runeEngine_);
ri->drawSpell();
this->children_.push_back(ri);
}
// Positioning
float biggestChildRadius = this->getBiggestChildrenRadius();
biggestChildRadius += outerRadius + _GRAPHICS_SPELLITEM_DISTANCE;
int i = 0;
for (SpellItem* ri : children_)
{
QPointF pos = getModifierPositionOnSpell(i,
children_.size(),
biggestChildRadius,
this->pos());
ri->setPos(pos);
this->positionPath(ri, outerRadius);
++i;
}
}
// Creating and positioning modifiers
if (!spell_->getModifiers().empty())
{
// Creating
vector<Spell*> spellModifiers = spell_->getModifiers();
for (Spell* mod : spellModifiers)
{
// Components
SpellItem* ri = new SpellItem(mod, this, runeImages_, runeEngine_);
//.........这里部分代码省略.........