Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9099


Ignore:
Timestamp:
Apr 20, 2012, 4:06:09 PM (13 years ago)
Author:
lkevin
Message:

Found a way to implement damage modifiers by
adding a flag to the pawn and then using this
flag in pawn::damage().

More compilation errors to be fixed though, a tick
function seems to be missing.

Location:
code/branches/pickup2012
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup2012/data/levels/templates/pickupRepresentationTemplates.oxt

    r8706 r9099  
    214214        </spawner-representation>
    215215    </PickupRepresentation>
     216</Template>
     217
     218<!-- DamageBoost pickups -->
     219
     220<Template name=normaldamageboostpickupRepresentation>
     221    <PickupRepresentation>
     222        <spawner-representation>
     223            <StaticEntity>
     224                <attached>
     225                    <Billboard position="0,0,0" colour="0.99,0.96,0.52" material="Sphere2" scale=0.5>
     226                        <attached>
     227                            <Billboard position="0,0,0" colour="0.98,0.94,0.22" material="asterisk" scale=0.5 />
     228                        </attached>
     229                    </Billboard>
     230                </attached>
     231            </StaticEntity>
     232        </spawner-representation>
     233    </PickupRepresentation>
     234</Template>
     235
     236<Template name=smallspeedpickup>
     237  <SpeedPickup
     238    duration = 10.0
     239    damageBoost = damageBoost*2
     240    activationType = "immediate"
     241    durationType = "continuous"
     242  />
    216243</Template>
    217244
  • code/branches/pickup2012/src/modules/pickup/PickupPrereqs.h

    r8706 r9099  
    8686    class ShieldPickup;
    8787    class ShrinkPickup;
    88 
     88    class DamageBoostPickup;
    8989}
    9090
  • code/branches/pickup2012/src/modules/pickup/items/CMakeLists.txt

    r8706 r9099  
    77  ShieldPickup.cc
    88  ShrinkPickup.cc
     9  DamageBoostPickup.cc
    910)
  • code/branches/pickup2012/src/orxonox/worldentities/pawns/Pawn.cc

    r9016 r9099  
    7575        this->lastHitOriginator_ = 0;
    7676
     77        // set damage multiplier to default value 1, meaning nominal damage
     78        this->damageMultiplier_ = 1;
     79
    7780        this->spawnparticleduration_ = 3.0f;
    7881
     
    228231    void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator)
    229232    {
    230         if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
     233        // apply multiplier
     234        damage *= originator->getDamageMultiplier();
     235
     236        if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
    231237        {
    232238            if (shielddamage >= this->getShieldHealth())
  • code/branches/pickup2012/src/orxonox/worldentities/pawns/Pawn.h

    r9016 r9099  
    162162                { return this->numexplosionchunks_; }
    163163
     164            // not that beautiful yet
     165            inline void setDamageMultiplier(float multiplier)
     166                { this->damageMultiplier_ = multiplier; }
     167            inline float getDamageMultiplier()
     168                { return this->damageMultiplier_; }
     169
     170
    164171            virtual void startLocalHumanControl();
    165172
     
    208215            float reloadWaitCountdown_;
    209216
     217            // modifiers
     218            float damageMultiplier_;
     219
    210220            WeakPtr<Pawn> lastHitOriginator_;
    211221
Note: See TracChangeset for help on using the changeset viewer.