Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9184


Ignore:
Timestamp:
May 18, 2012, 12:47:54 PM (12 years ago)
Author:
lkevin
Message:

Finished DamageBoost Pickup and the XML inclusions are working now.

Location:
code/branches/pickup2012
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup2012/data/levels/includes/pickups.oxi

    r9155 r9184  
    213213
    214214<PickupRepresentation
    215     pickupName = "DamageBoost Pickup"
    216     pickupDescription = "Multiplies the ship damage."
    217     spawnerTemplate = "damageboostpickupRepresentation"
    218 >
    219     <pickup>
    220         <DamageBoostPickup template=damageboostpickup />
     215    pickupName = "Small DamageBoost Pickup"
     216    pickupDescription = "Multiplies the ship damage with 2."
     217    spawnerTemplate = "smalldamageboostpickupRepresentation"
     218    inventoryRepresentation = "SmallDamageBoost"
     219>
     220    <pickup>
     221        <DamageBoostPickup template=smalldamageboostpickup />
     222    </pickup>
     223</PickupRepresentation>
     224
     225<PickupRepresentation
     226    pickupName = "Medium DamageBoost Pickup"
     227    pickupDescription = "Multiplies the ship damage with 5."
     228    spawnerTemplate = "mediumdamageboostpickupRepresentation"
     229    inventoryRepresentation = "MediumDamageBoost"
     230>
     231    <pickup>
     232        <DamageBoostPickup template=mediumdamageboostpickup />
     233    </pickup>
     234</PickupRepresentation>
     235
     236<PickupRepresentation
     237    pickupName = "Large DamageBoost Pickup"
     238    pickupDescription = "Multiplies the ship damage with 7."
     239    spawnerTemplate = "largedamageboostpickupRepresentation"
     240    inventoryRepresentation = "LargeDamageBoost"
     241>
     242    <pickup>
     243        <DamageBoostPickup template=largedamageboostpickup />
    221244    </pickup>
    222245</PickupRepresentation>
  • code/branches/pickup2012/data/levels/pickups.oxw

    r9155 r9184  
    173173    <PickupSpawner position="-50,75,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
    174174      <pickup>
    175         <DamageBoostPickup template=damageboostpickup />
     175        <DamageBoostPickup template=smalldamageboostpickup />
     176      </pickup>
     177    </PickupSpawner>
     178   
     179      <PickupSpawner position="-50,100,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
     180      <pickup>
     181        <DamageBoostPickup template=mediumdamageboostpickup />
     182      </pickup>
     183    </PickupSpawner>
     184   
     185      <PickupSpawner position="-50,125,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
     186      <pickup>
     187        <DamageBoostPickup template=largedamageboostpickup />
    176188      </pickup>
    177189    </PickupSpawner>
  • code/branches/pickup2012/data/levels/templates/pickupRepresentationTemplates.oxt

    r9155 r9184  
    218218<!-- DamageBoost pickups -->
    219219
    220 <Template name=damageboostpickupRepresentation>
     220<Template name=smalldamageboostpickupRepresentation>
    221221    <PickupRepresentation>
    222222        <spawner-representation>
     
    225225                    <Billboard position="0,0,0" colour="0.10,0.20,0.30" material="Sphere2" scale=0.1 >
    226226                        <attached>
    227                             <Billboard position="0,0,0" colour="0.30,0.30,0.30" material="damage" scale=0.7 />
    228                         </attached>
    229                     </Billboard>
    230                 </attached>
    231             </StaticEntity>
    232         </spawner-representation>
    233     </PickupRepresentation>
    234 </Template>
    235 
    236 <Template name=damageboostpickup>
     227                            <Billboard position="0,0,0" colour="0.30,0.30,0.30" material="damageSmall" scale=0.7 />
     228                        </attached>
     229                    </Billboard>
     230                </attached>
     231            </StaticEntity>
     232        </spawner-representation>
     233    </PickupRepresentation>
     234</Template>
     235
     236<Template name=smalldamageboostpickup>
    237237  <DamageBoostPickup
    238238    duration = 10.0
    239     damageMultiplier = 20.0
    240     activationType = "immediate"
    241     durationType = "continuous"
    242   />
    243 </Template>
     239    damageMultiplier = 2.0
     240    activationType = "immediate"
     241    durationType = "continuous"
     242  />
     243</Template>
     244
     245<Template name=mediumdamageboostpickupRepresentation>
     246    <PickupRepresentation>
     247        <spawner-representation>
     248            <StaticEntity>
     249                <attached>
     250                    <Billboard position="0,0,0" colour="0.10,0.20,0.30" material="Sphere2" scale=0.1 >
     251                        <attached>
     252                            <Billboard position="0,0,0" colour="0.30,0.30,0.30" material="damageMedium" scale=0.7 />
     253                        </attached>
     254                    </Billboard>
     255                </attached>
     256            </StaticEntity>
     257        </spawner-representation>
     258    </PickupRepresentation>
     259</Template>
     260
     261<Template name=mediumdamageboostpickup>
     262  <DamageBoostPickup
     263    duration = 10.0
     264    damageMultiplier = 5.0
     265    activationType = "immediate"
     266    durationType = "continuous"
     267  />
     268</Template>
     269
     270<Template name=largedamageboostpickupRepresentation>
     271    <PickupRepresentation>
     272        <spawner-representation>
     273            <StaticEntity>
     274                <attached>
     275                    <Billboard position="0,0,0" colour="0.10,0.20,0.30" material="Sphere2" scale=0.1 >
     276                        <attached>
     277                            <Billboard position="0,0,0" colour="0.30,0.30,0.30" material="damageLarge" scale=0.7 />
     278                        </attached>
     279                    </Billboard>
     280                </attached>
     281            </StaticEntity>
     282        </spawner-representation>
     283    </PickupRepresentation>
     284</Template>
     285
     286<Template name=largedamageboostpickup>
     287  <DamageBoostPickup
     288    duration = 10.0
     289    damageMultiplier = 7.0
     290    activationType = "immediate"
     291    durationType = "continuous"
     292  />
     293</Template>
     294
    244295
    245296<!-- Speed pickups -->
  • code/branches/pickup2012/src/modules/pickup/items/DamageBoostPickup.cc

    r9155 r9184  
    7070    void DamageBoostPickup::initialize(void)
    7171    {
    72         this->duration_ = 0.0f;
    73         this->damageMultiplier_ = 1.0f; //The default damage multiplier.
     72        this->duration_ = 0.0f;
     73        this->damageMultiplier_ = 1.0f; //The default damage multiplier.
    7474        //Defines who is allowed to pick up the pickup.
    7575        this->addTarget(ClassIdentifier<SpaceShip>::getIdentifier());
     
    8989
    9090        stream.clear();
    91         stream << this->damageMultiplier_;
     91        stream << this->getDamageMultiplier();
    9292        std::string type2 = "damageMultiplier";
    9393        std::string val2 = stream.str();
     
    116116        {
    117117            this->damageMultiplier_ = damageMultiplier;
    118             orxout() << "Set Damage " << damageMultiplier << endl;
    119         }
    120     }
    121 
    122 
    123     /**
    124     @brief
    125         Is called when the pickup has transited from used to unused or the other way around.
     118        }
     119    }
     120
     121
     122    /**
     123    @brief
     124        Is called when the pickup has transisted from used to unused or the other way around.
    126125    */
    127126    void DamageBoostPickup::changedUsed(void)
     
    151150
    152151            // Saves the old default Damage that is needed to restore the original damage
    153             this->olddamageMultiplier_ = ship->getDamageMultiplier();
    154             // Sets the new Damage with the damage multiplier.
    155             ship->setDamageMultiplier( this->damageMultiplier_ );
     152            this->olddamageMultiplier_ = 1.0f;
     153            // Sets the new Damage with the damage multiplier
     154            ship->setDamageMultiplier(this->getDamageMultiplier());
    156155        }
    157156        else
     
    206205        DamageBoostPickup* pickup = dynamic_cast<DamageBoostPickup*>(item);
    207206        pickup->setDuration(this->getDuration());
    208        
    209 
     207        pickup->setDamageMultiplier(this->getDamageMultiplier());
    210208        pickup->initializeIdentifier();
    211209    }
  • code/branches/pickup2012/src/modules/pickup/items/DamageBoostPickup.h

    r9155 r9184  
    6363            inline float getDuration(void) const
    6464                { return this->duration_; }
     65
    6566            inline void setDuration( float duration );
    6667
     
    7980        protected:
    8081            void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.
    81             void setDamageMultiplier(float damageMultiplier);
     82            void setDamageMultiplier(float damageMultiplier); //!< Sets the DamageMultiplier according to the XML.
    8283
    8384
  • code/branches/pickup2012/src/orxonox/worldentities/pawns/Pawn.cc

    r9155 r9184  
    231231    void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator)
    232232    {
    233         // apply multiplier
     233        //Applies multiplier given by the DamageBoost Pickup.
    234234        Pawn *test = dynamic_cast<Pawn *>(originator);
    235235        if( test != NULL )
    236         { orxout() << "Test " << damage << endl;
     236        {
    237237          damage *= originator->getDamageMultiplier();
    238238        }
  • code/branches/pickup2012/src/orxonox/worldentities/pawns/Pawn.h

    r9099 r9184  
    162162                { return this->numexplosionchunks_; }
    163163
    164             // not that beautiful yet
     164            // These are used with the Damage Boost Pickup to use the damage multiplier.
    165165            inline void setDamageMultiplier(float multiplier)
    166166                { this->damageMultiplier_ = multiplier; }
     
    215215            float reloadWaitCountdown_;
    216216
    217             // modifiers
    218             float damageMultiplier_;
     217            // Modifier
     218            float damageMultiplier_; // Used by the Damage Boost Pickup.
    219219
    220220            WeakPtr<Pawn> lastHitOriginator_;
Note: See TracChangeset for help on using the changeset viewer.