Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Class AbilitySillyVehicleVitality extends AbilityVehicleVitality
- Abstract;
- static function bool AbilityIsAllowed(GameInfo Game, MutUT2004RPG RPGMut)
- {
- Return Game.bAllowVehicles;
- }
- //Mechanic lvl 2
- //Support lvl 3
- static simulated function int Cost(RPGPlayerDataObject Data, int CurrentLevel)
- {
- if (CurrentLevel <= 1 && Data.Abilities.length > 0 && class<RPGClass>(Data.Abilities[0]) != None &&
- (class<RPGClass>(Data.Abilities[0]).default.ClassIDNumber == 5 || class<AbilityClassSupport>(Data.Abilities[0]) != None))
- {
- Return Super(RPGAbility).Cost(Data, CurrentLevel);
- }
- else if (Data.Abilities.Length > 0 && class<AbilityClassSupport>(Data.Abilities[0]) != None)
- {
- 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$"Vitality Hi ");
- //FixMe: both ClientModifyVehicle and ServerModifyVehicle calls this (this is called twice).
- /*if (Role != Role_Authority)
- Return;*/
- OldMax = V.HealthMax;
- HealthPerc = float(V.Health) / V.HealthMax;
- V.HealthMax *= (1.0 + (0.05 * float(AbilityLevel)));
- V.Health = V.HealthMax * HealthPerc;
- NewMax = V.HealthMax;
- 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$" No Nfo 1 ");
- return;
- }
- Nfo.VitalityBonus = NewMax - OldMax;
- Nfo.VitalityLevel = AbilityLevel;
- Nfo.CurrHpMax = NewMax;
- //log(Nfo.CurrHpMax);
- //Inv = V.FindInventoryType(class'InvVehicleNfo');
- //if (Inv == None)
- //{
- //log(V$" No Nfo 2 ");
- //return;
- //}
- }
- /* Remove any modifications to this vehicle, because the player is no longer driving it.
- */
- static simulated function UnModifyVehicle(Vehicle V, int AbilityLevel)
- {
- local int DefaultHealth;
- local float HealthPerc;
- //local float DefLinkHealMult; // Why change it on exit when you are not touching it on entry ?
- local InvVehicleNfo Nfo;
- local Inventory Inv;
- //log(V$"Vitality bye ");
- HealthPerc = float(V.Health) / V.HealthMax;
- if (ASVehicleFactory(V.ParentFactory) != None)
- {
- DefaultHealth = ASVehicleFactory(V.ParentFactory).VehicleHealth;
- //DefLinkHealMult = ASVehicleFactory(V.ParentFactory).VehicleLinkHealMult;
- }
- else
- {
- DefaultHealth = V.default.Health;
- //DefLinkHealMult = V.default.LinkHealMult;
- }
- //V.LinkHealMult = DefLinkHealMult;
- Inv = V.FindInventoryType(class'InvVehicleNfo');
- if (Inv == None)
- {
- log(V$" No Nfo 3 ");
- V.HealthMax = DefaultHealth;
- V.Health = HealthPerc * V.HealthMax;
- return;
- }
- Nfo = InvVehicleNfo(Inv);
- if (Nfo == None)
- {
- log(V$" No Nfo 4 ");
- V.HealthMax = DefaultHealth;
- V.Health = HealthPerc * V.HealthMax;
- return;
- }
- V.HealthMax = DefaultHealth; //V.HealthMax - Nfo.VitalityBonus;
- V.Health = HealthPerc * V.HealthMax;
- //Nfo.VitalityBonus = 0;
- Nfo.VitalityLevel = 0;
- //log(V$" bye bye "$V.HealthMax);
- }
- defaultproperties
- {
- AbilityName="Silly Vehicle Vitality"
- Description="This skill will increase vehicle health 5% per level. Exiting the vehicle will result in faster repairing. You must be the driver for this skill to take affect.|The Mechanic class may purchase up to level 2. The Support class may purchase all levels.|(Max level: 3)."
- StartingCost=5
- MaxLevel=3
- PackageName="SillyRPG"
- ClassFilterName="Misc Abilities"
- RequiredRanking(0)=4
- RequiredRanking(1)=4
- RequiredRanking(2)=4
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement