当前位置: 首页>>代码示例>>C++>>正文


C++ Damage类代码示例

本文整理汇总了C++中Damage的典型用法代码示例。如果您正苦于以下问题:C++ Damage类的具体用法?C++ Damage怎么用?C++ Damage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Damage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: end

void TableShape::handleDamages(const QList<Damage*>& damages)
{
    QList<Damage*>::ConstIterator end(damages.end());
    for (QList<Damage*>::ConstIterator it = damages.begin(); it != end; ++it) {
        Damage* damage = *it;
        if (!damage) continue;

        if (damage->type() == Damage::Cell) {
            CellDamage* cellDamage = static_cast<CellDamage*>(damage);
            const Region region = cellDamage->region();

            if (cellDamage->changes() & CellDamage::Appearance)
                d->sheetView->invalidateRegion(region);
            continue;
        }

        if (damage->type() == Damage::Sheet) {
            SheetDamage* sheetDamage = static_cast<SheetDamage*>(damage);

            if (sheetDamage->changes() & SheetDamage::PropertiesChanged)
                d->sheetView->invalidate();
            continue;
        }
    }

    update();
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:27,代码来源:TableShape.cpp

示例2: looseLiveFromDamage

void Attributs::looseLiveFromDamage(const Damage &damage)
{
    for(int i=0 ; i<damage.getMaxIndex() ; i++)
    {
        live -= damage.getValue(i).getValue();
    }
}
开发者ID:anliec,项目名称:Mosp,代码行数:7,代码来源:Attributs.cpp

示例3: GameObserver

/* Damage Stack resolve process:
 1 - apply damages to targets. For each of them, send an event to the GameObserver (for Damage triggers)
 2 - Once this is done, send a "Damage Stakc Resolved" event to the GameObserver
 3 - Once that message is received on the DamageStack's side, do the "afterDamage" effects (send to graveyard, etc...)
 Using events in 2 and 3 guarantees that the "send to graveyard" effect will only apply AFTER Damaged triggers are applied
 */
int DamageStack::resolve()
{
    for (int i = (int)(mObjects.size()) - 1; i >= 0; i--)
    {
        Damage * damage = (Damage*) mObjects[i];
        if (damage->state == NOT_RESOLVED)
            damage->resolve();
    }
    ((Interruptible*)this)->getObserver()->receiveEvent(NEW WEventDamageStackResolved());
    return 1;
}
开发者ID:younthu,项目名称:wagic,代码行数:17,代码来源:Damage.cpp

示例4: loadAttackData

void Attack::loadAttackData(GameObjectData* dataObj)
{
	for(GameObjectData* damageData : dataObj->getObjectList("damages"))
	{
		Damage dam;
		dam.load(damageData);
		_damages.push_back(dam);
	}

	if(dataObj->hasFloat("duration"))
		_duration = dataObj->getFloat("duration");
}
开发者ID:WriterOfAlicrow,项目名称:SOTE,代码行数:12,代码来源:Attack.cpp

示例5: applyAttackRelativeBonnus

void Attributs::applyAttackRelativeBonnus(Damage &damage) const
{
    for(unsigned i=0; i<damage.getValues().size() ; i++)
    {
        for(unsigned a=0 ; a<relativeFightBonus.size() ; a++)
        {
            if(damage.getValues().at(i).getType() == relativeFightBonus.at(a).getType() )
            {
                int newDamage = damage.getValues().at(i).getValue();
                newDamage += (newDamage * relativeFightBonus.at(a).getValue()) / 100; //one value point -> add 1% damage
                damage.getValues().at(i).setValue(newDamage);
            }
        }
    }
}
开发者ID:anliec,项目名称:Mosp,代码行数:15,代码来源:Attributs.cpp

示例6: Render

void DamageStack::Render()
{
    float currenty = y;
    for (size_t i = 0; i < mObjects.size(); i++)
    {
        Damage * damage = (Damage*) mObjects[i];
        if (damage->state == NOT_RESOLVED)
        {
            damage->x = x;
            damage->y = currenty;
            currenty += damage->mHeight;
            damage->Render();
        }
    }
}
开发者ID:younthu,项目名称:wagic,代码行数:15,代码来源:Damage.cpp

示例7: totalGSGraphic

void ViewerGraphic::Update () {
    GraphicComp* parent = (GraphicComp*) _view->GetGraphicComp()->GetParent();

    if (parent != nil) {
        FullGraphic gs;
        totalGSGraphic(parent->GetGraphic(), gs);

        if (Different(this, &gs)) {
            Damage* damage = _view->GetViewer()->GetDamage();
            
            damage->Incur(this);
            *(Graphic*)this = *(Graphic*)(&gs);
            damage->Incur(this);
        }
    }
}
开发者ID:PNCG,项目名称:neuron,代码行数:16,代码来源:viewer.cpp

示例8: victim

void Attack::Act(IGame& game) const
{
	State attacker = game.Get(actor);
	auto& targetActor = dynamic_cast<const Identity&>(target);
	State victim(game.Get(targetActor));
	if (!part)
	{
		Engage(attacker);
		game.Adjust(actor, attacker, skill.name);
		game.Adjust(targetActor, victim, L"Miss " + skill.name);
		return;
	}
	auto skillLevel = attacker.SkillLevel(skill, &victim);
	if (skillLevel.Value() == 0)
	{
		Engage(attacker);
		game.Adjust(actor, attacker, skill.name);
		game.Adjust(targetActor, victim, L"Resist " + skill.name + L":" + skillLevel.Description());
		return;
	}
	auto damage = attacker.AttackDamage(skill, skillLevel);
	Damage pain = damage - victim.Mitigation(*part);
	if (!victim.Hurt(*part, pain, actor.Description()+L"'"+skill.description))	
	{
		Engage(attacker);
		game.Adjust(actor, attacker, skill.name);
		game.Adjust(targetActor, victim, L"Mitigate " + skill.name + L"@" + part->Name() + L":" + pain.ActionDescription());
		return;
	}
	Engage(attacker);
	game.Adjust(actor, attacker, skill.name);
	game.Adjust(targetActor, victim, L"Hit " + skill.name + L"@" + part->Name() + L":" + pain.ActionDescription());
}
开发者ID:countpauper,项目名称:countpauper,代码行数:33,代码来源:Attack.cpp

示例9: takeDamage

int Character::takeDamage(Damage dmg)
{
  //TODO: handle damage resists
  int roll = dmg.roll();
  modifyHitPoints(-1 * roll);
  return roll;
}
开发者ID:pelagos,项目名称:amarlon,代码行数:7,代码来源:character.cpp

示例10: applyAttackFixBonnus

void Attributs::applyAttackFixBonnus(Damage &damage) const
{
    for(unsigned i=0; i<damage.getValues().size() ; i++)
    {
        int newDamage = damage.getValues().at(i).getValue();
        newDamage += fixDamageBonnus;
        for(unsigned a=0 ; a<fixFightBonus.size() ; a++)
        {
            if(damage.getValues().at(i).getType() == fixFightBonus.at(a).getType() )
            {
                newDamage += fixFightBonus.at(a).getValue(); //add fix attack bonnus
                //exit for loop: (there are only one couple)
                a = values.size();
            }
        }
        damage.getValues().at(i).setValue(newDamage);
    }
}
开发者ID:anliec,项目名称:Mosp,代码行数:18,代码来源:Attributs.cpp

示例11: applyDefenseRelativeResistances

void Attributs::applyDefenseRelativeResistances(Damage &damage) const
{
    for(unsigned i=0; i<damage.getValues().size() ; i++)
    {
        for(unsigned a=0 ; a<relativeResistances.size() ; a++)
        {
            if(damage.getValues().at(i).getType() == relativeResistances.at(a).getType() )
            {
                int newDamage = damage.getValues().at(i).getValue();
                newDamage -= (newDamage * relativeResistances.at(a).getValue()) / 100; //one value point -> add 1% resistances
                if(newDamage<0)
                {
                    newDamage = 0;
                }
                damage.getValues().at(i).setValue(newDamage);
            }
        }
    }
}
开发者ID:anliec,项目名称:Mosp,代码行数:19,代码来源:Attributs.cpp

示例12: applyDefenseFixResistances

void Attributs::applyDefenseFixResistances(Damage &damage) const
{
    for(unsigned i=0; i<damage.getValues().size() ; i++)
    {
        for(unsigned a=0 ; a<fixResistances.size() ; a++)
        {
            if(damage.getValues().at(i).getType() == fixResistances.at(a).getType() )
            {
                int newDamage = damage.getValues().at(i).getValue();
                newDamage -= fixResistances.at(a).getValue(); //add fix attack bonnus
                if(newDamage<0)
                {
                    newDamage = 0;
                }
                damage.getValues().at(i).setValue(newDamage);
            }
        }
    }
}
开发者ID:anliec,项目名称:Mosp,代码行数:19,代码来源:Attributs.cpp

示例13: applyAttackValues

void Attributs::applyAttackValues(Damage &damage) const
{
    for(unsigned i=0; i<damage.getValues().size() ; i++)
    {
        int newDamage = damage.getValues().at(i).getValue();
        int damageBonnus = powerBonnus;
        for(unsigned a=0 ; a<values.size() ; a++)
        {
            if(damage.getValues().at(i).getType() == values.at(a).getType() )
            {
                damageBonnus += values.at(a).getValue(); //one value point -> add 1% damage
                //exit for loop: (there are only one couple)
                a = values.size();
            }
        }
        newDamage += newDamage*damageBonnus/100;
        damage.getValues().at(i).setValue(newDamage);
    }
}
开发者ID:anliec,项目名称:Mosp,代码行数:19,代码来源:Attributs.cpp

示例14: return

bool Creature::doReflectionDamage(Damage damage, Creature* target, ReflectedDamageType printZero) {
    int dmg = damage.getReflected() ? damage.getReflected() : damage.getPhysicalReflected();

    // don't quit if we want to print 0
    if(!dmg && printZero == REFLECTED_NONE)
        return(false);

    if(damage.getReflected() || printZero == REFLECTED_MAGIC) {
        target->printColor("Your shield of magic reflects %s%d^x damage.\n", target->customColorize("*CC:DAMAGE*").c_str(), dmg);
        printColor("%M's shield of magic flares up and hits you for %s%d^x damage.\n", target, customColorize("*CC:DAMAGE*").c_str(), dmg);
        broadcastGroup(false, this, "%M's shield of magic flares up and hits %N for *CC:DAMAGE*%d^x damage.\n",
            target, this, dmg);
    } else {
        switch(damage.getPhysicalReflectedType()) {
        case REFLECTED_FIRE_SHIELD:
        default:
            target->printColor("Your shield of fire reflects %s%d^x damage.\n", target->customColorize("*CC:DAMAGE*").c_str(), dmg);
            printColor("%M's shield of fire flares up and hits you for %s%d^x damage.\n", target, customColorize("*CC:DAMAGE*").c_str(), dmg);
            broadcastGroup(false, this, "%M's shield of fire flares up and hits %N for *CC:DAMAGE*%d^x damage.\n",
                target, this, dmg);
            break;
        }
    }

    if(damage.getDoubleReflected()) {
        Damage reflectedDamage;
        reflectedDamage.setReflected(damage.getDoubleReflected());
        target->doReflectionDamage(reflectedDamage, this);
    }

    // we may have gotten this far for printing reasons (even on zero), but really, go no further
    if(!dmg)
        return(false);

    if(target->isPlayer() && isMonster())
        getAsMonster()->adjustThreat(target, dmg);

    hp.decrease(dmg);
    if(hp.getCur() <= 0)
        return(true);
    return(false);
}
开发者ID:RealmsMud,项目名称:RealmsCode,代码行数:42,代码来源:abjuration.cpp

示例15: end

void SheetAccessModel::handleDamages(const QList<Damage*>& damages)
{
    QList<Damage*>::ConstIterator end(damages.end());
    for (QList<Damage*>::ConstIterator it = damages.begin(); it != end; ++it) {
        Damage* damage = *it;
        if (!damage) {
            continue;
        }

        if (damage->type() == Damage::Sheet) {
            SheetDamage* sheetDamage = static_cast<SheetDamage*>(damage);
            kDebug(36007) << "Processing\t" << *sheetDamage;

            if (sheetDamage->changes() & SheetDamage::Name) {
                Sheet *sheet = sheetDamage->sheet();
                // We should never receive signals from sheets that are not in our model
                Q_ASSERT(d->cols.contains(sheet));
                const int sheetIndex = d->cols[sheet];
                setHeaderData(sheetIndex, Qt::Horizontal, sheet->sheetName());
            }
            continue;
        }
    }
}
开发者ID:KDE,项目名称:calligra-history,代码行数:24,代码来源:SheetAccessModel.cpp


注:本文中的Damage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。