Example #1
0
void ModuleManager::DamageModule(uint32 itemID, EvilNumber val)
{
    GenericModule * mod = m_Modules->GetModule(itemID);
    if( mod != NULL)
    {
        mod->SetAttribute(AttrHp, val);
    }
}
Example #2
0
void ModuleManager::_processExternalEffect(SubEffect * s)
{
    //50-50 it's targeting a specific module ( i'm assuming here )
    GenericModule * mod = m_Modules->GetModule(s->TargetItemID());
    if( mod != NULL )
    {
        //calculate new attribute
        mod->SetAttribute(s->AttributeID(),
                          CalculateNewAttributeValue(mod->GetAttribute(s->AttributeID()),
                                                                       s->AppliedValue(), s->CalculationType()));
    }
    else if( s->TargetItemID() == m_Ship->itemID() ) //guess it's not, but that means it should be targeting our ship itself
    {
        //calculate new attribute
        m_Ship->SetAttribute(s->AttributeID(),
                             CalculateNewAttributeValue(m_Ship->GetAttribute(s->AttributeID()),
                                                                             s->AppliedValue(), s->CalculationType()));
    }
    else //i have no idea what their targeting X_X
        sLog.Error("ModuleManager", "Process external effect inconsistency.  This shouldn't happen");

}