Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Class AbilitySillyVehicleOverride extends RPGAbility
- Abstract;
- static function bool AbilityIsAllowed(GameInfo Game, MutUT2004RPG RPGMut)
- {
- Return Game.bAllowVehicles;
- }
- static simulated function int Cost(RPGPlayerDataObject Data, int CurrentLevel)
- {
- if (Data.Abilities.Length > 0)
- {
- Return Super(RPGAbility).Cost(Data, CurrentLevel);
- }
- Return 0;
- }
- /* Modify the owning player's current vehicle. Called by MutUT2004RPG.DriverEnteredVehicle() serverside
- * and RPGStatsInv.ClientEnteredVehicle() clientside.
- */
- static simulated function ModifyVehicle(Vehicle V, int AbilityLevel)
- {
- local float HealthPerc;
- local int OldMax;
- local int NewMax;
- local InvVehicleNfo Nfo;
- local Inventory Inv;
- //log(V$"Override Hi ");
- Inv = V.FindInventoryType(class'InvVehicleNfo');
- if (Inv == None)
- {
- //log(V$" Making Nfo ");
- Nfo = V.spawn(class'InvVehicleNfo', V,,,rot(0,0,0));
- //if (Nfo == None)
- //log(V$" No Nfo -1 ");
- Nfo.GiveTo(V);
- //if (Nfo == None)
- //log(V$" No Nfo 0 ");
- }
- else
- {
- //log(V$" Nfo already done "$Inv);
- Nfo = InvVehicleNfo(Inv);
- }
- if (Nfo == None)
- {
- log(V$" Override No Nfo 1 ");
- return;
- }
- if (Nfo.PermaBonusHp != 0)
- {
- HealthPerc = float(V.Health) / V.HealthMax;
- if(Nfo.VitalityLevel != 0)
- {
- OldMax = V.HealthMax;
- V.HealthMax +=( (1.0 + (0.05 * float(AbilityLevel))) * float(Nfo.PermaBonusHp) );
- NewMax = V.HealthMax;
- Nfo.VitalityBonus += NewMax - OldMax;
- }
- else
- {
- V.HealthMax += Nfo.PermaBonusHp;
- }
- V.Health = V.HealthMax * HealthPerc;
- }
- Nfo.CurrHpMax = V.HealthMax;
- //log(V$" "$Nfo.CurrHpMax);
- //Inv = V.FindInventoryType(class'InvVehicleNfo');
- //if (Inv == None)
- //log(V$" No Nfo 2 ");
- }
- /* Remove any modifications to this vehicle, because the player is no longer driving it.
- */
- static simulated function UnModifyVehicle(Vehicle V, int AbilityLevel)
- {
- local InvVehicleNfo Nfo;
- local Inventory Inv;
- //log(V$"Override bye ");
- Inv = V.FindInventoryType(class'InvVehicleNfo');
- if (Inv == None)
- {
- log(V$" Override No Nfo 3 ");
- return;
- }
- Nfo = InvVehicleNfo(Inv);
- if (Nfo == None)
- {
- log(V$" Override No Nfo 4 ");
- return;
- }
- Nfo.CurrHpMax *= -1;
- //log(V$" bye bye ");
- }
- defaultproperties
- {
- AbilityName="Silly Vehicle Override"
- Description="Skill for handling some of vehicle stats "
- StartingCost=1
- CostAddPerLevel=-2
- MaxLevel=2
- PackageName="SillyRPG"
- ClassFilterName="Misc Abilities"
- RequiredRanking(0)=1
- RequiredRanking(1)=1
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement