Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 |
class Armor extends Powerups abstract; var() class<DamageType> ProtectionType; // Protects against DamageType (None if non-armor). var() int ArmorAbsorption; // Percent of damage item absorbs 0-100. var() int AbsorptionPriority; // Which items absorb damage first (higher=first). var armor NextArmor; // Temporary list created by Armors to prioritize damage absorption. // // Absorb damage. // function int ArmorAbsorbDamage(int Damage, class<DamageType> DamageType, vector HitLocation) { local int ArmorDamage; if ( DamageType.default.bArmorStops ) ArmorImpactEffect(HitLocation); if( (DamageType!=None) && (ProtectionType==DamageType) ) return 0; if ( !DamageType.default.bArmorStops ) Return Damage; ArmorDamage = (Damage * ArmorAbsorption) / 100; if( ArmorDamage >= Charge ) { ArmorDamage = Charge; Destroy(); } else Charge -= ArmorDamage; return (Damage - ArmorDamage); } // // Return armor value. // function int ArmorPriority(class<DamageType> DamageType) { if ( DamageType.default.bArmorStops ) return 0; if( (DamageType!=None) && (ProtectionType==DamageType) ) return 1000000; return AbsorptionPriority; } // // This function is called by ArmorAbsorbDamage and displays a visual effect // for an impact on an armor. // function ArmorImpactEffect(vector HitLocation); state Activated { event BeginState() { Super.BeginState(); if ( ProtectionType != None ) Pawn(Owner).ReducedDamageType = ProtectionType; } event EndState() { Super.EndState(); if ( (Pawn(Owner) != None) && (ProtectionType != Pawn(Owner).ReducedDamageType) ) Pawn(Owner).ReducedDamageType = None; } } // // Return the best armor to use. // function armor PrioritizeArmor( int Damage, class<DamageType> DamageType, vector HitLocation ) { local Armor FirstArmor, InsertAfter; if ( Inventory != None ) FirstArmor = Inventory.PrioritizeArmor(Damage, DamageType, HitLocation); else FirstArmor = None; if ( FirstArmor == None ) { nextArmor = None; return self; } // insert this armor into the prioritized armor list if ( FirstArmor.ArmorPriority(DamageType) < ArmorPriority(DamageType) ) { nextArmor = FirstArmor; return self; } InsertAfter = FirstArmor; while ( (InsertAfter.nextArmor != None) && (InsertAfter.nextArmor.ArmorPriority(DamageType) > ArmorPriority(DamageType)) ) InsertAfter = InsertAfter.nextArmor; nextArmor = InsertAfter.nextArmor; InsertAfter.nextArmor = self; return FirstArmor; } defaultproperties { UseReticleOnEvents(0)="UseReticleText" UseReticleOnEvents(1)="UseReticleCorners" UseReticleOnEvents(2)="UseReticleTopBars" ProximityReticleOnEvents(0)="ProximityReticleCorners" ProximityReticleOnEvents(1)="ProximityReticleTopBars" } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |